:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #607089;
    --line: #d9e0ea;
    --brand: #116466;
    --brand-dark: #0b4748;
    --accent: #c7502f;
    --ok: #18794e;
    --danger: #b42318;
    --warn: #a15c00;
    --shadow: 0 14px 34px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--brand);
    text-decoration: none;
}

.auth-page,
.app-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.app-page {
    display: block;
}

.auth-shell,
.page-shell {
    width: min(1080px, 100%);
    margin: 0 auto;
}

.auth-shell {
    max-width: 460px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.login-page {
    place-items: center;
    padding: 24px 16px;
    background: #edf3f9;
}

.login-shell {
    width: min(900px, 100%);
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(0, 520px);
    border: 1px solid rgba(145, 158, 177, 0.28);
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

.login-brand-panel {
    position: relative;
    display: grid;
    grid-template-rows: auto;
    align-content: start;
    gap: 22px;
    min-height: 0;
    padding: 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at 48% 43%, rgba(45, 212, 191, 0.16), transparent 26%),
        linear-gradient(145deg, #081d39 0%, #071832 100%);
    color: white;
}

.login-brand-panel::before {
    content: "";
    position: absolute;
    left: 40px;
    right: 40px;
    top: 235px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.55), transparent);
    opacity: 0.75;
    pointer-events: none;
}

.login-brand-lockup {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 850;
    letter-spacing: 0;
}

.login-brand-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.login-brand-icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: #0f766e;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-welcome-copy {
    position: relative;
    z-index: 1;
    align-self: end;
}

.login-welcome-copy h1 {
    margin: 0 0 12px;
    color: white;
    font-size: 28px;
    letter-spacing: 0;
}

.login-welcome-copy p {
    max-width: 275px;
    margin: 0;
    color: rgba(226, 232, 240, 0.86);
    font-size: 15px;
}

.login-shield-visual {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    align-self: center;
    min-height: 145px;
}

.login-shield-visual::before,
.login-shield-visual::after {
    content: "";
    position: absolute;
    width: 165px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.65), transparent);
}

.login-shield-visual::before {
    transform: translateX(-95px);
}

.login-shield-visual::after {
    transform: translateX(95px);
}

.login-shield-visual svg {
    position: relative;
    z-index: 1;
    width: 150px;
    height: 150px;
    filter: drop-shadow(0 18px 35px rgba(37, 99, 235, 0.28));
}

.shield-lines {
    fill: none;
    stroke: rgba(45, 212, 191, 0.36);
    stroke-width: 2;
    stroke-linecap: round;
}

.shield-outer {
    fill: rgba(37, 99, 235, 0.08);
    stroke: rgba(96, 165, 250, 0.55);
    stroke-width: 4;
}

.shield-inner {
    fill: rgba(15, 118, 110, 0.12);
    stroke: rgba(45, 212, 191, 0.32);
    stroke-width: 3;
}

.shield-lock-body {
    fill: rgba(20, 102, 128, 0.82);
    stroke: rgba(147, 197, 253, 0.9);
    stroke-width: 3;
}

.shield-lock-arc {
    fill: none;
    stroke: rgba(226, 232, 240, 0.92);
    stroke-width: 9;
    stroke-linecap: round;
}

.shield-key {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 4;
    stroke-linecap: round;
}

circle.shield-key {
    fill: #e2e8f0;
    stroke: none;
}

.login-trust-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.login-trust-grid div {
    display: grid;
    justify-items: center;
    gap: 7px;
    text-align: center;
}

.login-trust-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 50%;
    color: #6ee7b7;
    background: rgba(15, 23, 42, 0.28);
}

.login-trust-icon svg,
.login-input-icon svg,
.password-eye svg,
.login-data-note svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-trust-grid strong {
    color: white;
    font-size: 12px;
    line-height: 1.25;
}

.login-trust-grid p {
    margin: 0;
    color: rgba(203, 213, 225, 0.78);
    font-size: 10px;
    line-height: 1.35;
}

.login-copyright {
    position: relative;
    z-index: 1;
    margin: 0;
    color: rgba(203, 213, 225, 0.66);
    font-size: 10px;
}

.login-card {
    display: grid;
    align-content: center;
    justify-items: center;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 34px 34px;
}

.login-card__header,
.login-card form {
    width: min(100%, 420px);
}

.login-card__header {
    margin-bottom: 20px;
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 27px;
    line-height: 1.15;
}

.login-card__header p {
    margin: 0;
    color: var(--muted);
}

.login-field {
    gap: 7px;
}

.login-card form.stack {
    gap: 14px;
}

.field-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.field-heading a {
    font-size: 12px;
    font-weight: 700;
}

.login-forgot-link {
    justify-self: end;
    margin-top: -2px;
    font-size: 12px;
    font-weight: 750;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap input {
    min-height: 48px;
    padding-left: 44px;
    background: #fbfcfe;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    display: grid;
    place-items: center;
    color: #64748b;
    transform: translateY(-50%);
    pointer-events: none;
}

.password-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    transform: translateY(-50%);
}

.password-eye:hover {
    background: #eef2f7;
    color: var(--brand);
}

.login-card .action-wide {
    min-height: 48px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #94a3b8;
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.login-links-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.login-links-two > :nth-child(3) {
    grid-column: auto;
}

.login-card .action-link.secondary {
    min-height: 46px;
    padding: 10px 12px;
    background: #f8fafc;
    border-color: #d8e0ea;
    color: #172033;
    font-size: 13px;
    font-weight: 750;
}

.login-card .action-link.secondary:hover {
    background: #eef7f6;
    border-color: rgba(15, 118, 110, 0.45);
    color: #0b4748;
}

.login-data-note {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #607089;
    font-size: 12px;
    text-align: center;
}

.login-data-note span {
    color: var(--brand);
}

.login-card #message:empty {
    min-height: 0;
}

.loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(12, 18, 33, 0.58);
    backdrop-filter: blur(3px);
}

.loader-card {
    display: grid;
    place-items: center;
    gap: 14px;
    width: min(340px, calc(100vw - 32px));
    padding: 28px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 18px 50px rgba(8, 15, 28, 0.28);
}

.loader-card img {
    width: 96px;
    height: 96px;
    display: block;
}

.loader-text {
    font-weight: 750;
    color: var(--brand-dark);
    letter-spacing: 0;
}

.loader-subtext {
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

.brand {
    font-weight: 800;
    font-size: 20px;
}

h1,
h2 {
    margin: 0 0 10px;
    line-height: 1.15;
}

p {
    color: var(--muted);
    line-height: 1.55;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.stack {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 7px;
}

.field span,
label {
    font-weight: 650;
    font-size: 14px;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
    font: inherit;
    background: white;
}

input:focus,
select:focus {
    outline: 3px solid rgba(17, 100, 102, 0.16);
    border-color: var(--brand);
}

input[readonly] {
    background: #f8fafc;
    color: #4a5568;
    cursor: not-allowed;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.check input {
    width: auto;
    margin-top: 3px;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.auth-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
}

.auth-links-full {
    width: 100%;
}

.auth-links-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.login-links > :nth-child(3) {
    grid-column: 1 / -1;
}

.register-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.auth-links-grid > *,
.auth-links-full > * {
    width: 100%;
}

.verify-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.action-wide {
    min-width: 0;
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 16px;
    background: white;
    color: var(--text);
    text-align: center;
}

.action-link.secondary {
    background: #f0f3f7;
}

.action-link:hover {
    border-color: var(--brand);
}

button {
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
    background: var(--brand);
    color: white;
}

button.secondary {
    background: #e8edf3;
    color: var(--text);
}

button.warn {
    background: var(--accent);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.message {
    min-height: 22px;
    color: var(--muted);
    font-size: 14px;
}

.message.error {
    color: var(--danger);
}

.message.success {
    color: var(--ok);
}

.field-error {
    margin: -2px 0 0;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.35;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
    border-color: var(--danger);
    outline-color: rgba(180, 35, 24, 0.18);
}

.form-alert {
    padding: 14px 16px;
    border: 1px solid rgba(180, 35, 24, 0.22);
    border-left-width: 4px;
    border-radius: 10px;
    background: rgba(180, 35, 24, 0.06);
}

.form-alert.success {
    border-color: rgba(21, 128, 61, 0.26);
    border-left-color: var(--ok);
    background: rgba(21, 128, 61, 0.08);
}

.form-alert strong {
    display: block;
    margin-bottom: 8px;
}

.form-alert-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.form-alert-cta {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.form-alert-cta span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

[hidden],
.hidden {
    display: none !important;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.tile {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.tile .message {
    min-height: 22px;
}

.tile .action-wide {
    width: 100%;
    margin-top: auto;
}

.muted {
    color: var(--muted);
}

.assessment-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 18px;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    margin-bottom: 18px;
}

.timer {
    font-weight: 800;
    color: var(--accent);
}

.options {
    display: grid;
    gap: 10px;
    margin: 22px 0;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
}

.session-shell,
.session-result-shell,
.option,
.protected-text {
    user-select: none;
    -webkit-user-select: none;
}

.protected-text {
    display: block;
    flex: 1;
    min-width: 0;
}

.protected-text-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    pointer-events: none;
}

.feedback-answer-copy,
.result-question-copy,
.result-option-copy {
    margin: 6px 0;
}

.option input {
    width: auto;
    margin-top: 3px;
}

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

.nav-grid button {
    min-width: 0;
    padding: 10px 0;
    background: #e8edf3;
    color: var(--text);
}

.nav-grid button.active {
    background: var(--brand);
    color: white;
}

.nav-grid button.answered {
    background: var(--ok);
    color: white;
}

.nav-grid button.review {
    background: var(--warn);
    color: white;
}

.feedback,
.result-item {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    margin-top: 14px;
}

.session-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(9, 14, 24, 0.78);
    backdrop-filter: blur(2px);
    padding: 0;
}

.session-modal__shell {
    width: 100vw;
    height: 100vh;
    background: #f5f7fb;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
}

.session-modal__bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: white;
    border-bottom: 1px solid var(--line);
}

.session-modal__mount {
    width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
}

.session-modal .page-shell {
    width: 100%;
    max-width: none;
    padding: 18px;
}

.session-inline-loader {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
}

.session-result-shell {
    min-height: 100%;
}

.keyboard-warning {
    position: fixed;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    z-index: 10003;
    background: rgba(180, 35, 24, 0.96);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(23, 32, 51, 0.18);
    font-weight: 700;
}

.fullscreen-guard {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 6, 23, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.fullscreen-guard__card {
    width: min(620px, 100%);
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 24px 70px rgba(23, 32, 51, 0.24);
}

.fullscreen-guard__card h2 {
    margin-bottom: 10px;
}

.fullscreen-guard__card p {
    color: var(--muted);
}

.fullscreen-guard__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.fullscreen-guard__actions > * {
    width: 100%;
}

body.session-open {
    overflow: hidden;
    touch-action: none;
}

@media (max-width: 980px) {
    .login-shell {
        max-width: 720px;
        min-height: 0;
        grid-template-columns: 1fr;
    }

    .login-brand-panel,
    .login-card {
        padding: 32px;
    }

    .login-brand-panel {
        min-height: 0;
    }

    .login-welcome-copy h1 {
        font-size: 30px;
    }

    .login-shield-visual {
        min-height: 150px;
    }

    .login-shield-visual svg {
        width: 145px;
        height: 145px;
    }

    .grid,
    .tiles,
    .assessment-layout,
    .verify-actions {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 20px;
    }

    .topbar,
    .question-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .actions > *,
    .verify-actions > * {
        width: 100%;
    }

    .verify-actions .action-link {
        grid-column: auto;
    }

    .auth-links-grid {
        grid-template-columns: 1fr;
    }

    .register-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .auth-page,
    .app-page {
        padding: 16px 12px;
    }

    .login-page {
        padding: 12px;
    }

    .login-shell {
        border-radius: 10px;
    }

    .login-brand-panel,
    .login-card {
        padding: 24px 20px;
    }

    .login-brand-panel {
        gap: 24px;
    }

    .login-brand-panel::before,
    .login-shield-visual::before,
    .login-shield-visual::after {
        display: none;
    }

    .login-brand-lockup {
        font-size: 16px;
    }

    .login-welcome-copy h1 {
        font-size: 28px;
    }

    .login-trust-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .login-trust-grid div {
        justify-items: start;
        grid-template-columns: auto 1fr;
        text-align: left;
    }

    .login-trust-grid p {
        grid-column: 2;
    }

    .login-card h2 {
        font-size: 26px;
    }

    .login-links-two {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 18px;
    }

    .loader-card {
        width: min(300px, calc(100vw - 24px));
        padding: 22px;
    }

    .topbar,
    .question-meta {
        gap: 10px;
    }

    .brand {
        font-size: 18px;
    }

    .nav-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .auth-links {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-links > * {
        width: 100%;
    }

    .form-alert-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .form-alert-cta .action-link {
        width: 100%;
    }

    .session-modal {
        padding: 0;
    }

    .session-modal__shell {
        border-radius: 0;
    }

    .session-modal__bar {
        padding: 12px 14px;
    }

    .fullscreen-guard__card {
        padding: 20px;
    }

    .fullscreen-guard__actions {
        grid-template-columns: 1fr;
    }
}
