/* Learn Chinese: the landing page's frame (dark, grain, dim purple fire, VCR title, chunky buttons)
   around one calm HoI4-style panel per screen (gradient title bar, dark insets, round medals).
   ../assets/site.css is loaded first and gives the fonts, grain, .bg-fire and .btn. Phone first. */

@font-face {
  font-family: "Fusion Pixel";
  src: url("fonts/fusion-pixel-zh.woff2") format("woff2");
  font-display: swap;
}

:root {
  --win: #1a191c;
  --inset: #111013;
  --line: #3a3940;
  --line2: #222126;
  --text: #d4d4d4;
  --mute: #8d8f91;
  --dim: #5d5c63;
  --p1: #9b3fc0;
  --p2: #9b5fd0;
  --p3: #c79bf0;
  --glow: rgba(160, 70, 255, 0.9);
  --hz: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --px: "Fusion Pixel", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --vcr: "VCR OSD Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
a { color: var(--p3); }
a:hover { color: #e6ccff; }
p { line-height: 1.55; }
code { font-family: var(--vcr); color: var(--p3); }
.hz { font-family: var(--hz); }
.zh { font-family: var(--px); }
.py { font-family: var(--px); color: var(--p3); }
.muted { color: var(--mute); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.lead { margin: 0 0 16px; font-size: 18px; line-height: 1.6; }
kbd {
  display: inline-block;
  margin-left: 8px;
  padding: 0 4px;
  border: 1px solid #55545c;
  border-bottom-width: 2px;
  background: #151418;
  color: #b9b8bf;
  font-family: var(--vcr);
  font-size: 12px;
  line-height: 1.4;
  vertical-align: 2px;
}
:focus-visible { outline: 2px solid var(--p3); outline-offset: 2px; }

/* dimmer fire than the landing page, so it doesn't fight the text */
.bg-fire { opacity: 0.22; }

/* ---------- header: back link, glowing title ---------- */
.top { position: relative; width: 100%; max-width: 760px; margin: 0 auto; padding: 14px 16px 0; text-align: center; }
.back { position: absolute; top: 14px; left: 16px; font-family: var(--vcr); font-size: 16px; color: var(--mute); text-decoration: none; white-space: nowrap; }
.back:hover { color: #fff; text-shadow: 0 0 10px var(--glow); }
h1.title { margin: 30px 0 6px; font-size: clamp(32px, 6vw, 52px); letter-spacing: 3px; }
h1.title a { color: inherit; text-decoration: none; }
.subtitle { margin: 0 0 6px; color: var(--mute); font-size: 15px; }
.subtitle .zh { color: var(--p3); font-size: 24px; vertical-align: -3px; }
.nov { display: inline-block; margin: 6px 0 0; padding: 6px 12px; background: var(--inset); border: 1px solid var(--line); color: #e7b9ff; font-size: 14px; }
/* no Chinese voice: no ▶ buttons for texts without a recorded clip */
.novoice .say.tts { display: none !important; }

/* ---------- page column ---------- */
main#app { display: block; flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 18px 16px 40px; text-align: left; }
main#app:focus { outline: none; }

/* ---------- HoI4 windows ---------- */
.win {
  margin: 0 0 18px;
  background: var(--win);
  border: 1px solid #000;
  box-shadow: 0 0 0 1px var(--line), 0 0 40px rgba(130, 50, 200, 0.16);
}
.win.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.wh { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: linear-gradient(#45484b, #2b2c30); border-bottom: 1px solid #000; }
.wh h2 { margin: 0; font-family: var(--vcr); font-size: 21px; font-weight: normal; color: #fff; letter-spacing: 1px; }
.wb { padding: 20px 22px; }
.wb > :first-child { margin-top: 0; }
.wb > :last-child { margin-bottom: 0; }

/* buttons: site.css .btn, plus small / primary / danger */
button.btn { cursor: pointer; text-align: center; }
button.btn:hover:not(:disabled) { background: linear-gradient(#55545c, #3c3b42); box-shadow: inset 0 -2px 0 var(--p1); }
button.btn:disabled { opacity: 0.35; cursor: default; }
.btn { display: inline-block; font-size: 20px; padding: 12px 20px; }
.btn.sm { padding: 8px 14px; font-size: 16px; line-height: 1.2; }
.btn.pri { background: linear-gradient(#8a3cb8, #5c2482); box-shadow: inset 0 1px 0 #b46fe2, 0 0 12px rgba(160, 70, 255, 0.3); }
.btn.pri:hover, button.btn.pri:hover:not(:disabled) { background: linear-gradient(#a24fd2, #6d2e99); box-shadow: inset 0 1px 0 #c98ef3, 0 0 18px rgba(160, 70, 255, 0.6); }
.btn.danger:hover { box-shadow: inset 0 -2px 0 #c0404c !important; }
.btn kbd { vertical-align: 1px; }
.link { padding: 10px 6px; background: none; border: 0; color: var(--mute); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }
.link:hover { color: var(--p3); }
.hint { font-size: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 0; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* round medals */
.medal {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(#4a4950, #1e1d22);
  border: 1px solid #000;
  box-shadow: inset 0 0 0 2px #5e5d64;
  color: #fff;
  font-family: var(--vcr);
  font-size: 18px;
  line-height: 1;
}

.prog { height: 7px; margin-top: 8px; background: #1d1c21; border: 1px solid #000; }
.prog div { height: 100%; background: linear-gradient(90deg, #6e2a8c, var(--p3)); box-shadow: 0 0 8px var(--glow); transition: width 0.25s; }

/* ---------- home: the lesson list ---------- */
.path { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.step { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--inset); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
a.step:hover { background: #1c1a21; border-color: var(--p2); color: var(--text); }
.step b { display: block; color: #fff; font-family: var(--vcr); font-size: 19px; font-weight: normal; }
.step .sub { display: block; margin-top: 2px; color: #a8a1b4; font-size: 24px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done .medal { box-shadow: inset 0 0 0 2px var(--p2), 0 0 10px rgba(160, 70, 255, 0.45); color: var(--p3); }
.step.next { border-color: var(--p2); box-shadow: 0 0 0 1px var(--p2), 0 0 22px rgba(160, 70, 255, 0.35); }
.step.next .medal { background: radial-gradient(#8a3cb8, #3e2159); box-shadow: inset 0 0 0 2px #c98ef3, 0 0 14px var(--glow); }
.step.todo { opacity: 0.45; }
a.step.todo:hover, a.step.todo:focus-visible { opacity: 0.9; }
.go { flex: none; color: #fff; font-family: var(--vcr); font-size: 17px; text-shadow: 0 0 10px var(--glow); }

/* ---------- study cards: teach and quiz ---------- */
.study { max-width: 560px; margin: 0 auto; }
.studyhead { margin: 0 0 12px; color: var(--mute); font-size: 15px; }
.card .wb { padding: 22px 20px; text-align: center; }
.info { margin: 0 0 14px; color: #fff; font-size: 19px; line-height: 1.5; }
.who { margin: 0 0 4px; color: var(--mute); font-family: var(--vcr); font-size: 17px; letter-spacing: 1px; }
.bigrow { display: flex; align-items: center; justify-content: center; gap: 14px; }
.q { color: #fff; font-family: var(--hz); line-height: 1.2; text-shadow: 0 0 28px rgba(160, 70, 255, 0.5); overflow-wrap: anywhere; }
.q1 { font-size: 128px; }
.q3 { font-size: 84px; }
.q6 { font-size: 52px; line-height: 1.3; }
.qn { font-size: clamp(30px, 7.5vw, 42px); line-height: 1.4; }
.q.syl { font-size: 72px; line-height: 1.3; }
.q.en { margin: 6px 0 4px; font-family: "Pixeloid Sans", sans-serif; font-size: 28px; line-height: 1.35; text-shadow: none; }
.py.big { margin: 6px 0 0; color: #fff; font-size: 24px; text-shadow: 0 0 10px rgba(160, 70, 255, 0.6); }
.en { margin: 8px 0 0; color: #fff; font-size: 21px; line-height: 1.4; }
.note { max-width: 440px; margin: 16px auto 0; padding: 10px 14px; background: var(--inset); border-left: 2px solid var(--p2); color: #bdbcc4; font-size: 15px; line-height: 1.55; text-align: left; }
.note .hz { color: #fff; font-size: 17px; white-space: nowrap; }
.saywrap { margin: 14px 0 0; }
.learnnav { margin-top: 22px; }
.learnnav .btn { min-width: 64px; }

/* picture characters: the old drawing → the character */
.pic { flex: none; width: 92px; height: 92px; fill: none; stroke: var(--p3); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(160, 70, 255, 0.6)); }
.pic .fill { fill: var(--p3); stroke: none; }
.arrow { color: var(--dim); font-size: 28px; }

/* rudeness: three pips */
.rude { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 0; color: #e3b3ff; font-size: 15px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 16px; height: 10px; background: #2a2730; border: 1px solid #000; }
.r1 .pips i:nth-child(-n+1), .r2 .pips i:nth-child(-n+2), .r3 .pips i:nth-child(-n+3) { background: linear-gradient(#d06bff, #8a2fc0); box-shadow: 0 0 6px var(--glow); }
.r3 { color: #ffb3c8; }
.r3 .pips i { background: #2a2730; }
.r3 .pips i:nth-child(-n+3) { background: linear-gradient(#ff6b9a, #b82f62); box-shadow: 0 0 6px rgba(255, 70, 130, 0.8); }
.legend { display: inline-grid; gap: 4px; margin: 6px 0 0; }
.legend .rude { justify-content: flex-start; margin: 0; }

/* listen buttons */
.say { min-height: 44px; cursor: pointer; }
.playbig {
  display: block;
  width: 92px;
  height: 92px;
  margin: 4px auto 0;
  border-radius: 50%;
  background: radial-gradient(#8a3cb8, #3e2159);
  border: 1px solid #000;
  box-shadow: inset 0 0 0 2px #c98ef3, 0 0 22px var(--glow);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  padding: 0 0 0 6px;
}
.playbig:hover { background: radial-gradient(#a24fd2, #4b2869); }
.btn.mini { min-width: 44px; min-height: 44px; padding: 4px 12px; font-size: 16px; vertical-align: middle; }

/* questions */
.qwrap { min-height: 150px; display: flex; flex-direction: column; justify-content: center; }
.ask { margin: 10px 0 0; color: var(--mute); font-size: 16px; }
.sit { margin: 0; color: #fff; font-size: 22px; line-height: 1.45; }
.sit .hz { font-size: 26px; }
.opts { display: grid; gap: 8px; margin-top: 18px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; background: var(--inset); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 19px; text-align: left; cursor: pointer; }
.opt kbd { margin-left: 0; }
.olabel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ozh { color: #fff; font-size: 28px; line-height: 1.2; }
.opy { font-size: 24px; }
.opy.big { color: #fff; }
.opt:hover:not(:disabled) { background: #1c1a21; border-color: var(--p2); }
.opt:disabled { cursor: default; }
.opt.ok { background: #3b2257; border-color: var(--p3); color: #fff; box-shadow: 0 0 12px rgba(160, 70, 255, 0.45); }
.opt.bad { background: #3a1a22; border-color: #a0404c; color: #fff; }
.fb { min-height: 20px; margin-top: 14px; }
.verdict { margin: 0; font-family: var(--vcr); font-size: 20px; }
.verdict.good { color: var(--p3); text-shadow: 0 0 10px var(--glow); }
.verdict.nope { color: #ff9fb4; }
.ansline { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin: 8px 0 0; }
.big2 { color: #fff; font-size: 30px; }
.ansline .py { font-size: 24px; }
.ansen { color: #fff; }
.fb .row { margin-top: 14px; }

/* end of a lesson: what you learned */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 6px 10px; background: var(--inset); border: 1px solid var(--line); font-size: 14px; }
.chips .hz { color: #fff; font-size: 22px; }

/* ---------- dialogs, notices, footer ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; overflow: auto; background: rgba(6, 5, 9, 0.72); }
.mbox { width: min(440px, 100%); margin: 0; }
.x { padding: 0 4px; background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; }
.x:hover { color: var(--p3); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  transform: translateX(-50%);
  background: var(--win);
  border: 1px solid #000;
  box-shadow: 0 0 0 1px var(--line), 0 0 22px rgba(130, 50, 200, 0.4);
  color: #fff;
  font-size: 14px;
}
.foot { width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 16px 2px; border-top: 1px solid var(--line2); color: #6d6c73; font-size: 12px; line-height: 1.6; text-align: center; }
.foot p { margin: 0 0 6px; }
.foot a { color: #8d8c93; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  kbd { display: none; }
  .back { top: 12px; font-size: 15px; }
  h1.title { margin-top: 34px; }
  main#app { padding: 14px 16px 30px; }
  .wb { padding: 16px 14px; }
  .step { gap: 12px; padding: 10px 12px; }
  .step b { font-size: 17px; }
  .medal { width: 38px; height: 38px; font-size: 16px; }
  .go { font-size: 15px; }
  .card .wb { padding: 18px 14px 20px; }
  .q1 { font-size: 112px; }
  .q3 { font-size: 72px; }
  .q6 { font-size: 44px; }
  .q.syl { font-size: 60px; }
  .q.en { font-size: 24px; }
  .pic { width: 76px; height: 76px; }
  .qwrap { min-height: 130px; }
  .opt { min-height: 54px; font-size: 18px; }
  .learnnav .btn { padding: 12px 16px; }
}
