:root {
  --paper: #f5efe2; --paper-2: #ebe1cc; --ink: #1f1a17; --muted: #7a6e5f; --line: #d9ccb1; --red: #b8322a; --red-soft: #f6dcd6;
  --green: #2f7d4f; --green-soft: #dcefe1; --gold: #c9973a;
  --cao: "Liu Jian Mao Cao", "Noto Serif SC", serif; --xing: "Long Cang", "Noto Serif SC", serif; --kai: "Ma Shan Zheng", "Noto Serif SC", serif;
  --serif: "Noto Serif SC", "Songti SC", serif; --ui: system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #24201c; --paper-2: #2e2924; --ink: #f1e9da; --muted: #b3a690; --line: #463e35;
    --red-soft: #45221f; --green-soft: #1f3a2a; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--ui);
  background-image: radial-gradient(rgba(120, 90, 50, .06) 1px, transparent 1px); background-size: 6px 6px; }
a { color: inherit; }
button { font: inherit; cursor: pointer; color: inherit; }
[hidden] { display: none !important; }
.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
.brand small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.seal { display: inline-grid; place-items: center; width: 34px; height: 34px; background: var(--red); color: #fff; border-radius: 6px; font-family: var(--cao); font-size: 1.5rem; font-weight: 400; }
.top nav { margin-left: auto; display: flex; gap: 6px; }
.top nav a { text-decoration: none; padding: 6px 14px; border-radius: 999px; }
.top nav a.on, .top nav a:hover { background: var(--ink); color: var(--paper); }
main { max-width: 860px; margin: 0 auto; padding: 22px 16px 40px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 24px; }

/* home */
.hero { text-align: center; margin: 10px 0 24px; }
.hero .demo { font-family: var(--cao); font-size: clamp(5rem, 22vw, 9rem); line-height: 1.1; }
.hero h1 { font-family: var(--serif); margin: 0; font-size: clamp(1.6rem, 5vw, 2.2rem); }
.hero p { color: var(--muted); margin: 6px 0 0; }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.level { background: var(--paper-2); border: 2px solid var(--line); border-radius: 16px; padding: 18px; text-align: left; transition: transform .12s, border-color .12s; }
.level:hover { transform: translateY(-3px); border-color: var(--ink); }
.level .lv { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; }
.level .eg { font-family: var(--cao); font-size: 2rem; letter-spacing: .1em; }
.level .best { color: var(--muted); font-size: .9rem; }

/* play */
.bar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .95rem; margin-bottom: 10px; flex-wrap: wrap; gap: 6px; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress div { height: 100%; background: var(--red); transition: width .3s; }
.card { background: #fffaf0; border: 2px solid var(--line); border-radius: 22px; text-align: center; padding: 18px 16px 22px; position: relative;
  box-shadow: 0 8px 24px rgba(60, 40, 10, .12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { background: #2b2621; } }
.card .ask { color: var(--muted); }
.card .cursive { font-family: var(--cao); font-size: clamp(7rem, 34vw, 12rem); line-height: 1.15; min-height: 1.15em; animation: brush .5s ease-out; }
@keyframes brush { from { opacity: 0; transform: scale(.92); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
.card .loading { font-size: 1rem; color: var(--muted); min-height: 1.15em; display: grid; place-items: center; }
.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 480px) { .choices { grid-template-columns: repeat(2, 1fr); } }
.choice { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 8px 0; font-family: var(--serif); font-size: 2.4rem; line-height: 1.3; }
.choice:hover:not(:disabled) { border-color: var(--ink); }
.choice.right { border-color: var(--green); background: var(--green-soft); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.reveal { margin-top: 16px; border-top: 2px dashed var(--line); padding-top: 14px; animation: brush .4s ease-out; }
.styles { display: flex; justify-content: center; gap: clamp(10px, 4vw, 30px); flex-wrap: wrap; }
.styles figure { margin: 0; }
.styles .g { font-size: 3.4rem; line-height: 1.2; }
.styles figcaption { color: var(--muted); font-size: .82rem; }
.reveal .info { margin-top: 6px; font-size: 1.05rem; }
.reveal .info b { font-family: var(--serif); font-size: 1.3rem; }
.verdict { font-weight: 700; margin-top: 8px; }
.verdict.ok { color: var(--green); } .verdict.no { color: var(--red); }
.btn { background: var(--ink); color: var(--paper); border: 0; border-radius: 12px; padding: 10px 20px; font-weight: 700; margin-top: 14px; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.done { text-align: center; }
.done .score { font-family: var(--serif); font-size: 3rem; font-weight: 700; }
.done .seal-big { display: inline-block; font-family: var(--cao); font-size: 4rem; color: #fff; background: var(--red); border-radius: 12px; padding: 0 18px; transform: rotate(-6deg); margin-bottom: 10px; animation: stamp .45s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp { from { transform: rotate(-6deg) scale(2.4); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.review { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0; }
.review span { border: 2px solid var(--line); border-radius: 12px; padding: 2px 10px; font-size: 1.6rem; }
.review span.miss { border-color: var(--red); background: var(--red-soft); }
.review span small { font-family: var(--cao); margin-left: 4px; }

/* learn */
.learn h1 { font-family: var(--serif); }
.learn h2 { font-family: var(--serif); border-bottom: 2px solid var(--line); padding-bottom: 4px; margin-top: 28px; }
.learn p { margin: 0 0 12px; }
.learn .tip { background: var(--paper-2); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 6px; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.compare .c { background: var(--paper-2); border-radius: 14px; padding: 10px; text-align: center; }
.compare .c .g { font-size: 3rem; line-height: 1.2; }
.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.part { background: var(--paper-2); border-radius: 14px; padding: 12px 14px; }
.part .name { font-weight: 700; }
.part .row { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; font-size: 2rem; }
.part .row span small { display: block; font-size: .75rem; color: var(--muted); text-align: center; font-family: var(--ui); }
.kai { font-family: var(--kai); } .trad { font-family: var(--serif); } .xing { font-family: var(--xing); } .cao { font-family: var(--cao); }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.person { background: var(--paper-2); border-radius: 14px; padding: 12px 14px; }
.person b { font-family: var(--serif); font-size: 1.15rem; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
