/* ============================================================
   Mandarun — "Ink & Paper" minimal theme
   White paper, black ink, sparing cinnabar / jade / gold.
   ============================================================ */

:root {
    --paper: #ffffff;
    --paper-2: #faf9f6;
    --ink: #0b0b0b;
    --ink-2: #202020;
    --muted: #6f6f6f;
    --faint: #a9a49b;
    --line: #e7e4de;
    --line-2: #d6d2c9;

    --red: #c8102e;
    --jade: #0e7a5f;
    --gold: #ad8a2c;

    --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --zh: "Noto Serif SC", "Songti SC", "SimSun", serif;

    --maxw: 1260px;
    --gut: clamp(1.25rem, 4.5vw, 3.75rem);
    --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
}

body.modal-open { overflow: hidden; }

::selection { background: var(--ink); color: var(--paper); }

a { color: inherit; }

img, svg, table { max-width: 100%; }

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }

button { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
}

/* ---------- Layout ---------- */
.main { flex: 1 0 auto; }

.page {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding-inline: var(--gut);
}

.page--wide { max-width: 1460px; }

/* ---------- Header / nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
}

.site-header__inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding-inline: var(--gut);
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: var(--ink);
}

.brand__mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--zh);
    font-size: 20px;
    line-height: 1;
    transition: background .25s var(--ease);
}

.brand__mark--sm { width: 28px; height: 28px; font-size: 15px; }

.brand:hover .brand__mark { background: var(--red); }

.brand__name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .26em;
    text-transform: uppercase;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.9rem;
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-weight: 500;
}

.nav a,
.nav .link-btn {
    position: relative;
    color: var(--muted);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color .2s var(--ease);
}

.nav a::after,
.nav .link-btn::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 1px;
    background: var(--red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--ease);
}

.nav a:hover,
.nav .link-btn:hover { color: var(--ink); }

.nav a:hover::after,
.nav .link-btn:hover::after { transform: scaleX(1); }

.nav__user {
    color: var(--ink);
    letter-spacing: .08em;
    text-transform: none;
}

.nav .btn { color: var(--paper); }
.nav .btn::after { display: none; }
.nav .btn:hover { color: var(--paper); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    padding: 1.05rem 1.75rem;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background .25s var(--ease), color .25s var(--ease),
                border-color .25s var(--ease), transform .25s var(--ease);
}

.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--red); border-color: var(--red); }

.btn--ghost:hover { background: var(--ink); color: var(--paper); }

.btn--small { padding: .62rem 1.05rem; font-size: 11px; }

.btn--text {
    border: none;
    padding: 0;
    background: none;
    gap: .5rem;
}
.btn--text::after {
    content: "\2192";
    transition: transform .25s var(--ease);
}
.btn--text:hover::after { transform: translateX(5px); }

.btn:hover { transform: translateY(-1px); }

/* ---------- Shared typographic bits ---------- */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1.6rem;
}

.eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--red);
    border-radius: 50%;
    flex: none;
}

.eyebrow--plain::before { display: none; }

.zh { font-family: var(--zh); }

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }

.section--tight { padding-block: clamp(2rem, 5vw, 3.5rem); }

.section__head { max-width: 720px; margin-bottom: clamp(2rem, 4vw, 3.25rem); }

.section__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2rem, 4.6vw, 3.35rem);
    line-height: 1.04;
    letter-spacing: -.01em;
}

.section__title em { font-style: italic; }

.section__lede {
    max-width: 64ch;
    color: var(--muted);
    font-size: clamp(1rem, 1.5vw, 1.12rem);
    line-height: 1.65;
    margin: .35rem 0 clamp(2rem, 4vw, 3rem);
}

/* Hairline rule */
.rule {
    height: 1px;
    background: var(--line);
    margin: clamp(2.5rem, 6vw, 5rem) auto;
    max-width: var(--maxw);
}

/* ---------- Messages ---------- */
.messages { padding-top: 1.5rem; display: grid; gap: .75rem; }

.alert {
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--ink);
    padding: .9rem 1.1rem;
    font-size: 14px;
    background: var(--paper-2);
}
.alert-success { border-left-color: var(--jade); }
.alert-error, .alert-danger { border-left-color: var(--red); }
.alert-warning { border-left-color: var(--gold); }

/* ============================================================
   HOME
   ============================================================ */

.hero {
    position: relative;
    overflow: hidden;
    padding-block: clamp(3.5rem, 9vw, 7.5rem) clamp(2.5rem, 5vw, 4.5rem);
    border-bottom: 1px solid var(--line);
}

.hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 480px);
    align-items: stretch;
    gap: clamp(2rem, 5vw, 4.5rem);
}

.hero__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero__stage {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid var(--line);
    background: var(--paper-2);
    overflow: hidden;
}

.hero__viewport {
    position: relative;
    flex: 1 1 auto;
    min-height: 360px;
    overflow: hidden;
}

.hero__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.hero__hint {
    position: absolute;
    left: 1rem;
    bottom: .85rem;
    font-size: 10px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--faint);
    pointer-events: none;
}

.hero__caption {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .55rem;
    padding: .9rem 1.15rem 1rem;
    border-top: 1px solid var(--line);
}

.hero__caption-zh {
    font-family: var(--zh);
    font-size: 1.5rem;
    line-height: 1;
    color: var(--ink);
}

.hero__caption-py {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--red);
}

.hero__caption-def {
    flex: 1 1 100%;
    font-size: .82rem;
    line-height: 1.5;
    color: var(--muted);
}

.hero .page { position: relative; z-index: 1; }

.hero__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(3.2rem, 9.5vw, 7rem);
    line-height: .9;
    letter-spacing: .015em;
}

.hero__title-latin { display: block; }

.hero__title-zh {
    display: block;
    font-family: var(--zh);
    font-size: clamp(1rem, 2.4vw, 1.5rem);
    font-weight: 400;
    letter-spacing: .55em;
    color: var(--faint);
    margin-top: clamp(.9rem, 2vw, 1.4rem);
}

.hero__slogan {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.3rem, 3vw, 2.1rem);
    color: var(--muted);
    margin-top: clamp(1rem, 2.5vw, 1.75rem);
}

.cursor { color: var(--red); animation: blink 1.1s steps(1) infinite; }

@keyframes blink { 50% { opacity: 0; } }

.hero__lede {
    max-width: 46ch;
    margin-top: 1.75rem;
    color: var(--ink-2);
    font-size: clamp(1rem, 1.4vw, 1.12rem);
    line-height: 1.65;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: clamp(2.5rem, 5vw, 3.5rem) 0 0;
    border-top: 1px solid var(--line);
}

.stats li {
    padding: 1.35rem 2.25rem 0 0;
    margin-right: 2.25rem;
}

.stats li + li {
    border-left: 1px solid var(--line);
    padding-left: 2.25rem;
}

.stats b {
    display: block;
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    line-height: 1;
    letter-spacing: -.02em;
}

.stats span {
    display: block;
    margin-top: .5rem;
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Hero aside removed — hero is a single editorial column */

/* Steps */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.5rem, 3.5vw, 3rem);
}

.step {
    border-top: 1px solid var(--ink);
    padding-top: 1.6rem;
}

.step__num {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--red);
}

.step__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    line-height: 1.1;
    margin: 1.1rem 0 .85rem;
    display: flex;
    align-items: baseline;
    gap: .6rem;
}

.step__title .zh { color: var(--faint); font-size: .82em; }

.step p { color: var(--muted); font-size: .96rem; }

/* Mastery ladder */
.ladder {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border: 1px solid var(--line-2);
}

.rung {
    padding: clamp(1.5rem, 2.6vw, 2.25rem) clamp(1rem, 1.8vw, 1.5rem);
    border-right: 1px solid var(--line-2);
    display: flex;
    flex-direction: column;
    gap: .55rem;
    min-height: 200px;
    transition: background .3s var(--ease), color .3s var(--ease);
}

.rung:last-child { border-right: none; }

.rung__zh {
    font-family: var(--zh);
    font-size: clamp(2.2rem, 4.5vw, 3.2rem);
    line-height: 1;
    font-weight: 500;
    transition: color .3s var(--ease);
}

.rung__py {
    font-size: .8rem;
    letter-spacing: .08em;
    color: var(--faint);
    margin-top: -.3rem;
    transition: color .3s var(--ease);
}

.rung__en {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.rung__desc {
    margin-top: auto;
    font-size: .84rem;
    color: var(--muted);
    line-height: 1.5;
    transition: color .3s var(--ease);
}

.rung--master { background: var(--ink); color: var(--paper); }
.rung--master .rung__desc { color: rgba(255, 255, 255, .62); }
.rung--master .rung__zh { color: var(--gold); }
.rung--master .rung__py { color: rgba(255, 255, 255, .55); }

.rung:hover { background: var(--paper-2); }
.rung--master:hover { background: var(--ink-2); }

/* Feature grid */
.features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-top: 1px solid var(--line-2);
    border-left: 1px solid var(--line-2);
}

.feature {
    position: relative;
    overflow: hidden;
    padding: clamp(1.75rem, 3.5vw, 3rem);
    border-right: 1px solid var(--line-2);
    border-bottom: 1px solid var(--line-2);
    transition: background .3s var(--ease);
}

.feature:hover { background: var(--paper-2); }

.feature__index {
    font-family: var(--serif);
    font-size: 1.35rem;
    color: var(--faint);
    letter-spacing: .1em;
}

.feature__mark {
    position: absolute;
    right: 1.15rem;
    bottom: 1.15rem;
    width: 3.4rem;
    height: 3.4rem;
    color: var(--line-2);
    pointer-events: none;
    user-select: none;
    transition: color .35s var(--ease);
    overflow: visible;
}
.feature__mark .lit { fill: var(--ink); }
.feature__mark .lit--master { fill: var(--red); }
.feature:hover .feature__mark { color: var(--muted); }

.feature__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    margin: 1.5rem 0 .75rem;
    position: relative;
    z-index: 1;
}

.feature p {
    color: var(--muted);
    font-size: .95rem;
    max-width: 40ch;
    position: relative;
    z-index: 1;
}

/* CTA band */
.cta {
    background: var(--ink);
    color: var(--paper);
    padding-block: clamp(3.5rem, 8vw, 6rem);
    margin-top: clamp(3rem, 7vw, 6rem);
}

.cta .eyebrow { color: rgba(255, 255, 255, .55); }

.cta__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2.1rem, 5.2vw, 3.9rem);
    line-height: 1.02;
    letter-spacing: -.015em;
    max-width: 20ch;
}

.cta__lede {
    color: rgba(255, 255, 255, .6);
    max-width: 44ch;
    margin-top: 1.25rem;
}

.cta .btn--ghost { border-color: rgba(255, 255, 255, .55); color: var(--paper); }
.cta .btn--ghost:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.cta .btn--text { color: var(--paper); }
.cta .btn--text::after { content: "\2192"; }

/* ============================================================
   DICTIONARY / LEXICON
   ============================================================ */

.lex-header {
    padding-block: clamp(3rem, 7vw, 5.5rem) clamp(1.5rem, 3vw, 2.25rem);
}

.lex-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2.6rem, 7vw, 5rem);
    line-height: .98;
    letter-spacing: -.025em;
}

.lex-title .zh { font-size: .8em; font-weight: 600; }

.lex-lede {
    margin-top: 1.25rem;
    color: var(--muted);
    max-width: 52ch;
}

.lex-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--ink);
}

.search-field {
    display: flex;
    align-items: center;
    gap: .85rem;
    flex: 1;
    min-width: 0;
}

.search-field__glyph {
    font-family: var(--zh);
    font-size: 1.35rem;
    color: var(--faint);
    flex: none;
    line-height: 1;
}

.search-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: .55rem 0;
    font-family: var(--sans);
    font-size: clamp(.95rem, 1.5vw, 1.1rem);
    color: var(--ink);
}

.search-input::placeholder { color: var(--faint); }
.search-input:focus { outline: none; }

.word-count {
    flex: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

/* Hairline lexicon grid */
.lexicon {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    border-top: 1px solid var(--line-2);
    border-left: 1px solid var(--line-2);
    margin-top: 2rem;
}

.word-card {
    position: relative;
    border-right: 1px solid var(--line-2);
    border-bottom: 1px solid var(--line-2);
    transition: background .28s var(--ease), color .28s var(--ease);
}

.word-card[hidden] { display: none; }

.word-card-link {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    min-height: 172px;
    padding: 1.4rem 1.4rem 1.25rem;
    text-decoration: none;
    color: inherit;
}

.word-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    letter-spacing: .14em;
    color: var(--faint);
}

.word-rank { font-variant-numeric: tabular-nums; }

.word-card__seal {
    width: 7px;
    height: 7px;
    background: var(--red);
    border-radius: 50%;
    opacity: 0;
    transform: scale(.4);
    transition: opacity .28s var(--ease), transform .28s var(--ease);
}

.word-hanzi {
    font-family: var(--zh);
    font-weight: 500;
    font-size: clamp(2.1rem, 3.6vw, 2.9rem);
    line-height: 1;
    margin-top: auto;
    transition: color .28s var(--ease);
}

.word-pinyin {
    font-size: .82rem;
    letter-spacing: .05em;
    color: var(--muted);
    transition: color .28s var(--ease);
}

.word-meaning {
    font-size: .84rem;
    line-height: 1.45;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .28s var(--ease);
}

.word-card:hover { background: var(--ink); color: var(--paper); }
.word-card:hover .word-hanzi { color: var(--paper); }
.word-card:hover .word-pinyin,
.word-card:hover .word-meaning,
.word-card:hover .word-card__top { color: rgba(255, 255, 255, .62); }
.word-card:hover .word-card__seal { opacity: 1; transform: scale(1); }

.lex-empty {
    padding: 4rem 0;
    text-align: center;
    color: var(--muted);
    letter-spacing: .05em;
}

/* ============================================================
   MODAL
   ============================================================ */

.word-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.word-modal[hidden] { display: none; }

.word-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 8, .62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fade .25s var(--ease);
}

.word-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    background: var(--paper);
    border: 1px solid var(--ink);
    padding: clamp(2rem, 5vw, 3rem);
    max-height: 90vh;
    overflow-y: auto;
    animation: rise .3s var(--ease);
}

.word-modal__close {
    position: absolute;
    top: .6rem;
    right: .9rem;
    background: none;
    border: none;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--faint);
    cursor: pointer;
    transition: color .2s var(--ease);
}
.word-modal__close:hover { color: var(--red); }

.word-modal .word-rank-detail {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--red);
}

.word-modal__hanzi-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.word-modal .word-hanzi.simplified {
    font-family: var(--zh);
    font-weight: 500;
    font-size: clamp(3.5rem, 12vw, 5rem);
    line-height: 1;
    margin: 1rem 0 .5rem;
}

.word-modal__hanzi-row .speak-btn {
    flex: 0 0 auto;
    margin-top: .5rem;
}

.word-modal .word-pinyin {
    font-size: 1rem;
    letter-spacing: .12em;
    color: var(--muted);
}

.word-modal .word-traditional {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    margin-top: 1.25rem;
}

.word-modal .label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--faint);
}

.word-modal .word-hanzi.traditional {
    font-family: var(--zh);
    font-size: 1.9rem;
    line-height: 1;
}

.word-modal .word-meaning-detail {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    display: grid;
    gap: .5rem;
}

.word-modal .word-meaning-detail span:last-child {
    font-size: 1.02rem;
    line-height: 1.6;
}

.word-level {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    display: grid;
    gap: .65rem;
}

.word-level__rung {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding: .85rem 1rem;
    border: 1px solid var(--line-2);
    background: var(--paper-2);
    transition: background .3s var(--ease), color .3s var(--ease);
}

.word-level__zh {
    font-family: var(--zh);
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 500;
}

.word-level__py {
    font-size: .8rem;
    letter-spacing: .08em;
    color: var(--faint);
}

.word-level__en {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.word-level__rung.is-master {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}
.word-level__rung.is-master .word-level__zh { color: var(--gold); }
.word-level__rung.is-master .word-level__py { color: rgba(255, 255, 255, .55); }

.word-level__empty {
    font-size: .85rem;
    color: var(--faint);
}

.word-stats {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.word-stats__empty {
    margin-top: .75rem;
    font-size: .85rem;
    color: var(--faint);
}

.word-stats__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
    margin: .9rem 0 0;
}

.word-stats__item {
    padding: .7rem .85rem;
    border: 1px solid var(--line-2);
    background: var(--paper-2);
}

.word-stats__item dt {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--faint);
}

.word-stats__item dd {
    margin: .3rem 0 0;
    font-size: .88rem;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.word-stats__note {
    font-size: .78rem;
    font-weight: 400;
    color: var(--faint);
}


/* ============================================================
   WORD DETAIL
   ============================================================ */

.word-detail {
    max-width: 660px;
    margin: 0 auto;
    padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    transition: color .2s var(--ease);
}
.back-link:hover { color: var(--red); }

.word-detail__head {
    margin-top: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--line);
}

.word-detail .word-rank-detail {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--red);
}

.word-detail .word-hanzi {
    font-family: var(--zh);
    font-weight: 500;
    font-size: clamp(4rem, 15vw, 7.5rem);
    line-height: 1;
    margin-top: .75rem;
}

.word-detail .word-pinyin {
    margin-top: .8rem;
    font-size: 1.15rem;
    letter-spacing: .14em;
    color: var(--muted);
}

.word-detail .word-traditional {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--line);
}

.word-detail .label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--faint);
}

.word-detail .word-hanzi.traditional { font-size: 2rem; }

.word-detail .word-meaning-detail {
    padding: 1.5rem 0;
    display: grid;
    gap: .6rem;
}

.word-detail .word-meaning-detail span:last-child {
    font-size: 1.15rem;
    line-height: 1.65;
}

.word-detail .word-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem;
    margin-top: 1.5rem;
}

.word-detail__note {
    margin-top: 1.75rem;
    font-size: .85rem;
    color: var(--faint);
}

/* ============================================================
   AUTH
   ============================================================ */

.auth { padding-block: clamp(3rem, 9vw, 7rem); }

.auth__inner { display: flex; justify-content: center; }

.auth-card {
    width: min(420px, 100%);
    border: 1px solid var(--ink);
    padding: clamp(2rem, 5vw, 3rem);
}

.auth-card--center { text-align: center; }

.auth-card__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2rem, 4vw, 2.75rem);
    line-height: 1.05;
    margin-bottom: 1.75rem;
}

.auth-lead { color: var(--muted); margin-bottom: 1.5rem; }

.form-field { display: grid; gap: .5rem; margin-bottom: 1.35rem; }

.form-field label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--muted);
}

.form-field input {
    border: none;
    border-bottom: 1px solid var(--line-2);
    background: transparent;
    padding: .6rem 0;
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--ink);
    transition: border-color .2s var(--ease);
}
.form-field input:focus { outline: none; border-bottom-color: var(--ink); }

.form-errors {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    color: var(--red);
    font-size: .88rem;
}

.form-error {
    margin: 0;
    color: var(--red);
    font-size: .82rem;
    letter-spacing: .01em;
}

.btn--block { width: 100%; margin-top: .5rem; }

.auth-alt { margin-top: 1.5rem; font-size: .9rem; color: var(--muted); }
.auth-alt a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
    border-top: 1px solid var(--line);
    margin-top: auto;
    padding-block: 2.75rem;
    background: var(--paper);
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 2rem;
}

.site-footer__brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-footer__nav {
    display: flex;
    gap: 1.5rem;
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.site-footer__nav a { color: var(--muted); text-decoration: none; transition: color .2s var(--ease); }
.site-footer__nav a:hover { color: var(--ink); }

.site-footer__note {
    font-family: var(--zh);
    font-size: 13px;
    letter-spacing: .3em;
    color: var(--faint);
}

/* ---------- Motion ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .hero__grid {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
        gap: 2.5rem;
    }
}

@media (max-width: 820px) {
    .hero__grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .hero__stage { max-width: 420px; margin-inline: auto; }
    .hero__viewport { aspect-ratio: 1 / 1; min-height: 0; }
    .steps { grid-template-columns: 1fr; gap: 0; }
    .step { padding-block: 1.5rem; }
    .step + .step { border-top: 1px solid var(--line); }
    .features { grid-template-columns: 1fr; }
    .ladder { grid-template-columns: repeat(2, 1fr); }
    .rung { border-bottom: 1px solid var(--line-2); min-height: auto; }
    .rung:nth-child(2n) { border-right: none; }
    .rung--master { grid-column: 1 / -1; border-right: none; }
}

@media (max-width: 640px) {
    .site-header__inner { min-height: 64px; }
    .nav { gap: 1.1rem; letter-spacing: .1em; }
    .nav a:not(.btn), .nav__user { display: none; }
    .stats li { padding-right: 1.25rem; margin-right: 1.25rem; }
    .stats li + li { padding-left: 1.25rem; }
    .lex-controls { flex-direction: column; align-items: stretch; gap: .75rem; }
    .word-count { text-align: left; }
    .lexicon { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .word-card-link { min-height: 150px; padding: 1.1rem; }
    .feature { min-height: 15rem; }
    .feature__mark { width: 2.6rem; height: 2.6rem; right: 1rem; bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
