/* ============================================================
   Takamol Exam — Light theme (student-exam.xyz style)
   Main color: teal (exact copy of student-exam.xyz)
   ============================================================ */
:root {
    --teal:        #00767c;   /* main teal — nav bars, accents */
    --teal-dark:   #005a5f;   /* hover / pressed */
    --teal-deep:   #004d40;   /* dark teal text on light fills */
    --teal-mid:    #26a69a;   /* progress / mid accents */
    --teal-light:  #e0f2f1;   /* low-opacity accent fill */
    --teal-border: #80cbc4;   /* border on light teal fills */

    --bg:         #d9e2e1;   /* page background (gray-green) */
    --surface:    #ffffff;   /* cards / panels */
    --surface-2:  #f8f9f9;   /* sub-nav / raised */
    --surface-3:  #eef1f0;   /* option labels */
    --line:       #b0bfc0;   /* borders */
    --line-soft:  #e4e9e7;   /* soft borders inside cards */

    --text:       #1f2a26;   /* main dark text */
    --muted:      #5c6b65;   /* secondary text */
    --dim:        #8a9791;   /* faint text */

    --amber:      #ffb300;   /* selected option highlight */
    --amber-fill: #fffdf0;
    --amber-deep: #4a3600;
    --red:        #d32f2f;   /* finish button */

    --media-bg:   #ffffff;   /* light surface for question images */

    --radius:     6px;
    --radius-sm:  4px;

    --ui-scale:   1;         /* bumped by the text-size control */
}

/* Text-size levels (accessibility control) */
body.text-lg { --ui-scale: 1.2; }
body.text-xl { --ui-scale: 1.45; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
    color: var(--text);
    background: var(--bg);
    font-family: 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.container { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.screen-center { justify-content: center; align-items: center; overflow-y: auto; padding: 20px; }
.hidden { display: none !important; }

h1, h2, h3 { font-family: 'Sora', 'Hind Siliguri', sans-serif; font-weight: 600; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   SCREEN 1 — VERIFICATION
   ============================================================ */
.verify-window {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(15, 40, 25, .12);
}
.window-head {
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #ffffff;
    background: var(--teal);
}
.window-head-title { color: #ffffff; font-weight: 600; }
.window-head-clock { color: rgba(255, 255, 255, .92); font-variant-numeric: tabular-nums; }

.verify-content { padding: 28px 24px 24px; text-align: center; }

.brand-mark { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 22px; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.brand-name { font-family: 'Sora', sans-serif; font-weight: 600; font-size: 19px; letter-spacing: .2px; }
.brand-name-accent { color: var(--teal); }

.verify-lead { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

.info-box {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    text-align: left;
    margin: 0 0 22px;
    overflow: hidden;
}
.info-row { display: flex; align-items: center; padding: 13px 16px; font-size: 14px; border-bottom: 1px solid var(--line-soft); }
.info-row:last-child { border-bottom: none; }
.info-key { width: 118px; color: var(--muted); flex-shrink: 0; }
.info-val { color: var(--text); font-weight: 600; }

.confirm-msg { margin: 0 0 20px; color: var(--text); font-weight: 600; }

.action-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.btn {
    border: 1px solid transparent;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #ffffff; border-color: var(--teal); }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-ghost { background: var(--surface); color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--teal); border-color: var(--teal); }

.window-foot { text-align: right; padding: 12px 18px; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line-soft); }

/* ============================================================
   SCREEN 2 — EXAM
   ============================================================ */
.top-nav {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    background: var(--teal);
    color: #ffffff;
}
.nav-left { flex: 1 1 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.nav-page { font-weight: 600; font-size: 14px; color: #ffffff; }
.nav-dept { font-size: 12px; color: rgba(255, 255, 255, .8); }

.nav-center { flex: 0 1 auto; display: flex; align-items: center; justify-content: center; gap: 18px; }
.timer-display {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid rgba(255, 255, 255, .35);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    color: #ffffff;
}
.timer-icon { color: #ffffff; }
.timer-label { color: rgba(255, 255, 255, .8); }
.timer-value { color: #ffffff; font-weight: 600; font-variant-numeric: tabular-nums; }

.progress-wrap { display: flex; flex-direction: column; align-items: center; width: 132px; gap: 5px; }
.progress-container { width: 100%; height: 6px; border-radius: 99px; background: #ffffff; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; border-radius: 99px; background: var(--teal-mid); transition: width .3s ease; }
.progress-text { font-size: 11px; color: rgba(255, 255, 255, .85); }

.btn-finish {
    background: var(--red);
    color: #ffffff;
    border: 1px solid var(--red);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.btn-finish:hover { background: #b71c1c; border-color: #b71c1c; }

.sub-nav-info {
    padding: 8px 20px;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.sub-nav-info strong { color: var(--text); font-weight: 600; }

/* Accessibility controls (in top-right header, on the teal bar) */
.nav-right { flex: 1 1 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.a11y-group { display: flex; align-items: center; gap: 6px; }
.a11y-label { color: rgba(255, 255, 255, .9); font-size: 13px; }
.a11y-btn {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .4);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    min-width: 44px;
    min-height: 38px;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.a11y-btn:hover { background: rgba(255, 255, 255, .28); border-color: #ffffff; }
#sound-toggle { background: #ffffff; color: var(--teal); border-color: #ffffff; }
#sound-toggle.off { background: rgba(255, 255, 255, .15); color: rgba(255, 255, 255, .75); border-color: rgba(255, 255, 255, .4); }

.exam-body-layout { display: flex; flex: 1; overflow: hidden; padding: 18px 20px; gap: 16px; max-width: none; width: 100%; margin: 0 auto; }

.sidebar-palette { width: 42px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex-shrink: 0; }
.q-box {
    width: 100%;
    height: 32px;
    border-radius: 5px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all .12s ease;
}
.q-box:hover { border-color: var(--teal); color: var(--teal); }
.q-box.answered { background: var(--teal); color: #ffffff; border-color: var(--teal); }
.q-box.active { border: 2px solid var(--teal); color: var(--teal); }

.exam-content-main {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-y: auto;
    padding: 30px 32px;
    -webkit-overflow-scrolling: touch;
}

.q-text { font-weight: 600; font-size: calc(1.18rem * var(--ui-scale)); line-height: 1.7; margin: 0 0 22px; color: var(--text); }

/* Big "listen" button (read question / instructions aloud) */
.listen-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--teal-light);
    color: var(--teal-deep);
    border: 1px solid var(--teal-border);
    border-radius: 999px;
    padding: 11px 20px;
    margin: 0 0 20px;
    font: inherit;
    font-weight: 600;
    font-size: calc(0.98rem * var(--ui-scale));
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.listen-btn:hover { background: var(--teal); color: #ffffff; border-color: var(--teal); }
.listen-btn:active { transform: translateY(1px); }

/* Question image — light media card so transparent PNGs stay legible */
.q-image-container {
    width: 100%;
    max-width: 860px;
    margin: 0 0 24px;
    padding: 18px;
    background: var(--media-bg);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
}
.q-image-container img { width: 100%; height: auto; display: block; border-radius: 4px; }

/* Options */
.option-row {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    min-height: 60px;
    cursor: pointer;
    overflow: hidden;
    background: var(--surface);
    transition: border-color .12s ease, background .12s ease;
}
.option-row:hover { border-color: var(--teal); }
.option-row.selected { border-color: var(--amber); background: var(--amber-fill); }
.option-row.speaking { border-color: var(--teal); background: var(--teal-light); box-shadow: inset 0 0 0 1px var(--teal); }
.opt-label {
    width: calc(48px * var(--ui-scale));
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: calc(1rem * var(--ui-scale));
    color: var(--muted);
    background: var(--surface-3);
    border-right: 2px solid var(--line);
}
.option-row.selected .opt-label { background: var(--amber); color: var(--amber-deep); border-color: var(--amber); }
.opt-text { padding: 15px 16px; flex: 1; font-size: calc(1.05rem * var(--ui-scale)); line-height: 1.55; align-self: center; }

/* Small per-option speaker button */
.opt-speak {
    flex-shrink: 0;
    width: calc(50px * var(--ui-scale));
    background: transparent;
    border: none;
    border-left: 1px solid var(--line-soft);
    color: var(--muted);
    font-size: calc(1.05rem * var(--ui-scale));
    cursor: pointer;
    transition: color .12s ease, background .12s ease;
}
.opt-speak:hover { color: var(--teal); background: var(--teal-light); }

/* Big checkmark shown only on the selected option */
.opt-check {
    flex-shrink: 0;
    width: calc(46px * var(--ui-scale));
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--teal);
    font-size: calc(1.4rem * var(--ui-scale));
    font-weight: 700;
}
.option-row.selected .opt-check { display: flex; }

/* Instructions */
.instruction-block { line-height: 1.75; max-width: 640px; }
.instruction-icon { font-size: 26px; color: var(--teal); margin-bottom: 6px; }
.instruction-block h3 { color: var(--text); margin: 20px 0 6px; font-size: .98rem; }
.instruction-block p { color: var(--muted); margin: 0 0 8px; }
.instruction-block strong { color: var(--teal); font-weight: 600; }

/* Footer nav */
.footer-nav {
    padding: 14px 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
    background: var(--teal);
}
.nav-btn {
    background: var(--surface);
    border: 1px solid #888;
    color: var(--teal);
    font: inherit;
    font-weight: 600;
    font-size: calc(1rem * var(--ui-scale));
    padding: 14px 34px;
    min-width: 160px;
    min-height: 52px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.nav-btn:hover { background: var(--teal-light); }
.nav-btn-accent { background: var(--surface); color: var(--teal); border: 2px solid var(--teal); }
.nav-btn-accent:hover { background: var(--teal-light); }

/* ============================================================
   SCREEN 3 — RESULT
   ============================================================ */
.result-screen-bg { background: var(--teal) !important; }
.result-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 36px 28px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.result-ring { position: relative; width: 156px; height: 156px; margin: 0 auto 22px; }
.ring-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.ring-progress {
    fill: none;
    stroke: var(--teal);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 327;
    stroke-dashoffset: 327;
    transition: stroke-dashoffset 1s ease;
}
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.res-score-big { font-family: 'Sora', sans-serif; font-size: 36px; font-weight: 600; line-height: 1; color: var(--teal); }
.res-score-total { font-size: 18px; color: var(--muted); }
.res-percent-text { color: var(--teal); font-weight: 600; font-size: 14px; margin-top: 4px; }

.res-title { font-size: 20px; margin: 4px 0 2px; color: var(--text); }
.res-subtitle { font-size: 13px; color: var(--muted); font-weight: 400; margin: 0 0 8px; }
.res-user { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.res-user strong { color: var(--text); font-weight: 600; }
.res-msg-box {
    border: 1px solid var(--teal-border);
    background: var(--teal-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    color: var(--teal-deep);
    font-weight: 600;
    margin-bottom: 22px;
}
.btn-restart { width: 100%; }

/* ============================================================
   MOBILE / RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
    .top-nav { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
    .nav-left { flex: 1 1 auto; }
    .nav-page { font-size: 13px; }
    .nav-dept { font-size: 11px; }

    .nav-right { flex: 0 0 auto; gap: 8px; }
    .a11y-group { gap: 5px; }
    .a11y-label { font-size: 12px; }
    .a11y-btn { min-width: 36px; min-height: 32px; padding: 4px 9px; font-size: 13px; }
    .btn-finish { padding: 7px 11px; font-size: 12px; }

    .nav-center { order: 3; width: 100%; justify-content: space-between; gap: 12px; }
    .timer-display { padding: 5px 11px; font-size: 12px; }
    .timer-label { display: none; }
    .progress-wrap { width: auto; flex: 1 1 auto; max-width: 180px; }

    .sub-nav-info { flex-direction: column; gap: 2px; }
    .exam-body-layout { padding: 12px; gap: 10px; }
    .exam-content-main { padding: 22px 18px; }
    .q-text { margin-bottom: 18px; }
}
@media (max-width: 600px) {
    .top-nav { padding: 7px 10px; }
    .a11y-btn { min-width: 34px; min-height: 30px; padding: 4px 8px; }
    .exam-content-main { padding: 18px 15px; }
    .option-row { min-height: 54px; }
    .footer-nav { gap: 10px; padding: 10px; }
    .nav-btn { flex: 1; min-width: 0; padding: 12px 8px; min-height: 48px; font-size: 13px; }
    .sidebar-palette { width: 36px; }
    .q-box { height: 30px; }
    .info-key { width: 92px; }
    .verify-content { padding: 22px 18px 20px; }
    .action-btns { flex-direction: column; }
    .action-btns .btn { width: 100%; }
}
@media (max-width: 380px) {
    .a11y-label { display: none; }
    .nav-center { gap: 8px; }
    .timer-value { font-size: 12px; }
}
