:root {
    --navy: #071c49;
    --navy-2: #0d2b64;
    --navy-3: #163c7e;
    --orange: #ff7900;
    --orange-dark: #e76400;
    --cream: #fff5e7;
    --surface: #ffffff;
    --text: #10203f;
    --muted: #75819a;
    --line: #e4e9f2;
    --success: #15936a;
    --danger: #d84a43;
    --warning: #a36b00;
    --bg: #f3f6fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px max(24px, calc((100% - 1180px) / 2));
    background: var(--navy);
    color: #fff;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .2px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--orange);
    color: #fff;
    font-size: 24px;
    line-height: 1;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    color: #dbe6ff;
    font-size: 14px;
}

.desktop-nav a:hover {
    color: #fff;
}

.nav-user {
    color: #ffc38d;
}

.container {
    width: min(1180px, calc(100% - 36px));
    margin: 28px auto 70px;
}

.home-body {
    background: var(--navy);
}

.home-body .container {
    width: 100%;
    max-width: none;
    margin: 0;
}

.home-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 72px;
    color: #fff;
}

.home-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.home-titlebar h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.18;
}

.eyebrow,
.panel-kicker {
    display: block;
    margin: 0 0 8px;
    color: #ffc184;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.8px;
}

.home-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 2px solid #f5a15a;
    border-radius: 50%;
    background: var(--navy-2);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.daily-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 24px;
    overflow: hidden;
    margin-bottom: 32px;
    padding: 30px 34px 36px;
    border-radius: 28px;
    background: var(--orange);
    box-shadow: 0 18px 36px rgba(0, 0, 0, .18);
}

.daily-card::after {
    position: absolute;
    right: 80px;
    bottom: -50px;
    width: 190px;
    height: 120px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 50%;
    content: "";
    transform: rotate(-14deg);
}

.daily-copy,
.daily-rate {
    position: relative;
    z-index: 1;
}

.daily-label {
    color: #ffe4ca;
    font-size: 14px;
}

.daily-card h2 {
    margin: 4px 0;
    color: #fff;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.18;
}

.daily-card p {
    margin: 0 0 18px;
    color: #fff0df;
}

.daily-rate {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    text-align: right;
}

.daily-rate span,
.daily-rate small {
    color: #fff0df;
}

.daily-rate strong {
    color: #fff;
    font-size: 48px;
    line-height: 1.1;
}

.daily-progress {
    position: absolute;
    right: 34px;
    bottom: 16px;
    left: 34px;
    height: 6px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255,255,255,.35);
}

.daily-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #fff;
}

.home-section {
    margin-bottom: 30px;
}

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

.section-title h2 {
    margin: 0;
    font-size: 24px;
}

.section-title span {
    color: #9eb2d8;
    font-size: 13px;
}

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

.feature-card {
    position: relative;
    min-height: 158px;
    padding: 24px 20px;
    border-radius: 22px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 10px 24px rgba(0,0,0,.13);
    transition: transform .18s ease, box-shadow .18s ease;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0,0,0,.18);
}

.feature-card b {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 0 22px 0 18px;
    background: var(--orange);
    color: #fff;
    font-size: 20px;
}

.feature-icon {
    display: block;
    margin-bottom: 18px;
    color: var(--orange);
    font-size: 32px;
    line-height: 1;
}

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

.feature-card strong {
    font-size: 20px;
}

.feature-card small {
    margin-top: 4px;
    color: var(--muted);
}

.accuracy-panel,
.welcome-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px 180px;
    align-items: center;
    gap: 22px;
    padding: 26px 30px;
    border-radius: 22px;
    background: #fff;
    color: var(--text);
}

.accuracy-panel h2,
.welcome-card h2 {
    margin: 0 0 4px;
    font-size: 26px;
}

.accuracy-panel p,
.welcome-card p {
    margin: 0;
    color: var(--muted);
}

.accuracy-number {
    color: var(--orange);
    font-size: 46px;
    font-weight: 900;
    text-align: center;
}

.mini-stats {
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.mini-stats b {
    color: var(--text);
    font-size: 21px;
}

.quiz-body {
    background: var(--navy);
}

.quiz-body .container {
    max-width: none;
    margin-top: 0;
}

.quiz-shell {
    width: min(860px, calc(100% - 36px));
    margin: 0 auto;
    padding: 30px 0 70px;
    color: #fff;
}

.quiz-topline {
    display: grid;
    grid-template-columns: 44px 1fr 90px;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.back-link {
    color: #fff;
    font-size: 44px;
    line-height: 1;
}

.quiz-title {
    text-align: center;
}

.quiz-title span,
.quiz-title strong {
    display: block;
}

.quiz-title span {
    color: #aebfe1;
    font-size: 13px;
}

.quiz-title strong {
    font-size: 22px;
}

.quiz-score {
    color: #ff9b4d;
    font-size: 21px;
    font-weight: 800;
    text-align: right;
}

.quiz-progress-card {
    margin-bottom: 20px;
    padding: 16px 20px;
    border-radius: 18px;
    background: var(--cream);
    color: var(--text);
}

.quiz-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    font-weight: 800;
}

.quiz-progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 12px;
    background: #ffdcb6;
}

.quiz-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--orange);
}

.single-question-card {
    padding: clamp(24px, 5vw, 46px);
    border-radius: 28px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 18px 42px rgba(0,0,0,.18);
}

.question-kicker {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--orange-dark);
    font-size: 13px;
    font-weight: 800;
}

.single-question-card h1 {
    margin: 0 0 28px;
    font-size: clamp(23px, 3vw, 34px);
    line-height: 1.45;
}

.single-options {
    display: grid;
    gap: 13px;
}

.single-option {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    padding: 10px 18px;
    border: 2px solid #eef0f4;
    border-radius: 38px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.single-option:hover,
.single-option.selected {
    border-color: var(--orange);
    background: #fffaf5;
    box-shadow: 0 8px 18px rgba(255,121,0,.12);
}

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

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f2f4f8;
    color: var(--navy);
    font-weight: 900;
}

.single-option.selected .option-letter {
    background: var(--orange);
    color: #fff;
}

.option-text {
    font-size: 17px;
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 22px;
}

.save-hint {
    margin: 12px 0 0;
    color: #9eb2d8;
    font-size: 13px;
    text-align: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

.orange-button {
    border-color: var(--orange);
    background: var(--orange);
    color: #fff;
}

.orange-button:hover {
    background: var(--orange-dark);
}

.light-button {
    border-color: #fff;
    background: #fff;
    color: var(--orange-dark);
}

.outline-light {
    border-color: var(--orange);
    color: var(--orange-dark);
}

.skip-button {
    border-color: rgba(255,255,255,.35);
    background: transparent;
    color: #d9e3f7;
}

.quiz-empty {
    width: min(600px, calc(100% - 36px));
    margin: 70px auto;
    padding: 42px;
    border-radius: 24px;
    background: #fff;
    text-align: center;
}

.empty-icon {
    color: var(--orange);
    font-size: 50px;
}

.quiz-empty h1 {
    margin: 8px 0;
}

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

.section-head,
.toolbar,
.panel,
.question,
.empty {
    margin-bottom: 18px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.section-head h1,
.panel h1 {
    margin: 0 0 8px;
}

.section-head p,
.hint {
    color: var(--muted);
}

.form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.narrow {
    max-width: 460px;
    margin: 0 auto;
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert-success {
    border-color: #b7e2d2;
    background: #eefaf6;
    color: var(--success);
}

.alert-danger {
    border-color: #efc6c0;
    background: #fff2f0;
    color: var(--danger);
}

.alert-warning {
    border-color: #ecd89b;
    background: #fff8df;
    color: var(--warning);
}

.actions,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

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

.card {
    padding: 20px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(16,32,63,.06);
}

.card strong {
    display: block;
    font-size: 30px;
}

.card span {
    color: var(--muted);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--orange);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.badge.soft {
    background: #eef3fb;
    color: var(--muted);
}

.question h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

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

.option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.option input {
    width: 18px;
    min-height: 18px;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.answer-grid div {
    padding: 14px;
    border-radius: 8px;
    background: #f3f6fb;
}

.answer-grid span {
    display: block;
    color: var(--muted);
}

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

.right-text {
    color: var(--success);
}

.explanation {
    margin: 14px 0;
    padding: 14px;
    border-left: 4px solid var(--orange);
    background: #fff8ef;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
}

.link-danger {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
}

.sample {
    overflow: auto;
    padding: 14px;
    border-radius: 8px;
    background: #101827;
    color: #f8fafc;
    font-size: 13px;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pager a {
    min-width: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    text-align: center;
}

.pager a.active {
    border-color: var(--orange);
    background: var(--orange);
    color: #fff;
}

.bottom-nav {
    display: none;
}

.quiz-setup {
    width: min(620px, calc(100% - 36px));
    margin: 42px auto;
    padding: 42px;
    border-radius: 26px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 18px 42px rgba(0,0,0,.18);
}

.quiz-setup-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: var(--orange);
    color: #fff;
    font-size: 40px;
    line-height: 1;
}

.quiz-setup h1 {
    margin: 0 0 8px;
    font-size: 32px;
}

.setup-lead {
    margin: 0 0 24px;
    color: var(--muted);
}

.setup-form {
    display: grid;
    gap: 18px;
}

.count-options {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.count-chip {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.count-chip.active,
.count-chip:hover {
    border-color: var(--orange);
    background: #fff4e7;
    color: var(--orange-dark);
}

.setup-submit {
    min-height: 50px;
    margin-top: 4px;
}

.test-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.warning-button {
    border-color: #f1b64a;
    color: #9b6600;
}

.danger-button {
    border-color: #efc0bd;
    color: var(--danger);
}

@media (max-width: 860px) {
    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .accuracy-panel,
    .welcome-card {
        grid-template-columns: 1fr 130px;
    }

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

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

@media (max-width: 640px) {
    .topbar {
        padding: 13px 18px;
    }

    .desktop-nav {
        gap: 10px;
        font-size: 12px;
    }

    .desktop-nav a:nth-child(2),
    .desktop-nav a:nth-child(3),
    .desktop-nav .nav-user {
        display: none;
    }

    .container,
    .home-shell,
    .quiz-shell {
        width: calc(100% - 24px);
    }

    .home-shell,
    .quiz-shell {
        padding-top: 22px;
        padding-bottom: 88px;
    }

    .home-titlebar h1 {
        font-size: 28px;
    }

    .daily-card {
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 24px 22px 36px;
        border-radius: 22px;
    }

    .daily-rate {
        align-items: flex-start;
        margin-top: 12px;
        text-align: left;
    }

    .daily-rate strong {
        font-size: 38px;
    }

    .daily-progress {
        right: 22px;
        left: 22px;
    }

    .feature-grid {
        gap: 12px;
    }

    .feature-card {
        min-height: 142px;
        padding: 18px 16px;
        border-radius: 18px;
    }

    .feature-card b {
        width: 34px;
        height: 34px;
        border-radius: 0 18px 0 14px;
    }

    .feature-icon {
        margin-bottom: 12px;
        font-size: 26px;
    }

    .feature-card strong {
        font-size: 17px;
    }

    .feature-card small {
        font-size: 12px;
    }

    .accuracy-panel,
    .welcome-card {
        grid-template-columns: 1fr;
        padding: 22px;
        border-radius: 18px;
    }

    .quiz-setup {
        width: calc(100% - 24px);
        margin-top: 24px;
        padding: 26px 20px;
        border-radius: 20px;
    }

    .quiz-setup h1 {
        font-size: 27px;
    }

    .test-form {
        align-items: flex-start;
        flex-direction: column;
    }

    .accuracy-number {
        text-align: left;
    }

    .single-question-card {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .single-question-card h1 {
        font-size: 22px;
    }

    .single-option {
        min-height: 58px;
        padding: 8px 12px;
        border-radius: 28px;
    }

    .option-text {
        font-size: 15px;
    }

    .quiz-actions {
        position: sticky;
        bottom: 62px;
        z-index: 12;
        margin-right: -6px;
        margin-left: -6px;
        padding: 10px 6px;
        background: var(--navy);
    }

    .quiz-actions .button {
        flex: 1;
    }

    .bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 30;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: end;
        height: 62px;
        padding: 6px 12px 5px;
        border-top: 1px solid #e8ecf4;
        background: #fff;
        box-shadow: 0 -8px 24px rgba(7,28,73,.14);
    }

    .bottom-nav a {
        display: grid;
        justify-items: center;
        gap: 1px;
        color: #6f7788;
        font-size: 21px;
        line-height: 1;
    }

    .bottom-nav small {
        font-size: 11px;
    }

    .bottom-nav .bottom-main {
        align-self: start;
        justify-self: center;
        width: 58px;
        height: 58px;
        margin-top: -30px;
        border: 5px solid var(--navy);
        border-radius: 50%;
        background: var(--orange);
        color: #fff;
        font-size: 38px;
        box-shadow: 0 6px 16px rgba(255,121,0,.3);
    }

    .bottom-nav .bottom-main small {
        display: none;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

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

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

    table {
        display: block;
        overflow-x: auto;
    }
}
