:root {
    /* "Riso Exam Paper" — warm bone paper, cobalt + vermillion duotone, brutalist hard edges */
    --bg: #e7e0cf;
    --bg2: #f0e9d8;
    --card: #fbf7ee;
    --card2: #efe7d4;
    --ink: #17160f;
    --muted: #6c6555;
    --line: #17160f;
    --brand: #17160f;
    --brand2: #17160f;
    --accent: #fb4d1e;
    --easy: #1c9a52;
    --medium: #c5841a;
    --hard: #e23a1d;
    --good: #1c9a52;
    --bad: #d62f1f;
    --goodbg: #e6f1e8;
    --badbg: #fbe6e1;
    --shadow: 4px 4px 0 var(--ink);
    --r: 9px;
    --font-body:
        "Avenir Next", "Avenir", "Segoe UI", system-ui, -apple-system, Roboto,
        sans-serif;
    --font-head:
        "Futura", "Avenir Next Condensed", "Avenir Next", "Arial Black",
        system-ui, sans-serif;
    --font-mono: "Courier New", "Courier", ui-monospace, Menlo, monospace;
}
* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
}
body {
    font-family: var(--font-body);
    color: var(--ink);
    line-height: 1.55;
    min-height: 100vh;
    background-color: var(--bg);
    background-image:
        linear-gradient(rgba(23, 22, 15, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 22, 15, 0.045) 1px, transparent 1px);
    background-size: 27px 27px;
}
a {
    color: var(--brand);
}
::selection {
    background: #ffd83e;
    color: var(--ink);
}
.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 18px 80px;
}

header.app {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 0 18px;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 24px;
}
.logo {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    flex: 0 0 auto;
    background: var(--accent);
    border: 2px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 17px;
    color: #fff;
    font-family: var(--font-head);
    letter-spacing: 0.5px;
    transform: rotate(-4deg);
}
.title h1 {
    font-family: var(--font-head);
    font-size: 22px;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.2px;
}
.title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}
.spacer {
    flex: 1;
}
.countdown {
    text-align: right;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}
.countdown b {
    display: block;
    font-size: 26px;
    color: var(--accent);
    font-weight: 800;
    line-height: 1;
    font-family: var(--font-head);
}

.btn {
    appearance: none;
    border: 2px solid var(--ink);
    background: var(--card2);
    color: var(--ink);
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 0.1s,
        box-shadow 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 2px 2px 0 var(--ink);
    font-family: var(--font-body);
}
.btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--ink);
}
.btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--ink);
}
.btn.primary {
    background: var(--brand);
    color: #fff;
}
.btn.ghost {
    background: transparent;
    box-shadow: none;
    border-width: 1.5px;
}
.btn.ghost:hover {
    background: var(--card2);
    box-shadow: 2px 2px 0 var(--ink);
}
.btn.sm {
    padding: 6px 11px;
    font-size: 13px;
}
.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: 2px 2px 0 var(--ink);
}
.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.grid {
    display: grid;
    gap: 16px;
}

.modes {
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 28px;
}
@media (max-width: 900px) {
    .modes {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 560px) {
    .modes {
        grid-template-columns: repeat(2, 1fr);
    }
}
.mode {
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: var(--r);
    padding: 18px 16px;
    cursor: pointer;
    transition:
        transform 0.12s,
        box-shadow 0.12s;
    position: relative;
    box-shadow: 4px 4px 0 var(--ink);
}
.mode:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--accent);
}
.mode .ic {
    font-size: 28px;
    line-height: 1;
}
.mode h3 {
    margin: 12px 0 4px;
    font-size: 16px;
    font-family: var(--font-head);
    font-weight: 800;
    letter-spacing: -0.2px;
}
.mode p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.section-h {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 16px;
}
.section-h h2 {
    font-family: var(--font-head);
    font-size: 14px;
    margin: 0;
    color: var(--ink);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.section-h .line {
    flex: 1;
    height: 2px;
    background: var(--ink);
}

.stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.stat {
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 96px;
    box-shadow: 3px 3px 0 var(--ink);
}
.stat b {
    display: block;
    font-size: 22px;
    font-family: var(--font-head);
    font-weight: 800;
}
.stat span {
    color: var(--muted);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.chapters {
    grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 820px) {
    .chapters {
        grid-template-columns: 1fr;
    }
}
.chapter {
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 10px;
    padding: 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 11px;
    box-shadow: 3px 3px 0 var(--ink);
    transition:
        transform 0.12s,
        box-shadow 0.12s;
}
.chapter:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--brand);
}
.chapter .top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.chapter .num {
    width: 36px;
    height: 36px;
    border-radius: 7px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-weight: 800;
    background: var(--ink);
    color: var(--card);
    border: 2px solid var(--ink);
    font-family: var(--font-head);
}
.chapter h4 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 800;
    font-family: var(--font-head);
    letter-spacing: -0.1px;
}
.chapter .meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
    font-weight: 600;
}
.chapter .bar {
    height: 10px;
    background: var(--bg2);
    border-radius: 0;
    overflow: hidden;
    border: 2px solid var(--ink);
}
.chapter .bar i {
    display: block;
    height: 100%;
    background: var(--brand);
    width: 0%;
}
.chapter .acts {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
}
.chapter .acts .pct {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1.5px solid var(--ink);
}
.badge.easy {
    color: #0f5f31;
    background: #d8efdf;
}
.badge.medium {
    color: #7a5208;
    background: #fbeccb;
}
.badge.hard {
    color: #8f2113;
    background: #fbdcd4;
}
.badge.type {
    color: #142a99;
    background: #dde2ff;
}
.badge.src {
    color: #9c2f12;
    background: #ffe1d6;
}
.badge.topic {
    color: var(--ink);
    background: var(--card2);
}

.study-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.study-top h2 {
    font-family: var(--font-head);
    font-size: 18px;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.2px;
}
.progress {
    flex: 1;
    min-width: 160px;
    height: 12px;
    background: var(--bg2);
    border: 2px solid var(--ink);
    border-radius: 0;
    overflow: hidden;
}
.progress i {
    display: block;
    height: 100%;
    background: var(--brand);
    width: 0%;
}
.counter {
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-family: var(--font-mono);
}

/* flashcard as a ruled index card */
.fc-scene {
    perspective: 1600px;
    margin: 0 auto;
    max-width: 760px;
}
.fc {
    position: relative;
    display: grid;
    width: 100%;
    min-height: 340px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.fc.flipped {
    transform: rotateY(180deg);
}
.fc .face {
    position: relative;
    grid-area: 1 / 1;
    backface-visibility: hidden;
    border-radius: 12px;
    border: 2px solid var(--ink);
    padding: 30px 34px;
    display: flex;
    flex-direction: column;
    box-shadow: 7px 7px 0 var(--ink);
    overflow: hidden;
}
.fc .front {
    background-color: #fdf8ea;
    background-image: repeating-linear-gradient(
        transparent 0 32px,
        rgba(43, 70, 255, 0.1) 32px 33px
    );
}
.fc .front::before {
    content: "";
    position: absolute;
    left: 52px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(251, 77, 30, 0.5);
}
.fc .front::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 58px;
    height: 2px;
    background: rgba(251, 77, 30, 0.4);
}
.fc .back {
    transform: rotateY(180deg);
    background: #eef0ff;
    background-image: repeating-linear-gradient(
        transparent 0 32px,
        rgba(23, 22, 15, 0.06) 32px 33px
    );
}
.fc .face .tags {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}
.fc .qa {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 1;
}
.fc .qa .txt {
    font-size: 21px;
    font-weight: 700;
    max-width: 60ch;
    white-space: pre-wrap;
    font-family: var(--font-head);
    letter-spacing: -0.2px;
}
.fc .back .qa .txt {
    font-size: 18px;
    font-weight: 600;
    text-align: left;
    line-height: 1.6;
    font-family: var(--font-body);
}
.fc .label {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 800;
    font-family: var(--font-mono);
    z-index: 1;
}
.fc .hint {
    text-align: center;
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
    font-weight: 600;
}
.fc .expl {
    margin-top: 14px;
    padding: 12px 14px;
    background: #fff;
    border: 2px solid var(--ink);
    border-radius: 9px;
    color: var(--ink);
    font-size: 13.5px;
    white-space: pre-wrap;
    position: relative;
    z-index: 1;
}
.fc .expl b {
    color: var(--accent);
}
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0 8px;
    flex-wrap: wrap;
}
.iconbtn {
    width: 48px;
    height: 48px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 20px;
    border: 2px solid var(--ink);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    transition:
        transform 0.1s,
        box-shadow 0.1s;
    box-shadow: 3px 3px 0 var(--ink);
}
.iconbtn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--ink);
}
.iconbtn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--ink);
}
.iconbtn.big {
    width: 60px;
    height: 60px;
    font-size: 24px;
    background: var(--brand);
    color: #fff;
}
.iconbtn.on {
    background: #ffd83e;
    color: var(--ink);
}
.iconbtn.known {
    background: var(--good);
    color: #fff;
}
.toolbar {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12.5px;
    align-items: center;
    font-weight: 600;
}
.toolbar label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
select,
input[type="text"] {
    background: var(--card);
    border: 2px solid var(--ink);
    color: var(--ink);
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font-body);
}

.qcard {
    max-width: 760px;
    margin: 0 auto;
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 12px;
    padding: 26px;
    box-shadow: 6px 6px 0 var(--ink);
}
.qcard .tags {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.qcard .q {
    font-size: 20px;
    font-weight: 700;
    white-space: pre-wrap;
    font-family: var(--font-head);
    letter-spacing: -0.2px;
}
.opts {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}
.opt {
    text-align: left;
    border: 2px solid var(--ink);
    background: var(--card);
    color: var(--ink);
    padding: 12px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.1s;
    display: flex;
    gap: 11px;
    align-items: center;
    font-weight: 600;
    box-shadow: 2px 2px 0 var(--ink);
}
.opt:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--ink);
}
.opt .k {
    width: 25px;
    height: 25px;
    border-radius: 5px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background: var(--card2);
    border: 1.5px solid var(--ink);
    font-size: 12.5px;
    font-weight: 800;
    color: var(--ink);
    font-family: var(--font-mono);
}
.opt.sel {
    background: #dde2ff;
}
.opt.correct {
    background: var(--goodbg);
    border-color: var(--good);
    box-shadow: 2px 2px 0 var(--good);
}
.opt.correct .k {
    background: var(--good);
    color: #fff;
    border-color: var(--ink);
}
.opt.wrong {
    background: var(--badbg);
    border-color: var(--bad);
    box-shadow: 2px 2px 0 var(--bad);
}
.opt.wrong .k {
    background: var(--bad);
    color: #fff;
    border-color: var(--ink);
}
.opt.muteline {
    opacity: 0.7;
}
.reveal {
    margin-top: 18px;
    padding: 16px;
    border-radius: 10px;
    border: 2px solid var(--ink);
    background: #fff;
    white-space: pre-wrap;
    font-size: 15px;
    line-height: 1.6;
}
.reveal .lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    font-weight: 800;
    margin-bottom: 6px;
    font-family: var(--font-mono);
}
.expl2 {
    margin-top: 12px;
    color: var(--muted);
    font-size: 13.5px;
}
.feedback {
    margin-top: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-head);
    font-size: 16px;
}
.feedback.good {
    color: var(--good);
}
.feedback.bad {
    color: var(--bad);
}
.selfgrade {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.blist {
    display: grid;
    gap: 10px;
}
.bitem {
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 2px 2px 0 var(--ink);
}
.bitem .bq {
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-family: var(--font-body);
}
.bitem .bq .chev {
    color: var(--accent);
    transition: 0.2s;
    font-weight: 800;
}
.bitem.open .chev {
    transform: rotate(90deg);
}
.bitem .ba {
    display: none;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 2px solid var(--ink);
    white-space: pre-wrap;
    color: var(--ink);
}
.bitem.open .ba {
    display: block;
}
.bitem .btags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 9px;
}
.bitem .opt-line {
    margin: 4px 0 0 2px;
    color: var(--muted);
    font-size: 13.5px;
}
.bitem .opt-line.cor {
    color: var(--good);
    font-weight: 700;
}

.result {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}
.score-ring {
    font-size: 72px;
    font-weight: 800;
    margin: 8px 0;
    font-family: var(--font-head);
}
.score-sub {
    color: var(--muted);
    margin-bottom: 20px;
    font-weight: 600;
}
.rev-item {
    text-align: left;
    background: var(--card);
    border: 2px solid var(--ink);
    border-left-width: 7px;
    border-radius: 9px;
    padding: 13px 15px;
    margin-bottom: 10px;
    box-shadow: 2px 2px 0 var(--ink);
}
.rev-item.ok {
    border-left-color: var(--good);
}
.rev-item.no {
    border-left-color: var(--bad);
}
.rev-item .rq {
    font-weight: 700;
    margin-bottom: 6px;
}
.rev-item .ra {
    font-size: 13.5px;
    color: var(--muted);
    white-space: pre-wrap;
}
.empty {
    color: var(--muted);
    text-align: center;
    padding: 50px;
    font-weight: 600;
}
.kbd {
    display: inline-block;
    border: 1.5px solid var(--ink);
    background: var(--card);
    border-radius: 5px;
    padding: 1px 7px;
    font-size: 12px;
    color: var(--ink);
    font-family: var(--font-mono);
    box-shadow: 1px 1px 0 var(--ink);
}
.hide {
    display: none !important;
}
footer {
    margin-top: 44px;
    padding-top: 16px;
    border-top: 2px solid var(--ink);
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

/* lessons */
.lesson {
    max-width: 820px;
}
.lsec {
    margin: 0 0 28px;
}
.lh {
    font-family: var(--font-head);
    font-size: 18px;
    margin: 0 0 12px;
    color: var(--ink);
    font-weight: 800;
    border-left: 5px solid var(--accent);
    padding-left: 12px;
    letter-spacing: -0.2px;
}
.lp {
    margin: 0 0 11px;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.7;
    max-width: 74ch;
}
.lp code,
.lformula code,
.lnote code,
.lex-q code,
.lex-step code,
.lfline code {
    background: var(--card2);
    border: 1px solid var(--ink);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: #142a99;
}
.lformula {
    background: #fff;
    border: 2px solid var(--ink);
    border-left: 6px solid var(--brand);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 0 12px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--ink);
    white-space: pre-wrap;
    overflow-x: auto;
    box-shadow: 3px 3px 0 var(--ink);
}
.lnote {
    background: #fff7d6;
    border: 2px solid var(--ink);
    border-radius: 8px;
    padding: 11px 14px;
    margin: 0 0 12px;
    font-size: 13.5px;
    color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
}
.lnote b {
    color: var(--accent);
}
.ldiagram {
    background: #fff;
    border: 2px solid var(--ink);
    border-radius: 12px;
    padding: 18px;
    margin: 8px 0 14px;
    box-shadow: 3px 3px 0 var(--ink);
}
.lexample {
    background: #fff;
    border: 2px solid var(--ink);
    border-left: 6px solid var(--medium);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 8px 0 14px;
    box-shadow: 3px 3px 0 var(--ink);
}
.lex-h {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--medium);
    margin-bottom: 8px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-weight: 700;
}
.lex-q {
    font-size: 14.5px;
    color: var(--ink);
    line-height: 1.6;
    font-weight: 600;
}
.lex-sol {
    margin-top: 12px;
}
.lex-step {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 8px 0;
    font-size: 14px;
    color: var(--ink);
    line-height: 1.55;
}
.lex-n {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ink);
    border: none;
    display: grid;
    place-items: center;
    font-size: 11px;
    color: #fff;
    font-weight: 800;
    font-family: var(--font-mono);
}
.lex-a {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 2px dashed var(--ink);
    font-size: 14.5px;
    color: var(--ink);
}
.lex-a b {
    color: var(--accent);
}
.lformbox {
    max-width: 820px;
    background: var(--ink);
    color: #f3eee0;
    border: 2px solid var(--ink);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 8px 0 18px;
    box-shadow: 4px 4px 0 var(--accent);
}
.lfh {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 10px;
}
.lfline {
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: #ffd9c9;
    padding: 6px 0;
    border-bottom: 1px dashed #5b5446;
}
.lfline:last-child {
    border-bottom: none;
}
.lpractice {
    max-width: 820px;
    margin: 14px 0 0;
    padding-top: 20px;
    border-top: 2px solid var(--ink);
}

/* ===== logo + user chip + footer brand ===== */
.logo {
    background: #fdf8ea;
    padding: 5px;
}
.logo svg {
    width: 100%;
    height: 100%;
    display: block;
}
#userarea {
    display: flex;
    align-items: center;
    gap: 10px;
}
.userchip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--card2);
    border: 2px solid var(--ink);
    border-radius: 20px;
    padding: 5px 12px;
    font-weight: 800;
    font-size: 13px;
    box-shadow: 2px 2px 0 var(--ink);
}
.udot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--good);
    display: inline-block;
}
.brand-foot {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.brand-foot a {
    font-weight: 800;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 2px solid var(--accent);
}
.foot-sloth {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

/* ===== login ===== */
.authwrap {
    max-width: 380px;
    margin: 6vh auto 0;
}
.authcard {
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 14px;
    box-shadow: 6px 6px 0 var(--ink);
    padding: 26px;
}
.auth-h {
    font-family: var(--font-head);
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
}
.auth-sub {
    color: var(--muted);
    font-size: 13.5px;
    margin: 0 0 18px;
    font-weight: 600;
}
.authcard input {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    padding: 11px 13px;
    font-size: 15px;
}
.auth-err {
    background: var(--badbg);
    border: 2px solid var(--bad);
    color: #8f2113;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}
.auth-toggle {
    margin-top: 14px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}
.auth-toggle a {
    color: var(--brand);
    font-weight: 800;
}

/* ===== leaderboard ===== */
.lb-podium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 18px 0 22px;
}
@media (max-width: 620px) {
    .lb-podium {
        grid-template-columns: 1fr;
    }
}
.lb-spot {
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 12px;
    box-shadow: 4px 4px 0 var(--ink);
    padding: 18px 14px;
    text-align: center;
}
.lb-spot.rank1 {
    box-shadow: 5px 5px 0 #caa219;
    border-color: #caa219;
}
.lb-spot.rank2 {
    box-shadow: 5px 5px 0 #9aa0a6;
}
.lb-spot.rank3 {
    box-shadow: 5px 5px 0 #c08457;
}
.lb-spot.me {
    outline: 3px dashed var(--brand);
    outline-offset: 3px;
}
.lb-medal {
    font-size: 30px;
}
.lb-name {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 16px;
    margin: 6px 0 8px;
    word-break: break-word;
}
.lb-big {
    font-family: var(--font-head);
    font-size: 30px;
    font-weight: 800;
    color: var(--brand);
}
.lb-big span {
    display: block;
    font-size: 11px;
    color: var(--muted);
    font-family: var(--font-body);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.lb-small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}
.lb-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lb-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 9px;
    padding: 10px 14px;
    box-shadow: 2px 2px 0 var(--ink);
}
.lb-row.me {
    background: #fff4d6;
}
.lb-rank {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 18px;
    min-width: 28px;
    color: var(--muted);
}
.lb-uname {
    flex: 1;
    font-weight: 800;
}
.lb-uname .you {
    font-size: 10px;
    background: var(--brand);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    margin-left: 6px;
    vertical-align: middle;
}
.lb-cell {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    min-width: 84px;
    text-align: right;
}
.lb-cell b {
    color: var(--ink);
    font-family: var(--font-head);
    font-size: 16px;
}

/* ===== lesson links on fail ===== */
.lesson-tip {
    margin-top: 14px;
    padding: 11px 13px;
    background: #fff4d6;
    border: 2px solid var(--ink);
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rev-lesson {
    margin-top: 8px;
}

/* ===== playgrounds ===== */
.lwidget {
    margin: 8px 0 16px;
}
.pg {
    background: #fff;
    border: 2px solid var(--ink);
    border-radius: 12px;
    box-shadow: 3px 3px 0 var(--ink);
    overflow: hidden;
}
.pg-h {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--ink);
    color: #f3eee0;
}
.pg-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--accent);
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
}
.pg-title {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 14px;
}
.pg-sub {
    color: #bdb6a5;
    font-size: 12px;
    margin-left: auto;
}
.pg-body {
    padding: 16px;
}
.pg-caption {
    color: var(--muted);
    font-size: 12px;
    margin: 8px 0;
    font-weight: 600;
}
.pg-status {
    margin-top: 10px;
    font-size: 13.5px;
    color: var(--ink);
    font-weight: 600;
}
.pg-ctrls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 14px;
}
.pg-ctrls.col {
    flex-direction: column;
    align-items: stretch;
}
.pg-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
}
.pg-slabel {
    min-width: 92px;
}
.pg-snum {
    font-family: var(--font-mono);
    color: var(--ink);
    min-width: 34px;
    text-align: right;
}
.pg input[type="range"] {
    flex: 1;
    accent-color: var(--brand);
    height: 6px;
}
.pg-bars {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.pg-brow {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pg-blabel {
    min-width: 118px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    font-family: var(--font-mono);
}
.pg-brow.kept .pg-blabel {
    color: var(--ink);
}
.pg-btrack {
    flex: 1;
    height: 18px;
    background: var(--bg2);
    border: 1.5px solid var(--ink);
    border-radius: 5px;
    overflow: hidden;
}
.pg-bfill {
    height: 100%;
    transition: width 0.25s;
}
.pg-num {
    min-width: 104px;
    text-align: right;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--ink);
}
.pg-eq {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    background: var(--bg2);
    border: 1.5px solid var(--ink);
    border-radius: 7px;
    padding: 9px 12px;
}
.pg-eq b {
    color: var(--brand);
}
.pg-segwrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pg-seg {
    display: inline-flex;
    border: 2px solid var(--ink);
    border-radius: 8px;
    overflow: hidden;
}
.pg-seg button {
    border: none;
    background: var(--card);
    color: var(--ink);
    padding: 7px 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    border-right: 2px solid var(--ink);
}
.pg-seg button:last-child {
    border-right: none;
}
.pg-seg button.on {
    background: var(--brand);
    color: #fff;
}
.pg-extra {
    margin-top: 4px;
}
.pg-pick {
    font-family: var(--font-head);
    font-size: 16px;
    color: var(--accent);
    font-weight: 800;
    min-width: 60px;
}
.pg-tally {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.pg-trow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.pg-tk {
    font-family: var(--font-mono);
    min-width: 60px;
}
.pg-tbar {
    height: 12px;
    background: var(--accent);
    border: 1px solid var(--ink);
    border-radius: 3px;
    min-width: 2px;
}
.pg-tn {
    font-family: var(--font-mono);
    color: var(--muted);
}
.pg-op {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 800;
}
.tokrow {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}
.tok {
    padding: 7px 12px;
    border: 2px solid var(--ink);
    border-radius: 8px;
    background: var(--card);
    font-weight: 700;
    font-size: 14px;
    transition: 0.15s;
}
.tok.cur {
    background: var(--brand);
    color: #fff;
    transform: translateY(-2px);
}
.tok.done {
    opacity: 0.5;
}
.hcells {
    display: flex;
    gap: 6px;
    margin: 6px 0;
}
.hcell {
    flex: 1;
    height: 34px;
    border: 2px solid var(--ink);
    border-radius: 6px;
    background: #fff;
    transition: background 0.3s;
}
.pg-canvaswrap {
    background: var(--bg2);
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    padding: 8px;
}

/* ===== versus (multiplayer) ===== */
.vs-wait {
    text-align: center;
    padding: 40px 0;
}
.vs-spin {
    font-size: 46px;
    animation: vspin 1.4s ease-in-out infinite;
}
@keyframes vspin {
    0%,
    100% {
        transform: rotate(-12deg);
    }
    50% {
        transform: rotate(12deg);
    }
}
.vs-lobby {
    display: flex;
    justify-content: center;
    margin: 10px 0 16px;
}
.vs-pinwrap {
    background: var(--ink);
    color: #fbf7ee;
    border: 2px solid var(--ink);
    border-radius: 14px;
    box-shadow: 5px 5px 0 var(--accent);
    padding: 18px 30px;
    text-align: center;
}
.vs-pinlabel {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 3px;
    color: #bdb6a5;
}
.vs-pin {
    font-family: var(--font-head);
    font-size: 52px;
    font-weight: 800;
    letter-spacing: 10px;
    line-height: 1.1;
}
.vs-meta {
    font-size: 12px;
    color: #bdb6a5;
    font-weight: 700;
    margin-top: 4px;
}
.vs-players {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.vs-player {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 24px;
    padding: 6px 14px 6px 6px;
    font-weight: 800;
    box-shadow: 2px 2px 0 var(--ink);
}
.vs-player.me {
    background: #fff4d6;
}
.vs-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-head);
}
.vs-tag {
    font-size: 10px;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
}
.vs-waitmsg {
    color: var(--muted);
    font-weight: 700;
    align-self: center;
}
.vs-qtop {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-weight: 800;
}
.vs-qnum {
    font-family: var(--font-head);
    font-size: 16px;
}
.vs-topic {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.vs-prog {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
    font-family: var(--font-mono);
}
.vs-timer {
    height: 14px;
    background: var(--bg2);
    border: 2px solid var(--ink);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
}
.vs-timerfill {
    height: 100%;
    width: 100%;
    background: var(--accent);
    transition: width 0.1s linear;
}
.vs-question {
    font-family: var(--font-head);
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 12px;
    box-shadow: 4px 4px 0 var(--ink);
    padding: 24px 18px;
    margin-bottom: 16px;
}
.vs-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 560px) {
    .vs-opts {
        grid-template-columns: 1fr;
    }
}
.vs-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--ink);
    border-radius: 12px;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--ink);
    transition:
        transform 0.1s,
        box-shadow 0.1s;
    text-align: left;
}
.vs-opt:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--ink);
}
.vs-opt .vs-shape {
    font-size: 20px;
}
.vs-opt .vs-otext {
    flex: 1;
}
.vs-red {
    background: #e23a1d;
}
.vs-blue {
    background: #2b46ff;
}
.vs-amber {
    background: #c5841a;
}
.vs-green {
    background: #1c9a52;
}
.vs-opt.dim {
    opacity: 0.4;
}
.vs-opt.picked {
    outline: 4px solid var(--ink);
    outline-offset: 2px;
}
.vs-opt.vs-faded {
    opacity: 0.35;
    cursor: default;
}
.vs-opt.vs-correct {
    cursor: default;
    outline: 4px solid #0f5f31;
    outline-offset: 2px;
}
.vs-check {
    margin-left: auto;
    font-size: 20px;
}
.vs-locked {
    text-align: center;
    margin-top: 14px;
    font-weight: 800;
    color: var(--good);
}
.vs-myresult {
    text-align: center;
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 800;
    margin: 14px 0;
    padding: 12px;
    border: 2px solid var(--ink);
    border-radius: 10px;
}
.vs-myresult.good {
    background: var(--goodbg);
    color: var(--good);
}
.vs-myresult.bad {
    background: var(--badbg);
    color: var(--bad);
}
.vs-next {
    text-align: center;
    color: var(--muted);
    font-weight: 700;
    margin-top: 14px;
}
.vs-win {
    text-align: center;
    margin: 10px 0;
}
.vs-trophy {
    font-size: 54px;
}
.vs-win h2 {
    font-family: var(--font-head);
    font-size: 28px;
    margin: 4px 0;
}

/* ===== home hero ===== */
.home-hero{position:relative;display:grid;grid-template-columns:minmax(0,5fr) minmax(0,7fr);align-items:stretch;gap:32px;background:var(--card);border:2px solid var(--ink);border-radius:16px;box-shadow:6px 6px 0 var(--ink);padding:24px 28px;margin:0 0 22px;overflow:hidden}
.home-hero::before{content:"";position:absolute;inset:0;background-image:linear-gradient(rgba(23,22,15,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(23,22,15,.05) 1px,transparent 1px);background-size:18px 18px;pointer-events:none}
.home-hero>*{position:relative}
.hh-left{min-width:0;display:flex;flex-direction:column;justify-content:center}
.hh-right{min-width:0;display:flex;flex-direction:column;justify-content:center;gap:14px;border-left:2px dashed var(--line);padding-left:32px}
.hh-stats-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.hh-stats-label{font-family:var(--font-head);font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:1.6px;color:var(--muted)}
.hh-stats-pct{font-family:var(--font-head);font-size:13px;font-weight:800;color:var(--accent);letter-spacing:.4px}
.hh-bar{height:10px;background:var(--card2);border:2px solid var(--ink);border-radius:6px;overflow:hidden;box-shadow:inset 2px 2px 0 rgba(23,22,15,.08)}
.hh-bar i{display:block;height:100%;background:repeating-linear-gradient(45deg,var(--accent) 0 8px,#e44417 8px 16px);transition:width .5s ease}
.hh-stats{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.hh-stat{position:relative;display:flex;align-items:center;gap:12px;background:var(--card2);border:2px solid var(--ink);border-radius:10px;padding:12px 14px;box-shadow:3px 3px 0 var(--ink);min-width:0;overflow:hidden;grid-column:span 2}
.hh-stat:nth-child(4),.hh-stat:nth-child(5){grid-column:span 3}
.hh-stat.clickable{cursor:pointer;transition:transform .08s ease,box-shadow .08s ease}
.hh-stat.clickable:hover{transform:translate(-2px,-2px);box-shadow:5px 5px 0 var(--ink)}
.hh-stat.clickable:active{transform:translate(1px,1px);box-shadow:2px 2px 0 var(--ink)}
.hh-stat.clickable:focus-visible{outline:none;box-shadow:5px 5px 0 var(--ink);transform:translate(-2px,-2px)}
.hh-stat-ic{flex:0 0 auto;width:38px;height:38px;border-radius:8px;background:var(--card);border:2px solid var(--ink);display:grid;place-items:center;font-family:var(--font-head);font-weight:800;font-size:18px;color:var(--ink)}
.hh-stat-body{min-width:0;flex:1;line-height:1.1;overflow:hidden}
.hh-stat-val{font-family:var(--font-head);font-size:22px;font-weight:800;letter-spacing:-.3px;line-height:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hh-stat-lbl{font-family:var(--font-head);font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.9px;color:var(--muted);margin-top:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hh-stat-sub{font-size:11px;font-weight:600;color:var(--muted);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hh-ach{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:4px;padding-top:12px;border-top:2px dashed var(--line)}
.hh-ach-lbl{font-family:var(--font-head);font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:1.4px;color:var(--muted);flex:0 0 auto}
.hh-ach-list{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.hh-ach-b{position:relative;display:inline-grid;place-items:center;width:32px;height:32px;background:var(--card2);border:2px solid var(--ink);border-radius:8px;font-size:16px;box-shadow:2px 2px 0 var(--ink)}
.hh-ach-x{position:absolute;right:-6px;bottom:-6px;background:var(--accent);color:var(--card);border:2px solid var(--ink);border-radius:10px;font-family:var(--font-head);font-weight:800;font-size:10px;padding:0 4px;line-height:14px;min-width:18px;text-align:center}
.hh-ach-empty{font-size:12px;font-weight:600;color:var(--muted);font-style:italic}
.hh-greet{font-family:var(--font-head);font-size:32px;font-weight:800;margin:0 0 10px;letter-spacing:-.5px;line-height:1.1}
.hh-count{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin-top:4px}
.hh-count-num{font-family:var(--font-head);font-size:96px;font-weight:800;color:var(--card);line-height:.9;letter-spacing:-3px;background:var(--accent);border:3px solid var(--ink);border-radius:18px;padding:8px 22px 12px;box-shadow:6px 6px 0 var(--ink);text-shadow:2px 2px 0 rgba(23,22,15,.35);transform:rotate(-2deg);display:inline-block}
.hh-count-lbl{font-family:var(--font-head);font-size:20px;font-weight:800;text-transform:uppercase;letter-spacing:2px;color:var(--ink);line-height:1.15;max-width:160px}
.hh-count-lbl b{color:var(--accent)}
.hh-tag{margin-top:16px;display:inline-block;font-family:var(--font-head);font-weight:800;font-size:14px;letter-spacing:.5px;background:var(--ink);color:#fbf7ee;border:2px solid var(--ink);border-radius:20px;padding:5px 12px;box-shadow:3px 3px 0 var(--accent)}
@media (max-width:820px){.home-hero{grid-template-columns:1fr;gap:18px;padding:20px}.hh-right{border-left:none;border-top:2px dashed var(--line);padding-left:0;padding-top:18px}}
@media (max-width:560px){.hh-greet{font-size:26px}.hh-count-num{font-size:68px;padding:6px 16px 10px}.hh-count-lbl{font-size:16px}.hh-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.hh-stat,.hh-stat:nth-child(4),.hh-stat:nth-child(5){grid-column:span 1}.hh-stat:nth-child(5){grid-column:span 2}}

/* ===== continue / resume ===== */
.continue-banner{display:flex;align-items:center;justify-content:space-between;gap:14px;background:var(--ink);color:#fbf7ee;border:2px solid var(--ink);border-radius:12px;box-shadow:4px 4px 0 var(--accent);padding:14px 18px;margin:14px 0 4px}
.cb-label{font-family:var(--font-head);font-weight:800;font-size:15px}
.cb-topic{color:#bdb6a5;font-size:13px;font-weight:600;margin-top:2px}

/* ===== polished lesson "slides" ===== */
.lreadbar{position:sticky;top:0;z-index:30;height:6px;background:var(--bg2);border:2px solid var(--ink);border-radius:6px;overflow:hidden;margin:0 0 16px}
.lreadbar i{display:block;height:100%;width:0;background:var(--accent);transition:width .1s linear}
.lhero{background:var(--card);border:2px solid var(--ink);border-radius:16px;box-shadow:6px 6px 0 var(--ink);padding:20px 22px;margin-bottom:22px}
.lhero>.btn{margin-bottom:12px}
.lhero-row{display:flex;gap:18px;align-items:flex-start}
.lhero-num{flex:0 0 auto;width:60px;height:60px;border-radius:14px;background:var(--ink);color:var(--card);display:grid;place-items:center;font-family:var(--font-head);font-weight:800;font-size:30px;box-shadow:3px 3px 0 var(--accent)}
.lhero-txt{flex:1;min-width:0}
.lhero-badges{display:flex;gap:7px;margin-bottom:6px;flex-wrap:wrap}
.lhero-title{font-family:var(--font-head);font-size:27px;font-weight:800;margin:0 0 6px;letter-spacing:-.4px;line-height:1.1}
.lhero-sub{color:var(--muted);font-size:14.5px;font-weight:600;margin:0;max-width:70ch;line-height:1.55}
.ltoc{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;padding-top:14px;border-top:2px dashed var(--line)}
.ltoc-chip{font-size:12.5px;font-weight:700;text-decoration:none;color:var(--ink);background:var(--card2);border:1.5px solid var(--ink);border-radius:20px;padding:5px 12px;transition:.12s}
.ltoc-chip:hover{background:var(--brand);color:#fff;transform:translateY(-1px)}
.lslide{background:var(--card);border:2px solid var(--ink);border-radius:14px;box-shadow:4px 4px 0 var(--ink);padding:20px 22px;margin:0 0 18px;scroll-margin-top:14px}
.lslide-head{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.lslide-num{flex:0 0 auto;width:30px;height:30px;border-radius:8px;background:var(--accent);color:#fff;display:grid;place-items:center;font-family:var(--font-head);font-weight:800;font-size:15px;border:2px solid var(--ink)}
.lslide-head .lh{margin:0;border-left:none;padding-left:0;font-size:18px}
.lnav{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:24px}
@media(max-width:560px){.lnav{grid-template-columns:1fr}}
.lnav-card{text-align:left;border:2px solid var(--ink);background:var(--card);border-radius:12px;padding:13px 16px;cursor:pointer;box-shadow:3px 3px 0 var(--ink);transition:.12s;display:flex;flex-direction:column;gap:3px}
.lnav-card.next{text-align:right}
.lnav-card:hover{transform:translate(-1px,-1px);box-shadow:5px 5px 0 var(--brand)}
.lnav-dir{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:1px;color:var(--accent)}
.lnav-t{font-family:var(--font-head);font-weight:800;font-size:14.5px}

/* ===== mock exam ===== */
.mex-top{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:14px}
.mex-title{font-family:var(--font-head);font-size:18px;font-weight:800}
.mex-timer{font-family:var(--font-mono);font-size:26px;font-weight:800;background:var(--ink);color:#fbf7ee;border:2px solid var(--ink);border-radius:9px;padding:4px 14px;box-shadow:3px 3px 0 var(--accent)}
.mex-timer.low{color:#ffd9c9}
.mex-top .btn{margin-left:auto}
.mex-palette{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:16px}
.mex-pchip{width:34px;height:34px;border:2px solid var(--ink);background:var(--card);border-radius:8px;font-family:var(--font-head);font-weight:800;cursor:pointer;box-shadow:2px 2px 0 var(--ink);transition:.1s}
.mex-pchip:hover{transform:translate(-1px,-1px)}
.mex-pchip.done{background:#dde2ff}
.mex-pchip.cur{background:var(--brand);color:#fff}
.mex-pchip.marked{outline:2px solid var(--accent);outline-offset:1px}
.mex-ta{width:100%;min-height:120px;margin-top:16px;border:2px solid var(--ink);border-radius:10px;padding:12px 14px;font-size:15px;font-family:var(--font-body);resize:vertical;box-sizing:border-box}
.mex-hint{color:var(--muted);font-weight:700;font-size:12.5px;margin-top:10px}

/* ===== achievements ===== */
.lb-row{flex-wrap:wrap}
.ach{flex-basis:100%;display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.lb-spot .ach{justify-content:center;margin-top:10px;flex-basis:auto}
.ach-b{display:inline-flex;align-items:center;background:var(--card2);border:1.5px solid var(--ink);border-radius:8px;padding:2px 7px;font-size:15px;line-height:1;box-shadow:1px 1px 0 var(--ink)}
.ach-x{font-family:var(--font-mono);font-size:11px;font-weight:800;color:var(--accent);margin-left:2px}
.ach-legend{display:grid;grid-template-columns:1fr 1fr;gap:8px 18px}
@media(max-width:560px){.ach-legend{grid-template-columns:1fr}}
.ach-leg{display:flex;align-items:center;gap:9px;font-size:13px;font-weight:600;color:var(--muted)}
.ach-leg .ach-b{font-size:16px}

/* ===== mock exam history ===== */
.mex-recent-list{display:flex;flex-direction:column;gap:8px}
.mex-rrow{display:flex;align-items:center;gap:14px;background:var(--card);border:2px solid var(--ink);border-radius:9px;padding:10px 14px;box-shadow:2px 2px 0 var(--ink)}
.mex-rpct{font-family:var(--font-head);font-weight:800;font-size:20px;min-width:54px}
.mex-rmeta{flex:1;font-size:13px;color:var(--muted);font-weight:600}
.mex-rmeta b{color:var(--ink);font-family:var(--font-head)}
.mex-rdate{font-size:12px;color:var(--muted);font-family:var(--font-mono)}

/* ===== flashcard options (mc/multi) ===== */
.fc-opts{margin:18px 0 0;display:grid;grid-template-columns:1fr 1fr;gap:10px;text-align:left}
@media(max-width:560px){.fc-opts{grid-template-columns:1fr}}
.fc-opt{display:flex;align-items:center;gap:10px;text-align:left;background:#fff;border:2px solid var(--ink);border-radius:10px;padding:10px 12px;font-family:var(--font-body);font-weight:600;font-size:14.5px;line-height:1.35;cursor:pointer;box-shadow:2px 2px 0 var(--ink);transition:transform .1s,box-shadow .1s}
.fc-opt:hover{transform:translate(-1px,-1px);box-shadow:4px 4px 0 var(--ink)}
.fc-opt .fco-k{flex:0 0 auto;width:24px;height:24px;border-radius:6px;display:grid;place-items:center;color:#fff;font-family:var(--font-head);font-weight:800;font-size:13px;border:1.5px solid var(--ink)}
.fc-opt .fco-t{flex:1}
.fc-opt-0 .fco-k{background:#e23a1d}
.fc-opt-1 .fco-k{background:#2b46ff}
.fc-opt-2 .fco-k{background:#c5841a}
.fc-opt-3 .fco-k{background:#1c9a52}
.fc-opt.sel{background:#fff4d6}
.fc-opt.answered{cursor:default}
.fc-opt.answered:hover{transform:none;box-shadow:2px 2px 0 var(--ink)}
.fc-opt.correct{background:var(--goodbg);border-color:var(--good);box-shadow:2px 2px 0 var(--good)}
.fc-opt.wrong{background:var(--badbg);border-color:var(--bad);box-shadow:2px 2px 0 var(--bad)}
.fc-opt.answered:not(.correct):not(.wrong){opacity:.55}
.fc-check{margin-top:12px;width:100%}
.fc-fb{margin-top:8px}
.fc-fb .feedback{justify-content:center}
.fc-hint2{margin-top:12px;font-family:var(--font-mono);font-size:11px;color:var(--accent);text-transform:uppercase;letter-spacing:1px;font-weight:700;text-align:center}

/* ===== responsive: prevent text overflow everywhere ===== */
html{-webkit-text-size-adjust:100%}
body{overflow-x:hidden}
.fc .qa .txt,.fc-opt,.fco-t,.q,.opt,.lp,.lex-q,.bitem .bq,.bitem .ba,.vs-opt,.vs-otext,.reveal,.lb-uname,.rev-item .rq,.rev-item .ra,.pg-blabel,.mex-rmeta,.auth-sub,.cb-topic{overflow-wrap:break-word;word-break:break-word}
.wrap{padding-left:max(18px,env(safe-area-inset-left));padding-right:max(18px,env(safe-area-inset-right))}

/* ===== mobile / iPhone (<=600px) ===== */
@media (max-width:600px){
  .wrap{padding-top:14px;padding-bottom:calc(64px + env(safe-area-inset-bottom));padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
  header.app{gap:8px 10px;padding:12px 0 14px;margin-bottom:18px}
  .spacer{display:none}
  .logo{width:38px;height:38px;border-radius:7px}
  .title{flex:1 1 58%;min-width:0}
  .title h1{font-size:18px}
  .title p{font-size:11px}
  .countdown b{font-size:20px}
  .userchip{padding:4px 10px;font-size:12px}
  .btn{padding:8px 11px;font-size:13px}
  .btn.sm{padding:6px 9px;font-size:12px}

  .modes{grid-template-columns:1fr 1fr;gap:10px}
  .mode{padding:14px 12px;box-shadow:3px 3px 0 var(--ink)}
  .mode .ic{font-size:24px}
  .mode h3{font-size:15px}
  .chapters{grid-template-columns:1fr}
  .stats{gap:8px}
  .stat{min-width:0;flex:1 1 40%;padding:9px 11px}
  .stat b{font-size:18px}
  .section-h h2{font-size:13px}

  .fc-scene{max-width:100%}
  .fc{min-height:260px}
  .fc .face{padding:20px 18px;box-shadow:5px 5px 0 var(--ink)}
  .fc .qa .txt{font-size:18px;max-width:100%}
  .fc .back .qa .txt{font-size:15.5px}
  .fc .front::before{left:34px}
  .fc-opts{grid-template-columns:1fr;gap:8px}
  .fc-opt{font-size:14px;padding:9px 11px}
  .controls{gap:9px}
  .iconbtn{width:44px;height:44px;font-size:18px}
  .iconbtn.big{width:54px;height:54px;font-size:22px}

  .qcard{padding:18px 16px;box-shadow:4px 4px 0 var(--ink)}
  .q{font-size:18px}
  .opt{font-size:14.5px;padding:11px 12px}
  select,input[type=text],input[type=password],input[type=number],textarea,.mex-ta{font-size:16px}

  .score-ring{font-size:54px}
  .lb-cell{min-width:62px;font-size:12px}
  .lb-cell b{font-size:14px}
  .lb-podium{gap:10px}

  .lhero{padding:16px 16px}
  .lhero-row{gap:12px}
  .lhero-num{width:46px;height:46px;font-size:23px;border-radius:11px}
  .lhero-title{font-size:21px}
  .lslide{padding:16px 15px}
  .lh{font-size:16px}
  .lp{font-size:14.5px}
  .lnav{grid-template-columns:1fr}
  .lformula{font-size:13px}

  .vs-pin{font-size:42px;letter-spacing:7px}
  .vs-pinwrap{padding:16px 22px}
  .vs-question{font-size:19px;padding:18px 14px}
  .vs-opt{font-size:15px;padding:13px 14px}
  .vs-opts{grid-template-columns:1fr}

  .mex-top{gap:10px}
  .mex-timer{font-size:22px}
  .mex-top .btn{margin-left:0}
  .mex-pchip{width:30px;height:30px;font-size:13px}
  .mex-ta{min-height:110px}

  .pg-body{padding:12px}
  .pg-blabel{min-width:88px;font-size:12px}
  .pg-num{min-width:78px}
  .pg-slabel{min-width:74px}
  .tok{padding:6px 9px;font-size:13px}
  .ach-legend{grid-template-columns:1fr}
}

@media (max-width:380px){
  .modes{grid-template-columns:1fr}
  .title h1{font-size:16px}
  .fc .qa .txt{font-size:16.5px}
  .score-ring{font-size:44px}
  .vs-pin{font-size:34px;letter-spacing:4px}
}
