/* ==========================================================================
   Brainbox Aptitude Test — Candidate Panel
   Typography/tone inspired by brainboxinfoway.com: bold Poppins headings,
   clean Inter body copy, indigo/violet brand accent, generous whitespace.
   ========================================================================== */

:root {
    --brand-primary: #4f46e5;
    --brand-primary-dark: #4338ca;
    --brand-accent: #14b8a6;
    --brand-ink: #111827;
    --brand-muted: #6b7280;
    --brand-border: #e5e7eb;
    --brand-bg: #f7f7fb;
    --brand-surface: #ffffff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-soft: 0 10px 30px rgba(17, 24, 39, 0.08);
    --shadow-pop: 0 20px 45px rgba(79, 70, 229, 0.18);
    --font-heading: 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--brand-ink);
    background: radial-gradient(circle at top left, #eef2ff 0%, var(--brand-bg) 45%) fixed;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Header / Footer ---------- */

.site-header {
    background: var(--brand-surface);
    border-bottom: 1px solid var(--brand-border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    max-width: 1440px;
    padding: 14px 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: start;
    min-width: 0;
    text-decoration: none;
}

.brand-logo {
    height: 34px;
    width: auto;
    display: block;
}

.header-title {
    justify-self: center;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 18px;
    color: var(--brand-ink);
    white-space: nowrap;
}

/* Used on the module-selector landing page, which has no header-right badges
   to balance against — plain centered flex instead of the 3-column grid. */
.header-inner.header-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
}

.header-right {
    justify-self: end;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #f1f1f8;
    color: var(--brand-ink);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.header-menu-toggle:hover { background: #e6e6f2; }

.header-menu-panel {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-candidate {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 15px;
    color: var(--brand-ink);
    background: #f1f1f8;
    padding: 8px 16px;
    border: none;
    border-radius: 99px;
    max-width: 220px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.header-candidate:hover,
.header-candidate:focus-visible { background: #e6e6f2; }

.header-candidate .candidate-icon { font-size: 14px; flex-shrink: 0; }

.header-candidate #header-candidate-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 15px;
    color: var(--brand-primary);
    background: #eef2ff;
    padding: 8px 16px;
    border-radius: 99px;
    transition: background 0.2s ease, color 0.2s ease;
}

.header-timer .timer-icon { font-size: 14px; }

.header-timer.timer-warning {
    color: #b45309;
    background: #fef3c7;
}

.header-timer.timer-critical {
    color: #ffffff;
    background: #dc2626;
    animation: timer-critical-blink 1s ease-in-out infinite;
}

@keyframes timer-critical-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
    .header-timer.timer-critical { animation: none; }
}

.header-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--brand-primary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.header-info-btn:hover { background: #e0e4fd; }
.header-info-btn:active { transform: scale(0.92); }

.candidate-details-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--brand-border);
}

.candidate-details-row:last-child { border-bottom: none; }

.candidate-details-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--brand-primary);
    font-size: 15px;
}

.candidate-details-label {
    display: block;
    font-size: 12px;
    color: var(--brand-muted);
}

.candidate-details-value {
    display: block;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 15px;
    color: var(--brand-ink);
    word-break: break-word;
}

.site-footer {
    text-align: center;
    color: var(--brand-muted);
    font-size: 13px;
    padding: 32px 20px 40px;
}

/* ---------- Layout ---------- */

.app-shell {
    padding: 40px 20px 60px;
    display: flex;
    justify-content: center;
}

.screen { display: none; width: 100%; }
.screen.active { display: flex; justify-content: center; }

.card {
    background: var(--brand-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 40px;
    width: 100%;
    max-width: 560px;
    animation: fadeInUp 0.5s ease both;
}

.card-wide { max-width: 720px; }

/* ---------- Module selector (index.php landing page) ---------- */

.selector-wrap {
    width: 100%;
    max-width: 860px;
    text-align: center;
}

.selector-title { margin-bottom: 8px; }
.selector-subtitle { margin-bottom: 36px; }

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
    text-align: left;
}

.module-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    background: var(--brand-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 32px 28px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeInUp 0.5s ease both;
}

.module-card:nth-child(1) { animation-delay: 0.05s; }
.module-card:nth-child(2) { animation-delay: 0.15s; }
.module-card:nth-child(3) { animation-delay: 0.25s; }
.module-card:nth-child(4) { animation-delay: 0.35s; }

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-pop);
}

.module-icon { font-size: 34px; }

.module-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 19px;
    color: var(--brand-ink);
    margin: 0;
}

.module-desc {
    color: var(--brand-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.module-cta {
    margin-top: auto;
    padding-top: 10px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    color: var(--brand-primary);
}

/* ---------- Typography ---------- */

.title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 28px;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--brand-muted);
    margin: 0 0 28px;
    font-size: 15px;
}

/* ---------- Form elements ---------- */

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

.pi-loading { color: var(--brand-muted); font-size: 14px; margin: 0 0 22px; }

.search-box { position: relative; }
.search-box input[type="search"] {
    padding-left: 46px;
    -webkit-appearance: none;
    appearance: none;
}
.search-box::before {
    content: '⚲';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-muted);
    font-size: 16px;
    line-height: 1;
    pointer-events: none;
}

label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="number"],
textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-family: var(--font-body);
    border: 1.5px solid var(--brand-border);
    border-radius: var(--radius-md);
    background: #fbfbfe;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input[readonly] {
    background: #f1f1f8;
    color: var(--brand-muted);
    cursor: not-allowed;
}
input[readonly]:focus {
    box-shadow: none;
    border-color: var(--brand-border);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

/* ---------- Pre-Interview: Experience / Yes-No field types ---------- */

/* 3 separate fields (Years/Months/Days) side by side, each its own labeled
   number input — not a single amount + unit picker (see
   DOC/project-change-logs.md for why that first version was replaced). */
.pi-experience-field {
    display: flex;
    gap: 10px;
}
.pi-exp-part {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pi-exp-part input[type="number"] { text-align: center; }
.pi-exp-part-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-muted);
    text-align: center;
}

.pi-yesno-field {
    display: flex;
    gap: 20px;
}
.pi-yesno-field .pi-yesno-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
}
.pi-yesno-field input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

/* Group-level error state — for Experience/Yes-No, the red outline belongs
   on the whole field group (a <div>, not a single input/select), so
   .input-error (which only targets input/textarea) doesn't reach it. */
.pi-experience-field.group-error input[type="number"] {
    border-color: var(--danger);
    background: #fef2f2;
}
.pi-yesno-field.group-error .pi-yesno-option {
    color: var(--danger);
}

.otp-desc { padding-bottom: 8px; }

.otp-input-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.otp-box {
    width: 44px;
    height: 52px;
    padding: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-heading);
    border: 1.5px solid var(--brand-border);
    border-radius: var(--radius-md);
    background: #fbfbfe;
    color: var(--brand-ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.otp-box:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}
.otp-box.input-error {
    border-color: var(--danger);
    background: #fef2f2;
}

input.input-error,
textarea.input-error {
    border-color: var(--danger);
    background: #fef2f2;
}

input.input-error:focus,
textarea.input-error:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.field-error {
    display: block;
    color: var(--danger);
    font-size: 13px;
    margin-top: 6px;
}

.field-error:empty { display: none; margin-top: 0; }

.required-mark { color: var(--danger); font-weight: 700; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    padding: 13px 26px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Font Awesome icons replaced the old emoji glyphs everywhere on the
   candidate-facing pages — inherits font-size from whatever wraps it, no
   extra line-height so it doesn't throw off flex/inline-flex centering. */
.btn i, .fa-icon, .module-icon i, .candidate-icon i, .timer-icon i,
.result-badge i {
    display: inline-block;
    line-height: 1;
}

.nav-icon { display: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    color: #fff;
    box-shadow: var(--shadow-pop);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }

.btn-secondary {
    background: #f1f1f8;
    color: var(--brand-ink);
}
.btn-secondary:hover { background: #e6e6f2; }

.btn-success {
    background: linear-gradient(135deg, var(--success), #15803d);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #991b1b);
    color: #fff;
}

.btn-block { width: 100%; }

.btn-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.hidden { display: none !important; }

/* ---------- Instructions ---------- */

.instructions-list {
    margin: 0 0 8px;
    padding-left: 20px;
    color: var(--brand-ink);
}

.instructions-list li { margin-bottom: 12px; font-size: 15px; }

/* ---------- Progress ---------- */

.progress-wrap { margin-bottom: 28px; }

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-muted);
    margin-bottom: 10px;
}

.progress-bar {
    height: 8px;
    border-radius: 99px;
    background: #eceefb;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    border-radius: 99px;
    transition: width 0.35s ease;
}

/* ---------- Question ---------- */

.question-container { min-height: 260px; }

.question-index {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand-primary);
    background: #eef2ff;
    padding: 4px 10px;
    border-radius: 99px;
    margin-bottom: 14px;
}

.question-text {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 24px;
    line-height: 1.5;
}

.option-list { display: flex; flex-direction: column; gap: 12px; }

.question-textarea {
    width: 100%;
    min-height: 160px;
    padding: 14px 16px;
    font-size: 15px;
    font-family: var(--font-body);
    border: 1.5px solid var(--brand-border);
    border-radius: var(--radius-md);
    background: #fbfbfe;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--brand-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.option-item:hover { border-color: var(--brand-primary); background: #f9f9ff; }

.option-item.selected {
    border-color: var(--brand-primary);
    background: #eef2ff;
}

.option-item input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
    flex-shrink: 0;
    margin: 0;
}

.option-item .option-label {
    font-weight: 600;
    color: var(--brand-primary);
    width: 22px;
    flex-shrink: 0;
}

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

/* ---------- Scheduled tests list (scheduled-tests.php) ---------- */

.schedule-list { display: flex; flex-direction: column; gap: 10px; }

.empty-state { text-align: center; color: var(--brand-muted); padding: 30px 20px; font-size: 14px; }

/* ---------- Review ---------- */

.review-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; max-height: 55vh; overflow-y: auto; }

.review-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px;
    background: #f8f9fc;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--brand-primary);
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

.review-item:hover { box-shadow: var(--shadow-soft); }

.review-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.review-item .review-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-primary);
}

.review-item .review-q {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-ink);
    line-height: 1.5;
}

.review-item .review-answer-row {
    font-size: 14px;
    color: var(--brand-muted);
}

.review-item .review-answer-row strong {
    color: var(--brand-ink);
    font-weight: 700;
}

.review-item .review-answer-row strong.unanswered {
    color: var(--danger);
}

.review-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: none;
    border-radius: 8px;
    background: #eef2ff;
    color: var(--brand-primary);
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.review-edit-btn:hover { background: #e0e4fd; }
.review-edit-btn:active { transform: scale(0.93); }

.review-edit-btn.locked {
    background: #f3f4f6;
    color: var(--brand-muted);
    cursor: not-allowed;
}
.review-edit-btn.locked:hover { background: #f3f4f6; }
.review-edit-btn.locked:active { transform: none; }

.review-locked-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
}
.review-locked-banner i { font-size: 16px; }
.review-locked-banner #review-lock-timer-value {
    display: inline-block;
    animation: timer-critical-blink 1s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .review-locked-banner #review-lock-timer-value { animation: none; }
}

.edit-answer-question-box {
    background: #eef2ff;
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 24px;
}

.edit-answer-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-primary);
    margin-bottom: 8px;
}

.edit-answer-question {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.5;
    color: var(--brand-ink);
    margin: 0;
}

/* ---------- Result ---------- */

#screen-result .card,
#screen-pi-result .card { text-align: center; }

.result-badge {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success), #15803d);
    color: #fff;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.result-badge.fail { background: linear-gradient(135deg, var(--danger), #991b1b); }

.result-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin: 30px 0 20px;
    flex-wrap: wrap;
}

.stat { display: flex; flex-direction: column; align-items: center; min-width: 90px; }

.stat-value {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: var(--brand-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--brand-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.result-status {
    font-weight: 700;
    font-size: 16px;
}

/* ---------- Modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: modalOverlayIn 0.2s ease both;
}

.modal-overlay.closing { animation: modalOverlayOut 0.18s ease both; }

.modal-box {
    position: relative;
    background: var(--brand-surface);
    border-radius: var(--radius-lg);
    padding: 30px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-pop);
}

.modal-box.closing { animation: fadeOutDown 0.18s ease both; }

.modal-close-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #f1f1f8;
    color: var(--brand-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.modal-close-icon:hover { background: #e6e6f2; color: var(--brand-ink); }
.modal-close-icon:active { transform: scale(0.92); }

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalOverlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeOutDown {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(14px) scale(0.96); }
}

.modal-box h2 {
    font-family: var(--font-heading);
    margin: 0 0 12px;
    padding-right: 32px;
    font-size: 20px;
}

.modal-box p { color: var(--brand-muted); margin: 0; font-size: 14px; }

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-ink);
    color: #fff;
    padding: 12px 22px;
    border-radius: 99px;
    font-size: 14px;
    z-index: 200;
    box-shadow: var(--shadow-soft);
}

.toast.error { background: var(--danger); }

/* ---------- Animations ---------- */

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

.fade-in { animation: fadeInUp 0.4s ease both; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .card { padding: 26px 20px; border-radius: var(--radius-md); }
    .title { font-size: 22px; }
    .btn-row { flex-direction: column-reverse; }
    .btn { width: 100%; }
    .result-stats { gap: 16px; }
    .brand-logo { height: 26px; }
    .header-title { display: none; }
    .header-timer { font-size: 13px; padding: 6px 12px; }

    /* Tighter vertical rhythm on the Test screen so Prev/Next + the footer fit on one screen. */
    .app-shell { padding: 20px 16px 24px; }
    .question-container { min-height: 180px; }
    .site-footer { padding: 16px 20px 20px; }

    .module-grid { grid-template-columns: 1fr; }
    .module-card { padding: 24px 20px; }

    /* Prev/Next collapse to round icon buttons pinned left/right instead of stacking full-width. */
    .btn-row.test-nav-row {
        flex-direction: row;
        align-items: center;
        margin-top: 16px;
    }

    .test-nav-row #btn-prev,
    .test-nav-row #btn-next {
        width: 46px;
        height: 46px;
        padding: 0;
        flex: 0 0 auto;
        border-radius: 50%;
    }

    .test-nav-row .nav-text { display: none; }
    .test-nav-row .nav-icon { display: inline; font-size: 20px; }
    .test-nav-row #btn-review { flex: 1; width: auto; }

    /* Logo pinned left, timer + hamburger pinned right; the (hidden) title
       column no longer needs to be part of the grid math on small screens. */
    .header-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Only the countdown timer + hamburger stay in the header bar; everything
       else (candidate name, instructions) moves into a dropdown panel. */
    .header-menu-toggle { display: flex; }

    .header-menu-panel {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        min-width: 220px;
        background: var(--brand-surface);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-pop);
        padding: 12px;
        z-index: 40;
    }

    .header-menu-panel.open {
        display: flex;
        animation: menuDropIn 0.2s ease both;
    }

    .header-menu-panel.closing {
        display: flex;
        animation: menuDropOut 0.18s ease both;
    }

    @keyframes menuDropIn {
        from { opacity: 0; transform: translateY(-10px) scale(0.97); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }

    @keyframes menuDropOut {
        from { opacity: 1; transform: translateY(0) scale(1); }
        to { opacity: 0; transform: translateY(-10px) scale(0.97); }
    }

    .header-candidate,
    .header-info-btn {
        width: 100%;
        max-width: none;
        border-radius: var(--radius-md);
        justify-content: flex-start;
        font-size: 14px;
        padding: 10px 14px;
    }

    .header-info-btn::after { content: 'View Instructions'; margin-left: 8px; }
}

@media (min-width: 641px) and (max-width: 860px) {
    .header-title { font-size: 15px; }
}
