/* HSK Mastery — xuan paper, pine-soot ink, an indigo seal.
   Sibling identity to VerticalChinese: same paper/ink palette,
   new accent (--azure deep blue) replacing cinnabar. */

:root {
  --paper:        #F4ECD8;
  --paper-raised: #FBF5E6;
  --paper-sunken: #E7DCC2;
  --ink:          #1F1B16;
  --ink-faded:    #6E6253;
  --ink-whisper:  #A89A82;
  --azure:        #A8322A;   /* accent = VC cinnabar (Carson: same scheme as Vertical Chinese) */
  --azure-2:      #CB5C49;   /* = VC cinnabar-2 */
  --azure-dark:   #7E241E;
  --cinnabar:     #A8322A;
  --hairline:     rgba(31, 27, 22, 0.12);
  --gold:         #B08A3E;

  --serif-display: "Cormorant Garamond", "Noto Serif SC", Georgia, serif;
  --serif-body:    "Spectral", Georgia, "Times New Roman", serif;
  --han:           "Noto Serif SC", "Songti SC", serif;

  --maxw: 1100px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 60% 50% at 100% 0%, rgba(30,92,153,0.05), transparent 60%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(176,138,62,0.06), transparent 55%),
    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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
img { max-width: 100%; }

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

.eyebrow {
  font-family: var(--serif-body);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 12px;
  font-weight: 600;
  color: var(--azure);
}

/* ---------- seal logo ---------- */
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--azure);
  color: var(--paper-raised);
  font-family: var(--han); font-weight: 700; font-size: 22px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 2px rgba(251,245,230,0.3), 0 2px 0 rgba(31,27,22,0.18);
  line-height: 1;
}

/* ---------- nav ---------- */
header.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(244,236,216,0.82);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner { display: flex; align-items: center; gap: 18px; min-height: 68px; flex-wrap: wrap; padding: 8px 0; }
.brand { flex: none; display: flex; align-items: center; gap: 12px;
  font-family: var(--serif-display); font-size: 22px; font-weight: 600;
  letter-spacing: 0.01em; text-decoration: none; color: var(--ink); }
.nav-links { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px 18px; align-items: center; }
@media (min-width: 901px) { .nav-links { gap: 26px; } }
.nav-links a:not(.btn) { text-decoration: none; font-size: 15px; color: var(--ink-faded); transition: color .2s; }
.nav-links a:not(.btn):hover { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--serif-body); font-size: 16px; font-weight: 600;
  padding: 12px 22px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, box-shadow .2s, background .2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--azure); color: #fff;
  box-shadow: 0 2px 0 var(--azure-dark), 0 6px 18px rgba(30,92,153,0.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 3px 0 var(--azure-dark), 0 10px 26px rgba(30,92,153,0.34); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--azure-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-lg { font-size: 18px; padding: 16px 30px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- hero ---------- */
.hero { padding: 78px 0 56px; }
.hero-inner { max-width: 780px; }
.hero h1 {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: clamp(46px, 6.5vw, 80px);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin: 18px 0 8px;
}
.hero h1 .hl { color: var(--azure); }
.hero .lede { font-size: 20px; color: var(--ink-faded); max-width: 38em; margin: 22px 0 30px; line-height: 1.6; }
.hero-cta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* ---------- demo exercise card ---------- */
.demo-wrap { margin: 56px 0 0; max-width: 680px; }
.demo-card {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(251,245,230,0.9) inset, 0 22px 50px -28px rgba(31,27,22,0.4);
  overflow: hidden;
}
.demo-top {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--hairline);
  background: linear-gradient(var(--paper-raised), var(--paper-sunken));
}
.demo-top .badge {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-whisper); font-family: var(--serif-body);
}
.demo-top .topic {
  margin-left: auto; font-size: 12px; color: var(--azure); font-weight: 600;
  font-family: var(--serif-body);
}
.demo-body { padding: 28px 28px 24px; }
.demo-type { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--azure); font-weight: 600; margin-bottom: 14px; font-family: var(--serif-body); }
.demo-sentence {
  font-family: var(--han); font-size: clamp(22px, 3.5vw, 30px);
  color: var(--ink); line-height: 1.6; margin: 0 0 8px;
}
.demo-sentence .blank {
  display: inline-block; min-width: 2em; border-bottom: 2px solid var(--azure);
  vertical-align: bottom; text-align: center; color: var(--azure);
  font-weight: 700;
}
.demo-pinyin { font-family: var(--serif-display); font-style: italic;
  font-size: 16px; color: var(--ink-whisper); margin: 0 0 22px; }
.demo-choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 20px; }
.demo-choice {
  font-family: var(--han); font-size: 22px; padding: 10px 22px;
  background: var(--paper); border: 1.5px solid var(--hairline); border-radius: 10px;
  cursor: pointer; color: var(--ink); transition: all .15s; min-width: 64px; text-align: center;
}
.demo-choice:hover:not(:disabled) { border-color: var(--azure); color: var(--azure); }
.demo-choice.correct { background: rgba(30,92,153,0.1); border-color: var(--azure); color: var(--azure); }
.demo-choice.wrong   { background: rgba(168,50,42,0.08); border-color: var(--cinnabar); color: var(--cinnabar); }
.demo-choice:disabled { cursor: default; }
.demo-result { display: none; padding: 16px; background: var(--paper-sunken); border-radius: 10px;
  border-left: 3px solid var(--azure); }
.demo-result.wrong { border-left-color: var(--cinnabar); }
.demo-result.show { display: block; }
.demo-result .res-verdict { font-family: var(--serif-body); font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--azure); margin-bottom: 6px; }
.demo-result.wrong .res-verdict { color: var(--cinnabar); }
.demo-result .res-pinyin { font-family: var(--serif-display); font-style: italic;
  font-size: 17px; color: var(--cinnabar); margin-bottom: 4px; }
.demo-result .res-exp { font-size: 15px; color: var(--ink-faded); line-height: 1.6; margin: 0; }
.demo-result .res-retry { margin-top: 12px; }
.demo-foot { padding: 12px 16px; border-top: 1px solid var(--hairline);
  background: var(--paper-sunken); font-size: 13px; color: var(--ink-faded);
  display: flex; align-items: center; gap: 10px; }
.xp-pip { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--azure); margin-right: 4px; }

/* ---------- generic section ---------- */
section { padding: 76px 0; }
.section-head { max-width: 38em; margin-bottom: 44px; }
.section-head h2 { font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(34px, 4.4vw, 50px); line-height: 1.05; letter-spacing: -0.01em; margin: 10px 0 12px; }
.section-head p { font-size: 19px; color: var(--ink-faded); margin: 0; }

.rule { height: 1px; background: var(--hairline); border: 0; margin: 0; }

/* ---------- how it works steps ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
@media (max-width: 780px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .steps { grid-template-columns: 1fr; } }
.step { position: relative; padding-top: 26px; border-top: 2px solid var(--ink); }
.step .no { font-family: var(--han); position: absolute; top: -0.1em; right: 0;
  font-size: 40px; color: var(--paper-sunken); }
.step .day { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--azure); font-weight: 600; }
.step h3 { font-family: var(--serif-display); font-size: 24px; font-weight: 600; margin: 6px 0 8px; }
.step p { font-size: 15.5px; color: var(--ink-faded); margin: 0; }
.mastery-rule {
  margin-top: 10px; padding: 10px 12px; background: rgba(30,92,153,0.07);
  border-radius: 7px; border-left: 2px solid var(--azure);
  font-size: 13px; color: var(--azure); line-height: 1.5;
}

/* ---------- feature grid ---------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--hairline); border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
@media (max-width: 680px) { .features { grid-template-columns: 1fr; } }
.feature { background: var(--paper-raised); padding: 28px 26px; }
.feature .fhan { font-family: var(--han); font-size: 28px; color: var(--azure); }
.feature h3 { font-family: var(--serif-display); font-size: 22px; font-weight: 600; margin: 10px 0 7px; }
.feature p { font-size: 15px; color: var(--ink-faded); margin: 0; }

/* ---------- pricing ---------- */
.price-wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 50px; align-items: center; }
@media (max-width: 720px) { .price-wrap { grid-template-columns: 1fr; gap: 30px; } }
.price-card {
  background: var(--paper-raised); border: 1px solid var(--hairline); border-radius: 18px;
  padding: 38px 36px; box-shadow: 0 24px 60px -34px rgba(31,27,22,0.5);
  position: relative; overflow: hidden;
}
.price-card .stamp {
  position: absolute; top: 18px; right: 18px; transform: rotate(8deg);
  border: 2px solid var(--azure); color: var(--azure); border-radius: 8px;
  font-family: var(--han); font-size: 13px; letter-spacing: 0.1em; padding: 6px 8px; opacity: 0.85;
}
.price-card .label { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--azure); font-weight: 600; margin-bottom: 6px; }
.price-card .amount { font-family: var(--serif-display); font-size: 76px; font-weight: 600; line-height: 1; }
.price-card .amount sup { font-size: 30px; vertical-align: super; color: var(--ink-faded); }
.price-card .cadence { color: var(--ink-faded); font-size: 15px; margin-bottom: 6px; }
.price-card .alt-price { color: var(--ink-whisper); font-size: 13px; margin-bottom: 22px; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 26px; }
.price-card li { padding: 9px 0 9px 28px; position: relative;
  border-bottom: 1px solid var(--hairline); font-size: 16px; }
.price-card li:last-child { border-bottom: 0; }
.price-card li::before { content: "掌"; font-family: var(--han); position: absolute; left: 0; top: 9px;
  color: var(--azure); font-size: 14px; }
.price-card .btn { width: 100%; justify-content: center; }
.price-card .coming-note { font-size: 12px; color: var(--ink-whisper); text-align: center; margin-top: 10px; }
.price-side h2 { font-family: var(--serif-display); font-weight: 600; font-size: clamp(30px,3.8vw,44px);
  line-height: 1.05; margin: 0 0 14px; }
.price-side p { font-size: 17px; color: var(--ink-faded); }

/* ---------- email capture ---------- */
.capture-card {
  background: var(--paper-raised); border: 1px solid var(--hairline); border-radius: 14px;
  padding: 32px; margin: 0 auto; max-width: 520px; text-align: center;
}
.capture-card h3 { font-family: var(--serif-display); font-size: 26px; font-weight: 600; margin: 0 0 8px; }
.capture-card p { font-size: 16px; color: var(--ink-faded); margin: 0 0 18px; }
.capture-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.capture-form input[type="email"] {
  flex: 1 1 260px; padding: 14px 16px; font-family: var(--serif-body); font-size: 16px;
  border: 1px solid var(--hairline); border-radius: 8px; background: var(--paper); color: var(--ink);
}
.capture-form input[type="email"]:focus { outline: none; border-color: var(--azure); }
.capture-note { font-size: 13px; color: var(--ink-whisper); margin-top: 10px; }
.capture-ok { font-size: 15px; color: var(--azure); font-weight: 600; margin-top: 12px; display: none; }
.capture-err { font-size: 13px; color: var(--cinnabar); margin-top: 8px; display: none; }

/* ---------- cta band ---------- */
.band {
  background: var(--ink); color: var(--paper); border-radius: 20px;
  padding: 60px 50px; text-align: center; position: relative; overflow: hidden;
}
.band::before { content: "掌"; position: absolute; font-family: var(--han); font-size: 340px;
  color: rgba(244,236,216,0.04); right: -20px; top: -110px; pointer-events: none; }
.band h2 { font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(32px,5vw,54px); margin: 0 0 12px; color: var(--paper); }
.band p { color: var(--ink-whisper); font-size: 18px; margin: 0 0 26px; }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--hairline); padding: 40px 0 64px; margin-top: 30px; }
.foot-inner { display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  color: var(--ink-faded); font-size: 14px; }
.foot-inner .spacer { margin-left: auto; }

/* ---------- auth modal ---------- */
.auth-overlay { position: fixed; inset: 0; z-index: 100;
  background: rgba(31,27,22,0.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-overlay[hidden] { display: none; }
.auth-modal { position: relative; width: 100%; max-width: 400px;
  background: var(--paper-raised); border: 1px solid var(--hairline);
  border-radius: 16px; padding: 32px 28px 26px;
  box-shadow: 0 20px 60px rgba(31,27,22,0.35); }
.auth-close { position: absolute; top: 12px; right: 14px; border: 0; background: none;
  font-size: 26px; line-height: 1; color: var(--ink-whisper); cursor: pointer; }
.auth-close:hover { color: var(--ink); }
.auth-seal { font-family: var(--han); font-size: 34px; color: var(--azure); line-height: 1; }
.auth-modal h2 { font-family: var(--serif-display); font-size: 26px; margin: 12px 0 4px; }
.auth-sub { margin: 0 0 18px; font-size: 14px; color: var(--ink-faded); }
.auth-tabs { display: flex; gap: 4px; background: var(--paper-sunken);
  border-radius: 9px; padding: 4px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; cursor: pointer;
  font-family: var(--serif-body); font-size: 14px; font-weight: 600; color: var(--ink-faded);
  padding: 8px; border-radius: 6px; transition: background .15s, color .15s; }
.auth-tabs button.on { background: var(--paper-raised); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.auth-field { display: block; margin-bottom: 14px; }
.auth-field span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-faded); margin-bottom: 5px; }
.auth-field input { width: 100%; font-family: var(--serif-body); font-size: 16px;
  padding: 11px 13px; border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--paper); color: var(--ink); }
.auth-field input:focus { outline: none; border-color: var(--azure); }
.auth-modal .btn { width: 100%; justify-content: center; margin-top: 4px; }
.auth-error { margin: 0 0 12px; font-size: 14px; color: var(--cinnabar); }
.auth-foot { margin: 16px 0 0; font-size: 14px; color: var(--ink-faded); text-align: center; }
.linkish { border: 0; background: none; color: var(--azure); cursor: pointer;
  font-family: var(--serif-body); font-size: 14px; font-weight: 600; padding: 0; text-decoration: underline; }
body.modal-open { overflow: hidden; }

/* nav account chip */
.nav-account { display: flex; align-items: center; gap: 10px; }
.nav-account .btn { padding: 8px 14px; font-size: 14px; }
.acct-email { font-size: 13px; color: var(--ink-faded); max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-badge { font-family: var(--serif-body); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; }
.acct-badge.active   { background: var(--azure); color: #fff; }
.acct-badge.past_due { background: var(--gold); color: #fff; }
.acct-badge.none     { background: var(--paper-sunken); color: var(--ink-faded); }

/* ---------- member area (app.php / account.php) ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 48px 0 80px; }
.app-greeting { margin-bottom: 32px; }
.app-greeting h1 { font-family: var(--serif-display); font-size: clamp(30px,4vw,44px);
  font-weight: 600; margin: 0 0 6px; }
.app-greeting p { font-size: 17px; color: var(--ink-faded); margin: 0; }

.tasks-shell {
  background: var(--paper-raised); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 32px; min-height: 200px;
  display: flex; align-items: center; justify-content: center;
}
.tasks-placeholder { text-align: center; color: var(--ink-faded); }
.tasks-placeholder .big { font-family: var(--han); font-size: 56px;
  color: var(--paper-sunken); display: block; margin-bottom: 10px; }
.tasks-placeholder p { font-size: 16px; max-width: 26em; margin: 0 auto; line-height: 1.6; }

.acct-section { margin-bottom: 32px; }
.acct-section h2 { font-family: var(--serif-display); font-size: 24px; font-weight: 600;
  margin: 0 0 16px; border-bottom: 1px solid var(--hairline); padding-bottom: 10px; }
.acct-row { display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--hairline); font-size: 16px; }
.acct-row:last-child { border-bottom: 0; }
.acct-row .label { color: var(--ink-faded); font-size: 14px; min-width: 130px; }
.acct-row .value { color: var(--ink); font-weight: 500; }
.sub-badge { display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.sub-badge.active   { background: var(--azure); color: #fff; }
.sub-badge.past_due { background: var(--gold); color: #fff; }
.sub-badge.canceled { background: var(--paper-sunken); color: var(--ink-faded); }
.sub-badge.none     { background: var(--paper-sunken); color: var(--ink-faded); }

/* ---------- knowledge graph legend ---------- */
.graph-legend {
  display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-start;
  margin-bottom: 18px; padding: 14px 18px;
  background: var(--paper-raised); border: 1px solid var(--hairline);
  border-radius: 10px; font-size: 13px;
}
.gl-levels { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.gl-item { display: flex; align-items: center; gap: 6px; color: var(--ink-faded); }
.gl-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--lc, #888); flex: none;
}
.gl-dot.gl-featured { width: 14px; height: 14px; box-shadow: 0 0 0 2px var(--lc, #888), 0 0 0 4px rgba(30,92,153,0.2); }
.gl-dot.gl-locked { background: #DEDAD0; border: 1.5px solid var(--lc, #888); }
.gl-status { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.gl-status-item { display: flex; align-items: center; gap: 6px; color: var(--ink-faded); }
.gl-sq { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.gl-mastered { background: #1E5C99; }
.gl-frontier { background: rgba(30,92,153,0.28); border: 1.5px solid #1E5C99; }
.gl-locked-sq { background: #DEDAD0; border: 1px solid #BFB8AC; }
.gl-hint { font-style: italic; color: var(--ink-whisper); margin-left: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .btn-lg { font-size: 16px; padding: 14px 22px; }
  .band { padding: 40px 24px; }
  .price-card { padding: 28px 20px; }
}
