/* Characreation — the website. Tokens from the app's logo: midnight blue,
   ember and gold, Cinzel for display, Inter for text. Dark only. */
:root {
  --night-900: #070718;
  --night-800: #0b0b2b;
  --night-700: #14123f;
  --night-600: #1d1a5a;
  --ivory: #f3ead6;
  --ivory-muted: #c9bfa8;
  --gold: #e9b44c;
  --gold-bright: #ffd27a;
  --ember: #ff7a2f;
  --flame: #ff4d1c;
  --parchment: #efe3c8;
  --ink: #2a2117;
  --flame-gradient: linear-gradient(180deg, var(--gold-bright) 0%, var(--ember) 55%, var(--flame) 100%);
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 18px;
  --hairline: 1px solid rgba(233, 180, 76, 0.32);
  --container: 1120px;
  --topbar: 64px;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night-900);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: hidden;
}
img, video, svg { max-width: 100%; display: block; }
a { color: var(--gold-bright); }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
  margin: 0 0 0.45em;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.3rem, 6.2vw, 4.4rem);
  line-height: 1.06;
  background: var(--flame-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.08em; /* room for descenders under the clipped fill */
}
h2 { font-size: clamp(1.65rem, 3.6vw, 2.6rem); line-height: 1.15; }
h3 { font-size: 1.1rem; margin-bottom: 0.3em; }
p { margin: 0 0 1em; }
.lead { font-size: clamp(1.05rem, 1.4vw, 1.2rem); color: var(--ivory-muted); max-width: 62ch; }
.eyebrow {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.2rem;
}
.hint, .field-hint, .fine-print { font-size: 0.9rem; color: var(--ivory-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 0.5rem 1rem; background: var(--night-700); border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.container.narrow { max-width: 720px; }
section { position: relative; z-index: 1; padding-block: clamp(4rem, 9vw, 7rem); }
section.alt { background: var(--night-800); border-top: var(--hairline); border-bottom: var(--hairline); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  height: var(--topbar);
  padding-inline: clamp(1rem, 3vw, 2rem);
  background: rgba(11, 11, 43, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: var(--hairline);
}
.wordmark {
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.12em;
  font-size: 1.05rem; color: var(--gold); text-decoration: none; white-space: nowrap;
}
.topbar .sections { display: none; gap: 1.4rem; margin-inline: auto; }
.topbar .sections a { color: var(--ivory-muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.topbar .sections a:hover { color: var(--gold-bright); }
.lang-toggle { display: inline-flex; margin-left: auto; border: var(--hairline); border-radius: 999px; padding: 2px; }
.lang-toggle button {
  font: inherit; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.05em;
  color: var(--ivory-muted); background: none; border: 0; border-radius: 999px;
  padding: 0.3rem 0.7rem; cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.topbar .btn-small { display: none; }
@media (min-width: 720px) {
  .topbar .sections { display: flex; }
  .lang-toggle { margin-left: 0; }
  .topbar .btn-small { display: inline-flex; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.5rem; border-radius: 999px; border: 0;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.btn-small { padding: 0.5rem 1rem; font-size: 0.9rem; }
.btn-primary {
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold-bright), var(--ember));
  box-shadow: 0 0 0 1px rgba(255, 210, 122, 0.35), 0 12px 30px -12px var(--ember);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255, 210, 122, 0.6), 0 18px 40px -14px var(--flame); }
.btn-primary:disabled { opacity: 0.6; transform: none; cursor: progress; }
.btn-secondary { color: var(--gold-bright); background: transparent; box-shadow: inset 0 0 0 1px rgba(233, 180, 76, 0.5); }
.btn-secondary:hover { background: rgba(29, 26, 90, 0.6); box-shadow: inset 0 0 0 1px var(--gold-bright); }

/* Cards, phone frames, segmented controls */
.card {
  background: linear-gradient(180deg, rgba(20, 18, 63, 0.85), rgba(11, 11, 43, 0.9));
  border: var(--hairline); border-radius: var(--radius); padding: 1.5rem;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.card:hover { border-color: rgba(233, 180, 76, 0.6); }
.phone {
  position: relative; margin: 0; width: min(390px, 100%); aspect-ratio: 390 / 844;
  border-radius: 40px; background: #08081c; border: 9px solid var(--night-600);
  box-shadow: 0 40px 90px -35px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(233, 180, 76, 0.28), 0 0 60px -20px rgba(255, 122, 47, 0.35);
  overflow: hidden; isolation: isolate;
}
.phone > img, .phone > video, .phone > iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; background: #0d0d2e; }
.phone-small { width: min(260px, 100%); border-radius: 30px; border-width: 7px; }
.segmented { display: inline-flex; border: var(--hairline); border-radius: 999px; padding: 3px; margin: 0 0.75rem 1rem 0; }
.segmented button {
  font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--ivory-muted);
  background: none; border: 0; border-radius: 999px; padding: 0.45rem 1rem; cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.segmented button[aria-pressed="true"] { background: linear-gradient(135deg, var(--gold-bright), var(--ember)); color: var(--ink); }
.badge {
  display: inline-block; font-size: 0.85rem; letter-spacing: 0.04em; color: var(--gold);
  border: var(--hairline); border-radius: 999px; padding: 0.4rem 1rem;
}

/* Motion */
.reveal, .reveal-item { opacity: 0; transform: translateY(18px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal-item { transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.is-visible, .reveal.is-visible .reveal-item { opacity: 1; transform: none; }
#embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-item { opacity: 1; transform: none; transition: none; }
  #embers { display: none; }
  .btn, .card { transition: none; }
}

/* Layout helpers */
.two-col { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1.1fr 0.9fr; } .two-col.flip > :first-child { order: 2; } }
.grid { display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

/* Hero */
.hero { min-height: calc(100vh - var(--topbar)); display: grid; align-items: center; overflow: hidden; padding-block: clamp(2rem, 6vw, 5rem); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(60% 55% at 70% 45%, rgba(255, 122, 47, 0.16), transparent 70%),
              radial-gradient(50% 50% at 30% 60%, rgba(29, 26, 90, 0.75), transparent 70%);
}
.hero-inner { display: grid; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.hero-copy { order: 2; }
.hero-visual { order: 1; position: relative; width: min(70vw, 340px); margin-inline: auto; display: grid; justify-items: center; }
.hero-visual::before {
  content: ""; position: absolute; left: -10%; top: -10%; width: 120%; aspect-ratio: 1; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle at 50% 50%, rgba(22, 20, 68, 0.95) 0%, rgba(11, 12, 33, 0.92) 42%, rgba(7, 7, 24, 0) 70%);
}
.hero-logo {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  -webkit-mask-image: radial-gradient(ellipse 60% 64% at 50% 46%, #000 68%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 64% at 50% 46%, #000 68%, transparent 100%);
}
.hero-wordmark {
  margin: -11% 0 0; font-family: var(--font-display); font-weight: 900; font-size: clamp(1.5rem, 4.2vw, 2.4rem);
  letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
  background: linear-gradient(180deg, #ffe4a3 0%, var(--gold) 45%, var(--ember) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 140, 60, 0.45));
}
.rune-ring {
  position: absolute; left: -12%; top: -12%; width: 124%; aspect-ratio: 1; color: var(--gold); opacity: 0.22;
  animation: spin 120s linear infinite; pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.6rem 0 1rem; }
.hero-note { font-size: 0.9rem; color: var(--ivory-muted); }
.d20-wrap { position: absolute; right: -10%; top: -2%; display: grid; justify-items: center; gap: 0.2rem; }
.d20 {
  position: relative; width: 104px; height: 104px; padding: 0; border: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s ease;
}
.d20:hover { transform: translateY(-3px) rotate(-6deg); }
.d20 svg { width: 100%; height: 100%; overflow: visible; }
.d20-body { fill: #14123f; stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; }
.d20-lines { fill: none; stroke: var(--gold); stroke-width: 1.2; opacity: 0.75; }
.d20-face-bg { fill: rgba(29, 26, 90, 0.9); stroke: var(--gold-bright); stroke-width: 1.6; stroke-linejoin: round; }
.d20-face {
  position: absolute; inset: 0; display: grid; place-items: center; padding-top: 6px;
  font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; color: var(--gold-bright);
  transition: filter 0.2s ease;
}
.d20.is-rolling { animation: tumble 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.d20.is-rolling .d20-face { filter: blur(2px); }
.d20.is-crit .d20-body { stroke: var(--flame); fill: #3a1408; }
.d20.is-crit .d20-face { color: var(--gold-bright); text-shadow: 0 0 12px var(--ember); }
.d20.is-fumble .d20-face { color: var(--ivory-muted); }
@keyframes tumble {
  0% { transform: rotate(0) scale(1); }
  30% { transform: rotate(160deg) scale(1.18) translate(-6px, -12px); }
  60% { transform: rotate(290deg) scale(0.94) translate(6px, 4px); }
  100% { transform: rotate(360deg) scale(1); }
}
.d20-hint { margin: 0; font-size: 0.85rem; color: var(--ivory-muted); text-align: center; max-width: 12rem; min-height: 1.3em; }
@media (min-width: 900px) {
  .hero-inner { grid-template-columns: 1.15fr 0.85fr; }
  .hero-copy { order: 1; }
  .hero-visual { order: 2; width: min(100%, 420px); }
  .d20-wrap { right: -8%; top: 0; }
}
.center { text-align: center; }

/* Systems ring */
.ring-layout { position: relative; display: grid; justify-items: center; gap: 1.25rem; margin-block: 2rem 1rem; }
.ring { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; width: 100%; max-width: 480px; }
.ring-item { display: grid; }
.system {
  display: grid; justify-items: center; gap: 0.35rem; padding: 0.6rem 0.2rem; width: 100%;
  background: none; border: 0; color: var(--ivory-muted); font: inherit; cursor: pointer; text-align: center;
}
.system .emblem {
  width: 64px; height: 64px; padding: 12px; border-radius: 50%; color: var(--gold);
  background: rgba(20, 18, 63, 0.9); border: var(--hairline);
  box-shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.8);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.system .emblem path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.system:hover .emblem, .system:focus-visible .emblem { transform: translateY(-3px) scale(1.06); border-color: var(--gold-bright); box-shadow: 0 0 0 1px rgba(255, 210, 122, 0.5), 0 0 34px -6px rgba(255, 122, 47, 0.7); }
.system[aria-pressed="true"] .emblem { background: linear-gradient(135deg, var(--gold-bright), var(--ember)); color: var(--ink); border-color: transparent; }
.system[aria-pressed="true"] .system-name { color: var(--gold-bright); }
.system-name { font-size: 0.72rem; line-height: 1.2; font-weight: 500; }
.is-visible .system .emblem path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 1.4s ease forwards; animation-delay: calc(var(--i, 0) * 90ms + 200ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.phone-systems { width: min(300px, 78vw); }
.ring-caption { margin: 0; font-family: var(--font-display); font-weight: 700; color: var(--gold); letter-spacing: 0.04em; text-align: center; }
.phone > img { transition: opacity 0.18s ease; }
.phone > img.is-fading { opacity: 0; }
@supports (top: calc(sin(1deg) * 1px)) {
  @media (min-width: 900px) {
    .ring-layout { display: block; width: min(100%, 760px); aspect-ratio: 760 / 820; margin-inline: auto; }
    .ring { position: absolute; inset: 0; display: block; max-width: none; }
    .ring-item { position: absolute; left: calc(50% + cos(var(--a)) * 300px); top: calc(50% + sin(var(--a)) * 350px); transform: translate(-50%, -50%); width: 150px; }
    .phone-systems { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 224px; }
    .ring-caption { position: absolute; left: 50%; top: calc(50% + 252px); transform: translateX(-50%); white-space: nowrap; }
  }
}

/* Sheets */
.controls { display: flex; flex-wrap: wrap; margin: 0.5rem 0 1rem; }
.points { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: 1rem; }
.points li { padding-left: 1rem; border-left: 2px solid rgba(233, 180, 76, 0.45); }
.points h3 { font-size: 1rem; }
.points p { margin: 0; color: var(--ivory-muted); }
.phone-sheets { margin-inline: auto; width: min(360px, 84vw); }

/* Modules, AI, keep */
.modules-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; margin-top: 2rem; }
.module-card { display: grid; align-content: start; gap: 0.4rem; padding: 1rem 1rem 1.25rem; flex: 1 1 300px; max-width: 340px; }
.clip { position: relative; aspect-ratio: 3 / 5; border-radius: 16px; overflow: hidden; border: var(--hairline); background: #0d0d2e; margin-bottom: 0.6rem; }
.clip video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.clip-large { width: min(360px, 84vw); margin-inline: auto; border-radius: 28px; box-shadow: 0 40px 90px -35px rgba(0, 0, 0, 0.9), 0 0 60px -20px rgba(255, 122, 47, 0.3); }
.module-card p { margin: 0; color: var(--ivory-muted); font-size: 0.95rem; }
.icon { width: 40px; height: 40px; margin-bottom: 0.8rem; color: var(--gold); }
.icon path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#keep .card p { color: var(--ivory-muted); margin: 0; }
#keep .center { margin-top: 2rem; }

/* Live demo */
.demo-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.4rem 0 1rem; }
.phone-demo { margin-inline: auto; width: min(390px, 100%); }
.demo-loading {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; margin: 0; text-align: center;
  color: var(--ivory-muted); background: #0d0d2e; z-index: 1;
}
.demo-loading::before {
  content: ""; width: 34px; height: 34px; border-radius: 50%; margin-bottom: 0.8rem; justify-self: center;
  border: 3px solid rgba(233, 180, 76, 0.25); border-top-color: var(--gold-bright); animation: turn 0.9s linear infinite;
}
@keyframes turn { to { transform: rotate(360deg); } }
.demo-loading.is-done { display: none; }

/* The three steps into the closed test */
.steps { list-style: none; counter-reset: step; display: grid; gap: 1rem; margin: 1.75rem 0 1.25rem; padding: 0; }
.step { position: relative; padding-left: 4.2rem; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 1.5rem; top: 1.5rem;
  width: 2rem; height: 2rem; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: var(--ink); background: linear-gradient(135deg, var(--gold-bright), var(--ember));
  border-radius: 999px;
}
.step h3 { font-size: 1.15rem; margin: 0 0 0.4rem; }
.step p { color: var(--ivory-muted); margin: 0; }
.step-actions { margin: 1rem 0 0.6rem; }
.step .field-hint { margin: 0; }
@media (max-width: 520px) { .step { padding-left: 1.5rem; padding-top: 3.4rem; } .step::before { top: 1.5rem; left: 1.5rem; } }

/* Footer */
.footer { position: relative; z-index: 1; border-top: var(--hairline); padding-block: 3rem 2.5rem; background: var(--night-900); }
.footer-grid { display: grid; gap: 1.2rem; }
.footer-brand { display: grid; gap: 0.8rem; justify-items: start; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer-links a { color: var(--ivory-muted); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--gold-bright); }
.build { margin: 0; font-size: 0.85rem; color: var(--ivory-muted); opacity: 0.8; }
.fine-print { margin: 0; max-width: 70ch; }
@media (min-width: 900px) {
  .footer-grid { grid-template-columns: 1fr auto; align-items: start; }
  .footer-links { justify-content: end; }
  .build { grid-column: 2; text-align: right; }
  .fine-print { grid-column: 1; grid-row: 2; }
}

/* Prose pages: the privacy policy, the 404 */
.prose { padding-block: clamp(2.5rem, 6vw, 4rem); max-width: 72ch; }
.prose h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.prose h2 { font-size: 1.35rem; margin-top: 2.2rem; }
.prose p, .prose li { color: var(--ivory-muted); }
.prose strong { color: var(--ivory); }
.prose a:not(.btn) { color: var(--gold-bright); }
.prose hr { border: 0; border-top: var(--hairline); margin: 2rem 0; }
.page-actions { margin-top: 2rem; }
