/* ==========================================================================
   Japatan — The Great JLPT Vocabulary Adventure
   Sticker-book RPG quest style. Light = day journey / Dark = night journey.
   All colors flow through tokens so both themes share one component layer.
   ========================================================================== */

:root {
  --ink: #1d2e5c;
  --ink-soft: #45568a;
  --sky: #4a90f4;
  --sky-deep: #3373f2;
  --sky-pale: #cfe5ff;
  --sun: #ffc93c;
  --sun-deep: #f0a818;
  --meadow: #56c271;
  --meadow-pale: #d9f3de;
  --cheek: #ff8fa3;
  --cheek-pale: #ffe3e9;
  --grape: #8a63d2;
  --grape-pale: #eae1fb;
  --night: #142248;
  --night-deep: #0d1733;
  --paper: #f2f6fd;
  --card: #ffffff;
  --cloud: #f0f7ff;
  --chip-gold: #fff3cf;
  --stone-n3: #cfe0ff;
  --stone-n1: #ffe9ad;
  --note-bg: #fff6da;
  --hero-1: #7db4ff;
  --hero-2: #a0c8ff;
  --hero-3: #c6e0ff;
  --pagehero-1: #a8ccff;
  --h1-glow: rgba(255, 255, 255, 0.6);
  --shadow-ink: rgba(29, 46, 92, 0.9);
  --link: #2e63d8;
  --line: 3px solid var(--ink);
  --sticker-shadow: 0 5px 0 var(--shadow-ink);
  --sticker-shadow-sm: 0 3px 0 var(--shadow-ink);
  --r-lg: 26px;
  --r-md: 18px;
  --maxw: 1100px;
  --disp: "Baloo 2", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
  color-scheme: light;
}

/* ---------- Dark theme: the night leg of the journey ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #dfe8ff;
    --ink-soft: #9db0dd;
    --sky-pale: #2c3d74;
    --meadow-pale: #1f4030;
    --cheek-pale: #542f3e;
    --grape-pale: #392c63;
    --paper: #0e1732;
    --card: #1b2751;
    --cloud: #131e42;
    --chip-gold: #4a3c14;
    --stone-n3: #26376e;
    --stone-n1: #4a3c14;
    --note-bg: #3a3214;
    --hero-1: #0a1130;
    --hero-2: #14204a;
    --hero-3: #1d2b5c;
    --pagehero-1: #1d2b5c;
    --h1-glow: rgba(0, 0, 0, 0.45);
    --shadow-ink: rgba(0, 0, 0, 0.6);
    --link: #8db4ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #dfe8ff;
  --ink-soft: #9db0dd;
  --sky-pale: #2c3d74;
  --meadow-pale: #1f4030;
  --cheek-pale: #542f3e;
  --grape-pale: #392c63;
  --paper: #0e1732;
  --card: #1b2751;
  --cloud: #131e42;
  --chip-gold: #4a3c14;
  --stone-n3: #26376e;
  --stone-n1: #4a3c14;
  --note-bg: #3a3214;
  --hero-1: #0a1130;
  --hero-2: #14204a;
  --hero-3: #1d2b5c;
  --pagehero-1: #1d2b5c;
  --h1-glow: rgba(0, 0, 0, 0.45);
  --shadow-ink: rgba(0, 0, 0, 0.6);
  --link: #8db4ff;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Baloo 2", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { font-family: var(--disp); text-wrap: balance; }

::selection { background: var(--sun); color: #1d2e5c; }

/* ---------- Scroll pop-in ---------- */
.pop {
  opacity: 0;
  transform: translateY(26px) scale(0.95) rotate(var(--tilt, 0deg));
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-delay: var(--pop-delay, 0s);
}
.pop.in { opacity: 1; transform: translateY(0) scale(1) rotate(var(--tilt, 0deg)); }
@media (prefers-reduced-motion: reduce) {
  .pop { opacity: 1; transform: none; transition: none; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--ink);
  transform: rotate(-1.5deg);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; transform: rotate(1.5deg); }
.brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: var(--line);
  background: var(--card);
}

.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav a {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 6px 13px;
  border-radius: 999px;
  border: 2px solid transparent;
  white-space: nowrap;
}
.main-nav a:hover {
  text-decoration: none;
  border-color: var(--ink);
  background: var(--sun);
  color: #1d2e5c;
  transform: rotate(-2deg);
}
.main-nav a[aria-current="page"] { background: var(--sky-pale); border-color: var(--ink); }

.header-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* theme toggle */
.theme-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--card);
  box-shadow: var(--sticker-shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: transform 0.15s;
  padding: 0;
}
.theme-btn:hover { transform: rotate(-12deg) scale(1.08); background: var(--sun); color: #1d2e5c; }
.theme-btn:active { transform: translateY(3px); box-shadow: none; }
.theme-btn svg { width: 21px; height: 21px; }
.theme-btn .icon-sun { display: none; }
.theme-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }

/* language dropdown */
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--sticker-shadow-sm);
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { background: var(--sun); color: #1d2e5c; }
.lang-menu[open] summary { background: var(--sun); color: #1d2e5c; }
.lang-menu summary svg { width: 17px; height: 17px; flex-shrink: 0; }
.lang-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: var(--card);
  border: var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sticker-shadow);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  width: min(340px, calc(100vw - 32px));
  max-height: min(430px, 70vh);
  overflow-y: auto;
  z-index: 130;
}
.lang-panel a {
  padding: 5px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lang-panel a:hover { background: var(--sky-pale); text-decoration: none; }
.lang-panel a[aria-current="true"] { background: var(--sun); color: #1d2e5c; }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span {
  display: block;
  width: 26px;
  height: 3.5px;
  background: var(--ink);
  border-radius: 3px;
  margin: 5px 0;
}

/* ---------- Buttons: chunky game buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  padding: 14px 30px;
  border-radius: 999px;
  border: var(--line);
  font-family: var(--disp);
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--ink);
  box-shadow: var(--sticker-shadow);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s;
  position: relative;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 7px 0 var(--shadow-ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--shadow-ink); }
.btn-primary { background: var(--sun); color: #1d2e5c; }
.btn-primary:hover { background: #ffd35e; }
.btn-secondary { background: var(--card); }
.btn-secondary:hover { background: var(--cloud); }
.btn svg { flex-shrink: 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: linear-gradient(180deg, var(--hero-1) 0%, var(--hero-2) 60%, var(--hero-3) 100%);
  overflow: hidden;
  padding: 0;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 24px;
  padding: 64px 0 96px;
  position: relative;
  z-index: 2;
}
.hero-badge {
  display: inline-block;
  background: var(--card);
  border: var(--line);
  box-shadow: var(--sticker-shadow-sm);
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 22px;
  transform: rotate(-2deg);
}
.hero h1 {
  font-size: clamp(2.1rem, 4.8vw, 3.4rem);
  line-height: 1.3;
  font-weight: 900;
  margin-bottom: 20px;
  color: var(--ink);
  text-shadow: 0 3px 0 var(--h1-glow);
}
.hero h1 .mark {
  display: inline-block;
  background: linear-gradient(transparent 55%, var(--sun) 55%, var(--sun) 92%, transparent 92%);
  transform: rotate(-1deg);
  padding: 0 4px;
}
:root[data-theme="dark"] .hero h1 .mark,
:root:not([data-theme="light"]) .hero h1 .mark { color: inherit; }
.hero-lead {
  font-size: 1.12rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 30px;
  max-width: 32em;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.hero-note {
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 16px;
  color: var(--ink-soft);
}

/* hero art: mascot + speech bubble */
.hero-art { position: relative; text-align: center; }
.hero-art > img {
  width: min(360px, 78%);
  margin: 0 auto;
  filter: drop-shadow(0 18px 0 rgba(0, 0, 0, 0.14));
  animation: bob 4.5s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-16px) rotate(1.5deg); }
}
/* speech bubble: one continuous SVG path (body + tail), so the stroke is
   perfectly uniform everywhere */
.speech {
  position: absolute;
  width: 250px;
  height: 76px;
  transform: rotate(2deg);
  animation: speech-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s backwards;
  z-index: 3;
  pointer-events: none;
}
.speech svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.speech svg path {
  fill: var(--card);
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 0 var(--shadow-ink));
}
.speech span {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "M PLUS Rounded 1c", var(--disp);
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--ink);
}
@keyframes speech-pop {
  from { opacity: 0; transform: rotate(2deg) scale(0.3); }
  to { opacity: 1; transform: rotate(2deg) scale(1); }
}

/* drifting clouds & sparkles */
.cloud {
  position: absolute;
  background: var(--card);
  border: var(--line);
  border-radius: 999px;
  opacity: 0.95;
  z-index: 1;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border: inherit;
  border-radius: 50%;
  border-bottom: none;
}
.cloud::before { width: 45%; height: 90%; left: 14%; top: -46%; }
.cloud::after { width: 34%; height: 66%; right: 16%; top: -30%; }
.cloud-1 { width: 150px; height: 46px; top: 18%; left: -60px; animation: drift 38s linear infinite; }
.cloud-2 { width: 100px; height: 34px; top: 58%; left: -40px; animation: drift 55s linear infinite 8s; }
.cloud-3 { width: 190px; height: 56px; top: 8%; left: -80px; animation: drift 70s linear infinite 20s; }
@keyframes drift {
  from { transform: translateX(-220px); }
  to { transform: translateX(calc(100vw + 260px)); }
}
/* floating edible word chips */
.float-chip {
  position: absolute;
  z-index: 2;
  cursor: pointer;
  border: none;
  animation: floaty 6s ease-in-out infinite;
  transition: transform 0.7s cubic-bezier(0.5, 0, 0.75, 0.4), opacity 0.7s;
  font-size: 0.92rem;
  padding: 5px 15px;
}
.float-chip:hover { animation-play-state: paused; scale: 1.08; }
.float-chip.eaten { pointer-events: none; }
@keyframes floaty {
  0%, 100% { translate: 0 0; rotate: -2deg; }
  50% { translate: 0 -14px; rotate: 2.5deg; }
}
.nom {
  position: absolute;
  font-family: var(--disp);
  font-weight: 900;
  color: var(--ink);
  text-shadow: 0 2px 0 var(--card);
  animation: nom-pop 0.9s ease-out forwards;
  pointer-events: none;
  z-index: 9;
}
@keyframes nom-pop {
  0% { opacity: 0; transform: translateY(6px) scale(0.6); }
  25% { opacity: 1; transform: translateY(-6px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-30px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art > img, .cloud, .speech, .float-chip { animation: none; }
}

/* wavy ground edge */
.wave { display: block; width: 100%; height: 44px; margin-bottom: -1px; }
.wave .w-fill { fill: var(--paper); }
.wave .w-line { fill: none; stroke: var(--ink); stroke-width: 3; }

/* ---------- Word marquee ---------- */
.marquee-band {
  background: var(--paper);
  padding: 26px 0;
  border-bottom: var(--line);
  overflow: hidden;
}
.marquee {
  display: flex;
  width: max-content;
  animation: scroll-x 36s linear infinite;
}
.marquee:hover { animation-play-state: paused; }
@keyframes scroll-x {
  from { transform: translateX(0); }
  to { transform: translateX(-25%); }
}
.word-chip {
  display: inline-block;
  margin-inline-end: 14px;
  cursor: pointer;
  white-space: nowrap;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 6px 18px;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 1.02rem;
  box-shadow: var(--sticker-shadow-sm);
}
.word-chip small { font-weight: 700; font-size: 0.78rem; color: var(--ink-soft); }
.word-chip .chip-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.word-chip.flipped .chip-inner { transform: rotateY(180deg); }
.word-chip .chip-face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}
.word-chip .chip-back {
  transform: rotateY(180deg);
  align-items: center;
  font-size: 0.86rem;
  font-weight: 800;
}
.word-chip.c1 { background: var(--sky-pale); transform: rotate(-1.5deg); }
.word-chip.c2 { background: var(--cheek-pale); transform: rotate(1deg); }
.word-chip.c3 { background: var(--meadow-pale); transform: rotate(-0.5deg); }
.word-chip.c4 { background: var(--chip-gold); transform: rotate(1.5deg); }
.word-chip.c5 { background: var(--grape-pale); transform: rotate(-1deg); }
@media (prefers-reduced-motion: reduce) { .marquee { animation: none; } }

/* ---------- Sections ---------- */
section { padding: 84px 0; position: relative; }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 54px; }
.section-eyebrow {
  display: inline-block;
  font-family: var(--disp);
  color: #1d2e5c;
  background: var(--sun);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 16px;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
  transform: rotate(-2deg);
  box-shadow: var(--sticker-shadow-sm);
}
.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 14px;
}
.section-head p { color: var(--ink-soft); font-size: 1.05rem; font-weight: 500; }

.section-alt { background: var(--cloud); }
.section-meadow { background: linear-gradient(180deg, var(--cloud) 0%, var(--meadow-pale) 100%); }

/* ---------- Adventure gear ---------- */
.gear-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px 26px;
}
.gear-card {
  background: var(--card);
  border: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sticker-shadow);
  padding: 26px 24px 24px;
  text-align: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gear-card:nth-child(odd) { --tilt: -1.6deg; }
.gear-card:nth-child(even) { --tilt: 1.4deg; }
.gear-card:nth-child(3n) { --tilt: -0.8deg; }
.gear-card { transform: rotate(var(--tilt)); }
.gear-card:hover { transform: rotate(0deg) translateY(-6px) scale(1.02); }
.gear-card img { height: 120px; width: auto; margin: 0 auto 14px; object-fit: contain; }
.gear-card h3 { font-size: 1.14rem; font-weight: 800; margin-bottom: 8px; }
.gear-card h3 .tag {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--sky-deep);
  border-radius: 999px;
  width: fit-content;
  margin: 0 auto 8px;
  padding: 2px 12px;
  border: 2px solid var(--ink);
}
.gear-card:nth-child(2) h3 .tag { background: var(--meadow); }
.gear-card:nth-child(3) h3 .tag { background: var(--grape); }
.gear-card:nth-child(4) h3 .tag { background: var(--cheek); }
.gear-card:nth-child(5) h3 .tag { background: var(--sun-deep); }
.gear-card:nth-child(6) h3 .tag { background: var(--sky); }
.gear-card p { color: var(--ink-soft); font-size: 0.93rem; font-weight: 500; text-align: start; }

/* ---------- Quest map ---------- */
.quest-map { position: relative; height: 520px; max-width: 1000px; margin: 0 auto; }
.quest-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.quest-path path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 0.5 18;
  opacity: 0.65;
}
.quest-node { position: absolute; transform: translate(-50%, -50%); text-align: center; width: 150px; }
.quest-node .stone {
  font-family: var(--disp);
  font-weight: 900;
  font-size: 1.5rem;
  width: 74px;
  height: 74px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: var(--line);
  border-radius: 26px 22px 28px 20px;
  box-shadow: var(--sticker-shadow);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quest-node:hover .stone { transform: rotate(-6deg) scale(1.12); }
.quest-node.n5 .stone, .quest-item.n5 .stone { background: var(--meadow-pale); }
.quest-node.n4 .stone, .quest-item.n4 .stone { background: var(--sky-pale); }
.quest-node.n3 .stone, .quest-item.n3 .stone { background: var(--stone-n3); }
.quest-node.n2 .stone, .quest-item.n2 .stone { background: var(--grape-pale); }
.quest-node.n1 .stone, .quest-item.n1 .stone { background: var(--stone-n1); }
.quest-node .label {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1.45;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 4px 10px;
  box-shadow: var(--sticker-shadow-sm);
  display: inline-block;
}
.quest-node .label small { display: block; font-weight: 700; font-size: 0.72rem; color: var(--ink-soft); }
.quest-start, .quest-goal { position: absolute; text-align: center; transform: translate(-50%, -50%); }
.quest-start img { width: 90px; margin: 0 auto; }
.quest-goal img { width: 150px; margin: 0 auto; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.14)); }
.quest-flag {
  display: inline-block;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.8rem;
  background: var(--sun);
  color: #1d2e5c;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 12px;
  box-shadow: var(--sticker-shadow-sm);
  transform: rotate(-3deg);
}

.quest-list { display: none; }
@media (max-width: 820px) {
  .quest-map { display: none; }
  .quest-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 420px;
    margin: 0 auto;
    padding-inline-start: 8px;
    border-inline-start: 4px dotted var(--ink);
  }
  .quest-list .quest-item {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-inline-start: 18px;
  }
  .quest-list .stone {
    font-family: var(--disp);
    font-weight: 900;
    font-size: 1.2rem;
    width: 58px;
    height: 58px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: var(--line);
    border-radius: 20px 17px 22px 16px;
    box-shadow: var(--sticker-shadow-sm);
  }
  .quest-item p { font-weight: 700; font-size: 0.95rem; line-height: 1.5; }
  .quest-item p small { display: block; font-weight: 500; color: var(--ink-soft); font-size: 0.82rem; }
  .quest-item img { width: 74px; flex-shrink: 0; }
}

/* ---------- Screenshot gallery ---------- */
.shots {
  display: flex;
  gap: 26px;
  overflow-x: auto;
  padding: 26px 24px 34px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.shots::-webkit-scrollbar { height: 10px; }
.shots::-webkit-scrollbar-thumb { background: var(--ink); border-radius: 999px; }
.shots::-webkit-scrollbar-track { background: rgba(120, 140, 190, 0.25); border-radius: 999px; }
.shot:first-child { margin-inline-start: auto; }
.shot:last-child { margin-inline-end: auto; }
.shot {
  flex: 0 0 auto;
  width: min(250px, 62vw);
  scroll-snap-align: center;
  background: var(--card);
  border: var(--line);
  border-radius: 22px;
  box-shadow: var(--sticker-shadow);
  padding: 10px 10px 12px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.shot:nth-child(odd) { transform: rotate(-1.8deg); }
.shot:nth-child(even) { transform: rotate(1.6deg) translateY(10px); }
.shot:hover { transform: rotate(0deg) scale(1.04); z-index: 2; }
.shot img { border-radius: 14px; border: 2px solid var(--ink); }

/* ---------- Polaroid splits ---------- */
.split { display: grid; grid-template-columns: 1fr 1.1fr; gap: 60px; align-items: center; }
.split + .split { margin-top: 88px; }
.split:nth-of-type(even) .split-art { order: 2; }
.split-art { text-align: center; position: relative; }
.polaroid {
  display: inline-block;
  background: var(--card);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--sticker-shadow);
  padding: 18px 18px 14px;
  transform: rotate(-2.5deg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.split:nth-of-type(even) .polaroid { transform: rotate(2.5deg); }
.polaroid:hover { transform: rotate(0deg) scale(1.03); }
.polaroid img { width: min(280px, 60vw); margin: 0 auto; }
.polaroid figcaption { font-family: var(--disp); font-weight: 700; font-size: 0.9rem; margin-top: 10px; color: var(--ink-soft); }
.tape {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 110px;
  height: 30px;
  background: rgba(255, 201, 60, 0.75);
  border-left: 2px dashed rgba(0, 0, 0, 0.25);
  border-right: 2px dashed rgba(0, 0, 0, 0.25);
  transform: translateX(-50%) rotate(-4deg);
}
.split:nth-of-type(even) .tape { background: rgba(255, 143, 163, 0.6); transform: translateX(-50%) rotate(3deg); }
.split h3 { font-size: 1.55rem; font-weight: 900; margin-bottom: 14px; line-height: 1.45; }
.split > div > p { color: var(--ink-soft); font-weight: 500; margin-bottom: 12px; }
.split ul { list-style: none; margin-top: 18px; }
.split li { padding-inline-start: 34px; position: relative; margin-bottom: 12px; font-weight: 700; }
.split li::before {
  content: "✓";
  position: absolute;
  inset-inline-start: 0;
  top: 3px;
  width: 24px;
  height: 24px;
  background: var(--sun);
  border: 2.5px solid var(--ink);
  color: #1d2e5c;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.split li:nth-child(2)::before { background: var(--meadow-pale); color: var(--ink); }
.split li:nth-child(3)::before { background: var(--cheek-pale); color: var(--ink); }

/* ---------- Premium: plan comparison (night sky both themes) ---------- */
.night {
  background:
    linear-gradient(180deg, var(--night) 0%, var(--night-deep) 100%);
  color: #e8eeff;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
}
.night .section-eyebrow { background: var(--grape); color: #fff; border-color: #0d1733; }
.night .section-head h2 { color: #fff; }
.night .section-head p { color: #b9c6ea; }
.night .section-head img { width: 120px; margin: 0 auto 16px; }

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  max-width: 820px;
  margin: 0 auto;
  align-items: stretch;
}
.plan {
  border-radius: var(--r-lg);
  padding: 32px 30px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.plan-premium {
  background: #ffffff;
  color: #1d2e5c;
  border: 3px solid #1d2e5c;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(255, 201, 60, 0.35);
  transform: rotate(-1deg);
}
.plan-free {
  background: rgba(255, 255, 255, 0.07);
  color: #dfe6fa;
  border: 3px solid rgba(255, 255, 255, 0.4);
  transform: rotate(0.8deg);
}
.plan-badge {
  position: absolute;
  top: -16px;
  inset-inline-start: 24px;
  background: var(--sun);
  color: #1d2e5c;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 3px 14px;
  border-radius: 999px;
  border: 2.5px solid #1d2e5c;
  transform: rotate(-3deg);
}
.plan h3 { font-size: 1.4rem; font-weight: 900; margin-bottom: 18px; }
.plan-list { list-style: none; flex: 1; }
.plan-list li { padding-inline-start: 34px; position: relative; margin-bottom: 14px; line-height: 1.5; }
.plan-list li strong { display: block; font-family: var(--disp); font-weight: 800; }
.plan-list li small { font-size: 0.85rem; opacity: 0.75; }
.plan-list li::before {
  position: absolute;
  inset-inline-start: 0;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.plan-premium .plan-list li::before {
  content: "✓";
  background: var(--meadow);
  color: #fff;
  border: 2.5px solid #1d2e5c;
}
.plan-free .plan-list li::before {
  content: "–";
  background: rgba(255, 255, 255, 0.15);
  color: #dfe6fa;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
}
.plan-price {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px dashed rgba(120, 130, 170, 0.45);
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.85;
}
.plan-note {
  text-align: center;
  margin: 30px auto 0;
  max-width: 560px;
  font-size: 0.92rem;
  color: #b9c6ea;
  background: rgba(255, 255, 255, 0.06);
  border: 2px dashed rgba(255, 255, 255, 0.35);
  border-radius: var(--r-md);
  padding: 14px 22px;
}

/* ---------- FAQ ---------- */
.faq-list { max-width: 780px; margin: 0 auto; }
.faq-item {
  background: var(--card);
  border: var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sticker-shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.faq-item:nth-child(odd) { transform: rotate(-0.4deg); }
.faq-item:nth-child(even) { transform: rotate(0.4deg); }
.faq-item summary {
  cursor: pointer;
  padding: 18px 22px;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 1.02rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 14px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "Q";
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--disp);
  font-weight: 900;
  background: var(--sun);
  color: #1d2e5c;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
}
.faq-item summary::after {
  content: "▾";
  margin-inline-start: auto;
  color: var(--sky-deep);
  font-size: 1.2rem;
  transition: transform 0.25s;
}
.faq-item[open] summary::after { transform: rotate(-180deg); }
.faq-item[open] summary::before { background: var(--meadow); color: #fff; content: "A"; }
.faq-item .faq-a {
  padding: 0 22px 20px;
  padding-inline-start: 68px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.97rem;
}

/* ---------- CTA ---------- */
.cta-band {
  text-align: center;
  background: linear-gradient(180deg, var(--cloud) 0%, var(--sky-pale) 100%);
  overflow: hidden;
}
.cta-band img { width: 170px; margin: 0 auto 22px; animation: bob 4.5s ease-in-out infinite; }
.cta-band h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 900; margin-bottom: 12px; }
.cta-band p { color: var(--ink-soft); font-weight: 500; margin-bottom: 30px; }
@media (prefers-reduced-motion: reduce) { .cta-band img { animation: none; } }

/* ---------- Inner pages ---------- */
.page-hero {
  background: linear-gradient(180deg, var(--pagehero-1) 0%, var(--cloud) 100%);
  border-bottom: var(--line);
  padding: 52px 0 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.5rem);
  font-weight: 900;
  margin-bottom: 10px;
  position: relative;
  z-index: 2;
}
.page-hero p { color: var(--ink-soft); font-weight: 600; position: relative; z-index: 2; }
.page-hero .updated { font-size: 0.85rem; margin-top: 8px; }

.breadcrumb { font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); padding: 14px 0 0; position: relative; z-index: 2; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.breadcrumb li + li::before { content: "▸"; margin-inline-end: 6px; color: var(--ink-soft); }

.article {
  max-width: 780px;
  margin: 40px auto 80px;
  padding: 48px clamp(24px, 5vw, 56px);
  background: var(--card);
  border: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sticker-shadow);
  font-weight: 500;
}
.article h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 44px 0 14px;
  padding-inline-start: 14px;
  border-inline-start: 6px solid var(--sun);
}
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 1.08rem; font-weight: 800; margin: 28px 0 10px; }
.article p { margin-bottom: 14px; }
.article ul, .article ol { margin: 0 0 16px 24px; }
.article li { margin-bottom: 8px; }
.article table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 0.93rem; }
.article th, .article td { border: 2px solid var(--ink); padding: 10px 14px; text-align: start; vertical-align: top; }
.article th { background: var(--sky-pale); }
.article .note {
  background: var(--note-bg);
  border: 2.5px dashed var(--ink);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 0.95rem;
}

/* contact cards */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  max-width: 880px;
  margin: 0 auto;
}
.contact-card {
  background: var(--card);
  border: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sticker-shadow);
  padding: 34px 30px;
  text-align: center;
}
.contact-card:first-child { transform: rotate(-1deg); }
.contact-card:last-child { transform: rotate(1deg); }
.contact-card h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: 10px; }
.contact-card p { color: var(--ink-soft); font-weight: 500; font-size: 0.95rem; margin-bottom: 20px; }
.contact-email { font-size: 1rem; word-break: break-all; }
.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--sky-pale);
  border: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 18px;
  transform: rotate(-4deg);
}

/* ---------- Footer (night in both themes) ---------- */
.site-footer {
  background: #0d1733;
  color: #aab8e0;
  padding: 56px 0 32px;
  font-size: 0.92rem;
  border-top: 3px solid var(--ink);
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.footer-brand img { width: 34px; height: 34px; border-radius: 9px; border: 2px solid rgba(255,255,255,0.5); }
.footer-grid h4 {
  color: var(--sun);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 10px; }
.footer-grid a { color: #aab8e0; font-weight: 600; }
.footer-grid a:hover { color: #fff; }
.footer-bottom {
  border-top: 2px dashed rgba(255, 255, 255, 0.2);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: #7385b5;
}

/* ---------- RTL fine-tuning ---------- */
[dir="rtl"] .brand { transform: rotate(1.5deg); }
[dir="rtl"] .speech { right: auto; left: 4%; border-radius: 22px 22px 6px 22px; }
[dir="rtl"] .speech .tail { left: auto; right: 12px; transform: scaleX(-1); }
[dir="rtl"] .speech::after { left: auto; right: 14px; }
[dir="rtl"] .lang-panel { right: auto; left: 0; }
[dir="rtl"] .marquee { animation-direction: reverse; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; padding: 44px 0 80px; }
  .hero-lead { margin-left: auto; margin-right: auto; }
  .hero-cta { justify-content: center; }
  .hero-art { order: -1; margin-bottom: 8px; }
  .hero-art > img { width: min(250px, 58%); }
  .speech { right: 8%; top: -8px; font-size: 0.9rem; }
  [dir="rtl"] .speech { left: 8%; }
  .gear-grid { grid-template-columns: 1fr 1fr; }
  .split, .plan-grid, .contact-grid { grid-template-columns: 1fr; }
  .split:nth-of-type(even) .split-art { order: 0; }
  .split + .split { margin-top: 64px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    order: 10;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 4px 0 16px;
  }
  .main-nav a {
    padding: 11px 16px;
    border: 2px solid var(--ink);
    border-radius: 14px;
    text-align: center;
    background: var(--card);
  }
  .header-inner { flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; min-height: 0; }
  .nav-toggle { display: block; }
}

@media (max-width: 640px) {
  .gear-grid { grid-template-columns: 1fr; }
  section { padding: 60px 0; }
  .btn { padding: 13px 20px; font-size: 1rem; }
  .contact-email { font-size: 0.9rem; }
  .theme-btn { width: 38px; height: 38px; }
  .lang-menu summary { padding: 6px 12px; }
}

/* ==========================================================================
   Playable card demo (hero)
   ========================================================================== */
.hero-demo { position: relative; max-width: 370px; margin-inline: auto 122px; width: 100%; }
.demo-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.demo-badge {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.78rem;
  background: var(--sun);
  color: #1d2e5c;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 13px;
  box-shadow: var(--sticker-shadow-sm);
  transform: rotate(-2deg);
}
.demo-progress {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.demo-stage { position: relative; height: 350px; perspective: 1400px; }
.demo-under {
  position: absolute;
  inset: 0;
  background: var(--card);
  border: var(--line);
  border-radius: 22px;
  box-shadow: var(--sticker-shadow);
}
.demo-under.u1 { transform: rotate(3deg) translateY(6px); opacity: 0.55; }
.demo-under.u2 { transform: rotate(-2.4deg) translateY(3px); opacity: 0.8; }
.demo-card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
  cursor: pointer;
  touch-action: pan-y;
  will-change: transform;
}
.demo-card.flipped { transform: rotateY(180deg); }
.demo-card.dragging { transition: none; }
.demo-card.fly { transition: transform 0.4s ease-in, opacity 0.4s ease-in; opacity: 0; }
.demo-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card);
  border: var(--line);
  border-radius: 22px;
  box-shadow: var(--sticker-shadow);
  overflow: hidden;
}
.demo-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}
.demo-kanji {
  font-family: "M PLUS Rounded 1c", var(--disp);
  font-weight: 900;
  font-size: clamp(2.6rem, 9vw, 3.4rem);
  line-height: 1.2;
  color: var(--ink);
}
.demo-reading { font-weight: 700; color: var(--ink-soft); font-size: 1.02rem; }
.demo-level-chip {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.78rem;
  background: var(--sky-pale);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 11px;
}
.demo-flip-hint {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--ink-soft);
  animation: hint-nudge 2.2s ease-in-out infinite;
}
@keyframes hint-nudge {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.demo-audio {
  border: 2.5px solid var(--ink);
  background: var(--sky-pale);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--sticker-shadow-sm);
}
.demo-audio:active { transform: translateY(2px); box-shadow: none; }
.demo-audio svg { width: 20px; height: 20px; }
.demo-back {
  transform: rotateY(180deg);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: start;
}
.demo-tags { display: flex; gap: 8px; margin-top: 2px; }
.tag-pos, .tag-lv {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 1px 12px;
  border-radius: 999px;
}
.tag-pos { background: var(--sky-pale); color: var(--ink); }
.tag-lv { background: var(--cheek-pale); color: var(--ink); }
.demo-divider { border: none; border-top: 2px solid var(--cloud); margin: 7px 0 1px; }
.btn-play {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 999px;
  background: var(--sky-deep);
  color: #fff;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn-play svg { width: 17px; height: 17px; }
.btn-play:active { transform: translateY(2px); }
.demo-audio-sm { width: 32px; height: 32px; border-width: 2px; box-shadow: none; margin-inline-start: auto; flex-shrink: 0; }
.demo-audio-sm svg { width: 15px; height: 15px; }
.demo-back .demo-word-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-family: "M PLUS Rounded 1c", var(--disp);
}
.demo-back .demo-word-row strong { font-size: 1.5rem; font-weight: 900; }
.demo-back .demo-word-row span { color: var(--ink-soft); font-weight: 700; font-size: 0.88rem; }
.demo-label {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 6px;
}
.demo-meaning { font-weight: 800; font-size: 1.15rem; line-height: 1.4; }
.demo-example { font-size: 0.92rem; font-weight: 500; line-height: 1.6; }
.demo-example .jp { font-family: "M PLUS Rounded 1c", var(--disp); font-weight: 700; display: block; }
.demo-example .tr { color: var(--ink-soft); display: block; }
/* swipe stamps — same as the app: bare ○ / ✕ at the card's top-right.
   One pair lives inside each face, so they ride along with the dragged card. */
.demo-stamp {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 78px;
  height: 78px;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
  line-height: 0;
  z-index: 3;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
}
.demo-stamp svg { display: block; width: 100%; height: 100%; }
.stamp-know { color: rgba(52, 199, 89, 0.9); }
.stamp-dont { color: rgba(255, 59, 48, 0.88); }
/* answer buttons — same as the app: solid green/red fill, radius 16, text only */
.demo-btns { display: flex; gap: 14px; margin-top: 30px; }
.demo-btns .btn {
  flex: 1;
  padding: 14px 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 16px;
  box-shadow: none;
}
.demo-btns .btn:hover { transform: none; box-shadow: none; }
.demo-btns .btn:active { transform: scale(0.96); box-shadow: none; }
.btn-dont { background: #ff3b30; }
.btn-dont:hover { background: #ff5147; }
.btn-know { background: #34c759; }
.btn-know:hover { background: #48d167; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-dont { background: #ff453a; }
  :root:not([data-theme="light"]) .btn-know { background: #30d158; }
}
:root[data-theme="dark"] .btn-dont { background: #ff453a; }
:root[data-theme="dark"] .btn-know { background: #30d158; }
/* first-card tutorial overlay (mirrors the app's CardGestureTutorialOverlay) */
.demo-tut {
  position: absolute;
  inset: -8px;
  z-index: 6;
  border-radius: 26px;
  background: rgba(106, 112, 124, 0.62);
  pointer-events: none;
}
.demo-tut.hidden { display: none; }
.tut-skip {
  pointer-events: auto;
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(48, 51, 60, 0.88);
  color: #fff;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}
.tut-skip svg { width: 17px; height: 17px; }
.tut-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #fff;
  line-height: 0;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
  animation: tut-tap 1.5s ease-in-out infinite;
}
@keyframes tut-tap {
  0%, 100% { transform: translate(-50%, -46%) scale(1); }
  40% { transform: translate(-50%, -46%) scale(0.84); }
}
.tut-arrow {
  position: absolute;
  top: 50%;
  width: 44px;
  transform: translateY(-50%);
  line-height: 0;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
}
.tut-arrow-l { left: 12px; color: #ff5147; }
.tut-arrow-r { right: 12px; color: #34c759; }
.tut-ghost {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56%;
  height: 64%;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  animation: tut-ghost 5.6s ease-in-out infinite;
}
.tut-ghost svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 58px;
  height: 58px;
}
.tut-o { color: #34c759; animation: tut-o 5.6s linear infinite; }
.tut-x { color: #ff453a; animation: tut-x 5.6s linear infinite; }
@keyframes tut-ghost {
  0% { transform: translate(-50%, -50%) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  40% { transform: translate(calc(-50% + 92px), calc(-50% - 12px)) rotate(9deg); opacity: 1; }
  47%, 50% { transform: translate(calc(-50% + 92px), calc(-50% - 12px)) rotate(9deg); opacity: 0; }
  51% { transform: translate(-50%, -50%) rotate(0deg); opacity: 0; }
  60% { opacity: 1; }
  90% { transform: translate(calc(-50% - 92px), calc(-50% - 12px)) rotate(-9deg); opacity: 1; }
  97%, 100% { transform: translate(calc(-50% - 92px), calc(-50% - 12px)) rotate(-9deg); opacity: 0; }
}
@keyframes tut-o { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
@keyframes tut-x { 0%, 50% { opacity: 0; } 51%, 100% { opacity: 1; } }
.tut-banner {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(44, 47, 56, 0.88);
  color: #fff;
  text-align: center;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
}
.demo-tut.phase-tap .tut-arrow,
.demo-tut.phase-tap .tut-ghost,
.demo-tut.phase-tap .tut-msg-swipe { display: none; }
.demo-tut.phase-swipe .tut-hand,
.demo-tut.phase-swipe .tut-msg-tap { display: none; }
@media (prefers-reduced-motion: reduce) {
  .tut-hand { animation: none; }
  .tut-ghost { animation: none; }
  .tut-o { animation: none; }
  .tut-x { display: none; }
}
/* mascot next to the deck */
.demo-mascot {
  position: absolute;
  inset-inline-end: -158px;
  bottom: -10px;
  width: 148px;
  z-index: 4;
  pointer-events: none;
}
@media (max-width: 1260px) and (min-width: 901px) {
  .hero-demo { margin-inline-end: 100px; }
  .demo-mascot { inset-inline-end: -116px; width: 110px; }
}
.demo-mascot img { width: 100%; transition: transform 0.2s; }
.demo-mascot.happy img { animation: mascot-hop 0.55s ease; }
@keyframes mascot-hop {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-18px) rotate(-4deg); }
}
.demo-mascot .speech {
  bottom: calc(100% + 4px);
  inset-inline-start: 50%;
  margin-inline-start: -102px;
  top: auto;
  right: auto;
  width: 205px;
  height: 62px;
}
.demo-mascot .speech span { font-size: 0.82rem; top: 8px; height: 33px; }
/* result panel */
.demo-result {
  position: absolute;
  inset: 0;
  background: var(--card);
  border: var(--line);
  border-radius: 22px;
  box-shadow: var(--sticker-shadow);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  z-index: 5;
}
.demo-result { gap: 3px; padding: 14px 18px; }
.demo-result.show { display: flex; animation: result-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes result-pop {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}
.demo-result img { width: 76px; }
.demo-result .r-title { font-family: var(--disp); font-weight: 800; font-size: 0.95rem; color: var(--ink-soft); }
.demo-result .r-level {
  font-family: var(--disp);
  font-weight: 900;
  font-size: 2.3rem;
  line-height: 1.1;
  color: var(--sky-deep);
  background: linear-gradient(transparent 60%, var(--sun) 60%, var(--sun) 92%, transparent 92%);
  padding: 0 10px;
}
.demo-result .r-knew { font-weight: 700; font-size: 0.9rem; color: var(--ink-soft); }
.demo-result .r-msg { font-weight: 700; font-size: 0.92rem; }
.demo-result .r-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.demo-result .r-actions .btn { padding: 8px 15px; font-size: 0.82rem; }

@media (max-width: 900px) {
  .hero-demo { max-width: 340px; margin-top: 10px; }
  .demo-stage { height: 330px; }
  .float-chip { display: none; }
  .demo-mascot { position: static; width: 88px; margin: 10px auto 0; pointer-events: none; }
  .demo-mascot .speech { display: none; }
}

/* ==========================================================================
   Scroll-driven mountain climb (quest)
   ========================================================================== */
.climb { position: relative; height: 210vh; }
.climb-sticky {
  position: sticky;
  top: 90px;
  height: min(72vh, 600px);
  max-width: 1020px;
  margin: 0 auto;
}
.climb-scene { position: relative; width: 100%; height: 100%; }
.climb-scene svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mtn-body { fill: var(--meadow-pale); stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.mtn-snow { fill: var(--card); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.mtn-trail { fill: none; stroke: none; }
.climb-station {
  position: absolute;
  transform: translate(-50%, -100%);
  text-align: center;
  background: var(--card);
  border: 3px solid var(--ink-soft);
  border-radius: 16px;
  padding: 7px 14px 8px;
  box-shadow: none;
  color: var(--ink-soft);
  width: max-content;
  max-width: 176px;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.climb-station strong {
  display: inline-block;
  font-family: var(--disp);
  font-weight: 900;
  font-size: 1.05rem;
  line-height: 1.4;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--cloud);
  margin-bottom: 3px;
}
.climb-station span {
  display: block;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 0.74rem;
  line-height: 1.35;
}
.climb-station span small { display: block; font-weight: 600; font-size: 0.68rem; color: var(--ink-soft); }
.climb-station.lit {
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--sticker-shadow-sm);
  transform: translate(-50%, -100%) scale(1.06);
}
.climb-station.s-n5.lit strong { background: var(--meadow-pale); }
.climb-station.s-n4.lit strong { background: var(--sky-pale); }
.climb-station.s-n3.lit strong { background: var(--stone-n3); }
.climb-station.s-n2.lit strong { background: var(--grape-pale); }
.climb-egg { position: absolute; transform: translate(-50%, -92%); width: 64px; transition: opacity 0.4s, transform 0.4s; }
.climb-egg.hatched { opacity: 0; transform: translate(-50%, -92%) scale(0.6); }
.climb-goal {
  position: absolute;
  transform: translate(-50%, -96%) scale(0.5);
  text-align: center;
  width: 150px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.climb-goal img { width: 108px; margin: 0 auto; }
.climb-goal.lit { opacity: 1; transform: translate(-50%, -96%) scale(1); }
.climber {
  position: absolute;
  width: 74px;
  transform: translate(-50%, -88%) scaleX(-1);
  z-index: 5;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.12));
  transition: left 0.08s linear, top 0.08s linear, opacity 0.35s;
  opacity: 0;
}
.climber.active { opacity: 1; }
.climber.arrived { opacity: 0; }
@media (max-width: 820px) {
  .climb { display: none; }
}
@media (min-width: 821px) {
  #quest .quest-list { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .climb { height: auto; }
  .climb-sticky { position: static; height: 560px; }
  .climb-station, .climb-goal { opacity: 1; }
  .climb-station .label { opacity: 1; }
}

/* JP text always uses the rounded JP face, on every locale */
[lang="ja"] { font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", sans-serif; }
