/* styles.css — QuizForge screen styles */

:root {
    /* neutrals */
    --bg: #eef1f8;
    --bg-2: #e7ecfb;
    --card: #ffffff;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --line: #e6e9f2;
    --line-soft: #eef1f7;

    /* brand */
    --primary: #0f4c96;
    --primary-dark: #0b3b74;
    --accent: #e8a300;
    --accent-dark: #c9860b;
    --grad: linear-gradient(135deg, #0f4c96 0%, #0c3f80 100%);
    --grad-soft: linear-gradient(135deg, #eef3fa 0%, #f4f7fc 100%);

    /* status */
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --pass-bg: #ecfdf5;
    --pass-ink: #047857;
    --pass-line: #6ee7b7;
    --fail-bg: #fef2f2;
    --fail-ink: #b91c1c;
    --fail-line: #fca5a5;

    /* shape */
    --radius: 18px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow: 0 6px 24px -6px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 24px 60px -18px rgba(15, 76, 150, 0.3);
    --ring: 0 0 0 4px rgba(15, 76, 150, 0.2);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 480px at 50% -12%, rgba(15, 76, 150, 0.07), transparent 62%),
        linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1040px;
    width: 100%;
    margin: 0 auto;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    object-fit: contain;
    display: block;
    flex: none;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand {
    margin: 0;
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
}

.brand-tag {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.02em;
}

#app {
    max-width: 1040px;
    width: 100%;
    flex: 1 0 auto;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

/* view entrance animation */
.view {
    animation: viewIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes viewIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

/* ---------- buttons ---------- */
.btn {
    position: relative;
    font: inherit;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.15s ease, border-color 0.2s ease;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

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

.btn-lg {
    padding: 15px 28px;
    font-size: 16px;
    border-radius: 14px;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--grad);
    background-size: 140% 140%;
    color: #fff;
    box-shadow: 0 10px 24px -10px rgba(15, 76, 150, 0.65);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px -10px rgba(15, 76, 150, 0.7);
    background-position: 100% 0;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 10px 24px -10px rgba(239, 68, 68, 0.65);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px -10px rgba(239, 68, 68, 0.7);
}

.btn-ghost {
    background: #fff;
    color: var(--ink-soft);
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}

.btn-ghost:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.error-text {
    color: var(--fail-ink);
    margin-top: 14px;
    font-weight: 600;
}

/* ---------- welcome ---------- */
#view-welcome .card {
    overflow: hidden;
    max-width: 760px;
    margin: 0 auto;
}

#view-welcome .card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 62%, var(--accent) 100%);
}

#view-welcome h2 {
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 6px 0 4px;
}

.lead {
    color: var(--muted);
    font-size: 16px;
    margin-top: 0;
}

.facts {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 0;
    margin: 26px 0;
}

.facts li {
    text-align: center;
    background: var(--grad-soft);
    border: 1px solid #dde7f2;
    border-radius: var(--radius-sm);
    padding: 22px 10px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.facts li:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.fact-num {
    display: block;
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
}

.fact-label {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.instructions {
    margin: 22px 0;
    padding: 20px 22px;
    background: #f8fafc;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
}

.instructions h3 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions h3::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--grad);
}

.instructions ul {
    margin: 0;
    padding-left: 20px;
    color: var(--ink-soft);
}

.instructions li {
    margin-bottom: 7px;
}

.instructions li::marker {
    color: var(--primary);
}

.resume-banner {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 20px;
}

.resume-banner p {
    margin: 0 0 12px;
    font-weight: 600;
    color: #92400e;
}

.resume-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- exam ---------- */
.exam-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
}

.progress-text {
    font-weight: 600;
    color: var(--ink-soft);
    font-size: 15px;
}

.timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 18px;
    box-shadow: var(--shadow-sm);
}

.timer::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 150, 0.15);
}

.timer-warning {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: transparent;
    animation: pulseWarn 1s ease-in-out infinite;
}

.timer-warning::before {
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}

@keyframes pulseWarn {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.exam-body {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 22px;
    align-items: start;
}

.question-card {
    min-height: 340px;
}

.q-meta {
    display: inline-block;
    color: var(--primary-dark);
    background: var(--grad-soft);
    border: 1px solid #dde7f2;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 5px 12px;
    border-radius: 999px;
    margin: 0 0 16px;
}

.q-text {
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.35;
    margin: 0 0 24px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    counter-reset: opt;
}

.option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    padding: 15px 18px 15px 16px;
    cursor: pointer;
    counter-increment: opt;
    background: #fff;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
}

.option::before {
    content: counter(opt, upper-alpha);
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #f1f5f9;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.option:hover {
    border-color: #b9d1ea;
    background: #fafbff;
    transform: translateX(2px);
}

.option:focus-within {
    box-shadow: var(--ring);
    border-color: var(--primary);
}

.option.selected {
    border-color: var(--primary);
    background: var(--grad-soft);
}

.option.selected::before {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(15, 76, 150, 0.65);
}

.option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.option-text {
    flex: 1;
    font-weight: 500;
    color: var(--ink);
}

.exam-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line-soft);
}

.navigator {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    position: sticky;
    top: 84px;
}

.navigator h3 {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.navigator-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.nav-cell {
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}

.nav-cell:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.nav-cell.answered {
    background: var(--pass-bg);
    border-color: var(--pass-line);
    color: var(--pass-ink);
}

.nav-cell.unanswered {
    background: #fff;
    color: var(--muted);
}

.nav-cell.current {
    background: var(--grad);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px -8px rgba(15, 76, 150, 0.75);
}

.navigator-legend {
    margin: 16px 0;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

.dot.answered {
    background: var(--pass-line);
}

.dot.unanswered {
    background: #fff;
    border: 1px solid var(--line);
}

.dot.current {
    background: var(--primary);
}

/* ---------- results ---------- */
.result-header {
    position: relative;
    overflow: hidden;
    text-align: center;
    border-radius: var(--radius);
    padding: 40px 28px;
    margin-bottom: 22px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.result-header.pass {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: var(--pass-ink);
    border-color: var(--pass-line);
}

.result-header.fail {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: var(--fail-ink);
    border-color: var(--fail-line);
}

.result-header::after {
    content: "";
    position: absolute;
    top: -40%;
    right: -10%;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5), transparent 65%);
    pointer-events: none;
}

.result-score {
    position: relative;
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.result-percent {
    position: relative;
    font-size: 20px;
    font-weight: 600;
    margin-top: 8px;
    opacity: 0.85;
}

.result-verdict {
    position: relative;
    display: inline-block;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.18em;
    margin-top: 16px;
    padding: 8px 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.report {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.report-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-left-width: 5px;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s, transform 0.12s;
}

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

.report-item.correct {
    border-left-color: var(--pass-ink);
}

.report-item.incorrect {
    border-left-color: var(--fail-ink);
}

.report-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.report-num {
    font-weight: 700;
    color: var(--muted);
}

.report-status {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border-radius: 999px;
}

.report-item.correct .report-status {
    color: var(--pass-ink);
    background: var(--pass-bg);
}

.report-item.incorrect .report-status {
    color: var(--fail-ink);
    background: var(--fail-bg);
}

.report-question {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 14px;
}

.ans-row {
    margin: 5px 0;
}

.ans-label {
    color: var(--muted);
    font-weight: 600;
    margin-right: 6px;
}

.ans-correct {
    color: var(--pass-ink);
    font-weight: 600;
}

.ans-wrong {
    color: var(--fail-ink);
    font-weight: 600;
}

.explanation {
    margin: 12px 0 4px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 10px;
    color: var(--ink-soft);
    font-style: italic;
    font-size: 14px;
}

.source {
    margin: 12px 0 0;
    font-size: 14px;
}

.source a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.source a:hover {
    text-decoration: underline;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    .exam-body {
        grid-template-columns: 1fr;
    }

    .navigator {
        position: static;
    }
}

@media (max-width: 560px) {
    #app {
        padding: 22px 16px 48px;
    }

    .card {
        padding: 22px;
    }

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

    #view-welcome h2 {
        font-size: 25px;
    }

    .result-score {
        font-size: 42px;
    }

    .exam-nav {
        flex-direction: column-reverse;
    }

    .exam-nav .btn {
        width: 100%;
    }
}

/* ---------- footer ---------- */
.app-footer {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 22px 24px 34px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.55);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.footer-text {
    letter-spacing: 0.01em;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    border-radius: 8px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    opacity: 0.92;
}

.footer-brand:hover {
    transform: translateY(-1px);
    opacity: 1;
}

.footer-brand:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

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