:root {
  --paper: #f3ecdf;
  --sheet: #f7f1e6;
  --card: #fbf7f0;
  --ink: #241f1c;
  --soft: #6b625a;
  --blush: #e7b2a4;
  --heart: #c85b5b;
  --note: #f3e2bc;
  --desk: #e4d3bc;
  --hand: "Marker Felt", "Chalkboard SE", "Kaiti SC", "KaiTi", cursive;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", "STSong", serif;
  color: var(--ink);
  background: var(--desk);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(255, 252, 245, 0.7), transparent 60%),
    var(--desk);
}
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.kicker a { border-bottom: 1px solid var(--ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
::selection { background: #ead3a2; }

#app {
  width: min(440px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
}
body.has-nav #app { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

.top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 0;
}
.mark {
  font-family: var(--hand);
  font-size: 22px;
  color: inherit;
  text-decoration: none;
}
.top .sound-toggle[data-act="mute"] { margin-left: auto; }
.ghost {
  border: 0;
  background: transparent;
  padding: 6px 2px;
  color: var(--soft);
  cursor: pointer;
}
.top-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quiz-replay { margin: 2px 0 12px; }
.sound-toggle, .step-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 48% 52% 46% 54% / 52% 46% 54% 48%;
  background: #fff;
  cursor: pointer;
  flex: none;
  display: grid;
  place-items: center;
}
.sound-toggle svg, .step-toggle svg {
  width: 28px;
  height: 28px;
  display: block;
}
.sound-toggle path, .step-toggle path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound-toggle .note-off { display: none; }
.sound-toggle.is-quiet .note-off { display: block; }
.sound-toggle .back-mark, .step-toggle .back-mark {
  fill: var(--ink);
  stroke: none;
}

.cover, .page { padding: 22px 18px 28px; }
.kicker {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--soft);
}
.logo {
  font-family: var(--hand);
  font-weight: 400;
  font-size: 52px;
  line-height: 0.92;
  margin: 0;
}
.sub { margin: 6px 0 14px; color: var(--soft); }
.lede { font-size: 18px; margin: 14px 0; }
.aside { color: var(--soft); margin: 14px 0 0; }

.panel {
  margin: 0;
  border: 2.5px solid var(--ink);
  border-radius: 3px 4px 3px 5px;
  background: var(--card);
  padding: 8px 8px 10px;
}
.inked {
  display: block;
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  object-position: 50% 40%;
  mix-blend-mode: multiply;
}
.scene-ink, .life-ink {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  background: transparent;
}
.listen-ink {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.listener.is-hot .listen-ink { transform: rotate(-6deg) scale(1.06); }
img.thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  mix-blend-mode: multiply;
  background: transparent;
}
.card-doodle img.thumb { width: 200px; height: 200px; }
.panel figcaption, .caption {
  font-family: var(--hand);
  font-size: 20px;
  line-height: 1.35;
  margin: 8px 4px 2px;
}

.row, .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn, .choice, .chip {
  border: 2px solid var(--ink);
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border-radius: 999px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
}
.btn.primary, .chip[aria-current="true"] {
  background: var(--ink);
  color: var(--card);
}
.btn[disabled], .choice[disabled] { cursor: default; }
.btn.tiny { min-height: 36px; padding: 4px 12px; font-size: 15px; }
.btn.block { width: 100%; margin: 4px 0 12px; }

.nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(440px, 100%);
  display: flex;
  background: var(--card);
  border-top: 2px solid var(--ink);
  z-index: 4;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 12px 2px 11px;
  font-size: 14px;
}
.nav a[aria-current="page"] { background: var(--ink); color: var(--card); }

.families { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.chip { padding: 7px 12px; border-radius: 999px; text-decoration: none; color: inherit; }

h1 { font-weight: 500; font-size: 32px; line-height: 1.15; margin: 0 0 8px; }
h2 { font-size: 15px; font-weight: 500; letter-spacing: 0.08em; color: var(--soft); margin: 18px 0 6px; }
.quiet { color: var(--soft); margin: 0 0 8px; }
#voice-line:empty { display: none; }
.legal { font-size: 12px; line-height: 1.45; margin-top: 12px; }
.count { color: var(--soft); font-size: 14px; }

.term-list { list-style: none; padding: 0; margin: 0; }
.term-list a {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(36, 31, 28, 0.12);
  color: inherit;
  text-decoration: none;
}
.it { font-family: var(--hand); font-size: 28px; line-height: 1; }
.zh { color: var(--soft); font-size: 14px; margin-top: 3px; }
.stamp { font-size: 12px; color: var(--soft); }

.word-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.word-head .syllables { flex: none; max-width: 100%; }
.say-pair { display: flex; gap: 6px; flex: 1 0 100%; align-items: center; }
.syllables { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; margin: 8px 0 4px; }
.syl {
  font-family: var(--hand);
  font-size: 30px;
  line-height: 1;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.syl.stress { font-size: 46px; border-bottom-color: var(--ink); }
.syl.is-saying {
  background: #ead3a2;
  border-radius: 8px;
}
.syl-gap { width: 12px; }
.mark-stamp {
  display: inline-block;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0 8px;
  margin-left: 8px;
  font-family: var(--hand);
  font-size: 22px;
  vertical-align: middle;
}

.slip {
  background: var(--note);
  border: 1.5px solid var(--ink);
  padding: 12px 14px;
  margin: 14px 0;
  transform: rotate(-0.35deg);
}
.slip p { margin: 0; }
.slip p + p { margin-top: 8px; }

.card-tools { display: flex; gap: 14px; align-items: center; margin: 12px 0; }
.mic-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.mic-actions .btn { min-height: 44px; }
.stamp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.dog-stamp {
  width: 72px;
  height: 72px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  object-fit: cover;
  object-position: center 42%;
  background: #fff;
  mix-blend-mode: multiply;
}
.listener { width: 120px; flex: none; position: relative; left: -16px; }
.listener.is-hot .ear { transform: rotate(-24deg); }
.listener .ear.a { transform-origin: 28px 30px; }
.listener .ear.b { transform-origin: 58px 26px; }
.listener.is-hot .ear.a { transform: rotate(-32deg); }
.listener.is-hot .ear.b { transform: rotate(26deg); }

.choices { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.choice {
  width: 100%;
  border-radius: 14px;
  text-align: left;
  padding: 10px 14px;
  font-family: var(--hand);
  font-size: 30px;
  line-height: 1;
}
.choice small {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--soft);
}
.choice.is-picked { background: var(--ink); color: var(--card); }
.choice.is-picked small { color: rgba(251, 247, 240, 0.78); }
.choice.is-dim { opacity: 0.42; }

.strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cell {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--card);
}
.num {
  position: absolute;
  left: 6px;
  top: 4px;
  z-index: 1;
  font-family: var(--hand);
  font-size: 14px;
}
.setup {
  display: flex;
  align-items: flex-end;
  padding: 22px 12px 12px;
}
.setup p { margin: 0; font-size: 20px; }
.setup .big {
  font-family: var(--hand);
  font-size: 34px;
  line-height: 0.95;
}
.cell.span { grid-column: 1 / -1; overflow: hidden; }
.num-right { left: auto; right: 6px; }
.gutter {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 2px solid var(--ink);
  z-index: 1;
  pointer-events: none;
}
.setup { min-height: 96px; }

.life-dir { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.life-card {
  display: block;
  border: 2px solid var(--ink);
  border-radius: 3px 4px 3px 5px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  background: var(--card);
}
.life-card .life-ink { width: 100%; height: auto; }
.life-card span { display: block; padding: 8px 10px 10px; font-size: 16px; }
.life-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.life-panel { margin: 0; }
.life-panel .tag {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--soft);
  margin: 0 0 4px;
}
.life-links { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 28px; }
.room-jump {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 4px 7px 5px 3px;
  background: var(--card);
  padding: 6px 8px 6px 12px;
  color: inherit;
}
.play-key {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 48% 52% 46% 54% / 52% 46% 54% 48%;
  background: #fff;
}
.play-key svg { width: 22px; height: 22px; display: block; }
.play-key .back-mark { fill: var(--ink); stroke: none; }

.progress { color: var(--soft); font-size: 14px; margin-top: 0; }

.doodle, .comic { width: 100%; height: auto; display: block; }
.doodle *, .comic * {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-box: view-box;
}
.doodle .fill, .comic .fill { fill: var(--ink); stroke: none; }
.doodle .paper, .comic .paper { fill: var(--card); stroke: var(--ink); }
.doodle .blush, .comic .blush { fill: var(--blush); stroke: none; }
.doodle .heart, .comic .heart { fill: var(--heart); stroke: var(--ink); stroke-width: 1.4; }
.comic .wkey { fill: var(--card); stroke: var(--ink); stroke-width: 1.4; }
.comic .bkey { fill: var(--ink); stroke: none; }
.comic .blush { display: none; }
.scene-idle .blush, .scene-dolce .blush, .scene-espressivo .blush,
.scene-pp .blush, .scene-legato .blush, .scene-andante .blush { display: block; }
.term-list .it, .term-list .zh { display: block; }
.card-doodle { width: 200px; margin: 2px auto 0; }
.card-doodle .thumb,
.card-doodle img.thumb { width: 200px; height: 200px; }
.card-sound { display: flex; justify-content: center; }
.card-sound .quiz-replay { margin: 0 0 8px; }
.life text { font-size: 15px; }
.life-panel figcaption { font-size: 16px; }
.doodle text, .comic text {
  fill: var(--ink);
  stroke: none;
  font-family: var(--hand);
}
.thumb { width: 64px; height: 64px; }
.thumb * { stroke-width: 1.5; }
.life { background: transparent; }

.thumb .leg { transform-origin: 32px 45px; animation: stride var(--step) ease-in-out infinite; }
.thumb .leg.b { animation-delay: calc(var(--step) / -2); }
.thumb.is-slow .figure { transform-origin: 32px 40px; animation: rock 2.6s ease-in-out infinite; }
.thumb.is-slow .leg { animation: none; }
@keyframes stride {
  0%, 100% { transform: rotate(var(--stride)); }
  50% { transform: rotate(calc(var(--stride) * -1)); }
}
@keyframes rock {
  50% { transform: rotate(-4deg); }
}

.stage { position: relative; }
.eyes-shut, .eyes-wide, .mouth-frown, .mouth-o, .mouth-flat,
.dog-shut, .spikes, .lid-in, .fx { display: none; }
.tail { transform-origin: 362px 168px; animation: wag 1.3s ease-in-out infinite; }
.ear-l { transform-origin: 294px 150px; }
@keyframes wag { 50% { transform: rotate(16deg); } }

.scene-dolce .eyes-open, .scene-largo .eyes-open, .scene-espressivo .eyes-open,
.scene-pp .eyes-open, .scene-legato .eyes-open { display: none; }
.scene-dolce .eyes-shut, .scene-largo .eyes-shut, .scene-espressivo .eyes-shut,
.scene-pp .eyes-shut, .scene-legato .eyes-shut { display: block; }
.scene-dolce .dog-eyes, .scene-largo .dog-eyes, .scene-espressivo .dog-eyes { display: none; }
.scene-dolce .dog-shut, .scene-largo .dog-shut, .scene-espressivo .dog-shut { display: block; }

.scene-furioso .eyes-open, .scene-ff .eyes-open, .scene-sfz .eyes-open,
.scene-presto .eyes-open { display: none; }
.scene-furioso .eyes-wide, .scene-ff .eyes-wide, .scene-sfz .eyes-wide,
.scene-presto .eyes-wide { display: block; }
.scene-furioso .mouth-smile, .scene-sfz .mouth-smile, .scene-largo .mouth-smile,
.scene-maestoso .mouth-smile, .scene-presto .mouth-smile { display: none; }
.scene-furioso .mouth-frown { display: block; }
.scene-sfz .mouth-o, .scene-presto .mouth-o { display: block; }
.scene-largo .mouth-flat, .scene-maestoso .mouth-flat { display: block; }
.scene-furioso .spikes { display: block; }

.scene-dolce .fx-hearts, .scene-dolce .fx-flowers, .scene-dolce .fx-notes,
.scene-espressivo .fx-hearts, .scene-espressivo .fx-notes { display: block; }
.scene-largo .fx-zzz { display: block; }
.scene-maestoso .fx-q, .scene-sfz .fx-q, .scene-confused .fx-q { display: block; }
.scene-furioso .fx-speed, .scene-presto .fx-speed, .scene-ff .fx-speed { display: block; }
.scene-legato .fx-slur, .scene-espressivo .fx-slur { display: block; }
.scene-staccato .fx-notes, .scene-pizzicato .fx-notes, .scene-andante .fx-notes,
.scene-presto .fx-notes { display: block; }

.fx .heart { transform-origin: center; animation: float 2.4s ease-in infinite; }
.h2 { animation-delay: 0.4s; }
.fx-notes text { animation: float 1.8s ease-in infinite; }
.n2 { animation-delay: 0.35s; }
.zzz { animation: float 2.8s ease-in infinite; font-size: 20px; }
.qmark { font-size: 28px; animation: pop 0.8s ease-in-out infinite; }
@keyframes float {
  0% { transform: translateY(8px); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-22px); opacity: 0; }
}
@keyframes pop {
  50% { transform: translateY(-3px) scale(1.08); }
}

.scene-furioso .lid {
  transform-origin: 172px 150px;
  animation: lidOff 0.62s cubic-bezier(.2, .7, .2, 1) forwards;
}
@keyframes lidOff { to { transform: translate(92px, -46px) rotate(-22deg); } }
.scene-furioso .pianist, .scene-ff .pianist { animation: smash 0.12s linear 5; }
@keyframes smash { 50% { transform: translate(3px, 1px) rotate(1.5deg); } }
.scene-furioso .dog {
  transform-origin: 332px 176px;
  animation: hopFlip 0.7s 0.08s ease-in forwards;
}
@keyframes hopFlip {
  35% { transform: translateY(-22px) rotate(-10deg); }
  100% { transform: translateY(-10px) rotate(180deg); }
}
.scene-furioso .tail, .scene-largo .tail { animation: none; }
.scene-presto .cowlick { transform-origin: 92px 76px; animation: wind 0.18s linear infinite; }
@keyframes wind { 50% { transform: rotate(12deg); } }
.scene-presto .ear-l, .scene-ff .ear-l { transform: rotate(24deg); }
.scene-pp .ear-l, .scene-listen .ear-l { transform: rotate(-18deg); }
.scene-pp .dog { transform: translate(-10px, 4px); }
.scene-andante .pianist { animation: bob 0.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(2px); } }
.scene-espressivo .pianist { transform-origin: 78px 160px; animation: sway 2.4s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(-2.5deg); } }
.scene-maestoso .pianist { transform: translateY(-8px); }
.scene-staccato .fx-notes .note { animation-duration: 0.42s; }
.scene-pizzicato .hand { transform: translateY(-14px); }
.slur { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw 1.2s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.scene-sfz .dog { animation: hop 0.45s ease-out; }
@keyframes hop { 40% { transform: translateY(-16px); } }

.recap li { margin: 6px 0; }

.people { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.person-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 4px 10px;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 4px 7px 5px 3px;
  background: var(--card);
  padding: 8px 12px 8px 6px;
  color: inherit;
}
.person-card .it, .person-card .zh, .person-card .quiet { display: block; }
.person-card .it { font-size: 22px; }
.person-card .quiet { margin: 2px 0 0; }
.portrait { display: block; width: 108px; height: 148px; }
.portrait.big { width: min(280px, 78%); height: 340px; margin: 0 auto 4px; }
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  mix-blend-mode: multiply;
  background: transparent;
}
.facts { margin: 0 0 8px; padding-left: 1.2em; }
.facts li { margin: 8px 0; }

.splash {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 18px calc(24px + env(safe-area-inset-bottom));
}
.splash .logo {
  text-align: center;
  font-size: 46px;
  margin: 0;
}
.tagline {
  margin: 28px 12px 0;
  text-align: center;
  font-size: 17px;
  line-height: 1.45;
}
.tagline.en {
  margin-top: 8px;
  font-size: 15px;
  color: var(--soft);
}
.play {
  width: 100%;
  margin: 52px 0 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.play-reel { position: relative; width: 132%; }
.play-still {
  width: 100%;
  height: auto;
  display: block;
  mix-blend-mode: multiply;
}
.enter {
  min-width: 148px;
  margin-top: auto;
  margin-bottom: 12vh;
  font-family: var(--hand);
  font-size: 22px;
}
.aside a { border-bottom: 1px solid var(--ink); }

@media (max-width: 360px) {
  .logo { font-size: 42px; }
  .choice { font-size: 26px; }
  .life-grid { grid-template-columns: 1fr; }
}

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