/* ============================================
   Vocab Studio — Design System v2
   Plus Jakarta Sans + Anuphan
   60% #F6F8FC · 30% #0F172A · 10% #0066FF
   ============================================ */

:root {
    --bg: #0D1520;
    --surface: #162030;
    --surface-2: #1C2A3E;
    --ink: #E2E8F4;
    --ink-2: #8DA0BC;
    --ink-3: #506070;
    --accent: #4D94FF;
    --accent-2: #3D80FF;
    --accent-10: rgba(77, 148, 255, 0.14);
    --line: #1E2D42;
    --line-2: #2A3E58;
    --ok: #10B981;
    --ok-10: rgba(16, 185, 129, 0.14);
    --bad: #F87171;
    --bad-10: rgba(248, 113, 113, 0.14);
    --sh-s: 0 1px 3px rgba(0, 0, 0, 0.4);
    --sh-m: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    --sh-accent: 0 8px 18px -6px rgba(77, 148, 255, 0.4);
    --r-s: 8px;
    --r-m: 12px;
    --r-l: 16px;
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', 'Anuphan', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.6;
    font-size: 14.5px;
}

/* ============ TOP BAR ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(13, 21, 32, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.02em;
}

.brand-name {
    font-size: 15.5px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.brand-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: var(--accent-10);
    padding: 3px 9px;
    border-radius: 99px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 13px 5px 5px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 99px;
    background: var(--accent-10);
    color: var(--accent);
    font-weight: 800;
    font-size: 12px;
    display: grid;
    place-items: center;
    text-transform: uppercase;
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    color: var(--ink-3);
    border: none;
    border-radius: var(--r-s);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}

.btn-logout:hover {
    color: var(--bad);
    background: var(--bad-10);
}

/* ============ PAGE LAYOUT ============ */
.page {
    max-width: 1040px;
    margin: 0 auto;
    padding: 40px 24px 96px;
}

/* ============ STATS ============ */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    padding: 20px 24px;
}

.stat-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1.1;
}

/* ============ SEGMENTED TABS ============ */
.segmented {
    display: inline-flex;
    background: var(--bg);
    padding: 4px;
    border-radius: 12px;
    gap: 2px;
    margin-bottom: 36px;
}

.seg-btn {
    padding: 9px 20px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink-2);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: color 0.15s;
    white-space: nowrap;
}

.seg-btn:hover { color: var(--ink); }

.seg-btn.active {
    background: var(--surface-2);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ============ TAB CONTENT ============ */
.tab-content {
    display: none;
    animation: fadeUp 0.3s ease-out;
}

.tab-content.active { display: block; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-head { margin-bottom: 28px; }

.page-head h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin-bottom: 4px;
}

.section-desc {
    color: var(--ink-3);
    font-size: 14px;
}

.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin: 40px 0 16px;
}

.section-label .count {
    color: var(--line-2);
    margin-left: 4px;
}

/* ============ FORM PANEL ============ */
.form-section {
    background: var(--surface);
    padding: 28px;
    border-radius: var(--r-l);
    border: 1px solid var(--line);
    box-shadow: var(--sh-s);
}

.form-section h3 {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-group { margin-bottom: 16px; }

.form-grid .form-group { margin-bottom: 0; }

.form-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink-2);
    font-weight: 600;
    font-size: 12.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238DA0BC' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.form-group input::placeholder { color: var(--ink-3); }

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1);
}

.form-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

/* ============ BUTTONS ============ */
.btn-primary {
    height: 44px;
    padding: 0 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
    background: var(--accent-2);
    transform: translateY(-1px);
    box-shadow: var(--sh-accent);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    padding: 8px 16px;
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-s);
    cursor: pointer;
    font-weight: 700;
    font-size: 12.5px;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.message {
    font-size: 13px;
    font-weight: 600;
}

/* ============ LOGIN ============ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 44px 40px;
    box-shadow: var(--sh-m);
    width: 100%;
    max-width: 410px;
    animation: fadeUp 0.4s ease-out;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.login-brand .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    font-size: 21px;
    margin-bottom: 16px;
    box-shadow: var(--sh-accent);
}

.login-box h1 {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--ink-3);
    font-size: 13.5px;
}

.btn-login {
    width: 100%;
    height: 46px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-login:hover {
    background: var(--accent-2);
    transform: translateY(-1px);
    box-shadow: var(--sh-accent);
}

.error-message {
    color: var(--bad);
    margin-top: 14px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

/* ============ VOCAB GRID ============ */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}

.vocab-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-m);
    padding: 18px 20px;
    transition: border-color 0.15s, box-shadow 0.2s, transform 0.2s;
}

.vocab-card:hover {
    border-color: var(--line-2);
    box-shadow: var(--sh-m);
    transform: translateY(-2px);
}

.vocab-en {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.vocab-th {
    font-size: 13.5px;
    color: var(--ink-2);
    margin-top: 3px;
}

.vocab-del {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--ink-3);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    display: grid;
    place-items: center;
    font-family: inherit;
}

.vocab-card:hover .vocab-del { opacity: 1; }

.vocab-del:hover {
    background: var(--bad-10);
    color: var(--bad);
}

/* ============ QUESTION LIST (admin) ============ */
.q-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    padding: 22px 24px;
    margin-bottom: 12px;
}

.q-item-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.q-item-head .q-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.q-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.q-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border-radius: 9px;
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-2);
}

.q-opt .opt-key { flex-shrink: 0; }

.q-opt.is-correct {
    border-color: transparent;
    background: var(--ok-10);
    color: var(--ink);
    font-weight: 600;
}

.q-opt.is-correct .opt-key {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}

/* ============ QUIZ (student) ============ */
.exam-question {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    padding: 24px;
    margin-bottom: 14px;
}

.q-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.q-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent-10);
    color: var(--accent);
    font-weight: 800;
    font-size: 13px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.q-head h3 {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.opt {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--line-2);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-weight: 500;
    font-size: 14px;
    color: var(--ink-2);
}

.opt:hover {
    border-color: var(--accent);
    color: var(--ink);
}

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

.opt-key {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.opt:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-10);
    color: var(--ink);
    font-weight: 600;
}

.opt:has(input:checked) .opt-key {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ============ RESULTS ============ */
.result-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    padding: 22px 24px;
    margin-bottom: 12px;
}

.result-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.result-date {
    font-size: 12.5px;
    color: var(--ink-3);
    font-weight: 600;
}

.result-score {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 2px;
}

.result-score .pct {
    font-size: 14px;
    font-weight: 700;
    margin-left: 6px;
}

.score-good { color: var(--ok); }
.score-bad  { color: var(--bad); }

.result-student {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.progress {
    height: 6px;
    background: var(--line);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 16px;
}

.progress-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--ok);
    transition: width 0.4s ease;
}

.progress-fill.low { background: var(--bad); }

.detail-panel {
    display: none;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.answer-correct,
.answer-wrong {
    border-radius: 10px;
    padding: 13px 16px;
    margin-bottom: 10px;
    font-size: 13.5px;
    line-height: 1.7;
}

.answer-correct {
    background: var(--ok-10);
    border-left: 3px solid var(--ok);
}

.answer-wrong {
    background: var(--bad-10);
    border-left: 3px solid var(--bad);
}

.answer-q {
    font-weight: 700;
    color: var(--ink);
}

.answer-label { color: var(--ink-3); }

/* ============ EMPTY STATE ============ */
.empty {
    text-align: center;
    color: var(--ink-3);
    padding: 64px 24px;
    font-size: 14px;
    border: 1.5px dashed var(--line-2);
    border-radius: var(--r-l);
    background: transparent;
}

.empty-icon {
    font-size: 26px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ============ LIST CONTAINER ============ */
.list-container { display: block; }

/* ============ SUBMIT BAR ============ */
.submit-bar {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 99px;
    white-space: nowrap;
}

.badge-auto    { background: var(--accent-10); color: var(--accent); }
.badge-manual  { background: var(--surface-2); color: var(--ink-2); }
.badge-open    { background: var(--ok-10); color: var(--ok); }
.badge-closed  { background: var(--surface-2); color: var(--ink-3); }
.badge-pending { background: rgba(217, 119, 6, 0.2); color: #FBBF24; }
.badge-graded  { background: var(--ok-10); color: var(--ok); }

.type-chip {
    display: inline-grid;
    place-items: center;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink-2);
    flex-shrink: 0;
}

.type-chip.written { background: rgba(109, 74, 201, 0.2); color: #C4B5FD; }

/* ============ STATUS TOGGLE ============ */
.status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 99px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-3);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.status-toggle .dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--line-2);
    transition: background 0.15s;
}

.status-toggle.on {
    border-color: rgba(8, 158, 110, 0.35);
    background: var(--ok-10);
    color: var(--ok);
}

.status-toggle.on .dot { background: var(--ok); }

/* ============ EXAM CARDS (admin) ============ */
.exam-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    margin-bottom: 12px;
    overflow: hidden;
}

.exam-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    flex-wrap: wrap;
}

.exam-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.exam-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.exam-meta .sep { color: var(--line-2); font-size: 12px; }

.exam-qcount {
    font-size: 12.5px;
    color: var(--ink-3);
    font-weight: 600;
}

.exam-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-delete-soft {
    padding: 8px 14px;
    background: transparent;
    color: var(--ink-3);
    border: 1px solid var(--line-2);
    border-radius: var(--r-s);
    cursor: pointer;
    font-weight: 700;
    font-size: 12.5px;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-delete-soft:hover {
    color: var(--bad);
    border-color: var(--bad);
    background: var(--bad-10);
}

/* ============ MANAGE PANEL ============ */
.manage-panel {
    display: none;
    border-top: 1px solid var(--line);
    padding: 22px 24px;
    background: var(--surface-2);
}

.manage-panel.open { display: block; }

.q-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
}

.q-row-num {
    font-size: 12px;
    font-weight: 800;
    color: var(--ink-3);
    padding-top: 2px;
    min-width: 18px;
}

.q-row-body { flex: 1; min-width: 0; }

.q-row-text { font-weight: 600; font-size: 14px; }

.q-row-answer {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-top: 3px;
}

.q-row-answer strong { color: var(--ok); }

.q-row .btn-delete-soft { padding: 5px 10px; font-size: 11.5px; }

.add-q-box {
    margin-top: 18px;
    padding: 20px;
    border: 1.5px dashed var(--line-2);
    border-radius: var(--r-m);
    background: var(--surface);
}

.add-q-box h4 {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 14px;
}

.hint {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 8px;
}

/* ============ WRITTEN ANSWER ============ */
.answer-textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px 14px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.6;
}

.answer-textarea::placeholder { color: var(--ink-3); }

.answer-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1);
}

/* ============ GRADING ============ */
.grade-btns {
    display: inline-flex;
    gap: 6px;
    margin-top: 10px;
}

.grade-btn {
    padding: 7px 16px;
    border-radius: 8px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-2);
    transition: all 0.15s;
}

.grade-btn.correct:hover, .grade-btn.correct.active {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}

.grade-btn.wrong:hover, .grade-btn.wrong.active {
    background: var(--bad);
    border-color: var(--bad);
    color: #fff;
}

.answer-neutral {
    border-radius: 10px;
    padding: 13px 16px;
    margin-bottom: 10px;
    font-size: 13.5px;
    line-height: 1.7;
    background: var(--surface-2);
    border-left: 3px solid var(--line-2);
}

.written-answer-text {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 13px;
    margin-top: 6px;
    white-space: pre-wrap;
    color: var(--ink);
}

/* ============ TAB CHIP ============ */
.tab-chip {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #D97706;
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    margin-left: 7px;
    vertical-align: 1px;
}

/* ============ STUDENT EXAM PICKER ============ */
.pick-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    padding: 20px 24px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    transition: border-color 0.15s, box-shadow 0.2s;
}

.pick-card:hover {
    border-color: var(--line-2);
    box-shadow: var(--sh-m);
}

.runner-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.btn-ghost {
    padding: 9px 16px;
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-s);
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }

.stats-2 { grid-template-columns: repeat(2, 1fr); }

/* ============ SESSIONS / SCHEDULE ============ */
.session-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    padding: 22px 24px;
    margin-bottom: 12px;
}

.session-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.session-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 4px;
}

.session-student {
    font-size: 13px;
    color: var(--ink-3);
    font-weight: 600;
    margin-bottom: 6px;
}

.session-meta-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.session-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}

.session-time-icon {
    font-size: 14px;
}

.session-desc {
    margin-top: 12px;
    font-size: 13.5px;
    color: var(--ink-2);
    line-height: 1.6;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--line);
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.badge-approved  { background: var(--ok-10);  color: var(--ok); }
.badge-completed { background: var(--accent-10); color: var(--accent); }
.badge-cancelled { background: var(--surface-2); color: var(--ink-3); }

.btn-approve {
    height: 38px;
    padding: 0 20px;
    background: var(--ok);
    color: #fff;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13.5px;
    font-family: inherit;
    transition: background 0.15s, transform 0.15s;
}

.btn-approve:hover { background: #067A54; transform: translateY(-1px); }

.session-divider {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin: 28px 0 14px;
}

.pending-banner {
    background: rgba(180, 83, 9, 0.18);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: var(--r-m);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: #FCD34D;
}

/* ============ LESSONS ============ */
.lesson-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.lesson-section-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    gap: 12px;
    text-align: left;
}

.lesson-section-head:hover { background: var(--accent-10); }

.lesson-section-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lesson-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.lesson-section-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.lesson-count {
    font-size: 12.5px;
    color: var(--ink-3);
    font-weight: 600;
}

.section-chevron {
    font-size: 11px;
    color: var(--ink-3);
    width: 16px;
    text-align: center;
    transition: transform 0.2s;
}

.lesson-list {
    border-top: 1px solid var(--line);
    padding: 8px;
}

.lesson-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13.5px;
}

.lesson-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
    color: var(--ink);
}

.lesson-row:hover { background: var(--bg); }

.lesson-row-icon {
    font-size: 15px;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: var(--accent-10);
    border-radius: 9px;
}

.lesson-row-body { flex: 1; min-width: 0; }

.lesson-row-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.lesson-row-desc {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-top: 2px;
}

.lesson-row-arrow {
    font-size: 16px;
    color: var(--ink-3);
    flex-shrink: 0;
}

.lesson-content-placeholder {
    text-align: center;
    padding: 80px 24px;
    color: var(--ink-3);
    border: 1.5px dashed var(--line-2);
    border-radius: var(--r-l);
    margin-top: 24px;
}

/* Level badges */
.level-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
    letter-spacing: 0.04em;
}

.level-a1 { background: rgba(16, 185, 129, 0.15); color: #4ADE80; }
.level-a2 { background: rgba(22, 163, 74, 0.15);  color: #86EFAC; }
.level-b1 { background: rgba(59, 130, 246, 0.15); color: #93C5FD; }
.level-b2 { background: rgba(29, 78, 216, 0.15);  color: #BFDBFE; }
.level-c1 { background: rgba(126, 34, 206, 0.15); color: #D8B4FE; }
.level-c2 { background: rgba(107, 33, 168, 0.15); color: #E9D5FF; }

/* ============ MATCHING QUESTION ============ */
.type-chip.matching { background: rgba(3, 105, 161, 0.2); color: #7DD3FC; }

.matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 4px;
}

.match-col { display: flex; flex-direction: column; gap: 8px; }

.match-col-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    margin-bottom: 2px;
}

.match-item {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--ink);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, color 0.15s;
    text-align: left;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    line-height: 1.4;
}

.match-item:hover { border-color: var(--accent); background: var(--accent-10); }

.match-item.active {
    border-color: var(--accent);
    background: var(--accent-10);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.18);
    color: var(--accent);
    font-weight: 700;
}

.match-pair-badge {
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 5px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-hint {
    font-size: 12.5px;
    color: #7DD3FC;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(6, 182, 212, 0.12);
    border-radius: 8px;
}

/* Pair color themes — 8 colors for up to 8 pairs */
.match-item[data-pair="0"] { background: rgba(59,130,246,0.15);  border-color: #3B82F6; color: #93C5FD; }
.match-item[data-pair="1"] { background: rgba(34,197,94,0.15);   border-color: #22C55E; color: #86EFAC; }
.match-item[data-pair="2"] { background: rgba(168,85,247,0.15);  border-color: #A855F7; color: #D8B4FE; }
.match-item[data-pair="3"] { background: rgba(249,115,22,0.15);  border-color: #F97316; color: #FDBA74; }
.match-item[data-pair="4"] { background: rgba(244,63,94,0.15);   border-color: #F43F5E; color: #FCA5A5; }
.match-item[data-pair="5"] { background: rgba(6,182,212,0.15);   border-color: #06B6D4; color: #67E8F9; }
.match-item[data-pair="6"] { background: rgba(234,179,8,0.15);   border-color: #EAB308; color: #FDE047; }
.match-item[data-pair="7"] { background: rgba(16,185,129,0.15);  border-color: #10B981; color: #6EE7B7; }

/* Admin: pair input rows */
.pair-rows { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }

.pair-row {
    display: grid;
    grid-template-columns: 1fr 18px 1fr 30px;
    gap: 8px;
    align-items: center;
}

.pair-row input {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.pair-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.pair-row input::placeholder { color: var(--ink-3); }

.pair-sep {
    text-align: center;
    color: var(--ink-3);
    font-size: 14px;
    font-weight: 600;
    user-select: none;
}

.pair-remove {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 13px;
    display: grid;
    place-items: center;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.pair-remove:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-10); }

/* Result detail: matching pair breakdown */
.match-pair-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13.5px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-wrap: wrap;
}

.match-pair-detail:last-child { border-bottom: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 760px) {
    .exam-card-head { padding: 16px 18px; }
    .manage-panel { padding: 16px 18px; }
    .exam-actions { width: 100%; }
    .pick-card { padding: 16px 18px; }

    .page { padding: 24px 16px 72px; }

    .topbar-inner { padding: 12px 16px; }

    .brand-name { display: none; }

    .user-chip span:last-child { display: none; }

    .user-chip { padding: 5px; }

    .stats { grid-template-columns: 1fr; gap: 10px; }

    .stat { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }

    .stat-label { margin-bottom: 0; }

    .stat-value { font-size: 24px; }

    .segmented {
        width: 100%;
        display: flex;
    }

    .seg-btn { flex: 1; padding: 9px 8px; font-size: 12.5px; }

    .page-head h2 { font-size: 23px; }

    .form-grid { grid-template-columns: 1fr; }

    .form-section { padding: 20px; }

    .options { grid-template-columns: 1fr; }

    .matching-grid { grid-template-columns: 1fr; }

    .pair-row { grid-template-columns: 1fr 18px 1fr 30px; }

    .q-opts { grid-template-columns: 1fr; }

    .vocab-del { opacity: 1; }

    .result-score { font-size: 19px; }
}

/* ── Lesson Content ─────────────────────────────── */
.lc-section {
    margin-top: 24px;
}
.lc-section-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 10px;
}
.lc-desc {
    font-size: 14.5px;
    color: var(--ink-2);
    line-height: 1.65;
    margin-bottom: 28px;
}
.lc-hint {
    font-size: 13px;
    color: var(--ink-3);
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--surface-2);
    border-radius: var(--r-m);
}

/* ── 声母表 Card Grid ────────────────────────── */
.sm-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sm-card-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1.5px solid var(--line-2);
    border-radius: 14px;
    padding: 20px 20px;
}
.sm-card-row--center {
    justify-content: center;
}
.sm-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.sm-group--center {
    justify-content: center;
}
.sm-sep {
    width: 1.5px;
    align-self: stretch;
    background: var(--line-2);
    border-radius: 2px;
    margin: 0 4px;
}
.sm-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 14px 10px;
    font-size: 26px;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-radius: 10px;
    letter-spacing: -0.01em;
    line-height: 1;
    transition: background 0.15s, transform 0.1s;
    cursor: default;
}
.sm-pill:hover {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    .sm-card-row { padding: 14px; gap: 8px; }
    .sm-pill { font-size: 20px; min-width: 44px; padding: 10px 8px; }
    .sm-group { gap: 6px; }
}
