:root {
    --portal-bg: linear-gradient(135deg, #f8f4ec 0%, #dbe8f5 45%, #f3efe3 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --header-bg: linear-gradient(135deg, #0e3b5d 0%, #18666b 100%);
    --primary: #0f6e8c;
    --primary-dark: #0c5670;
    --accent: #f4a261;
    --text-main: #1f2933;
    --text-muted: #52606d;
    --border-soft: rgba(15, 110, 140, 0.12);
    --success-soft: rgba(47, 133, 90, 0.14);
    --danger-soft: rgba(192, 57, 43, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--portal-bg);
    color: var(--text-main);
}

.portal-shell {
    min-height: 100vh;
    position: relative;
}

.portal-shell::before,
.portal-shell::after {
    content: "";
    position: fixed;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(20px);
    z-index: 0;
    pointer-events: none;
}

.portal-shell::before {
    top: -120px;
    left: -100px;
    background: rgba(244, 162, 97, 0.22);
}

.portal-shell::after {
    right: -90px;
    bottom: -100px;
    background: rgba(15, 110, 140, 0.18);
}

.container,
.row,
.col-12,
.col-xl-10,
.col-xl-11 {
    position: relative;
    z-index: 1;
}

.exam-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.portal-header {
    padding: 2rem;
    background: var(--header-bg);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.85;
}

.portal-title {
    font-size: clamp(1.9rem, 3vw, 2.8rem);
    font-weight: 800;
}

.portal-subtitle {
    max-width: 45rem;
    opacity: 0.92;
}

.screen {
    padding: 2rem;
}

.intro-panel,
.form-panel,
.result-panel {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 1.75rem;
    height: 100%;
}

.section-title {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 700;
}

.instruction-list {
    padding-left: 1.2rem;
    margin-bottom: 0;
    color: var(--text-muted);
}

.instruction-list li + li {
    margin-top: 0.45rem;
}

.form-control {
    border-radius: 14px;
    border: 1px solid rgba(15, 110, 140, 0.2);
    padding: 0.9rem 1rem;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 110, 140, 0.15);
}

.btn {
    border-radius: 14px;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.admin-link {
    white-space: nowrap;
}

.exam-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(245, 249, 251, 0.95));
    margin-bottom: 1.5rem;
}

.toolbar-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.candidate-name {
    font-size: 1.4rem;
    font-weight: 700;
}

.timer-box {
    min-width: 160px;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(15, 110, 140, 0.08);
}

.timer-text {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    color: var(--primary-dark);
}

.timer-danger {
    background: var(--danger-soft);
}

.timer-danger .timer-text {
    color: #b83227;
}

.chapter-block {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    padding: 1.5rem;
}

.chapter-block + .chapter-block {
    margin-top: 1.5rem;
}

.chapter-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.chapter-badge {
    background: rgba(244, 162, 97, 0.16);
    color: #b56422;
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.question-card {
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 1.25rem;
    background: #fff;
    color: var(--text-main);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.question-card + .question-card {
    margin-top: 1rem;
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.question-card.question-missing {
    border-color: #c0392b;
    background: rgba(255, 248, 247, 0.95);
}

.question-number {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.question-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 0.35rem;
    margin-bottom: 1rem;
}

.option-grid {
    display: grid;
    gap: 0.75rem;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid rgba(15, 110, 140, 0.14);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.option-label:hover {
    border-color: rgba(15, 110, 140, 0.35);
    background: rgba(15, 110, 140, 0.04);
}

.option-label input {
    margin-top: 0.2rem;
}

.option-letter {
    font-weight: 700;
    color: var(--primary-dark);
    min-width: 1.25rem;
}

.option-text {
    color: var(--text-main);
}

.chapter-indicator {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.score-card {
    border-radius: 18px;
    padding: 1.35rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border-soft);
    height: 100%;
}

.total-card {
    background: rgba(47, 133, 90, 0.08);
    border-color: rgba(47, 133, 90, 0.18);
}

.score-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 2rem;
    line-height: 1;
}

.results-table thead th {
    background: rgba(15, 110, 140, 0.08);
    color: var(--primary-dark);
    white-space: nowrap;
}

.results-table td,
.results-table th {
    padding: 1rem 0.9rem;
}

.badge-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(15, 110, 140, 0.08);
    color: var(--primary-dark);
    font-weight: 700;
}

.admin-shell .screen {
    padding-top: 1.75rem;
}

@media (max-width: 767.98px) {
    .portal-header,
    .exam-toolbar,
    .chapter-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .screen,
    .portal-header {
        padding: 1.35rem;
    }

    .timer-box {
        width: 100%;
    }

    .timer-text {
        font-size: 1.75rem;
    }
}
