/* ==========================================================================
   Ember Educator Quiz · custom stylesheet (no build step required)
   ========================================================================== */

:root {
    --ink: #182033;
    --ink-soft: #34405a;
    --muted: #6b7488;
    --line: #e4e8f0;
    --card: #ffffff;
    --bg: #f6f7fb;
    --cream: #fff9f2;
    --brand: #f97316;
    --brand-dark: #ea580c;
    --brand-soft: #fff1e4;
    --brand-line: #ffd9b8;
    --teal: #0f766e;
    --teal-soft: #e7f6f3;
    --blue: #2563eb;
    --blue-soft: #eaf1ff;
    --green: #15803d;
    --green-soft: #e8f7ed;
    --red: #dc2626;
    --red-soft: #fdecec;
    --amber: #b45309;
    --amber-soft: #fef3c7;
    --violet: #7c3aed;
    --violet-soft: #f1eafe;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px rgba(24, 32, 51, .06);
    --shadow: 0 12px 32px -18px rgba(24, 32, 51, .28);
    --shadow-lg: 0 28px 70px -32px rgba(24, 32, 51, .38);
    --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }

/* ------------------------------------------------ buttons & badges */
.btn {
    --btn-bg: var(--brand);
    --btn-fg: #fff;
    --btn-border: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .72rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font: inherit;
    font-weight: 650;
    font-size: .94rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    box-shadow: 0 10px 20px -12px rgba(249, 115, 22, .7);
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid rgba(249, 115, 22, .35); outline-offset: 2px; }

.btn-primary { --btn-bg: linear-gradient(135deg, #fb923c, #ea580c); --btn-fg: #fff; }
.btn-secondary { --btn-bg: #fff; --btn-fg: var(--ink); --btn-border: var(--line); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { --btn-border: #cfd6e4; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-soft); --btn-border: var(--line); box-shadow: none; }
.btn-danger { --btn-bg: var(--red); --btn-fg: #fff; box-shadow: 0 10px 20px -12px rgba(220, 38, 38, .6); }
.btn-teal { --btn-bg: var(--teal); --btn-fg: #fff; box-shadow: 0 10px 20px -12px rgba(15, 118, 110, .6); }
.btn-sm { padding: .45rem .8rem; font-size: .82rem; }
.btn-lg { padding: .9rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .01em;
    background: #eef1f7;
    color: var(--ink-soft);
    white-space: nowrap;
}

.badge-easy { background: var(--green-soft); color: var(--green); }
.badge-medium { background: var(--amber-soft); color: var(--amber); }
.badge-hard { background: var(--red-soft); color: var(--red); }
.badge-success { background: var(--green-soft); color: var(--green); }
.badge-danger { background: var(--red-soft); color: var(--red); }
.badge-muted { background: #eef1f7; color: var(--muted); }
.badge-type-multiple_choice { background: var(--blue-soft); color: var(--blue); }
.badge-type-true_false { background: var(--teal-soft); color: var(--teal); }
.badge-type-fill_blank { background: var(--violet-soft); color: var(--violet); }
.badge-type-problem_solving { background: var(--brand-soft); color: var(--brand-dark); }
.badge-subject-science { background: var(--blue-soft); color: var(--blue); }
.badge-subject-tle { background: var(--amber-soft); color: var(--amber); }
.badge-subject-combined { background: var(--violet-soft); color: var(--violet); }

/* ------------------------------------------------ alerts */
.flash-stack { display: grid; gap: .6rem; margin: 1.1rem 0; }

.alert {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: .92rem;
    box-shadow: var(--shadow-sm);
}

.alert-icon {
    flex: 0 0 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 800;
    background: rgba(255, 255, 255, .55);
}

.alert-success { background: var(--green-soft); border-color: #bfe8cc; color: #14532d; }
.alert-danger { background: var(--red-soft); border-color: #f6c9c9; color: #7f1d1d; }
.alert-list { margin: .4rem 0 0; padding-left: 1.1rem; }

/* ==========================================================================
   Public site
   ========================================================================== */

.public-body {
    background:
        radial-gradient(900px 420px at 8% -10%, rgba(249, 115, 22, .12), transparent 65%),
        radial-gradient(800px 380px at 92% 0%, rgba(37, 99, 235, .10), transparent 60%),
        var(--cream);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 249, 242, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(228, 232, 240, .8);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 74px;
}

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

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: #fff;
    background: linear-gradient(145deg, #fb923c, #ea580c 60%, #c2410c);
    box-shadow: 0 8px 18px -8px rgba(234, 88, 12, .8);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.02rem; letter-spacing: -.01em; }
.brand-text em { font-style: normal; color: var(--brand-dark); }
.brand-text small { color: var(--muted); font-size: .72rem; margin-top: .22rem; font-weight: 600; letter-spacing: .02em; }

.site-nav { display: flex; align-items: center; gap: .35rem; }
.site-nav a {
    padding: .55rem .9rem;
    border-radius: 999px;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: .9rem;
}
.site-nav a:hover { background: rgba(249, 115, 22, .09); text-decoration: none; }
.site-nav a.is-active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }

.site-main { padding-bottom: 4rem; }

/* ------------------------------------------------------------------ hero */
.hero { padding: 3.2rem 0 1rem; }

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
    gap: 2.4rem;
    align-items: start;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: 1rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--brand-line);
    color: var(--brand-dark);
    font-size: .76rem;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.hero h1 {
    font-size: clamp(2.1rem, 4.4vw, 3.5rem);
    line-height: 1.06;
    letter-spacing: -.035em;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero h1 span {
    background: linear-gradient(120deg, #ea580c, #f59e0b 55%, #d97706);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-lead {
    font-size: 1.08rem;
    color: var(--ink-soft);
    max-width: 34rem;
}

.hero-points { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .42rem .7rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-soft);
    box-shadow: var(--shadow-sm);
}

.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

.stat-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
    margin-top: 2rem;
    max-width: 34rem;
}

.stat-pill {
    background: rgba(255, 255, 255, .78);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .8rem .9rem;
}
.stat-pill strong { display: block; font-size: 1.35rem; letter-spacing: -.02em; line-height: 1.1; }
.stat-pill span { color: var(--muted); font-size: .76rem; font-weight: 600; }

/* -------------------------------------------------------------- start card */
.start-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 1.6rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.start-card::before {
    content: "";
    position: absolute;
    inset: -60px -40px auto auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, .22), transparent 70%);
}

.start-card h2 { font-size: 1.3rem; letter-spacing: -.02em; margin-bottom: .3rem; }
.start-card > p { color: var(--muted); font-size: .9rem; margin-bottom: 1.2rem; }

.start-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
    margin: 1rem 0 1.2rem;
}
.start-meta div {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: .6rem .7rem;
}
.start-meta span { display: block; font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.start-meta strong { font-size: .9rem; }

/* ----------------------------------------------------------------- sections */
.section { padding: 2.6rem 0 0; }
.section-head { margin-bottom: 1.4rem; }
.section-head h2 { font-size: 1.5rem; letter-spacing: -.025em; margin-bottom: .3rem; }
.section-head p { color: var(--muted); font-size: .94rem; }

.type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }

.type-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
}
.type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.type-card h3 { font-size: .96rem; margin: .7rem 0 .3rem; }
.type-card p { font-size: .82rem; color: var(--muted); }

.icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    background: var(--brand-soft);
    color: var(--brand-dark);
}
.icon-badge.blue { background: var(--blue-soft); color: var(--blue); }
.icon-badge.teal { background: var(--teal-soft); color: var(--teal); }
.icon-badge.violet { background: var(--violet-soft); color: var(--violet); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.step {
    display: flex;
    gap: .85rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
}
.step-num {
    flex: 0 0 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .82rem;
    background: var(--ink);
    color: #fff;
}
.step h3 { font-size: .92rem; margin-bottom: .18rem; }
.step p { font-size: .82rem; color: var(--muted); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }

.topic-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.topic-group {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
}
.topic-group h3 { font-size: .95rem; margin-bottom: .7rem; letter-spacing: -.01em; }
.topic-group h3 .small { font-weight: 500; margin-left: .3rem; }
.tag {
    padding: .38rem .75rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: .8rem;
    color: var(--ink-soft);
    font-weight: 600;
}

.site-footer { border-top: 1px solid var(--line); background: #fffdfa; padding: 1.4rem 0; margin-top: 3rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-inner p { color: var(--muted); font-size: .8rem; }
.footer-note { font-weight: 600; }

/* ==========================================================================
   Quiz screens
   ========================================================================== */

.quiz-shell { max-width: 900px; margin: 0 auto; padding: 2rem 24px 0; }

.quiz-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}
.quiz-head h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.025em; }
.quiz-head p { color: var(--muted); font-size: .9rem; margin-top: .25rem; }
.quiz-meta { display: flex; flex-wrap: wrap; gap: .4rem; }

.quiz-progress {
    position: sticky;
    top: 86px;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.2rem;
}
.progress-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.progress-top strong { font-size: .86rem; }
.progress-top span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.progress-track { height: 8px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #fb923c, #ea580c); transition: width .25s ease; }

.question-list { display: grid; gap: 1rem; }

.question-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem 1.35rem;
    box-shadow: var(--shadow-sm);
}
.question-card.is-answered { border-color: #cfe3d8; box-shadow: 0 8px 24px -20px rgba(21, 128, 61, .5); }

.question-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .7rem; flex-wrap: wrap; }
.q-number { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: .88rem; }
.q-number span {
    width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
    background: var(--ink); color: #fff; font-size: .78rem;
}
.q-badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.q-topic { color: var(--muted); font-size: .78rem; font-weight: 600; }

.q-prompt { font-size: 1.02rem; color: var(--ink); margin: .2rem 0 1rem; }
.q-prompt .blank {
    display: inline-block;
    min-width: 5.5rem;
    border-bottom: 2px dashed var(--brand);
    color: var(--brand-dark);
    text-align: center;
    font-weight: 700;
}

.options { display: grid; gap: .55rem; }

.option {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: .7rem .8rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    background: #fff;
}
.option:hover { border-color: #cfd8e8; background: #fafbfe; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-key {
    flex: 0 0 26px;
    height: 26px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #f1f4fa;
    color: var(--ink-soft);
    font-size: .78rem;
    font-weight: 800;
}
.option-text { font-size: .92rem; padding-top: .1rem; }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(249, 115, 22, .12); }
.option:has(input:checked) .option-key { background: var(--brand); color: #fff; }

.tf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }

.answer-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: .8rem .9rem;
    font: inherit;
    font-size: .95rem;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.answer-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249, 115, 22, .15); }

.answer-row { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; }
.answer-row .answer-input { flex: 1 1 12rem; }

.unit-box {
    display: inline-flex;
    align-items: center;
    padding: 0 .9rem;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--bg);
    font-weight: 700;
    color: var(--ink-soft);
    font-size: .9rem;
}

.direction-select { flex: 0 1 15rem; }

.quiz-actions { margin: 1.4rem 0 2rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.quiz-actions .muted { font-size: .84rem; }

.submit-card {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border: 1px solid var(--brand-line);
    border-radius: var(--radius);
    padding: 1.2rem 1.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.2rem 0 2rem;
}
.submit-card h3 { font-size: 1rem; }
.submit-card p { color: var(--brand-dark); font-size: .84rem; }

/* ------------------------------------------------------------------ result */
.result-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 1.8rem;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.score-ring {
    --score: 0;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--ring-color, var(--brand)) calc(var(--score) * 1%), #eef1f7 0);
    display: grid;
    place-items: center;
    position: relative;
}
.score-ring::before { content: ""; position: absolute; inset: 12px; background: #fff; border-radius: 50%; }
.score-inner { position: relative; text-align: center; }
.score-inner strong { display: block; font-size: 2rem; line-height: 1; letter-spacing: -.04em; }
.score-inner span { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.result-copy h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.03em; margin: .35rem 0; }
.result-copy p { color: var(--muted); font-size: .95rem; max-width: 38rem; }
.result-badges { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .4rem; }
.result-stats { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 1rem; }
.result-stats div strong { display: block; font-size: 1.25rem; letter-spacing: -.02em; }
.result-stats div span { font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 1.05rem; letter-spacing: -.01em; }
.panel-head p { color: var(--muted); font-size: .82rem; }
.panel-body { padding: 1.2rem; }

.breakdown { display: grid; gap: .75rem; }
.breakdown-row { display: grid; grid-template-columns: 12rem minmax(0, 1fr) auto; gap: .8rem; align-items: center; }
.breakdown-row span { font-size: .85rem; font-weight: 600; }
.breakdown-track { height: 9px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
.breakdown-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #fb923c, #ea580c); }
.breakdown-row b { font-size: .82rem; color: var(--muted); }

.review-list { display: grid; gap: .8rem; margin-top: 1rem; }
.review-card {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-sm);
}
.review-card.is-wrong { border-left-color: var(--red); }
.review-head { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: .4rem; }
.review-head h3 { font-size: .95rem; font-weight: 650; max-width: 46rem; }
.review-answer { display: grid; gap: .2rem; font-size: .85rem; margin-top: .4rem; }
.answer-line { display: flex; gap: .45rem; align-items: flex-start; }
.answer-line b { min-width: 6.5rem; color: var(--muted); font-weight: 600; }
.answer-line span { color: var(--ink); }
.answer-line.ok span { color: var(--green); font-weight: 650; }
.answer-line.bad span { color: var(--red); font-weight: 650; }
.explanation { margin-top: .55rem; padding: .6rem .7rem; background: var(--bg); border-radius: 10px; font-size: .82rem; color: var(--ink-soft); }
.slide-preview { margin-top: .7rem; display: inline-flex; align-items: center; gap: .5rem; font-size: .78rem; }
.slide-thumb { width: 116px; border-radius: 8px; border: 1px solid var(--line); }

/* ==========================================================================
   Admin
   ========================================================================== */

.admin-body { background: #f3f5f9; }

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 258px;
    flex: 0 0 258px;
    background: linear-gradient(180deg, #151b2b, #101624);
    color: #cfd6e6;
    display: flex;
    flex-direction: column;
    padding: 1.3rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-brand { display: flex; gap: .65rem; align-items: center; padding: .2rem .4rem 1.2rem; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.admin-brand:hover { text-decoration: none; }
.admin-brand .brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 1.1rem; }
.admin-brand strong { display: block; font-size: .95rem; letter-spacing: -.01em; }
.admin-brand small { color: #8e9ab4; font-size: .7rem; font-weight: 600; }

.admin-nav { display: grid; gap: .2rem; margin-top: 1.1rem; }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .62rem .7rem;
    border-radius: 11px;
    color: #aeb8cc;
    font-size: .88rem;
    font-weight: 600;
}
.admin-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.admin-nav a.is-active { background: linear-gradient(135deg, rgba(249, 115, 22, .22), rgba(249, 115, 22, .08)); color: #fdba74; box-shadow: inset 0 0 0 1px rgba(249, 115, 22, .25); }
.admin-nav svg { width: 17px; height: 17px; fill: currentColor; opacity: .9; }

.admin-sidebar-footer { margin-top: auto; padding-top: 1.2rem; display: grid; gap: .7rem; }
.sidebar-link { color: #9aa6bd; font-size: .8rem; font-weight: 600; padding: 0 .4rem; }
.sidebar-link:hover { color: #fff; text-decoration: none; }
.admin-user { display: flex; gap: .6rem; align-items: center; padding: .7rem .4rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(249, 115, 22, .18); color: #fdba74; font-weight: 800; font-size: .85rem; flex: 0 0 34px; }
.admin-user strong { display: block; font-size: .8rem; color: #fff; line-height: 1.2; }
.admin-user small { display: block; font-size: .68rem; color: #8e9ab4; word-break: break-all; }
.admin-sidebar .btn-ghost { color: #cfd6e6; border-color: rgba(255, 255, 255, .14); font-size: .8rem; }
.admin-sidebar .btn-ghost:hover { background: rgba(255, 255, 255, .06); }

.admin-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 2rem;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 15;
}
.topbar-heading h1 { font-size: 1.25rem; letter-spacing: -.02em; }
.topbar-heading p { color: var(--muted); font-size: .82rem; }
.topbar-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

.icon-btn { border: 0; background: transparent; cursor: pointer; }
.menu-toggle { display: none; width: 38px; height: 38px; border-radius: 10px; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.menu-toggle span { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }

.admin-content { padding: 1.6rem 2rem 3rem; max-width: 1320px; width: 100%; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card .stat-icon {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand-dark); font-size: 1rem; margin-bottom: .7rem;
}
.stat-card.blue .stat-icon { background: var(--blue-soft); color: var(--blue); }
.stat-card.teal .stat-icon { background: var(--teal-soft); color: var(--teal); }
.stat-card.violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; margin-top: .1rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid-2.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stack { display: grid; gap: 1rem; }
.mt { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }

.kv-list { display: grid; gap: .7rem; }
.kv { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding-bottom: .7rem; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; padding-bottom: 0; }
.kv span { color: var(--muted); font-size: .84rem; }
.kv strong { font-size: .88rem; text-align: right; }

.bar-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 2.2rem; gap: .7rem; align-items: center; margin-bottom: .6rem; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row span { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.bar-track { height: 8px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #fb923c, #ea580c); }
.bar-row b { font-size: .8rem; color: var(--muted); text-align: right; }

.notice {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    padding: .8rem 1rem;
    border-radius: 12px;
    background: var(--amber-soft);
    border: 1px solid #fde68a;
    color: #78350f;
    font-size: .84rem;
    margin-bottom: 1rem;
}

.notice.info { background: var(--blue-soft); border-color: #c9dbff; color: #1e3a8a; }
.notice strong { display: block; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
    text-align: left;
    padding: .55rem .6rem;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.data-table td { padding: .7rem .6rem; border-bottom: 1px solid #eef1f7; vertical-align: top; }
.data-table tbody tr:hover { background: #fafbfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .cell-main { font-weight: 600; color: var(--ink); max-width: 34rem; }
.data-table .cell-sub { color: var(--muted); font-size: .76rem; }
.table-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.empty-cell { text-align: center; color: var(--muted); padding: 2rem !important; }

.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.filter-bar .field { min-width: 10rem; flex: 1 1 10rem; }
.filter-bar .field.grow { flex: 2 1 16rem; }
.filter-bar .btn { margin-bottom: .1rem; }

/* forms */
.field { display: grid; gap: .32rem; margin-bottom: .9rem; }
.field > label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.field .help { font-size: .76rem; color: var(--muted); }
.field .error { font-size: .76rem; color: var(--red); font-weight: 600; }

.input, .select, .textarea {
    width: 100%;
    padding: .68rem .8rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { resize: vertical; min-height: 7rem; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249, 115, 22, .13); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }

.checkbox { display: flex; gap: .5rem; align-items: flex-start; font-size: .85rem; color: var(--ink-soft); cursor: pointer; }
.checkbox input { margin-top: .2rem; accent-color: var(--brand); width: 16px; height: 16px; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow-sm); }
.form-card h2 { font-size: 1rem; margin-bottom: .9rem; }
.form-card .field:last-child { margin-bottom: 0; }

.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }

.option-grid { display: grid; gap: .55rem; }
.option-grid .option-line { display: flex; gap: .55rem; align-items: center; }
.option-letter { flex: 0 0 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); font-size: .76rem; font-weight: 800; color: var(--ink-soft); }

.type-panel { display: none; }
.type-panel.is-visible { display: block; }

.image-preview { margin-top: .5rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.image-preview img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.image-preview.is-empty { display: none; }

.pagination { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: 1rem; }
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 .6rem;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-soft);
    font-size: .82rem;
    font-weight: 600;
}
.page-link:hover { background: var(--bg); text-decoration: none; }
.page-link.is-current { background: var(--ink); border-color: var(--ink); color: #fff; }
.page-link.is-disabled { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------ admin login */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(700px 400px at 15% 0%, rgba(249, 115, 22, .16), transparent 60%),
        radial-gradient(700px 400px at 85% 100%, rgba(37, 99, 235, .12), transparent 60%),
        #f6f7fb;
}
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 1.8rem; box-shadow: var(--shadow-lg); }
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.4rem; }
.auth-card h1 { font-size: 1.4rem; letter-spacing: -.025em; margin-bottom: .25rem; }
.auth-card > p { color: var(--muted); font-size: .88rem; margin-bottom: 1.3rem; }
.auth-back { display: block; text-align: center; margin-top: 1rem; font-size: .82rem; color: var(--muted); }

/* ------------------------------------------------------ responsive */
.sidebar-backdrop { display: none; }

@media (max-width: 1080px) {
    .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .grid-2.equal { grid-template-columns: minmax(0, 1fr); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
    .start-card { max-width: 34rem; }
    .breakdown-row { grid-template-columns: 9rem minmax(0, 1fr) auto; }
}

@media (max-width: 820px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 60;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 60px rgba(0, 0, 0, .35);
    }
    .admin-sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 15, 28, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    .sidebar-backdrop.is-visible { opacity: 1; pointer-events: auto; }
    .menu-toggle { display: flex; }
    .admin-topbar { padding: 1rem 1.2rem; }
    .admin-content { padding: 1.2rem 1.2rem 2.5rem; }
}

@media (max-width: 640px) {
    .container { padding: 0 18px; }
    .header-inner { height: 66px; }
    .brand-text small { display: none; }
    .site-nav a { padding: .5rem .7rem; font-size: .84rem; }
    .hero { padding-top: 2rem; }
    .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
    .stat-pill { padding: .6rem; }
    .stat-pill strong { font-size: 1.1rem; }
    .type-grid, .steps { grid-template-columns: minmax(0, 1fr); }
    .topic-groups { grid-template-columns: minmax(0, 1fr); }
    .quiz-shell { padding: 1.2rem 18px 0; }
    .quiz-progress { top: 76px; }
    .question-card { padding: 1rem; }
    .tf-grid { grid-template-columns: minmax(0, 1fr); }
    .result-hero { grid-template-columns: minmax(0, 1fr); text-align: center; justify-items: center; gap: 1.2rem; padding: 1.4rem; }
    .result-badges, .result-stats { justify-content: center; }
    .result-stats { justify-content: space-around; }
    .breakdown-row { grid-template-columns: 7.5rem minmax(0, 1fr) auto; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
    .admin-topbar { flex-wrap: wrap; }
    .topbar-actions { margin-left: 0; width: 100%; }
    .filter-bar .field { flex: 1 1 100%; }
    .auth-card { padding: 1.4rem; }
}

@media (max-width: 420px) {
    .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: minmax(0, 1fr); }
}
