/* apophex.com — the landing page, ported from the app's (client/src/pages/LandingPage.tsx
   and the `ld-` rules in client/src/styles.css). Same tokens, buttons and brand lockup as
   the studio, so the site and the app read as one product. No framework, no build step,
   no script and no external request: this file, the HTML and the SVGs are the whole site.
   The document scrolls (the app's landing scrolls inside its own box); the wider layouts
   are at the end. */

:root {
  /* surfaces: page -> panel -> raised -> hover, each a step lighter so depth reads at a glance */
  --bg: #0b0c11; --panel: #13151d; --panel2: #1b1e2a; --panel3: #242838;
  --border: #262a3a; --border-strong: #363b4f;
  --text: #eef0f6; --muted: #9ba2b8; --muted2: #6f778f;
  /* brand: violet with a teal counterpoint */
  --accent: #8b6cff; --accent-dark: #4b37a8; --accent-soft: rgba(139, 108, 255, .16);
  --accent2: #19d3a2; --ok: #3ddc84;
  --radius: 12px; --radius-xs: 6px;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --dur: .18s; --dur-fast: .12s;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0; font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden;
}
main { flex: 1 0 auto; display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-xs); }
.icon { display: block; flex: none; }
.count { color: var(--muted); font-size: 12.5px; }

.skip {
  position: absolute; left: 12px; top: -48px; padding: 8px 12px; z-index: 100;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text);
}
.skip:focus { top: 12px; }

/* ---- buttons: the studio's, at website weight ---- */
a.primary, a.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  font: inherit; font-weight: 600; font-size: 14.5px; padding: 11px 18px; border-radius: 10px;
  border: 1px solid transparent; transition: background var(--dur) ease, border-color var(--dur) ease,
    color var(--dur) ease, box-shadow var(--dur) ease, transform var(--dur-fast) var(--ease-out);
}
a.primary { background: linear-gradient(135deg, #9a7dff 0%, var(--accent) 45%, #6f4df5 100%); color: #fff;
  box-shadow: 0 4px 14px rgba(124, 92, 255, .22); }
a.primary:hover { background: linear-gradient(135deg, #a58cff 0%, #9276ff 45%, #7a5bff 100%);
  box-shadow: 0 6px 18px rgba(124, 92, 255, .32); }
a.ghost { color: var(--text); background: var(--panel); border-color: var(--border); }
a.ghost:hover { background: var(--panel2); border-color: var(--accent); }
a.primary:active, a.ghost:active { transform: scale(.97); }
.ld-cta.sm, a.ld-cta.sm { padding: 8px 14px; font-size: 13px; border-radius: 9px; }
.ld-ctas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.ld-ctas.center { justify-content: center; margin-top: 22px; }
.ld-invite { margin-top: 12px; font-size: 13px; color: var(--muted2); max-width: 54ch; }

/* ---- the brand lockup: the flask on a charcoal tile, lit from below, and the wordmark ---- */
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; letter-spacing: .18em;
  font-size: 15px; font-weight: 800; color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; flex: none; display: inline-flex; align-items: center;
  justify-content: center; background: radial-gradient(circle at 50% 80%, rgba(139, 108, 255, .32), var(--panel2) 70%);
  border: 1px solid var(--border-strong); box-shadow: 0 2px 10px rgba(124, 92, 255, .3); }
.brand-mark img { display: block; }
.brand-word { background: linear-gradient(90deg, #c4b3ff, #8b6cff 55%, #19d3a2 130%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- layout ---- */
.ld-wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* header: the same lockup as the studio's top bar, plus the way in */
.ld-head { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.ld-headrow { display: flex; align-items: center; gap: 18px; min-height: 62px; }
.ld-nav { display: flex; gap: 4px; margin-left: 12px; }
.ld-nav a, .ld-footnav a { color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 7px 10px; border-radius: 8px; transition: color var(--dur) ease, background var(--dur) ease; }
.ld-nav a:hover, .ld-footnav a:hover { color: var(--text); background: var(--panel2); }
.ld-headacts { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* hero */
.ld-hero { position: relative; padding: 72px 0 56px; overflow: hidden; }
.ld-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; background:
  radial-gradient(760px 420px at 18% 0%, rgba(139, 108, 255, .22), transparent 70%),
  radial-gradient(520px 360px at 92% 30%, rgba(25, 211, 162, .10), transparent 70%); }
.ld-herogrid { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.ld-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.ld-hero h1 { font-size: clamp(34px, 5.4vw, 60px); line-height: 1.04; font-weight: 800; letter-spacing: -.025em;
  background: linear-gradient(120deg, #f4f1ff 0%, #d9ceff 55%, #a48bff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld-lead { margin-top: 18px; font-size: 17.5px; line-height: 1.6; color: var(--muted); max-width: 54ch; }
.ld-proof { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--muted); }
.ld-proof li { display: flex; align-items: center; gap: 8px; }
.ld-proof .icon { color: var(--accent2); }
.ld-herovis { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; }
/* the mark, lit from below like the app icon, at poster size */
.ld-flask { position: relative; z-index: 2; display: inline-flex; padding: 22px; border-radius: 30px; margin-bottom: -34px;
  background: radial-gradient(circle at 50% 82%, rgba(139, 108, 255, .42), var(--panel2) 68%);
  border: 1px solid var(--border-strong); box-shadow: 0 10px 40px rgba(124, 92, 255, .38), 0 0 0 8px rgba(139, 108, 255, .06); }
.ld-flask img { display: block; }
.ld-flask.small { padding: 14px; border-radius: 20px; margin: 0 0 18px; box-shadow: 0 6px 24px rgba(124, 92, 255, .3); }

/* the studio, drawn: window chrome, three panes, one live step */
.ld-window { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03); overflow: hidden; font-size: 11px; }
.ld-winbar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--panel2); }
.ld-dots { display: inline-flex; gap: 5px; }
.ld-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.ld-winbrand { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; letter-spacing: .16em; font-size: 10px; color: #c4b3ff; }
.ld-winbrand img { display: block; }
.ld-winchip { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 10px; font-weight: 500; }
.ld-winchip + .ld-winchip { margin-left: 0; }
.ld-winchip i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(61, 220, 132, .14); }
.ld-winchip em { font-style: normal; color: var(--muted); }
.ld-winbody { display: grid; grid-template-columns: 1.1fr 1.2fr 1fr; gap: 10px; padding: 12px; }
.ld-winpane { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.ld-winlabel { font-size: 9.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted2); margin: 2px 0 1px; }
.ld-line { height: 6px; border-radius: 3px; background: var(--panel3); }
.ld-line.w50 { width: 50%; } .ld-line.w60 { width: 60%; } .ld-line.w70 { width: 70%; } .ld-line.w80 { width: 80%; }
.ld-line.w85 { width: 85%; } .ld-line.w90 { width: 90%; } .ld-line.w95 { width: 95%; }
.ld-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.ld-tiles span { aspect-ratio: 3 / 4; border-radius: 6px; border: 1px solid var(--border); }
.ld-tiles .t1 { background: linear-gradient(160deg, #6a4dff, #2b1f6b); }
.ld-tiles .t2 { background: linear-gradient(160deg, #9a7dff, #3c2a8a); }
.ld-tiles .t3 { background: linear-gradient(160deg, #19d3a2, #0f4a3c); }
.ld-tiles .t4 { background: linear-gradient(160deg, #c4b3ff, #4b37a8); }
.ld-tiles .t5 { background: linear-gradient(160deg, #3d2f7a, #1b1e2a); }
.ld-tiles .t6 { background: linear-gradient(160deg, #7a55ff, #19d3a2 140%); }
.ld-winsteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; color: var(--muted2); }
.ld-winsteps li { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-winsteps li.done { color: var(--muted); }
.ld-winsteps li.done .icon { color: var(--accent2); }
.ld-winsteps li.live { color: var(--text); font-weight: 600; flex-direction: column; align-items: stretch; gap: 4px; }
.ld-bar { display: block; height: 5px; border-radius: 3px; background: var(--panel3); overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 62%; border-radius: 3px; transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); animation: ld-fill 1.1s var(--ease-out) .5s both; }
@keyframes ld-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* one entrance, once: the hero rises into place on first paint */
.ld-herocopy > * { animation: ld-rise .55s var(--ease-out) both; }
.ld-herocopy > :nth-child(2) { animation-delay: .05s; }
.ld-herocopy > :nth-child(3) { animation-delay: .1s; }
.ld-herocopy > :nth-child(4) { animation-delay: .15s; }
.ld-herocopy > :nth-child(5) { animation-delay: .2s; }
.ld-herocopy > :nth-child(6) { animation-delay: .25s; }
.ld-herovis { animation: ld-rise .6s var(--ease-out) .12s both; }
@keyframes ld-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* the numbers strip */
.ld-stats { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--panel); }
.ld-statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 22px 24px; }
.ld-statrow div { display: flex; flex-direction: column; gap: 2px; }
.ld-statrow strong { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  background: linear-gradient(90deg, #c4b3ff, #8b6cff 70%); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums; }
.ld-statrow span { font-size: 12.5px; color: var(--muted); }

/* sections */
.ld-section { padding: 88px 0; }
.ld-alt { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
h2 { font-size: clamp(26px, 3.3vw, 38px); line-height: 1.12; font-weight: 800; letter-spacing: -.02em; max-width: 24ch; }
.ld-body { margin-top: 16px; font-size: 16px; line-height: 1.65; color: var(--muted); max-width: 60ch; }
.ld-narrow { max-width: 64ch; }
.ld-split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.ld-cardcol { display: flex; flex-direction: column; gap: 12px; }

/* cards: the studio's panels, with an icon tile */
.ld-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  transition: border-color var(--dur) ease, transform var(--dur) var(--ease-out); }
.ld-card h3 { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.ld-card p { margin-top: 8px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.ld-card h3 .icon { color: var(--accent); }
.ld-cardicon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #c4b3ff; margin-bottom: 14px; border: 1px solid rgba(139, 108, 255, .22); }
@media (hover: hover) and (pointer: fine) {
  .ld-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
}
.ld-featgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 34px; }

/* the numbered walk-through */
.ld-steps { list-style: none; margin: 34px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.ld-steps li { position: relative; padding: 22px 18px 20px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.ld-stepnum { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin-bottom: 14px;
  background: linear-gradient(90deg, #c4b3ff, #8b6cff 60%, #19d3a2 140%); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums; }
.ld-steps h3 { font-size: 15.5px; font-weight: 650; }
.ld-steps p { margin-top: 8px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }

/* the stack, as a plain grid with a hairline accent */
.ld-stackgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 34px; }
.ld-stack { padding: 18px 0 0; border-top: 2px solid var(--accent-dark); }
.ld-stack h3 { font-size: 15.5px; font-weight: 650; }
.ld-stack p { margin-top: 8px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }

/* yours vs shared */
.ld-privgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; }
.ld-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.ld-list li { display: flex; align-items: center; gap: 9px; color: var(--text); }
.ld-list .icon { color: var(--accent2); flex: none; }
.ld-privgrid .ld-card:last-child .ld-list .icon { color: var(--muted2); }

/* the last word */
.ld-final { padding: 40px 0 96px; }
.ld-finalbox { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 24px;
  border: 1px solid var(--border-strong); border-radius: 20px; background:
    radial-gradient(600px 300px at 50% 0%, rgba(139, 108, 255, .2), transparent 70%), var(--panel); }
.ld-finalbox h2 { max-width: none; }
.ld-finalbox .ld-body { text-align: center; }

/* footer */
.ld-foot { border-top: 1px solid var(--border); padding: 26px 0 calc(26px + env(safe-area-inset-bottom, 0px)); background: var(--panel); }
.ld-footrow { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ld-foot .brand { font-size: 12.5px; }
.ld-foot .brand-mark { width: 24px; height: 24px; }
.ld-footnav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.ld-footrow > .count { flex-basis: 100%; }

/* the roleplay section: copy beside a small relationship map, then four cards */
.ld-rolesplit { align-items: center; }
.ld-rolegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 44px; }
.ld-relmap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 14px;
  background-image: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0); background-size: 22px 22px; }
.ld-relmap svg { display: block; width: 100%; height: auto; max-height: 340px; }
.ld-relglyph { fill: var(--panel); stroke-width: 1.5; }
.ld-relnode circle { fill: var(--panel2); stroke: var(--border-strong); stroke-width: 1.5; }
.ld-relnode.hero circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.ld-relnode text { fill: var(--muted); font-size: 13px; font-weight: 600; font-family: inherit; }
.ld-relnode.hero text { fill: var(--text); }
.ld-relkey { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.ld-relkey span { display: inline-flex; align-items: center; gap: 6px; }
.ld-relkey i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
/* the built-in relationship types' colours (client/src/relTypes.tsx) */
.ld-relkey .k-lover { background: #ff6b9d; }
.ld-relkey .k-friend { background: #19d3a2; }
.ld-relkey .k-enemy { background: #ff6b7d; }
.ld-relkey .k-idol { background: #ffb84d; }

/* ---------- 404: the shattered flask, and the way back ---------- */
.lost { display: flex; align-items: center; justify-content: center; text-align: center; padding: 56px 0 80px; }
.lost-box { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 460px; }
.lost-art { display: inline-flex; padding: 22px; border-radius: 30px; margin-bottom: 10px;
  background: radial-gradient(circle at 50% 82%, rgba(139, 108, 255, .3), var(--panel2) 68%);
  border: 1px solid var(--border-strong); box-shadow: 0 10px 40px rgba(124, 92, 255, .22), 0 0 0 8px rgba(139, 108, 255, .05); }
.lost-art svg { display: block; width: 132px; height: 132px; }
.lost h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.12; letter-spacing: -.02em; }
.lost p { color: var(--muted); line-height: 1.55; font-size: 15px; }
.lost .ld-ctas { margin-top: 14px; justify-content: center; }

/* ---------- narrower screens: stack the hero, fold the grids, drop the section links ---------- */
@media (max-width: 1024px) {
  .ld-featgrid, .ld-stackgrid, .ld-rolegrid { grid-template-columns: repeat(2, 1fr); }
  .ld-steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .ld-hero { padding: 48px 0 40px; }
  .ld-herogrid { grid-template-columns: 1fr; gap: 40px; }
  .ld-herovis { order: -1; }
  .ld-flask { margin-bottom: -28px; padding: 16px; border-radius: 24px; }
  .ld-flask img { width: 84px; height: 84px; }
  .ld-split { grid-template-columns: 1fr; gap: 32px; }
  .ld-section { padding: 64px 0; }
}
@media (max-width: 820px) {
  .ld-nav { display: none; }
}
@media (max-width: 640px) {
  .ld-wrap { padding: 0 16px; }
  .ld-headrow { min-height: 56px; gap: 10px; }
  .ld-statrow { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; padding: 20px 16px; }
  .ld-featgrid, .ld-stackgrid, .ld-privgrid, .ld-steps, .ld-rolegrid { grid-template-columns: 1fr; }
  .ld-relmap { max-width: 420px; }
  .ld-winbody { grid-template-columns: 1fr 1fr; }
  .ld-winbody .ld-winpane:last-child { grid-column: 1 / -1; }
  .ld-winchip em { display: none; }
  .ld-ctas .ld-cta { flex: 1 1 auto; justify-content: center; }
  .ld-finalbox { padding: 40px 18px; }
  .ld-lead { font-size: 16px; }
  .lost-art { padding: 16px; border-radius: 24px; }
  .lost-art svg { width: 100px; height: 100px; }
}
@media (hover: none) {
  .ld-cta, a.ld-cta { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ld-herocopy > *, .ld-herovis, .ld-bar i { animation: none; }
  .ld-card, a.primary, a.ghost { transition: none; }
}
