/* ================================================
   RESET & BASE
================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #F2F2EF;
    font-family: 'DM Sans', sans-serif;
    color: #111110;
    min-height: 100vh;
    display: flex;
}

a { text-decoration: none; color: inherit; }

/* ================================================
   LAYOUT — SIDE NAV + MAIN
================================================ */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ---- Side Nav ---- */
.side-nav {
    width: 72px;
    background: #fff;
    border-right: 1px solid #E8E8E3;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    gap: 0;
}

.side-nav-logo {
    width: 40px;
    height: 40px;
    background: #111110;
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.side-nav-logo span {
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    font-family: 'DM Mono', monospace;
}

.nav-items {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    flex: 1;
}

.nav-item {
    width: 44px;
    height: 44px;
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ADADB0;
    transition: background .15s, color .15s;
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: #F4F4F0;
    color: #111110;
}

.nav-item.active {
    background: #111110;
    color: #fff;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-tooltip {
    position: absolute;
    left: calc(100% + 12px);
    background: #111110;
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: .35rem .7rem;
    border-radius: .5rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .15s, transform .15s;
    z-index: 200;
}

.nav-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #111110;
}

.nav-item:hover .nav-tooltip {
    opacity: 1;
    transform: translateX(0);
}

.side-nav-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding-top: 1rem;
    border-top: 1px solid #F0F0EC;
    width: 100%;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    background: #E8E8E3;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    color: #6B6B70;
    cursor: pointer;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: 72px;
    flex: 1;
    min-width: 0;
    padding: 1.5rem;
    max-width: calc(100vw - 72px);
}

/* ================================================
   TOP BAR
================================================ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.top-bar-left h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #111110;
    line-height: 1.2;
}

.top-bar-left p {
    font-size: .8rem;
    color: #9999A0;
    margin-top: .15rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.top-bar-btn {
    height: 38px;
    padding: 0 1rem;
    background: #111110;
    color: #fff;
    border: none;
    border-radius: .65rem;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
    transition: opacity .2s;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.top-bar-btn:hover { opacity: .8; }

.top-bar-icon-btn {
    width: 38px;
    height: 38px;
    background: #fff;
    border: 1px solid #E8E8E3;
    border-radius: .65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
    color: #6B6B70;
}
.top-bar-icon-btn:hover { background: #F4F4F0; }
.top-bar-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ================================================
   GRID SYSTEM
================================================ */
.grid-auto {
    display: grid;
    gap: 1rem;
}

.grid-3-col {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4-col {
    grid-template-columns: repeat(4, 1fr);
}

.grid-main {
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    align-items: start;
}

/* ================================================
   CARD
================================================ */
.card {
    background: #fff;
    border-radius: 1.25rem;
    border: 1px solid #E8E8E3;
    padding: 1.25rem;
}

.card-dark {
    background: #111110;
    border-radius: 1.25rem;
    padding: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9999A0;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.card-title svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .6;
}

.card-link {
    font-size: .75rem;
    font-weight: 700;
    color: #ADADB0;
    transition: color .15s;
}
.card-link:hover { color: #111110; }

/* ================================================
   STAT CARDS
================================================ */
.stat-value {
    font-family: 'DM Mono', monospace;
    font-size: 2rem;
    font-weight: 500;
    color: #111110;
    line-height: 1;
    margin-bottom: .3rem;
}

.stat-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #9999A0;
    margin-bottom: .75rem;
}

.stat-sub {
    font-size: .75rem;
    color: #9999A0;
    line-height: 1.5;
}

.stat-accent {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: .4rem;
}
.stat-accent.up   { background: #DCFCE7; color: #16A34A; }
.stat-accent.down { background: #FEE2E2; color: #DC2626; }
.stat-accent.warn { background: #FEF3C7; color: #B45309; }

/* ================================================
   PROGRESS BAR
================================================ */
.progress-track {
    background: #F0F0EC;
    border-radius: 99px;
    height: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .6s ease;
}

/* ================================================
   BADGE / CHIP
================================================ */
.chip {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 700;
    white-space: nowrap;
}
.chip.green  { background: #DCFCE7; color: #16A34A; }
.chip.orange { background: #FEF3C7; color: #B45309; }
.chip.red    { background: #FEE2E2; color: #DC2626; }
.chip.grey   { background: #F0F0EC; color: #9999A0; }
.chip.blue   { background: #EEF2FF; color: #4338CA; }

/* ================================================
   DAYS BADGE
================================================ */
.days-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .28rem .65rem;
    border-radius: .45rem;
    font-family: 'DM Mono', monospace;
    font-size: .72rem;
    font-weight: 500;
    white-space: nowrap;
}
.days-badge.done   { background: #F4F4F0; color: #ADADB0; }
.days-badge.today  { background: #FEF3C7; color: #92400E; }
.days-badge.urgent { background: #FEE2E2; color: #991B1B; }
.days-badge.soon   { background: #FFF7ED; color: #9A3412; }
.days-badge.safe   { background: #F0FDF4; color: #166534; }

/* ================================================
   SUBJECT ROW
================================================ */
.subject-row {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .875rem 0;
    border-bottom: 1px solid #F4F4F0;
}
.subject-row:last-child { border-bottom: none; }

.subject-icon {
    width: 36px;
    height: 36px;
    border-radius: .65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
    font-family: 'DM Mono', monospace;
}

/* ================================================
   EXAM TABLE
================================================ */
.exam-table { width: 100%; border-collapse: collapse; }
.exam-table thead th {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #ADADB0;
    text-align: left;
    padding: .4rem .6rem .6rem;
    border-bottom: 1px solid #F0F0EC;
}
.exam-table tbody td {
    padding: .75rem .6rem;
    font-size: .845rem;
    color: #111110;
    border-bottom: 1px solid #F4F4F0;
    vertical-align: middle;
    line-height: 1.4;
}
.exam-table tbody tr:last-child td              { border-bottom: none; }
.exam-table tbody tr.past-row td               { color: #C8C8C4; }
.exam-table tbody tr.today-row td              { background: #FFFBEB; }
.exam-table tbody tr.today-row                 { border-left: 3px solid #F59E0B; }
.exam-table tbody tr:not(.past-row):hover td   { background: #FAFAF8; }

/* ================================================
   COUNTDOWN CARD (dark)
================================================ */
.countdown-number {
    font-family: 'DM Mono', monospace;
    font-size: 4rem;
    font-weight: 500;
    color: #fff;
    line-height: 1;
}
.countdown-sub {
    font-size: .65rem;
    color: rgba(255,255,255,.35);
    margin-top: .3rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 700;
}

/* ================================================
   BUTTONS
================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: .875rem;
    background: #111110;
    color: #fff;
    border: none;
    border-radius: .85rem;
    font-weight: 700;
    font-size: .875rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    text-align: center;
    transition: opacity .2s;
    gap: .4rem;
}
.btn-primary:hover { opacity: .8; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .65rem 1rem;
    background: rgba(255,255,255,.1);
    color: #fff;
    border: none;
    border-radius: .75rem;
    font-weight: 600;
    font-size: .8rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background .2s;
    gap: .35rem;
}
.btn-ghost:hover { background: rgba(255,255,255,.18); }

.btn-small {
    display: inline-flex;
    align-items: center;
    padding: .3rem .75rem;
    background: #F4F4F0;
    color: #6B6B70;
    border: none;
    border-radius: .5rem;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.btn-small:hover { background: #E8E8E3; color: #111110; }

/* ================================================
   SECTION LABEL
================================================ */
.section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9999A0;
    display: block;
    margin-bottom: .75rem;
}

/* ================================================
   MONO
================================================ */
.mono { font-family: 'DM Mono', monospace; }

/* ================================================
   DIVIDER
================================================ */
.divider {
    border: none;
    border-top: 1px solid #F0F0EC;
    margin: .75rem 0;
}

/* ================================================
   WARNING BOX
================================================ */
.warning-box {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-left: 3px solid #F59E0B;
    border-radius: .85rem;
    padding: .875rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
}

/* ================================================
   PAGE FOOTER
================================================ */
.page-footer {
    text-align: center;
    padding: 2rem 0 1rem;
    color: #C8C8C4;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ================================================
   MOBILE — BOTTOM NAV
================================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #E8E8E3;
    padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
    z-index: 100;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    color: #ADADB0;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .35rem .6rem;
    border-radius: .6rem;
    transition: color .15s;
    cursor: pointer;
}
.mobile-nav-item.active { color: #111110; }
.mobile-nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ================================================
   INDEX — COUNTDOWN GRID
================================================ */
.countdown-grid {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 2rem;
    align-items: center;
}

/* ================================================
   INDEX — SUBJECTS GRID
================================================ */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .875rem;
}

.subject-card {
    background: #fff;
    border-radius: 1.25rem;
    border: 1px solid #E4E4DF;
    padding: 1.25rem;
    transition: box-shadow .2s, transform .2s;
}
.subject-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,.06);
    transform: translateY(-2px);
}

/* ================================================
   QUIZ PAGE
================================================ */
.quiz-wrap {
    max-width: 720px;
    margin: 0 auto;
}

.quiz-progress-bar {
    background: rgba(255,255,255,.08);
    border-radius: 99px;
    height: 4px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: #F0F0EC;
}

.quiz-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: #22C55E;
    transition: width .4s ease;
}

.question-block  { display: none; }
.question-block.active { display: block; }

.question-number {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9999A0;
    margin-bottom: .6rem;
}

.question-text {
    font-size: 1rem;
    font-weight: 600;
    color: #111110;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.question-image {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: .75rem;
    margin-bottom: 1rem;
    background: #F4F4F0;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin-bottom: 1.25rem;
}

.option-btn {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    background: #F7F7F4;
    border: 1.5px solid #E8E8E3;
    border-radius: .85rem;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s;
    font-family: 'DM Sans', sans-serif;
    width: 100%;
}
.option-btn:hover       { background: #F0F0EC; border-color: #D0D0CB; }
.option-btn.selected    { background: #EEF2FF; border-color: #6366F1; }
.option-btn.correct     { background: #F0FDF4; border-color: #22C55E; }
.option-btn.wrong       { background: #FEF2F2; border-color: #EF4444; }

.option-key {
    width: 24px;
    height: 24px;
    border-radius: .4rem;
    background: #E8E8E3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    color: #6B6B70;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    font-family: 'DM Mono', monospace;
}
.option-btn.selected .option-key { background: #6366F1; color: #fff; }
.option-btn.correct  .option-key { background: #22C55E; color: #fff; }
.option-btn.wrong    .option-key { background: #EF4444; color: #fff; }

.option-text {
    font-size: .875rem;
    color: #111110;
    line-height: 1.45;
    padding-top: .1rem;
}

.nav-btns {
    display: flex;
    gap: .6rem;
    align-items: center;
    justify-content: space-between;
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .75rem 1.25rem;
    border-radius: .75rem;
    font-size: .875rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: 'DM Sans', sans-serif;
    transition: opacity .2s, background .15s;
}
.btn-nav.secondary        { background: #F4F4F0; color: #6B6B70; }
.btn-nav.secondary:hover  { background: #E8E8E3; }
.btn-nav.primary          { background: #111110; color: #fff; }
.btn-nav.primary:hover    { opacity: .8; }
.btn-nav:disabled         { opacity: .35; cursor: not-allowed; }

.question-counter {
    font-family: 'DM Mono', monospace;
    font-size: .82rem;
    font-weight: 500;
    color: #9999A0;
}

.exam-timer {
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
    background: #111110;
    padding: .4rem .9rem;
    border-radius: .65rem;
    letter-spacing: .05em;
}
.exam-timer.warning { background: #EF4444; }

.dots-row {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: 1.25rem;
}
.dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: #E8E8E3;
    transition: background .2s;
}
.dot.answered { background: #6366F1; }
.dot.current  { background: #111110; transform: scale(1.3); }

/* ================================================
   RESULT PAGE
================================================ */
.result-wrap {
    max-width: 780px;
    margin: 0 auto;
}

.score-circle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.score-circle {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 1rem;
}
.score-circle svg {
    transform: rotate(-90deg);
    width: 140px;
    height: 140px;
}
.score-circle-track {
    fill: none;
    stroke: #F0F0EC;
    stroke-width: 8;
}
.score-circle-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}
.score-circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.score-pct {
    font-family: 'DM Mono', monospace;
    font-size: 1.75rem;
    font-weight: 500;
    line-height: 1;
    color: #111110;
}
.score-fraction {
    font-size: .7rem;
    color: #9999A0;
    font-weight: 600;
    margin-top: .2rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    margin-bottom: 1rem;
}
.result-stat {
    background: #fff;
    border: 1px solid #E8E8E3;
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
}
.result-stat-val {
    font-family: 'DM Mono', monospace;
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1;
    margin-bottom: .3rem;
}
.result-stat-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9999A0;
}

.review-item {
    padding: 1rem 0;
    border-bottom: 1px solid #F4F4F0;
}
.review-item:last-child { border-bottom: none; }

.review-q {
    font-size: .875rem;
    font-weight: 600;
    color: #111110;
    margin-bottom: .6rem;
    line-height: 1.5;
}

.review-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
}

.review-option {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: .65rem;
    font-size: .8rem;
    background: #F7F7F4;
    border: 1px solid #E8E8E3;
}
.review-option.correct { background: #F0FDF4; border-color: #22C55E; color: #15803D; font-weight: 600; }
.review-option.wrong   { background: #FEF2F2; border-color: #EF4444; color: #DC2626; font-weight: 600; }

.review-key {
    width: 20px;
    height: 20px;
    border-radius: .3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 700;
    background: #E8E8E3;
    color: #6B6B70;
    flex-shrink: 0;
    font-family: 'DM Mono', monospace;
}
.review-option.correct .review-key { background: #22C55E; color: #fff; }
.review-option.wrong   .review-key { background: #EF4444; color: #fff; }

.explanation-box {
    margin-top: .6rem;
    padding: .65rem .875rem;
    background: #F7F7F4;
    border-radius: .65rem;
    font-size: .78rem;
    color: #6B6B70;
    line-height: 1.55;
    border-left: 3px solid #6366F1;
}

/* ================================================
   PROGRESS PAGE
================================================ */
.progress-wrap { max-width: 1000px; margin: 0 auto; }

.subject-progress-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .875rem 0;
    border-bottom: 1px solid #F4F4F0;
}
.subject-progress-row:last-child { border-bottom: none; }

.reward-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 0;
    border-bottom: 1px solid #F4F4F0;
    gap: 1rem;
}
.reward-row:last-child { border-bottom: none; }

.tab-btns {
    display: flex;
    gap: .35rem;
    margin-bottom: 1rem;
    background: #F4F4F0;
    padding: .3rem;
    border-radius: .75rem;
    width: fit-content;
}
.tab-btn {
    padding: .4rem .9rem;
    border-radius: .55rem;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #9999A0;
    font-family: 'DM Sans', sans-serif;
    transition: background .15s, color .15s;
}
.tab-btn.active {
    background: #fff;
    color: #111110;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.chart-container {
    position: relative;
    height: 220px;
}

/* ================================================
   EXAM PAGE
================================================ */
.exam-wrap { max-width: 860px; margin: 0 auto; }

.exam-mode-card {
    background: #fff;
    border: 1.5px solid #E8E8E3;
    border-radius: 1.25rem;
    padding: 1.5rem;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.exam-mode-card:hover {
    border-color: #111110;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    transform: translateY(-2px);
}
.exam-mode-card.featured {
    background: #111110;
    border-color: #111110;
}

.mode-icon {
    width: 44px;
    height: 44px;
    border-radius: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mode-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.exam-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 0;
    border-bottom: 1px solid #F4F4F0;
    gap: 1rem;
}
.exam-history-row:last-child { border-bottom: none; }

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px solid #F4F4F0;
    font-size: .845rem;
    color: #4B4B50;
    line-height: 1.5;
}
.rule-item:last-child { border-bottom: none; }

.rule-num {
    width: 22px;
    height: 22px;
    background: #F4F4F0;
    border-radius: .4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 700;
    color: #6B6B70;
    flex-shrink: 0;
    font-family: 'DM Mono', monospace;
    margin-top: .1rem;
}

.subject-exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .6rem;
}

.subject-exam-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1rem .75rem;
    background: #F7F7F4;
    border: 1.5px solid #E8E8E3;
    border-radius: 1rem;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
    text-decoration: none;
    color: #111110;
}
.subject-exam-btn:hover {
    border-color: #111110;
    background: #fff;
    transform: translateY(-1px);
}

/* ================================================
   RESPONSIVE
================================================ */
@media (max-width: 1024px) {
    .grid-main { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .grid-4-col { grid-template-columns: repeat(2, 1fr); }
    .grid-3-col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .side-nav          { display: none; }
    .mobile-bottom-nav { display: flex; }
    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 1rem 1rem calc(5rem + env(safe-area-inset-bottom));
    }
    .grid-4-col        { grid-template-columns: repeat(2, 1fr); }
    .grid-3-col        { grid-template-columns: 1fr; }
    .grid-main         { grid-template-columns: 1fr; }
    .hide-mobile       { display: none !important; }
    .show-mobile       { display: block !important; }
    .countdown-number  { font-size: 3rem; }
    .countdown-grid    { grid-template-columns: 1fr; gap: 1rem; }
    .subjects-grid     { grid-template-columns: 1fr; }
    .options-grid      { grid-template-columns: 1fr; }
    .review-options    { grid-template-columns: 1fr; }
    .result-stats      { grid-template-columns: repeat(3, 1fr); }
    .chart-container   { height: 180px; }
    .subject-exam-grid { grid-template-columns: repeat(3, 1fr); }
    .score-circle      { width: 120px; height: 120px; }
    .score-circle svg  { width: 120px; height: 120px; }
    .score-pct         { font-size: 1.4rem; }
}

@media (min-width: 641px) {
    .hide-mobile { display: block; }
    .show-mobile { display: none; }
}