/* ============================================================
   Mandarun — games section
   Reuses the "Ink & Paper" tokens from minimal.css.
   ============================================================ */

/* ---------- Landing page ---------- */

.games-hero {
    border-bottom: 1px solid var(--line);
    padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.game-card {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: clamp(1.5rem, 3vw, 2.25rem);
    border: 1px solid var(--line-2);
    background: var(--paper);
}

.game-card--live { border-color: var(--ink); }
.game-card--soon { background: var(--paper-2); }

.game-card__head {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-card__mark {
    flex: none;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 1px solid var(--ink);
    font-family: var(--zh);
    font-size: 1.6rem;
    line-height: 1;
}

.game-card--live .game-card__mark { background: var(--ink); color: var(--paper); }
.game-card--soon .game-card__mark { border-style: dashed; border-color: var(--line-2); color: var(--faint); }

.game-card__headings { min-width: 0; }

.game-card__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.1;
}

.game-card__zh {
    font-family: var(--zh);
    color: var(--muted);
    font-size: 1rem;
    letter-spacing: .08em;
    margin-top: .25rem;
}

.game-card__text {
    color: var(--muted);
    line-height: 1.65;
    font-size: .95rem;
}

.game-card__meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.1rem;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--faint);
}

.game-card__actions { margin-top: auto; padding-top: .5rem; }

/* ---------- Quiz shell ---------- */

.quiz-page { padding-bottom: clamp(3rem, 7vw, 5rem); }

.quiz-top {
    border-bottom: 1px solid var(--line);
    background: var(--paper-2);
}

.quiz-top__inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    padding-block: 1.5rem 1.25rem;
}

.quiz-top__title { display: flex; flex-direction: column; gap: .35rem; }

.quiz-top__back {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
}
.quiz-top__back:hover { color: var(--red); }

.quiz-top__name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    line-height: 1;
}

.quiz-top__zh {
    font-family: var(--zh);
    color: var(--muted);
    letter-spacing: .12em;
    font-size: .95rem;
}

.quiz-stats { display: flex; gap: clamp(1.25rem, 4vw, 2.75rem); }

.quiz-stat { display: flex; flex-direction: column; gap: .15rem; text-align: right; }

.quiz-stat--clock { align-items: flex-end; }

.quiz-giveup {
    margin-top: .4rem;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line-2);
    padding: 0 0 .1rem;
    cursor: pointer;
    transition: color .18s var(--ease), border-color .18s var(--ease);
}

.quiz-giveup:hover { color: var(--red); border-color: var(--red); }
.quiz-giveup.is-armed { color: var(--red); border-color: var(--red); }

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

.quiz-stat__v {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.quiz-progress { height: 3px; background: var(--line); position: relative; }

.quiz-progress__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--jade);
    transition: width .45s var(--ease);
}

/* ---------- Layout ---------- */

.quiz-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(240px, .9fr);
    gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: start;
    padding-top: clamp(1.5rem, 3vw, 2.5rem);
}

/* ---------- Map ---------- */

.quiz-map {
    --map-line: #8a8278;        /* province outlines — dark enough to read */
    --map-fill: #f6f4ef;

    border: 1px solid var(--line-2);
    background: var(--paper);
    padding: clamp(.75rem, 2vw, 1.25rem);
}

.quiz-map__missing { color: var(--muted); padding: 2rem; text-align: center; }

/* ---------- The target ---------- */

.quiz-target {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem .9rem;
    margin-bottom: .6rem;
    border: 1px solid var(--line-2);
    background: var(--paper-2);
    max-width: 30rem;
}

.quiz-target__body { flex: 1 1 auto; min-width: 0; }

.quiz-target__label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--faint);
}

.quiz-target__name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.4rem, 3vw, 2.15rem);
    line-height: 1.15;
    margin-top: .1rem;
    color: var(--ink);
}

.quiz-target__meta {
    font-size: .78rem;
    color: var(--muted);
    margin-top: .2rem;
}

.quiz-arrow {
    flex: none;
    width: 2.3rem;
    height: 2.3rem;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-2);
    background: var(--paper);
    color: var(--ink);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: background .18s var(--ease), color .18s var(--ease),
                border-color .18s var(--ease);
}

.quiz-arrow:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.quiz-arrow:disabled { opacity: .3; cursor: default; }
.quiz-arrow:disabled:hover { background: var(--paper); color: var(--ink); border-color: var(--line-2); }

.quiz-message {
    min-height: 1.3rem;
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: .35rem;
}

.quiz-message--good { color: var(--jade); }
.quiz-message--bad { color: var(--red); }
.quiz-message--warn { color: var(--gold); }

.cn-map { display: block; width: 100%; height: auto; }

.cn-prov {
    fill: var(--map-fill);
    stroke: var(--map-line);
    stroke-width: 1.2;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    transition: fill .18s var(--ease), stroke .18s var(--ease);
}

.cn-prov:hover { fill: #ece8e0; }

.cn-prov.is-guessed {
    fill: var(--jade);
    stroke: #0a5c47;
}

.cn-prov.is-wrong { fill: var(--red); }

/* Marker for divisions that are a pixel or two wide (Macao): the shape
   itself cannot be seen, so it is shown as a small round territory. */
.cn-micro {
    fill: var(--map-fill);
    stroke: var(--map-line);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    transition: fill .18s var(--ease), stroke .18s var(--ease);
}

.cn-micro:hover { fill: #ece8e0; }

.cn-micro.is-guessed {
    fill: var(--jade);
    stroke: #0a5c47;
}

.cn-micro.is-wrong { fill: var(--red); }

.cn-labels { pointer-events: none; }

.cn-label {
    font-family: var(--zh);
    font-size: 15px;
    fill: var(--faint);
    text-anchor: middle;
    dominant-baseline: middle;
    opacity: 0;
    paint-order: stroke;
    stroke: var(--paper);
    stroke-width: 3px;
    stroke-linejoin: round;
    transition: opacity .2s var(--ease);
}

.cn-map--labels .cn-label { opacity: 1; }
.cn-label.is-guessed { opacity: 1; fill: #fff; stroke: var(--jade); }

/* English / Pinyin labels: latin glyphs are narrower than hanzi, so they
   run a size smaller to fit the same shapes.  The Chinese font is kept
   so the pinyin tone marks render in the same face as the hanzi labels. */
.cn-label--latin {
    font-size: 12px;
    letter-spacing: .02em;
}

/* ---------- Side panel ---------- */

.quiz-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 96px;
}

.quiz-controls {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.quiz-control { display: flex; flex-direction: column; gap: .35rem; }

.quiz-control__label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--faint);
}

.quiz-control__select {
    padding: .55rem .7rem;
    border: 1px solid var(--line-2);
    background: var(--paper);
    font-family: var(--sans);
    font-size: .9rem;
    color: var(--ink);
}

.quiz-toggle {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    font-size: .88rem;
    color: var(--muted);
}

.quiz-toggle input { position: absolute; opacity: 0; pointer-events: none; }

.quiz-toggle__box {
    width: 15px;
    height: 15px;
    border: 1px solid var(--line-2);
    flex: none;
    position: relative;
    transition: border-color .2s var(--ease), background .2s var(--ease);
}

.quiz-toggle input:checked + .quiz-toggle__box { background: var(--ink); border-color: var(--ink); }

.quiz-toggle input:checked + .quiz-toggle__box::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--paper);
}

.quiz-toggle input:focus-visible + .quiz-toggle__box { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Actions ---------- */

.quiz-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

.quiz-hint { font-size: .8rem; color: var(--faint); line-height: 1.6; }

.quiz-hint kbd {
    font-family: var(--sans);
    font-size: .72rem;
    border: 1px solid var(--line-2);
    padding: .05rem .3rem;
}

/* ---------- Results ---------- */

.quiz-result {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.quiz-result__panel {
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--paper);
    border: 1px solid var(--ink);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
}

.quiz-result__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2.5rem, 7vw, 4rem);
    line-height: 1;
}

.quiz-result__lede {
    color: var(--muted);
    margin-top: .5rem;
}

.quiz-result__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    border-top: 1px solid var(--line-2);
    border-left: 1px solid var(--line-2);
    margin: 1.5rem 0;
}

.quiz-result__stat {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: .9rem .6rem;
    border-right: 1px solid var(--line-2);
    border-bottom: 1px solid var(--line-2);
}

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

.quiz-result__stat b { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; }

.quiz-result__label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: .6rem;
}

.quiz-result__missed {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
}

.quiz-result__missed li {
    display: inline-flex;
    align-items: baseline;
    gap: .4rem;
    border: 1px solid var(--line-2);
    padding: .3rem .55rem;
}

.quiz-result__missed b { font-family: var(--zh); font-weight: 500; font-size: .9rem; }
.quiz-result__missed span { font-size: .72rem; color: var(--muted); }

.quiz-result__record { font-size: .82rem; color: var(--muted); margin-bottom: 1rem; }

.quiz-result__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---------- The Daily Three ---------- */

.dt-shell { margin-top: clamp(2rem, 5vw, 3.5rem); }

.dt-back {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2em;
    text-decoration: none;
    text-transform: uppercase;
}

.dt-back:hover { color: var(--red); }

.dt-title {
    font-family: var(--serif);
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    font-weight: 500;
    line-height: 1.2;
}

.dt-date {
    color: var(--faint);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.dt-topstats {
    display: flex;
    gap: clamp(1.25rem, 4vw, 2.75rem);
}

.dt-shell .quiz-card .speak-btn { margin-bottom: .5rem; }

.dt-shell .quiz-card .speak-btn:not(.speak-btn--big) {
    position: relative;
}

.dt-shell .quiz-card .speak-btn:not(.speak-btn--big)::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
}

.dt-shell .quiz-card__meaning {
    max-width: 42rem;
    margin: 1.1rem auto 0;
    font-size: clamp(1.15rem, 2.6vw, 1.5rem);
    line-height: 1.45;
}

.dt-shell .quiz-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.dt-shell .btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
}

.dt-shell .btn-primary:disabled:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.dt-feedback {
    display: none;
    margin: 1rem 0 0;
    padding: .85rem 1rem;
    border-left: 3px solid var(--line-2);
    background: var(--paper);
    text-align: left;
}

.dt-feedback.is-good {
    display: block;
    border-color: var(--jade);
    background: rgba(14, 122, 95, .07);
}

.dt-feedback.is-bad {
    display: block;
    border-color: var(--red);
    background: rgba(200, 16, 46, .06);
}

.dt-feedback__verdict {
    display: block;
    margin-bottom: .2rem;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.dt-feedback.is-good .dt-feedback__verdict { color: var(--jade); }
.dt-feedback.is-bad .dt-feedback__verdict { color: var(--red); }

.dt-feedback__reveal {
    color: var(--ink-2);
    font-size: .9rem;
    line-height: 1.5;
}

.quiz-option:disabled { cursor: default; }

.quiz-option:disabled:hover {
    background: var(--paper);
    color: var(--ink);
}

.quiz-option.is-selected,
.quiz-option.is-selected:hover {
    background: var(--ink);
    box-shadow: inset 0 0 0 2px var(--red);
    color: var(--paper);
}

.quiz-option.is-correct,
.quiz-option.is-correct:disabled:hover {
    background: rgba(14, 122, 95, .08);
    box-shadow: inset 0 0 0 1px var(--jade);
    color: var(--ink);
}

.quiz-option.is-wrong,
.quiz-option.is-wrong:disabled:hover {
    background: rgba(200, 16, 46, .07);
    box-shadow: inset 0 0 0 1px var(--red);
    color: var(--ink);
}

.dt-review {
    list-style: none;
    margin: 1.5rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    text-align: left;
}

.dt-review__item {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr);
    gap: .5rem .75rem;
    padding: .8rem .9rem;
    border: 1px solid var(--line-2);
}

.dt-review__mark {
    grid-row: 1 / span 2;
    width: 1.4rem;
    height: 1.4rem;
    display: grid;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: .8rem;
}

.dt-review__item.is-correct .dt-review__mark { color: var(--jade); }
.dt-review__item.is-wrong .dt-review__mark { color: var(--red); }

.dt-review__word {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.dt-review__word b {
    font-family: var(--zh);
    font-size: 1.4rem;
    font-weight: 500;
}

.dt-review__word span {
    color: var(--muted);
    font-family: var(--serif);
    font-size: 1rem;
    letter-spacing: .08em;
}

.dt-review__word .speak-btn {
    width: 1.6rem;
    height: 1.6rem;
    font-size: .55rem;
}

.dt-review__meaning {
    grid-column: 2;
    margin: 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.5;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .quiz-layout { grid-template-columns: 1fr; }
    .quiz-side { position: static; }
    .quiz-stats { gap: 1.25rem; }
    .quiz-stat { text-align: left; }
}

@media (max-width: 620px) {
    .dt-shell .quiz-options { grid-template-columns: 1fr; }
}
