@font-face {
  font-family: Cormorant;
  src: url('./fonts/CormorantGaramond.woff2') format('woff2');
  font-display: swap;
  font-weight: 100 900;
}
@font-face {
  font-family: Cormorant;
  src: url('./fonts/CormorantGaramond-Italic.woff2') format('woff2');
  font-display: swap;
  font-style: italic;
  font-weight: 100 900;
}
@font-face {
  font-family: Caveat;
  src: url('./fonts/Caveat.woff2') format('woff2');
  font-display: swap;
  font-weight: 100 900;
}

:root {
  color-scheme: light;
  --paper: #f6eedc;
  --canvas: #e9dfc8;
  --ink: #403f31;
  --muted: #817a66;
  --green: #4a5944;
  --gold: #b38446;
  --orange: #e9a23b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}

.page-shell {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 16px;
}

.masthead {
  text-align: center;
  padding: 24px 0 20px;
}

.edition {
  font-size: 9px;
  letter-spacing: 2.5px;
  color: #8d7a58;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.fine-rule {
  height: 1px;
  width: 28px;
  background: #b7a5817a;
}

.masthead h1 {
  font-family: 'Songti SC', 'STSong', 'Noto Serif CJK SC', serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 4px;
  margin: 12px 0 6px;
}

.masthead > p {
  font-family: Cormorant, serif;
  font-style: italic;
  font-size: 19px;
  color: #84745b;
  margin: 0;
}

.chapter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #8c8069;
}

.word-card {
  background: var(--paper);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: 0 8px 25px #59472c0c, 0 2px 4px #59472c09;
  border: 1px solid #fff8e744;
}

.stage {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  padding: 0;
  border: 0;
  border-radius: 17px 17px 0 0;
  overflow: hidden;
  background: #eee2c8;
  isolation: isolate;
  text-align: left;
  touch-action: manipulation;
}

.stage-mount {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
}

.plate-number {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 5;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 1.6px;
  color: #877756;
}

.replay-hint {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #7b7059;
  font-size: 8px;
  letter-spacing: 1px;
  z-index: 5;
  padding: 4px 7px;
  border-radius: 14px;
  background: #f6eedc9c;
  backdrop-filter: blur(8px);
}

.replay-hint svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-copy {
  padding: 18px 22px 20px;
  position: relative;
  background-color: var(--paper);
}

.word-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.word-line h2 {
  font-family: Cormorant, Georgia, serif;
  font-size: 38px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.5px;
  margin: 0;
}

.word-index {
  font-family: Cormorant, serif;
  font-size: 15px;
  color: #bcb097;
}

.phonetics {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  height: 34px;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.part-of-speech {
  font-family: Cormorant, serif;
  font-style: italic;
  font-size: 17px;
  color: #8d7b5c;
}

.audio-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid #b9aa884b;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  background: #e9dfc443;
  margin-left: 2px;
  transition: background 0.15s ease;
}

.audio-button svg {
  width: 14px;
  height: 14px;
  stroke: #7b795c;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audio-button:hover,
.sentence-audio:hover {
  background: #e5d7b8;
}

.is-playing {
  box-shadow: 0 0 0 3px #b8995d30 !important;
  background: #e5d7b8 !important;
}

.meaning {
  font-size: 15px;
  margin: 6px 0 16px;
  letter-spacing: 0.8px;
  color: #3b3a2e;
}

.example {
  border-top: 1px solid #aa997732;
  padding-top: 14px;
}

.english {
  font-family: Cormorant, Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.28;
  margin: 0 0 9px;
  color: #4e4c3e;
}

.english mark {
  position: relative;
  isolation: isolate;
  background: none;
  color: inherit;
  white-space: nowrap;
}

.english mark:after {
  content: '';
  position: absolute;
  z-index: -1;
  left: -2px;
  right: -3px;
  bottom: 1px;
  height: 5px;
  background: var(--orange);
  opacity: 0.55;
  transform: rotate(-2deg);
  border-radius: 40% 30% 35% 25%;
  clip-path: polygon(0 25%, 33% 5%, 71% 19%, 100% 0, 98% 78%, 59% 97%, 25% 83%, 1% 100%);
}

.chinese {
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: 0.3px;
  color: #8b826f;
  margin: 0;
}

.example-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 20px;
  margin-top: 8px;
}

.source-tag {
  font-size: 9px;
  letter-spacing: 0.6px;
  color: #9c8c6c;
}

.sentence-audio {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #7a795d;
  border: 0;
  background: transparent;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.sentence-audio svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

footer {
  text-align: center;
  padding: 10px 0 40px;
  color: #8c7d60;
}

footer p {
  font-family: 'Songti SC', 'STSong', serif;
  font-size: 14px;
  letter-spacing: 3px;
  margin: 12px 0;
}

footer > span:last-child {
  font-size: 8px;
  letter-spacing: 1.8px;
}

.footer-ornament {
  font-size: 24px;
  color: #a79062;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* ==========================================================================
   CSS 3D Pop-up Book Stage (.pc-*)
   ========================================================================== */
.pc-stage {
  position: absolute;
  inset: 0;
  perspective: 900px;
  background: radial-gradient(ellipse at 18% 12%, #77503744, transparent 70%),
              repeating-linear-gradient(2deg, #140c0818 0 1px, transparent 1px 4px),
              repeating-linear-gradient(0deg, transparent 0 65px, #160d09aa 66px 68px, #91644630 69px 70px),
              linear-gradient(115deg, #493023, #261913);
  overflow: hidden;
}

.pc-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 400px;
  height: 300px;
  transform-origin: center;
  perspective-origin: 50% 42%;
  transform-style: preserve-3d;
}

.pc-world {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 68%;
}

.pc-book {
  position: absolute;
  left: 35px;
  top: 91px;
  width: 330px;
  height: 240px;
  transform: translateY(0) rotateX(90deg);
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
}

.pc-cover {
  position: absolute;
  inset: -7px;
  background: #293c2d;
  border: 2px solid #526047;
  border-radius: 5px;
  transform: translateZ(-7px);
  box-shadow: 7px 12px 19px #120b0999, inset 0 0 0 2px #b69b5938;
}

.pc-edges {
  position: absolute;
  inset: 0;
  transform: translateZ(-3px);
  border-radius: 3px;
  background: #c8b897;
  box-shadow: 0 1px #eee3ca, 0 3px #b1a080, 0 4px #e2d3b5, 0 5px #c0af8d;
}

.pc-page {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: repeating-linear-gradient(17deg, #ad92600a 0 1px, transparent 1px 5px),
              linear-gradient(100deg, #ecdfc2, #fff5df 55%, #e9dbbd);
  border: 1px solid #e1d1ae;
  border-radius: 2px;
}

.pc-page-left {
  left: 0;
  transform: rotateY(-1deg);
  transform-origin: right center;
}

.pc-page-right {
  right: 0;
  transform: rotateY(1deg);
  transform-origin: left center;
}

.pc-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 46%;
  width: 8%;
  background: linear-gradient(90deg, transparent, #71533326 43%, #59412d45 50%, #fff6dc70 60%, transparent);
  transform: translateZ(1px);
}

.pc-anchor,
.pc-hinge,
.pc-body {
  position: absolute;
  transform-style: preserve-3d;
  transform-origin: 50% 100%;
}

.pc-hinge,
.pc-body {
  inset: 0;
}

.pc-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  backface-visibility: visible;
}

.pc-paper-edge {
  transform: translate3d(1.3px, 0.7px, -1.2px);
  filter: brightness(0.64) sepia(0.25);
}

.pc-arch {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 2px 2px;
  background: radial-gradient(ellipse at 30% 20%, #fff5dd, #e6d4b0);
  border: 5px double #cdb78d;
  box-shadow: inset 0 0 0 6px #f8ecd2, inset 0 0 25px #a58a5733;
}

.pc-shadow {
  position: absolute;
  background: #44301c;
  filter: blur(4px);
  border-radius: 50%;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.pc-ink {
  position: absolute;
  font-family: Caveat, cursive;
  font-weight: 700;
  line-height: 0.86;
  white-space: pre;
  text-align: center;
  color: #30200f;
  text-shadow: 0 0.2px #30200f;
  transform-origin: center;
}

.pc-light,
.pc-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pc-light {
  background: radial-gradient(ellipse at 20% 10%, #ffdf9e22, transparent 68%);
}

.pc-vignette {
  background: radial-gradient(ellipse at 50% 48%, transparent 48%, #160b063d 100%);
}

.pc-spark,
.pc-glint {
  position: absolute;
  left: 38%;
  top: 3%;
  width: 4px;
  height: 4px;
  background: #fff0ae;
  border-radius: 50%;
  box-shadow: 0 0 6px #eec576;
  opacity: 0;
  pointer-events: none;
}

.pc-glint {
  width: 10px;
  height: 10px;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

.pc-print {
  position: absolute;
  width: 3px;
  height: 5px;
  border-radius: 50%;
  background: #71583d;
  opacity: 0;
  pointer-events: none;
}

.pc-bracket {
  position: absolute;
  top: 38%;
  width: 8px;
  height: 32%;
  border: 1.7px solid #7c542a;
  opacity: 0;
  pointer-events: none;
}

.pc-bracket-left {
  left: 18%;
  border-right: 0;
}

.pc-bracket-right {
  right: 18%;
  border-left: 0;
}

.pc-mote {
  position: absolute;
  left: 55%;
  top: 8%;
  width: 5px;
  height: 5px;
  background: #a58c61;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.pc-hole-window {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 3px solid #d3bd93;
  box-shadow: 2px 1px #a48b65;
  background: #2b1a11;
  pointer-events: none;
}

.pc-hole-scroll {
  position: absolute;
  inset: 0 0 auto;
  height: 300%;
  background-repeat: repeat-y;
}

.pc-fall .pc-book,
.pc-fall .pc-shadow { display: none; }

.pc-full-backdrop {
  position: absolute;
  inset: -2%;
  width: 104%;
  height: 104%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
}

.pc-fall .pc-canvas { z-index: 1; }

/* Round 2 Additions: Sneak zzz, Hanging Frame Hook, Flashlight Lightcone, Lantern Wash */
.pc-zzz {
  position: absolute;
  left: 85%;
  top: 14%;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'Caveat', cursive, serif;
  font-weight: 700;
  color: #3b2410;
  text-shadow: 0 1px 2px #fff8eb, 0 0 4px #ffffff, 0 0 6px #ffffff;
  pointer-events: none;
  transform: translateZ(12px);
  user-select: none;
}

.pc-zzz .pc-z {
  display: inline-block;
  line-height: 1;
}

.pc-zzz .pc-z1 {
  font-size: 16px;
  opacity: 0.9;
}

.pc-zzz .pc-z2 {
  font-size: 22px;
  opacity: 0.95;
  transform: translateY(-6px);
}

.pc-hook {
  position: absolute;
  top: -16px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6a4a28;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  pointer-events: none;
}

.pc-cord {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 32px;
  height: 14px;
  border-top: 1.5px solid #856138;
  border-left: 1.5px solid #856138;
  border-right: 1.5px solid #856138;
  border-radius: 4px 4px 0 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.pc-lightcone {
  position: absolute;
  left: 45px;
  top: 125px;
  width: 215px;
  height: 115px;
  background: radial-gradient(ellipse at 84% 32%, rgba(255, 248, 195, 0.58) 0%, rgba(255, 225, 135, 0.26) 38%, rgba(255, 205, 95, 0.06) 65%, transparent 75%);
  clip-path: polygon(84% 32%, 0% 68%, 20% 100%, 94% 54%);
  filter: blur(5px);
  pointer-events: none;
  transform: rotateX(55deg) translateZ(1px);
  transform-origin: 84% 32%;
}

.pc-lantern-wash {
  position: absolute;
  left: 55px;
  top: 25px;
  width: 290px;
  height: 195px;
  border-radius: 50%;
  background: radial-gradient(circle at 62% 64%, rgba(255, 210, 100, 0.62) 0%, rgba(255, 175, 50, 0.30) 38%, rgba(255, 135, 20, 0.08) 60%, transparent 75%);
  pointer-events: none;
  transform: translateZ(-45px);
}

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

/* Round 3: physical states and paper utilities (no translucent state sprites). */
.pc-arch::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: .10; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.64' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23927954' filter='url(%23n)' d='M0 0h160v160H0z'/%3E%3C/svg%3E");
}
.pc-arch { background-image: linear-gradient(135deg, #fff8e6cc, #aa936933); }
.pc-light { background: radial-gradient(ellipse at 12% 5%, #fff0c959, transparent 72%); }
.pc-arch-tint { position:absolute; inset:0; mix-blend-mode:multiply; mask-size:contain; mask-position:center; mask-repeat:no-repeat; -webkit-mask-size:contain; -webkit-mask-position:center; }
.pc-paper-frame { position:absolute; inset:0; border:7px solid #fff8e8; border-radius:10px; background:#e8dbc3; box-shadow:inset 0 0 0 2px #b9a17a, 2px 3px 2px #62472044; }
.pc-paper-arrow { position:absolute; inset:0; background:#ad8150; border:4px solid #fff9ea; clip-path:polygon(0 30%,62% 30%,62% 0,100% 50%,62% 100%,62% 70%,0 70%); filter:drop-shadow(2px 2px 1px #72522b66); }
.pc-path { position:absolute; height:5px; background:radial-gradient(circle,#71583d88 2px,transparent 2.5px) 0 0/9px 5px repeat-x; pointer-events:none; }
.pc-beam { position:absolute; width:130px; height:80px; transform-origin:0 50%; margin-top:-40px; background:linear-gradient(90deg,#fff3bb99,transparent); clip-path:polygon(0 48%,100% 0,100% 100%,0 52%); pointer-events:none; }
.pc-glow { position:absolute; width:65px; height:65px; border-radius:50%; transform:translate(-50%,-50%); background:radial-gradient(circle,#ffeeba99,#f3be5655 35%,transparent 70%); box-shadow:0 0 16px #ffde8799; pointer-events:none; }
.pc-halo { width:90px; height:90px; border:2px solid #b88e4566; background:radial-gradient(circle,transparent 45%,#f0d08a55 60%,transparent 70%); }
.pc-flame-shade { position:absolute; border-radius:50%; pointer-events:none; }
.pc-vessel-mask { position:absolute; left:12%; right:12%; top:18%; bottom:9%; border-radius:18% 18% 22% 22%; background:linear-gradient(110deg,#e7ddc9,#a5a99f); border:2px solid #979588; }
.pc-glass > .pc-paper-edge { display:none; }
.pc-comparison { position:absolute; width:140px; text-align:center; font:15px Caveat,cursive; color:#735632; }
.pc-equal { position:absolute; left:185px; top:110px; font:40px Caveat,cursive; color:#835c2e; text-shadow:2px 2px #fff7df; transform-origin:50% 100%; }
.pc-letter,.pc-letter-trace { position:absolute; font-family:Caveat,cursive; font-weight:bold; line-height:1; }
.pc-letter { color:#634b32; paint-order:stroke fill; -webkit-text-stroke:4px #fff9e9; filter:drop-shadow(1px 2px 1px #63432277); }
.pc-letter-trace { color:#74563433; transform:rotateX(65deg); pointer-events:none; }
.pc-dust-cloud { position:absolute; inset:5% -10% 55%; background:radial-gradient(circle at 10% 70%,#9a8455 1px,transparent 3px),radial-gradient(circle at 35% 25%,#9a8455 2px,transparent 4px),radial-gradient(circle at 70% 50%,#9a8455 2px,transparent 4px),radial-gradient(circle at 90% 20%,#9a8455 1px,transparent 3px); }
.pc-motion-arc { position:absolute; inset:-15px; border-top:2px dashed #9b754c88; border-radius:50%; pointer-events:none; }

/* Ink on the illustration paper plane, in the same 3D book world; no HUD. */
.pc-cue{position:absolute;left:0;top:0;width:400px;height:260px;transform:translateZ(26px);pointer-events:none;backface-visibility:hidden}
.pc-cue svg,.m2 .pc-cue svg{display:block;width:100%;height:100%;overflow:visible}
.pc-cue-floor{transform-origin:50% 211px;transform:rotateX(90deg) translateZ(1px)}
