:root {
    --primary: #1677FF;
    --primary-weak: #E8F2FF;
    --surface: #FFFFFF;
    --soft: #F5F7FA;
    --success: #52C41A;
    --danger: #FF4D4F;
    --text: #333333;
    --muted: #7B8494;
    --border: #E5E6EB;
    --shadow: 0 10px 30px rgba(19, 33, 68, 0.08);
    --radius: 16px;
}

[data-theme="dark"] {
    --surface: #151922;
    --soft: #0F131B;
    --text: #F2F5FA;
    --muted: #9BA5B7;
    --border: #252B36;
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--soft);
    color: var(--text);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

.mobile-shell {
    width: 100%;
    min-height: 100svh;
    margin: 0 auto;
    background: var(--soft);
    position: relative;
    padding-bottom: 40px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 82px;
    padding: 0 clamp(24px, 3vw, 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    background: #36AFE8;
    border-bottom: 0;
    backdrop-filter: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-right: auto;
    color: #fff;
}

.brand-mark,
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.topbar .brand-mark {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 16px;
}

.brand small {
    color: rgba(255, 255, 255, .82);
    font-size: 12px;
}

.pc-nav {
    height: 100%;
    display: flex;
    align-items: stretch;
}

.pc-nav button,
.pc-nav a {
    min-width: 96px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
}

.pc-nav button.active,
.pc-nav a.active {
    background: #248CC1;
}

.avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    font-weight: 800;
    margin-left: auto;
}

.icon-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    transition: transform .16s ease, background .16s ease, border .16s ease;
}

.icon-btn:active,
.primary-btn:active,
.entry-card:active,
.mini-btn:active {
    transform: scale(.96);
}

.icon-btn.active [data-icon="star"]::before {
    content: "★";
    color: var(--primary);
}

.ghost {
    background: transparent;
    border-color: transparent;
}

@media (min-width: 720px) {
    .topbar #backBtn {
        display: none !important;
    }
}

.view {
    display: none;
    width: calc(100vw - 64px);
    max-width: 100%;
    margin: 0 auto;
    padding: 32px 0;
    animation: viewIn .28s ease both;
}

.view.active {
    display: block;
}

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

.home-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin: 8px 0 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
}

h1,
h2,
p {
    margin: 0;
}

.home-head h1 {
    max-width: 520px;
    font-size: 34px;
    line-height: 1.22;
}

.home-view {
    padding-top: 28px;
}

.home-hero {
    min-height: 280px;
    padding: clamp(28px, 4vw, 56px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 36px;
    align-items: end;
    overflow: hidden;
    position: relative;
    color: #fff;
    background:
        linear-gradient(115deg, rgba(15, 51, 99, .96), rgba(22, 119, 255, .88)),
        radial-gradient(circle at 86% 12%, rgba(82, 196, 26, .32), transparent 32%);
    border-radius: 0 0 28px 28px;
}

.home-hero::after {
    content: "";
    position: absolute;
    right: clamp(18px, 5vw, 84px);
    top: 32px;
    width: 270px;
    height: 270px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    opacity: .72;
}

.home-copy,
.home-progress-block {
    position: relative;
    z-index: 1;
}

.home-copy .eyebrow {
    color: rgba(255, 255, 255, .72);
}

.home-copy h1 {
    max-width: 780px;
    font-size: clamp(38px, 5.2vw, 76px);
    line-height: 1.02;
    font-weight: 900;
}

.home-subtitle {
    max-width: 560px;
    margin-top: 18px;
    color: rgba(255, 255, 255, .76);
    font-size: 16px;
    line-height: 1.8;
}

.home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.home-actions .primary-btn {
    background: #fff;
    color: #0F3363;
}

.home-actions .outline-link {
    border-color: rgba(255, 255, 255, .42);
    color: #fff;
}

.home-actions .text-btn {
    background: rgba(255, 255, 255, .14);
    color: #fff;
}

.home-progress-block {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 180px;
    padding-left: 28px;
    border-left: 1px solid rgba(255, 255, 255, .22);
}

.home-progress-block span {
    color: rgba(255, 255, 255, .72);
    font-size: 14px;
}

.home-progress-block strong {
    margin-top: 10px;
    font-size: clamp(56px, 7vw, 96px);
    line-height: .92;
}

.home-progress-track {
    height: 9px;
    margin-top: 28px;
    overflow: hidden;
    background: rgba(255, 255, 255, .18);
}

.home-progress-track i {
    display: block;
    width: 0;
    height: 100%;
    background: #52C41A;
    transition: width .5s ease;
}

.home-metric-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.home-metric-strip div {
    min-height: 104px;
    padding: 22px 30px;
    border-right: 1px solid var(--border);
}

.home-metric-strip div:last-child {
    border-right: 0;
}

.home-metric-strip span,
.practice-lane small,
.home-stream .section-title,
.home-track .section-title {
    color: var(--muted);
}

.home-metric-strip strong {
    display: block;
    margin-top: 8px;
    font-size: 32px;
}

.practice-lanes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.practice-lane {
    min-height: 138px;
    padding: 24px 28px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-content: center;
    column-gap: 14px;
    text-align: left;
    background: transparent;
    border-right: 1px solid var(--border);
    color: var(--text);
    transition: background .18s ease, transform .18s ease;
}

.practice-lane:last-child {
    border-right: 0;
}

.practice-lane:hover {
    background: #F8FBFF;
}

.practice-lane:active {
    transform: translateY(1px);
}

.practice-lane [data-icon] {
    grid-row: span 2;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: var(--primary-weak);
    color: var(--primary);
}

.practice-lane.primary [data-icon] {
    background: var(--primary);
    color: #fff;
}

.practice-lane.danger [data-icon] {
    background: #FFF1F0;
    color: var(--danger);
}

.practice-lane strong {
    font-size: 18px;
}

.practice-lane small {
    margin-top: 5px;
}

.home-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
    gap: 56px;
    padding: 34px 0 10px;
}

.home-stream,
.home-track {
    min-width: 0;
}

.home-stream .section-title,
.home-track .section-title {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.home-stream .section-title h2,
.home-track .section-title h2 {
    color: var(--text);
    font-size: 22px;
}

.home-view .record-list,
.home-view .chapter-strip {
    gap: 0;
}

.home-view .record-item {
    min-height: 86px;
    padding: 18px 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

.record-index,
.chapter-rank {
    color: #B7C0CE;
    font-weight: 800;
    letter-spacing: .08em;
}

.home-view .record-item strong {
    -webkit-line-clamp: 1;
    font-size: 16px;
}

.home-view .record-item small {
    display: block;
    margin-top: 6px;
}

.home-view .chapter-strip {
    grid-template-columns: minmax(0, 1fr);
}

.home-view .chapter-card {
    padding: 18px 0;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    text-align: left;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

.home-view .chapter-card > span:not(.chapter-rank) {
    margin: 4px 0 0;
    grid-column: 2 / 3;
    color: var(--muted);
}

.home-view .chapter-card small {
    grid-column: 3 / 4;
    grid-row: 1 / span 2;
    color: var(--primary);
    font-weight: 800;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-tile {
    min-height: 82px;
    padding: 12px 9px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-tile span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.stat-tile strong {
    display: block;
    margin-top: 10px;
    color: var(--text);
    font-size: clamp(18px, 4.8vw, 24px);
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.entry-card {
    min-height: 132px;
    text-align: left;
    padding: 18px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .16s ease, box-shadow .16s ease;
}

.entry-card.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.entry-card.danger span:first-child {
    color: var(--danger);
}

.entry-card strong,
.entry-card small {
    display: block;
}

.entry-card strong {
    margin-top: 14px;
    font-size: 18px;
}

.entry-card small {
    margin-top: 4px;
    color: currentColor;
    opacity: .72;
}

.panel,
.question-card,
.auth-panel,
.answer-panel,
.score-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    padding: 16px;
    margin-bottom: 14px;
}

.home-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title h1,
.section-title h2 {
    font-size: 18px;
}

.sticky-title {
    margin-bottom: 12px;
}

.primary-btn,
.text-btn,
.mini-btn,
.plain-btn,
.outline-link {
    min-height: 48px;
    border-radius: 14px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-decoration: none;
    transition: transform .16s ease, opacity .16s ease, background .16s ease;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
}

.text-btn,
.mini-btn {
    background: var(--primary-weak);
    color: var(--primary);
}

.mini-btn {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 13px;
}

.plain-btn {
    width: 100%;
    background: transparent;
    color: var(--primary);
}

.outline-link {
    border: 1px solid var(--border);
    color: var(--text);
}

.record-list,
.question-list,
.rank-list {
    display: grid;
    gap: 10px;
}

.record-item,
.list-item,
.rank-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: var(--soft);
}

.record-item strong,
.list-item strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.record-item small,
.list-item small,
.rank-item small {
    color: var(--muted);
}

.chapter-strip,
.chapter-layout {
    display: grid;
    gap: 10px;
}

.chapter-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chapter-layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chapter-card {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--soft);
    border: 1px solid var(--border);
}

.chapter-card strong,
.chapter-card span,
.chapter-card small {
    display: block;
}

.chapter-card span {
    margin: 6px 0;
    color: var(--muted);
}

.auth-panel {
    padding: 24px;
    margin-top: 12vh;
}

.auth-panel p {
    color: var(--muted);
    margin: 8px 0 22px;
}

.auth-panel label {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--muted);
}

input,
textarea,
select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 14px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}

.quiz-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.quiz-head p {
    color: var(--muted);
}

.quiz-head h2 {
    font-size: 24px;
}

.exam-clock {
    min-width: 72px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--danger);
    color: #fff;
    font-weight: 800;
}

.exam-layout {
    display: grid;
    gap: 14px;
}

.exam-sidebar,
.exam-sheet {
    display: grid;
    gap: 12px;
}

.exam-box {
    position: relative;
    border: 1px solid #BFC5CC;
    border-radius: 4px;
    background: #fff;
}

.exam-box > span,
.exam-legend {
    display: inline-block;
    padding: 0 10px;
    color: #1F2D3D;
    background: var(--soft);
    font-size: 14px;
}

.exam-room {
    min-height: 54px;
    padding: 16px 12px 10px;
    text-align: center;
}

.exam-room > span,
.timer-card > span,
.candidate-card .exam-legend,
.hint-box .exam-legend,
.question-card .exam-legend {
    position: absolute;
    left: 50%;
    top: -11px;
    transform: translateX(-50%);
    white-space: nowrap;
}

.exam-room strong,
.timer-card strong {
    display: block;
    font-size: 16px;
    font-weight: 500;
}

.candidate-card {
    padding: 28px 12px 16px;
}

.candidate-photo {
    width: 110px;
    height: 110px;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
    border: 1px solid #BFC5CC;
    color: var(--primary);
    font-size: 34px;
    font-weight: 800;
    background: #F8FAFC;
}

.candidate-card strong {
    display: block;
    color: #ff2f48;
    text-align: center;
    font-weight: 500;
    margin-bottom: 10px;
}

.candidate-card p {
    margin-top: 6px;
    color: #111827;
    font-size: 14px;
}

.timer-card {
    min-height: 58px;
    padding: 18px 12px 8px;
    text-align: center;
}

.timer-card strong {
    color: #ff2f48;
    font-size: 26px;
    line-height: 1;
}

.exam-main {
    min-width: 0;
}

.quiz-clock-copy {
    min-width: 76px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #fff1f0;
    color: #ff2f48;
    border: 1px solid #ffccc7;
    font-weight: 800;
}

.study-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.study-mode-toggle button {
    min-height: 38px;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.study-mode-toggle button.active {
    background: var(--primary);
    color: #fff;
}

.answer-choice-line {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.answer-choice-line > span {
    color: #111827;
    font-size: 14px;
}

.hint-box {
    min-height: 52px;
    padding: 20px 12px 10px;
}

.hint-box p {
    color: #111827;
    font-size: 14px;
}

.question-palette {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    border-top: 1px solid #E7EAF0;
    border-left: 1px solid #E7EAF0;
    background: #fff;
}

.palette-item {
    aspect-ratio: 1;
    min-width: 0;
    display: grid;
    place-items: center;
    border-right: 1px solid #E7EAF0;
    border-bottom: 1px solid #E7EAF0;
    background: #fff;
    color: #1F2D3D;
    font-size: 14px;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.palette-item.active {
    background: var(--primary);
    color: #fff;
}

.palette-item.done:not(.active) {
    background: #E8F6EF;
    color: #168A45;
}

.palette-item.memorized:not(.active) {
    background: #FFF7E6;
    color: #B56B00;
}

.palette-item.marked:not(.active)::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--danger);
    align-self: start;
    justify-self: end;
    margin: 3px;
    grid-area: 1 / 1;
}

.palette-item:active {
    transform: scale(.94);
}

.progress-bar {
    height: 8px;
    background: #DCE8F8;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: inherit;
    transition: width .35s ease;
}

.question-card {
    position: relative;
    padding: 18px;
    margin-bottom: 14px;
}

.question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.question-meta span {
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--primary-weak);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.question-card h1 {
    font-size: 19px;
    line-height: 1.55;
}

.options-list {
    display: grid;
    gap: 10px;
}

.option {
    min-height: 58px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 2px solid var(--border);
    transition: transform .16s ease, border .16s ease, background .16s ease;
    text-align: left;
}

.option:active {
    transform: scale(.985);
}

.option .code {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--soft);
    color: var(--muted);
    font-weight: 800;
}

.option.selected {
    border-color: var(--primary);
    background: var(--primary-weak);
}

.option.correct {
    border-color: var(--success);
}

.option.wrong {
    border-color: var(--danger);
}

.option-empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--soft);
}

.answer-panel {
    margin-top: 14px;
    padding: 16px;
    animation: feedbackIn .28s ease both;
}

@keyframes feedbackIn {
    from {
        opacity: 0;
        transform: scale(.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.answer-panel strong {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
}

.answer-panel h3 {
    margin: 14px 0 6px;
    font-size: 14px;
}

.answer-panel p {
    color: var(--muted);
    white-space: pre-wrap;
}

.bottom-actions {
    position: sticky;
    bottom: 76px;
    display: grid;
    grid-template-columns: 44px 44px minmax(0, 1fr);
    gap: 8px;
    margin-top: 16px;
    padding: 10px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.bottom-actions.exam-actions {
    grid-template-columns: 44px 44px minmax(0, 1fr) 92px;
}

.exam-bottom {
    display: grid;
    gap: 12px;
}

.secondary-action,
.finish-action {
    min-height: 44px;
    border-radius: 0;
}

.secondary-action {
    background: #1E9AF0;
}

.finish-action {
    background: #24A65A;
}

.score-panel {
    padding: 24px;
    text-align: center;
}

.score-panel p {
    color: var(--muted);
}

.score-number {
    margin: 16px 0 4px;
    color: var(--primary);
    font-weight: 900;
    font-size: 72px;
    line-height: 1;
}

.score-number span {
    display: inline-block;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 20px 0;
}

.score-grid span {
    padding: 12px 6px;
    border-radius: 14px;
    background: var(--soft);
    color: var(--muted);
    font-size: 12px;
}

.score-grid strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-size: 18px;
}

.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 12px;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.heatmap {
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    gap: 4px;
}

.heatmap span {
    aspect-ratio: 1;
    border-radius: 4px;
    background: #DDE5F0;
}

.heatmap span[data-level="1"] {
    background: #B9D8FF;
}

.heatmap span[data-level="2"] {
    background: #6BAEFF;
}

.heatmap span[data-level="3"] {
    background: var(--primary);
}

.tabbar {
    display: none;
}

.site-footer {
    width: calc(100vw - 64px);
    max-width: 100%;
    margin: 12px auto 0;
    padding: 14px 12px 22px;
    text-align: center;
    color: var(--muted);
    background: transparent;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.tabbar button {
    background: transparent;
    color: var(--muted);
    border-radius: 14px;
    display: grid;
    place-items: center;
    gap: 2px;
}

.tabbar button.active {
    color: var(--primary);
    background: var(--primary-weak);
}

.tabbar small {
    font-size: 11px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 88px;
    z-index: 100;
    transform: translateX(-50%) translateY(12px);
    min-width: 160px;
    max-width: min(86vw, 360px);
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(16, 21, 34, .92);
    color: #fff;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 18px 0;
}

.hidden {
    display: none !important;
}

[data-icon]::before {
    display: inline-block;
    font-size: 22px;
    line-height: 1;
}

[data-icon="back"]::before { content: "←"; }
[data-icon="list"]::before { content: "☰"; }
[data-icon="shuffle"]::before { content: "⇄"; }
[data-icon="timer"]::before { content: "⏱"; }
[data-icon="alert"]::before { content: "!"; }
[data-icon="prev"]::before { content: "‹"; }
[data-icon="next"]::before { content: "›"; }
[data-icon="star"]::before { content: "☆"; }
[data-icon="home"]::before { content: "⌂"; }
[data-icon="book"]::before { content: "▤"; }
[data-icon="exam"]::before { content: "✓"; }
[data-icon="wrong"]::before { content: "×"; }
[data-icon="user"]::before { content: "○"; }

@media (max-width: 719px) {
    .mobile-shell {
        width: min(100%, 540px);
        padding-bottom: 110px;
    }

    .topbar {
        height: 64px;
        padding: 10px 16px;
        justify-content: space-between;
        gap: 10px;
        background: color-mix(in srgb, var(--surface) 90%, transparent);
        border-bottom: 1px solid var(--border);
        backdrop-filter: blur(18px);
    }

    .brand {
        margin-right: 0;
        color: var(--text);
    }

    .topbar .brand-mark {
        background: var(--primary);
    }

    .brand small {
        color: var(--muted);
    }

    .pc-nav {
        display: none;
    }

    .avatar-btn {
        margin-left: 0;
        background: var(--primary-weak);
        color: var(--primary);
    }

    .view {
        width: auto;
        margin: 0;
        padding: 18px 16px;
    }

    .home-view {
        padding: 0 0 18px;
    }

    .home-hero {
        min-height: auto;
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding: 28px 20px;
        border-radius: 0 0 22px 22px;
    }

    .home-hero::after {
        right: -70px;
        top: 34px;
        width: 190px;
        height: 190px;
    }

    .home-copy h1 {
        font-size: 38px;
        line-height: 1.08;
    }

    .home-subtitle {
        font-size: 14px;
        line-height: 1.7;
    }

    .home-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .home-actions .primary-btn {
        grid-column: 1 / -1;
    }

    .home-progress-block {
        min-height: auto;
        padding: 20px 0 0;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, .22);
    }

    .home-progress-block strong {
        font-size: 54px;
    }

    .home-metric-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-metric-strip div {
        min-height: 82px;
        padding: 16px 12px;
    }

    .home-metric-strip span {
        font-size: 12px;
    }

    .home-metric-strip strong {
        font-size: 22px;
    }

    .practice-lanes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .practice-lane {
        min-height: 120px;
        padding: 18px 14px;
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .practice-lane:nth-child(2n) {
        border-right: 0;
    }

    .practice-lane [data-icon] {
        width: 34px;
        height: 34px;
    }

    .practice-lane strong {
        font-size: 16px;
    }

    .practice-lane small {
        font-size: 12px;
    }

    .home-workspace {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding: 24px 0 0;
    }

    .home-stream,
    .home-track {
        padding: 0 16px;
    }

    .home-view .record-item {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .home-view .record-item .mini-btn {
        grid-column: 2;
        justify-self: start;
        margin-top: 10px;
    }

    .home-view .chapter-card {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .home-view .chapter-card small {
        grid-column: 2;
        grid-row: auto;
        justify-self: start;
        margin-top: 4px;
    }

    .home-head h1 {
        max-width: 300px;
        font-size: 26px;
    }

    .stats-grid {
        gap: 9px;
        margin-bottom: 18px;
    }

    .entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 18px;
    }

    .chapter-strip,
    .chapter-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-panels {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .exam-sidebar {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }

    .candidate-card {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 74px minmax(0, 1fr);
        column-gap: 12px;
        padding-top: 22px;
    }

    .candidate-photo {
        width: 74px;
        height: 74px;
        grid-row: span 5;
        margin: 0;
        font-size: 24px;
    }

    .candidate-card strong {
        text-align: left;
        margin: 0 0 2px;
    }

    .candidate-card p {
        margin-top: 3px;
        font-size: 12px;
    }

    .exam-room,
    .timer-card {
        min-height: 60px;
    }

    .answer-choice-line .options-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-palette {
        display: flex;
        overflow-x: auto;
        border: 1px solid #E7EAF0;
    }

    .palette-item {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        aspect-ratio: auto;
    }

    .quiz-clock-copy {
        display: none;
    }

    .tabbar {
        position: fixed;
        left: 50%;
        bottom: 0;
        z-index: 40;
        width: min(100%, 540px);
        transform: translateX(-50%);
        height: 68px;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        background: color-mix(in srgb, var(--surface) 94%, transparent);
        border-top: 1px solid var(--border);
        backdrop-filter: blur(18px);
    }

    .site-footer {
        position: fixed;
        left: 50%;
        bottom: 68px;
        z-index: 35;
        width: min(100%, 540px);
        transform: translateX(-50%);
        margin: 0;
        padding: 4px 12px;
        background: color-mix(in srgb, var(--surface) 88%, transparent);
        border-top: 1px solid var(--border);
    }
}

@media (min-width: 980px) {
    .home-head h1 {
        max-width: 760px;
    }

    .chapter-layout {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .question-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-panel {
        width: min(560px, 100%);
        margin: 80px auto;
    }

    .score-panel {
        width: min(860px, 100%);
        margin: 70px auto;
    }

    #view-profile {
        display: none;
        grid-template-columns: 360px minmax(0, 1fr);
        gap: 16px;
        align-items: start;
    }

    #view-profile.active {
        display: grid;
    }

    #view-profile .panel {
        margin-bottom: 0;
    }

    .exam-layout {
        width: 100%;
        margin: 10px 0 0;
        display: grid;
        grid-template-columns: 206px minmax(560px, 1fr) 336px;
        gap: 16px;
        align-items: start;
    }

    .exam-main {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .quiz-head {
        height: 0;
        margin: 0;
        overflow: hidden;
    }

    .progress-bar {
        height: 0;
        margin: 0;
    }

    .study-mode-toggle {
        width: 170px;
        margin: 0 0 10px auto;
        border-radius: 4px;
        box-shadow: none;
    }

    .study-mode-toggle button {
        min-height: 32px;
        border-radius: 2px;
        font-size: 14px;
    }

    .question-card {
        min-height: 380px;
        margin-bottom: 0;
        padding: 28px 26px 30px;
        display: flex;
        flex-direction: column;
        border-radius: 4px;
        border-color: #BFC5CC;
        box-shadow: none;
    }

    .question-card .exam-legend {
        position: absolute;
        left: 28px;
        top: -11px;
        transform: none;
        background: #f7f7f7;
    }

    .question-meta {
        margin-bottom: 10px;
    }

    .question-meta span {
        border-radius: 0;
        background: transparent;
        color: #5A6675;
        padding: 0;
        font-size: 13px;
        font-weight: 400;
    }

    .question-card h1 {
        font-size: 21px;
        line-height: 1.7;
        font-weight: 400;
        color: #111827;
    }

    .answer-choice-line {
        margin: 28px 0 0;
        padding: 0;
        display: grid;
        grid-template-columns: 76px minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        position: relative;
        z-index: 2;
    }

    .answer-choice-line > span {
        padding-top: 13px;
        text-align: right;
    }

    .answer-choice-line .options-list {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .option {
        min-height: 46px;
        padding: 8px 12px;
        display: grid;
        grid-template-columns: 38px minmax(0, 1fr);
        place-items: initial;
        align-items: center;
        gap: 12px;
        border-radius: 4px;
        border: 1px solid #C8D0DA;
        box-shadow: none;
        background: #fff;
        color: #111827;
        font-size: 16px;
        line-height: 1.5;
    }

    .option .code {
        width: 30px;
        height: 30px;
        border-radius: 4px;
        background: #F3F7FB;
        color: #1F2D3D;
        font-weight: 700;
    }

    .option.selected {
        border-color: #1677FF;
        background: #E8F2FF;
        color: #111827;
    }

    .option.selected .code {
        background: #1677FF;
        color: #fff;
    }

    .exam-bottom {
        margin-top: 28px;
        display: grid;
        grid-template-columns: 330px minmax(0, 1fr);
        align-items: start;
        gap: 48px;
    }

    .hint-box {
        min-height: 52px;
        box-shadow: none;
        background: #fff;
    }

    .hint-box .exam-legend {
        background: #f7f7f7;
    }

    .bottom-actions {
        position: static;
        grid-template-columns: 100px 0 100px;
        gap: 20px;
        margin: 7px 0 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        backdrop-filter: none;
    }

    .bottom-actions.exam-actions {
        grid-template-columns: 100px 0 100px 100px;
    }

    #favoriteQuestion {
        width: 0;
        height: 0;
        padding: 0;
        border: 0;
        overflow: hidden;
    }

    .answer-panel {
        margin-top: 20px;
        border-radius: 4px;
        box-shadow: none;
    }

    .exam-sheet {
        padding-top: 2px;
        max-height: calc(100svh - 126px);
        overflow: auto;
    }

    .question-palette {
        grid-template-columns: repeat(10, 1fr);
        width: 100%;
    }

    .palette-item {
        width: auto;
        height: 35px;
        aspect-ratio: auto;
        font-size: 14px;
    }

    .profile-actions,
    .score-grid {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
    }
}
