/* Wakaru website — one stylesheet for every page.
   Tokens copied verbatim from DESIGN.md; do not invent colors here.
   (--bg-deep and --glow are recorded in DESIGN.md as website-only tokens.) */

:root {
  --bg: #0c1322;
  --bg-deep: #080d19;
  --panel: #111b2e;
  --panel-2: #182539;
  --line: #1f2d47;
  --line-soft: #192640;
  --text: #e6ecf5;
  --text-soft: #94a4bc;
  --text-faint: #61708a;
  --accent: #2dd4bf;
  --accent-deep: #14b8a6;
  --accent-ink: #04231f;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --reading: #93c5fd;
  --glow: rgba(45, 212, 191, 0.09);
  --r: 10px;
  --r-s: 6px;
  --display: 'Murecho', system-ui, sans-serif;
  --jp: 'Murecho', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
}

* { margin: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.6 system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

:lang(ja) { font-family: var(--jp); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 1.4rem; }

section { scroll-margin-top: 5rem; }

/* ---- Header ---- */

.nav-shell {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: .95rem 0;
}

.mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  margin-right: auto;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.mark:hover { text-decoration: none; }
.mark .kana { color: var(--accent); font-weight: 500; font-size: .85em; margin-left: .35rem; }

.nav a:not(.mark):not(.btn) { color: var(--text-soft); font-size: .95rem; white-space: nowrap; }
.nav a:not(.mark):not(.btn):hover { color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); }

.nav .btn { padding: .45rem .95rem; font-size: .9rem; }

@media (max-width: 680px) {
  .nav { flex-wrap: wrap; row-gap: .55rem; column-gap: 1.1rem; }
  .mark { flex-basis: 100%; }
  .nav .btn { display: none; }
}

/* ---- Buttons ---- */

.btn {
  display: inline-block;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.btn:hover { background: var(--line); text-decoration: none; }

.btn.primary {
  background: var(--accent-deep);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn.primary:hover { background: var(--accent); transform: translateY(-1px); }
.btn.primary:active { transform: none; }

/* ---- Section scaffolding ---- */

.section { padding: 5.5rem 0 0; }

.kicker {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: .8rem;
}

h1, h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 { font-size: clamp(1.5rem, 3vw, 1.95rem); margin-bottom: .7rem; }

.sub { color: var(--text-soft); max-width: 40rem; }

/* ---- Hero ---- */

.hero { padding: 5rem 0 0; text-align: center; }

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.08;
  margin: 0 auto .95rem;
  max-width: 15em;
}

.hero .sub {
  font-size: 1.1rem;
  margin: 0 auto 1.9rem;
  max-width: 34rem;
}

.hero .cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.hero .btn.primary { padding: .8rem 1.6rem; font-size: 1.02rem; }
.hero .cta-note { color: var(--text-faint); font-size: .92rem; }

/* ---- Demo frame (the pitch) ---- */

.stage { position: relative; margin-top: 3.4rem; }

/* Screen-light spilling from the frame — a background, not a box-shadow. */
.stage::before {
  content: '';
  position: absolute;
  inset: -18% -12% -24%;
  background: radial-gradient(55% 55% at 50% 55%, var(--glow), transparent 70%);
  pointer-events: none;
}

.frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(120% 85% at 78% 0%, #1c2b4e 0%, transparent 55%),
    radial-gradient(80% 60% at 12% 100%, #12203c 0%, transparent 58%),
    radial-gradient(45% 35% at 62% 68%, rgba(45, 212, 191, 0.05) 0%, transparent 70%),
    linear-gradient(180deg, #101a33 0%, var(--bg-deep) 100%);
}

.frame .hintbar {
  position: absolute;
  top: .95rem;
  left: 1.15rem;
  color: var(--text-faint);
  font-size: .78rem;
  letter-spacing: .02em;
}

/* Subtitles, exactly as the overlay draws them: dark text-shadow, no boxes. */
.subs {
  position: absolute;
  left: 0; right: 0; bottom: 13%;
  text-align: center;
  text-shadow: 0 0 4px #000, 0 2px 4px rgba(0, 0, 0, 0.9);
}

.subs .jpline {
  font-family: var(--jp);
  font-size: clamp(1.05rem, 3.1vw, 1.8rem);
  font-weight: 600;
  margin-bottom: .5rem;
}
.subs .enline { font-size: clamp(.85rem, 2.2vw, 1.25rem); font-weight: 500; }

.subs rt { color: var(--reading); font-size: .48em; font-weight: 400; }
.tok-particle { color: #9ca3af; }

/* The word being spoken right now — the overlay's real glow recipe. */
.tok-spoken {
  text-shadow: 0 0 4px #000, 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 10px rgba(125, 211, 252, 0.6);
}

/* The word card, in its real chrome (the one sanctioned glassy surface). */
.wordcard {
  position: absolute;
  right: 4.5%;
  bottom: 34%;
  width: min(250px, 38%);
  background: rgba(13, 20, 35, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 13px 16px 13px;
  text-align: left;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
}
.wordcard .wc-head { display: flex; align-items: baseline; gap: 9px; }
.wordcard .wc-surface { font-family: var(--jp); font-size: 1.5rem; font-weight: 700; color: #7dd3fc; }
.wordcard .wc-reading { color: var(--reading); font-size: .85rem; }
.wordcard .wc-audio { margin-left: auto; font-size: .9rem; }
.wordcard .wc-gloss { color: #e2e8f0; font-size: .88rem; margin: 5px 0 3px; }
.wordcard .wc-dict { color: var(--text-faint); font-size: .74rem; margin-bottom: 9px; }
.wordcard .wc-save {
  display: inline-block;
  background: var(--accent-deep);
  color: var(--accent-ink);
  border: none;
  border-radius: 8px;
  padding: 5px 14px;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
}
@media (max-width: 560px) {
  .wordcard { display: none; }
  .frame { aspect-ratio: 4 / 3; }
  .subs { bottom: 22%; }
  .playbar .row span:not(.t) { display: none; }
}

/* Player bar: progress line + the injected replay buttons. */
.playbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: .7rem 1.15rem .8rem;
  background: linear-gradient(180deg, transparent, rgba(4, 8, 16, 0.75));
}
.playbar .track {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  margin-bottom: .55rem;
  overflow: hidden;
}
.playbar .track i {
  display: block;
  height: 100%;
  width: 37%;
  background: var(--accent);
}
.playbar .row {
  display: flex;
  align-items: center;
  gap: .9rem;
  color: var(--text-soft);
  font-size: .78rem;
}
.playbar svg { display: block; color: #d7dfeb; }
.playbar .t { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-faint); }

/* ---- Feature grid ---- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  margin-top: 2rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.35rem 1.4rem 1.3rem;
  transition: border-color .18s ease, transform .18s ease;
}
.card:hover { border-color: rgba(45, 212, 191, 0.35); transform: translateY(-2px); }

.card .ic {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  margin-bottom: .8rem;
}
.card h3 { font-family: var(--display); font-size: 1.02rem; font-weight: 600; margin-bottom: .4rem; }
.card p { color: var(--text-soft); font-size: .93rem; }

.also {
  margin-top: 1.4rem;
  color: var(--text-faint);
  font-size: .92rem;
  max-width: 46rem;
}

/* ---- Steps ---- */

.steps {
  list-style: none;
  padding: 0;
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.1rem;
}
.steps li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.15rem 1.2rem 1.1rem;
}
.steps .n {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: .45rem;
}
.steps p { color: var(--text-soft); font-size: .93rem; }
.steps b { color: var(--text); font-weight: 600; }

/* ---- Tip (matches .pp-tip) ---- */

.tip {
  background: var(--panel);
  border-left: 2px solid var(--accent-deep);
  border-radius: 0 var(--r-s) var(--r-s) 0;
  padding: .75rem 1rem;
  color: var(--text-soft);
  font-size: .93rem;
  margin-top: 1.6rem;
  max-width: 46rem;
}

/* ---- Pricing ---- */

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
  margin-top: 2rem;
  align-items: stretch;
}

.plan {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.45rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  text-align: left;
}
.plan.best { background: var(--panel-2); border-color: var(--accent-deep); }

.plan .name { color: var(--text-soft); font-size: .95rem; font-weight: 600; }
.plan .tag {
  color: var(--accent);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600;
  margin-bottom: .15rem;
}
.plan .price {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.15rem;
  letter-spacing: -0.02em;
  margin-top: .35rem;
  font-variant-numeric: tabular-nums;
}
.plan .price small { font-size: .95rem; color: var(--text-soft); font-weight: 500; letter-spacing: 0; }
.plan .permo { color: var(--text-soft); font-size: .9rem; }
.plan .save { color: var(--ok); }
.plan .btn { margin-top: 1.2rem; text-align: center; }

.plan-notes { margin-top: 1.4rem; color: var(--text-faint); font-size: .92rem; }
.plan-notes p { margin-top: .25rem; }

/* ---- FAQ folds ---- */

.faq { margin-top: 1.6rem; max-width: 46rem; }

.faq details {
  border-bottom: 1px solid var(--line-soft);
  padding: .95rem 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.02rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '▾';
  color: var(--text-faint);
  transition: transform .18s ease;
}
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details p { color: var(--text-soft); margin-top: .6rem; max-width: 42rem; }

/* ---- Closing CTA band ---- */

.closer {
  margin-top: 5.5rem;
  padding: 3.2rem 1.5rem;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.closer::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto;
  height: 120%;
  background: radial-gradient(50% 60% at 50% 0%, var(--glow), transparent 70%);
  pointer-events: none;
}
.closer > * { position: relative; }
.closer h2 { margin-bottom: .5rem; }
.closer .sub { margin: 0 auto 1.5rem; }

/* ---- Prose pages (privacy, terms) ---- */

.prose { max-width: 720px; padding-top: 3.2rem; }
.prose h1 { font-size: clamp(1.7rem, 3.5vw, 2.2rem); margin-bottom: .4rem; }
.prose .updated { color: var(--text-faint); font-size: .9rem; margin-bottom: 2rem; }
.prose h2 { font-size: 1.18rem; margin: 2.1rem 0 .55rem; }
.prose p, .prose li { color: var(--text-soft); }
.prose p + p { margin-top: .6rem; }
.prose ul { padding-left: 1.2rem; margin-top: .4rem; }
.prose li { margin-top: .4rem; }
.prose b, .prose strong { color: var(--text); font-weight: 600; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .8rem;
  font-size: .92rem;
}
.prose th, .prose td {
  text-align: left;
  padding: .6rem .75rem;
  border: 1px solid var(--line);
  color: var(--text-soft);
  vertical-align: top;
}
.prose th { color: var(--text); font-weight: 600; background: var(--panel); }
.table-scroll { overflow-x: auto; }

/* ---- Account ---- */

.account { max-width: 480px; padding-top: 3.2rem; }
.account h1 { font-size: 1.7rem; margin-bottom: .45rem; }
.account .sub { margin-bottom: 1.5rem; }

.acct-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.3rem 1.35rem;
  margin-top: 1rem;
}

.node { display: flex; align-items: baseline; gap: .6rem; padding: .3rem 0; }
.node .dot { font-weight: 700; }
.node .dot.ok { color: var(--ok); }
.node .dot.warn { color: var(--warn); }
.node .dot.err { color: var(--err); }
.node .label { color: var(--text-soft); min-width: 5.5rem; font-size: .92rem; }
.node .value { font-weight: 600; overflow-wrap: anywhere; }

.acct-status { margin-top: .9rem; color: var(--text-soft); font-size: .93rem; }
.acct-status.err { color: var(--err); }

.acct-actions { margin-top: 1.15rem; display: flex; gap: .8rem; align-items: center; }

/* ---- Footer ---- */

footer {
  margin-top: 5.5rem;
  border-top: 1px solid var(--line-soft);
  padding: 2.2rem 0 2.6rem;
  color: var(--text-faint);
  font-size: .88rem;
}
footer .cols {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.3rem;
}
footer .fmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
footer .fmark .kana { color: var(--accent); font-weight: 500; font-size: .85em; margin-left: .3rem; }
footer .tagline { margin-top: .3rem; max-width: 20rem; }
footer .links { display: flex; gap: 1.3rem; flex-wrap: wrap; align-items: center; }
footer a { color: var(--text-soft); }
footer p + p { margin-top: .35rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
