/* ==========================================================================
   Mock interview page – uses the colour tokens from main.css
   ========================================================================== */

body.mock-page {
    margin: 0;
    background:
        radial-gradient(50rem 22rem at 0% 0%, rgba(14, 165, 233, 0.10), transparent 60%),
        radial-gradient(40rem 22rem at 100% 0%, rgba(81, 43, 212, 0.12), transparent 60%),
        var(--page-bg);
    color: var(--text);
    font-family: var(--base-font-family);
    line-height: 1.6;
}

.mock {
    max-width: 56rem;
    margin: 0 auto;
    padding: 5rem clamp(1rem, 4vw, 2rem) 4rem;
}

.mock h1,
.mock h2,
.mock h3 {
    margin: 0 0 0.75rem;
    color: var(--heading-color);
    line-height: 1.3;
}

.mock h2 { font-size: 1.25rem; }
.mock h3 { font-size: 1rem; margin-top: 0.25rem; }

.mock-loading {
    padding: 4rem 0;
    text-align: center;
    color: var(--text-muted);
}

/* Hero */
.mock-hero {
    margin-bottom: 1.75rem;
}

.mock-eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brand);
}

.mock-hero h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.mock-hero p {
    max-width: 40rem;
    margin: 0;
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Cards */
.mock-card {
    margin-bottom: 1rem;
    padding: clamp(1rem, 3vw, 1.5rem);
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-2);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 1rem;
}

.mock-alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid #d97706;
    border-radius: 0 10px 10px 0;
    background: rgba(245, 158, 11, 0.12);
}

.mock-error {
    margin: 0.75rem 0 0;
    color: #dc2626;
    font-size: 0.9rem;
}

:root[data-theme="dark"] .mock-error { color: #f87171; }

/* Topic chips */
.topic-group + .topic-group { margin-top: 1rem; }

.topic-group h3 {
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.6rem 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.topic-chip:hover:not(:disabled) { border-color: var(--brand); }

.topic-chip.selected {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

:root[data-theme="dark"] .topic-chip.selected { color: #0f0f17; }

.topic-chip:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chip-count {
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 700;
}

.topic-chip.selected .chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
    gap: 1rem;
    align-items: end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.field select {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 500;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0;
    font-weight: 500;
}

.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--heading-color);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--brand);
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(90deg, var(--brand), #3b1f9e);
    color: #fff;
    box-shadow: 0 6px 18px rgba(81, 43, 212, 0.25);
}

:root[data-theme="dark"] .btn-primary {
    background: linear-gradient(90deg, #7c5cf0, #512bd4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-lg { padding: 0.9rem 2rem; font-size: 1.05rem; }

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
}

.icon-btn:hover { color: var(--brand); border-color: var(--brand); }
.icon-btn svg { width: 17px; height: 17px; }

.start-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.5rem 0;
}

.pool-info { margin: 0; color: var(--text-muted); }

.privacy-note {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* History */
.history ul,
.summary-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.history li,
.summary-list li {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--border);
}

.history li:first-child,
.summary-list li:first-child { border-top: 0; }

.history-topics,
.summary-q { flex: 1; min-width: 0; }

.summary-q small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.history-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.history-score {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-weight: 800;
    color: #fff;
}

/* Score colours */
.strong { --score: #10b981; }
.good { --score: #0ea5e9; }
.fair { --score: #f59e0b; }
.weak { --score: #ef4444; }

.history-score { background: var(--score); }

/* Progress */
.mock-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transition: width 0.3s ease;
}

/* Question */
.question-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.topic-tag {
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 600;
}

.mock .level {
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mock .question-title {
    font-size: clamp(1.3rem, 3vw, 1.6rem);
    font-weight: 700;
}

.mock .question-title code,
.summary-q code,
.tips code {
    padding: 0.1em 0.35em;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--code-inline-color);
    font-family: var(--code-font-family);
    font-size: 0.9em;
}

.question-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Recorder */
.recorder {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1rem;
}

.mic-btn {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-2), var(--brand));
    color: #fff;
    box-shadow: 0 8px 24px rgba(81, 43, 212, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.mic-btn:hover { transform: scale(1.05); }
.mic-btn svg { width: 30px; height: 30px; }

.mic-btn.recording {
    background: linear-gradient(135deg, #f87171, #dc2626);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
}

.mic-btn.recording::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 3px solid rgba(239, 68, 68, 0.5);
    border-radius: inherit;
    animation: pulse 1.4s ease-out infinite;
}

@keyframes pulse {
    from { transform: scale(0.95); opacity: 1; }
    to { transform: scale(1.3); opacity: 0; }
}

.recorder-status {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.recorder-status.typing { margin-bottom: 0.75rem; }

.recorder-status span {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.recorder-status span.low { color: #dc2626; font-weight: 600; }

#answer-box {
    box-sizing: border-box;
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    line-height: 1.6;
    resize: vertical;
}

#answer-box:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.answer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.end-row {
    margin-top: 1.25rem;
    text-align: center;
}

/* Result */
.result-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.result-summary {
    flex: 1;
    min-width: min(100%, 18rem);
}

.result-label {
    display: inline-block;
    margin-bottom: 0.35rem;
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    background: var(--score);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.score-ring {
    position: relative;
    flex: none;
    width: var(--size);
    height: var(--size);
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring circle {
    fill: none;
    stroke-width: 9;
}

.score-ring .track { stroke: var(--border); }

.score-ring .value {
    stroke: var(--score);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease;
}

.score-number {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: calc(var(--size) * 0.28);
    font-weight: 800;
    color: var(--heading-color);
}

.score-bar { margin-top: 0.75rem; }

.score-bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.score-bar-label b { color: var(--heading-color); }

.score-bar-track {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--score);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.metric {
    padding: 0.7rem;
    border-radius: 12px;
    background: var(--surface);
    text-align: center;
}

.metric b {
    display: block;
    font-size: 1.15rem;
    color: var(--heading-color);
}

.metric span {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.keypoints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
}

.kp {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.kp.covered {
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
}

.kp.missed {
    border: 1px dashed var(--border);
    color: var(--text-muted);
}

:root[data-theme="dark"] .kp.covered { color: #34d399; }

.tips {
    margin: 0;
    padding-left: 1.2rem;
}

.tips li + li { margin-top: 0.35rem; }

.your-answer {
    margin: 0;
    white-space: pre-wrap;
    color: var(--text);
}

/* Model answer – rendered with the docs styles */
.model-answer summary {
    font-weight: 700;
    color: var(--heading-color);
    cursor: pointer;
}

.mock .model-answer .markdown-section {
    max-width: none;
    margin: 0;
    padding: 0.5rem 0 0;
    container-type: normal;
}

.mock .model-answer .markdown-section img { max-width: 100%; }

.mock .model-answer .markdown-section table {
    display: block;
    overflow-x: auto;
}

/* Phones */
@media (max-width: 640px) {
    .mock { padding-top: 4.5rem; }

    .result-top { justify-content: center; text-align: left; }

    .recorder { gap: 0.85rem; }

    .mic-btn { width: 62px; height: 62px; }

    .answer-actions .btn { flex: 1; }

    .history-meta { display: none; }
}
