/*
 * Modern interface layer
 * Preserves the institutional navy-and-gold identity while improving
 * responsiveness, hierarchy, feedback and motion.
 */

:root {
    --surface-glass: rgba(7, 24, 35, 0.78);
    --surface-raised: rgba(12, 35, 48, 0.94);
    --surface-deep: rgba(4, 15, 23, 0.96);
    --line-soft: rgba(232, 219, 158, 0.12);
    --line-gold: rgba(234, 211, 114, 0.34);
    --cyan-400: #57c9d8;
    --cyan-300: #8ddce5;
    --modern-shadow: 0 20px 55px rgba(0, 0, 0, 0.28);
    --modern-shadow-small: 0 10px 30px rgba(0, 0, 0, 0.2);
    --radius-xl: 28px;
}

html {
    scrollbar-color: rgba(217, 187, 85, 0.55) var(--navy-950);
}

body {
    overflow-x: hidden;
    background:
        radial-gradient(circle at 8% 8%, rgba(87, 201, 216, 0.09), transparent 26rem),
        radial-gradient(circle at 88% 15%, rgba(217, 187, 85, 0.1), transparent 30rem),
        linear-gradient(135deg, transparent 0 72%, rgba(63, 97, 75, 0.06) 72% 78%, transparent 78%),
        var(--navy-950);
    font-size: 1rem;
}

body::before {
    background-image:
        linear-gradient(rgba(217, 187, 85, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(217, 187, 85, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: 0.44;
    mask-image: linear-gradient(to bottom, #000 0, transparent 82%);
}

::selection {
    color: var(--navy-950);
    background: var(--gold-300);
}

::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

::-webkit-scrollbar-track {
    background: var(--navy-950);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--gold-500), #8e7c3f);
    border: 3px solid var(--navy-950);
    border-radius: 999px;
}

.page-scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 120;
    height: 3px;
    background: rgba(255, 255, 255, 0.025);
    pointer-events: none;
}

.page-scroll-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--gold-500), var(--gold-300), var(--cyan-400));
    box-shadow: 0 0 16px rgba(234, 211, 114, 0.7);
    transition: width 80ms linear;
}

.site-header {
    position: sticky;
    top: 12px;
    z-index: 60;
    width: min(calc(100% - 32px), calc(var(--content) + 36px));
    min-height: 78px;
    margin-top: 12px;
    padding: 8px 18px;
    background: rgba(5, 20, 30, 0.76);
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    box-shadow: var(--modern-shadow-small);
    backdrop-filter: blur(20px) saturate(135%);
}

.brand {
    min-width: 0;
}

.brand img,
.command-logo {
    filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.24));
}

.brand strong {
    color: #fffdf6;
}

.brand small {
    font-size: 0.76rem;
}

.header-admin-link,
.header-logout-form button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(255, 255, 255, 0.09);
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.header-admin-link:hover,
.header-logout-form button:hover {
    transform: translateY(-1px);
}

.mission-nav {
    position: sticky;
    top: 102px;
    z-index: 45;
    margin-top: 10px;
    padding: 9px 12px;
    background: rgba(6, 22, 32, 0.82);
    border-color: var(--line-soft);
    box-shadow: var(--modern-shadow-small);
    backdrop-filter: blur(18px) saturate(130%);
}

.nav-link,
.nav-progress,
.student-session-name {
    font-size: 0.875rem;
}

.nav-progress progress {
    height: 8px;
}

.main-shell {
    width: min(calc(100% - 32px), var(--content));
}

.eyebrow {
    color: var(--gold-300);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
}

.button {
    position: relative;
    isolation: isolate;
    min-height: 48px;
    overflow: hidden;
    border-radius: 13px;
    font-size: 0.86rem;
    letter-spacing: 0.045em;
    transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease, background 170ms ease;
}

.button::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, transparent 15%, rgba(255, 255, 255, 0.2) 48%, transparent 76%);
    content: "";
    transform: translateX(-125%);
    transition: transform 520ms ease;
}

.button:hover::before {
    transform: translateX(125%);
}

.button:hover {
    transform: translateY(-2px);
}

.button-primary {
    box-shadow: 0 10px 24px rgba(217, 187, 85, 0.16);
}

.button-primary:hover {
    box-shadow: 0 14px 30px rgba(217, 187, 85, 0.25);
}

.button:active {
    transform: translateY(0) scale(0.985);
}

.hero {
    gap: clamp(34px, 6vw, 86px);
    min-height: min(720px, calc(100vh - 110px));
    padding-block: clamp(54px, 8vw, 96px);
}

.hero h1 {
    max-width: 770px;
    text-wrap: balance;
}

.hero-lead {
    max-width: 680px;
    font-size: clamp(1rem, 1.7vw, 1.15rem);
}

.hero-emblem {
    border-radius: var(--radius-xl);
    box-shadow: inset 0 0 70px rgba(87, 201, 216, 0.045), var(--modern-shadow);
}

.feature-list {
    border-color: var(--line-soft);
}

.instructions,
.question-panel,
.feedback-panel,
.remember-card,
.form-card,
.results-table-card,
.admin-result-hero,
.result-registration-card {
    border-color: var(--line-soft);
    box-shadow: var(--modern-shadow);
    backdrop-filter: blur(12px);
}

.instructions {
    border-radius: var(--radius-xl);
}

.section-heading,
.mission-heading {
    padding-top: clamp(42px, 6vw, 68px);
}

.section-heading h1,
.mission-heading h1 {
    text-wrap: balance;
}

.student-profile-strip {
    padding: 19px 22px;
    background: linear-gradient(110deg, rgba(13, 43, 57, 0.82), rgba(6, 22, 32, 0.82));
    border-color: var(--line-soft);
    border-radius: 17px;
    box-shadow: var(--modern-shadow-small);
    backdrop-filter: blur(14px);
}

.student-avatar {
    box-shadow: 0 8px 20px rgba(217, 187, 85, 0.2);
}

.sequence-banner {
    border-radius: 17px;
    box-shadow: var(--modern-shadow-small);
}

.mission-grid {
    gap: 16px;
}

.mission-card {
    min-height: 112px;
    border-radius: 17px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    transform: translateZ(0);
}

.mission-card:not(.status-locked):hover {
    border-color: rgba(234, 211, 114, 0.42);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
    transform: translateY(-3px);
}

.mission-card.status-available {
    box-shadow:
        0 16px 36px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(234, 211, 114, 0.1),
        inset 0 0 34px rgba(217, 187, 85, 0.04);
}

.mission-card.status-locked {
    box-shadow: none;
}

.mission-number {
    font-size: 1.6rem;
}

.mission-copy strong {
    font-size: 1.03rem;
    line-height: 1.28;
}

.mission-status {
    min-width: 86px;
    text-align: center;
}

.question-panel,
.feedback-panel {
    border-radius: var(--radius-xl);
}

.question-panel h2 {
    max-width: 970px;
    text-wrap: balance;
}

.answer-form {
    gap: 14px;
}

.answer-option {
    min-height: 78px;
    border-radius: 15px;
    font-size: 1rem;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.answer-option:hover {
    border-color: rgba(234, 211, 114, 0.4);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    transform: translateX(4px);
}

.answer-letter {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.feedback-panel {
    overflow: visible;
}

.response-alert {
    backdrop-filter: blur(9px);
}

.response-alert-card {
    border-radius: 24px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.58);
}

.response-alert-actions {
    justify-content: flex-end;
}

.response-alert-actions .button-primary {
    min-width: 270px;
}

.form-card {
    border-radius: 24px;
}

.field input,
.search-form input {
    min-height: 52px;
    border-radius: 12px;
}

.field label {
    font-size: 0.875rem;
}

.field small,
.field-error {
    font-size: 0.78rem;
}

.stats-grid article {
    border-radius: 18px;
    box-shadow: var(--modern-shadow-small);
}

.results-table-card {
    border-radius: 22px;
}

.results-table tbody tr {
    transition: background 150ms ease, transform 150ms ease;
}

.results-table tbody tr:hover {
    background: rgba(217, 187, 85, 0.045);
}

.score-card,
.admin-score-card {
    box-shadow: var(--modern-shadow);
}

.review-item {
    border-radius: 18px;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.review-item:hover {
    border-color: rgba(217, 187, 85, 0.25);
    box-shadow: var(--modern-shadow-small);
    transform: translateY(-2px);
}

.site-footer {
    margin-top: 20px;
}

.has-interaction-light {
    isolation: isolate;
}

.has-interaction-light > *:not(.interaction-light) {
    position: relative;
    z-index: 1;
}

.interaction-light {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(
        260px circle at var(--pointer-x, 50%) var(--pointer-y, 50%),
        rgba(141, 220, 229, 0.1),
        transparent 68%
    );
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.has-interaction-light:hover .interaction-light {
    opacity: 1;
}

.mission-card,
.stats-grid article,
.review-item {
    animation: modern-rise 420ms ease backwards;
}

.mission-card:nth-child(2n),
.stats-grid article:nth-child(2n),
.review-item:nth-child(2n) {
    animation-delay: 45ms;
}

.mission-card:nth-child(3n),
.review-item:nth-child(3n) {
    animation-delay: 90ms;
}

@keyframes modern-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1080px) {
    .mission-grid {
        grid-template-columns: 1fr;
    }

    .portal-layout {
        grid-template-columns: minmax(0, 0.82fr) minmax(470px, 1.18fr);
        gap: 42px;
    }

    .site-header {
        width: min(calc(100% - 24px), var(--content));
    }
}

@media (max-width: 900px) {
    .site-header {
        top: 8px;
    }

    .mission-nav {
        top: 96px;
    }

    .hero {
        min-height: auto;
    }

    .hero-copy {
        padding-top: 10px;
    }

    .portal-layout {
        grid-template-columns: 1fr;
    }

    .portal-intro {
        position: static;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .site-header {
        position: relative;
        top: auto;
        min-height: 70px;
        margin-top: 8px;
        padding: 7px 12px;
        border-radius: 14px;
    }

    .mission-nav {
        top: 8px;
        border-radius: 12px;
    }

    .command-logo {
        display: none;
    }

    .main-shell {
        width: min(calc(100% - 20px), var(--content));
    }

    .hero {
        padding-block: 40px 56px;
    }

    .hero h1 {
        font-size: clamp(2.65rem, 13vw, 4rem);
    }

    .hero-emblem {
        border-radius: 20px;
    }

    .instructions {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .section-heading,
    .mission-heading {
        padding-top: 36px;
    }

    .student-profile-strip {
        padding: 15px;
    }

    .mission-card {
        min-height: 108px;
    }

    .question-panel,
    .feedback-panel,
    .response-alert-card {
        border-radius: 19px;
    }

    .answer-option:hover {
        transform: none;
    }

    .response-alert-actions .button-primary {
        width: 100%;
        min-width: 0;
    }

    .admin-heading {
        align-items: stretch;
    }

    .admin-heading-actions {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .site-header {
        width: calc(100% - 16px);
    }

    .brand {
        gap: 9px;
    }

    .brand img {
        width: 44px;
        height: 44px;
    }

    .brand strong {
        font-size: 0.69rem;
        letter-spacing: 0.09em;
    }

    .header-actions {
        gap: 4px;
    }

    .header-admin-link {
        max-width: 104px;
        min-height: 38px;
        padding: 6px 8px;
        font-size: 0.68rem;
        line-height: 1.2;
    }

    .mission-nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .nav-link {
        min-width: 0;
        overflow: hidden;
        font-size: 0.75rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-progress {
        font-size: 0.75rem;
    }

    .hero-actions,
    .form-actions,
    .admin-heading-actions {
        gap: 9px;
    }

    .feature-list strong {
        font-size: 1.5rem;
    }

    .feature-list span {
        font-size: 0.68rem;
    }

    .section-heading h1,
    .mission-heading h1,
    .portal-intro h1,
    .admin-heading h1 {
        font-size: clamp(2.25rem, 12vw, 3rem);
    }

    .score-preview strong {
        font-size: 2.4rem;
    }

    .sequence-banner {
        border-radius: 14px;
    }

    .mission-card {
        min-height: 116px;
        border-radius: 14px;
    }

    .mission-copy strong {
        font-size: 0.95rem;
    }

    .mission-status {
        min-width: 0;
        width: max-content;
    }

    .question-panel,
    .feedback-panel {
        padding: 22px 16px;
    }

    .question-panel h2 {
        font-size: clamp(1.45rem, 7vw, 2rem);
    }

    .answer-option {
        min-height: 74px;
        font-size: 0.95rem;
        line-height: 1.42;
    }

    .response-alert {
        padding: 8px;
    }

    .response-alert-card {
        max-height: calc(100dvh - 16px);
        padding: 22px 17px;
    }

    .response-alert-card h2 {
        font-size: clamp(2rem, 11vw, 3.2rem);
    }

    .form-card {
        padding: 22px 17px;
        border-radius: 18px;
    }

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

    .results-table-card {
        padding: 18px 12px;
        border-radius: 17px;
    }

    .result-registration-card {
        grid-template-columns: 1fr;
    }

    .review-item {
        border-radius: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mission-card,
    .stats-grid article,
    .review-item {
        animation: none;
    }

    .button::before,
    .interaction-light,
    .page-scroll-progress span {
        transition: none;
    }
}

@media print {
    .page-scroll-progress,
    .interaction-light {
        display: none !important;
    }

    .site-header {
        position: static;
        width: 100%;
        margin: 0;
        background: #fff;
        box-shadow: none;
    }
}
