:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #edf2f7;
    --text: #152033;
    --muted: #607089;
    --line: #dbe3ee;
    --primary: #0f6b8f;
    --primary-dark: #0a4d66;
    --accent: #b8860b;
    --success: #15803d;
    --danger: #b42318;
    --warning: #9a6700;
    --shadow: 0 18px 50px rgba(21, 32, 51, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(135deg, rgba(15, 107, 143, 0.12), rgba(184, 134, 11, 0.08)),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(244, 247, 251, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.nav-shell,
.page-shell,
.site-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.nav-shell {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand img {
    width: 42px;
    height: 48px;
    object-fit: contain;
}

.brand span {
    display: grid;
    gap: 2px;
}

.brand small,
.muted,
.helper,
.site-footer span {
    color: var(--muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-links a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
}

.nav-links a.active,
.nav-links a:hover {
    color: var(--text);
    background: var(--surface);
}

.nav-links .nav-login {
    color: var(--primary);
}

.page-shell {
    padding: 56px 0;
}

.hero,
.auth-layout,
.result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.72fr);
    gap: 56px;
    align-items: center;
}

.hero {
    min-height: calc(100vh - 210px);
    padding: 30px 0 18px;
}

.eyebrow {
    display: inline-flex;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 18px;
    font-size: clamp(2.25rem, 6vw, 4.9rem);
    line-height: 0.98;
}

.hero-title {
    max-width: 780px;
    margin: 12px 0 24px;
    font-size: 4.35rem;
    line-height: 1;
}

.hero-title span,
.hero-title strong {
    display: block;
}

.hero-title span {
    color: var(--text);
    font-weight: 900;
}

.hero-title strong {
    width: fit-content;
    max-width: 100%;
    margin-top: 10px;
    padding: 12px 18px 14px;
    color: var(--primary-dark);
    background: rgba(255, 255, 255, 0.54);
    border: 1px solid rgba(15, 107, 143, 0.16);
    border-left: 6px solid var(--accent);
    border-radius: 8px;
    font-size: 2.7rem;
    line-height: 1.12;
    overflow-wrap: anywhere;
    box-shadow: 0 14px 40px rgba(21, 32, 51, 0.08);
}

.content-section h1,
.result-layout h1,
.auth-layout h1 {
    font-size: clamp(2rem, 4vw, 3.7rem);
}

.hero-copy p,
.section-copy p,
.content-section > p {
    max-width: 640px;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.8;
}

.card,
.search-panel,
.info-grid article,
.metric-grid article,
.steps article {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.search-panel,
.form-card,
.text-card,
.result-card {
    padding: 28px;
}

.hero .search-panel {
    padding: 32px;
    border-color: rgba(15, 107, 143, 0.12);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 24px 70px rgba(21, 32, 51, 0.12);
}

.hero .search-panel label {
    margin-bottom: 2px;
    font-size: 1.02rem;
}

.hero .search-row {
    gap: 14px;
}

.hero .button {
    min-width: 84px;
}

.search-panel label,
.form-card label {
    display: grid;
    gap: 9px;
    color: var(--text);
    font-weight: 800;
}

input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

input:focus {
    outline: 3px solid rgba(15, 107, 143, 0.18);
    border-color: var(--primary);
}

input:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text);
    background: #fff;
    font: inherit;
    resize: vertical;
}

textarea:focus {
    outline: 3px solid rgba(15, 107, 143, 0.18);
    border-color: var(--primary);
}

.search-row,
.action-row,
.section-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-row {
    margin-top: 10px;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    white-space: nowrap;
}

.button.primary {
    color: #fff;
    background: var(--primary);
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary {
    color: var(--primary);
    background: var(--surface-soft);
}

.button.danger {
    color: #fff;
    background: var(--danger);
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.9rem;
}

.info-grid,
.metric-grid,
.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.info-grid article,
.metric-grid article,
.steps article {
    display: grid;
    gap: 8px;
    padding: 20px;
}

.metric-grid strong {
    font-size: 2.25rem;
}

.steps strong {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--primary);
    border-radius: 50%;
}

.form-card {
    display: grid;
    gap: 18px;
}

.form-card h2 {
    margin: 10px 0 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    font-size: 1.1rem;
}

.wide-form {
    max-width: 860px;
}

.notice {
    max-width: 860px;
    margin: 18px 0;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 800;
}

.notice.success {
    color: var(--success);
    background: #ecfdf3;
}

.notice.error {
    color: var(--danger);
    background: #fff1f0;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.alert.danger {
    color: var(--danger);
    background: #fff1f0;
}

.alert.warning {
    color: var(--warning);
    background: #fff8df;
}

.result-page {
    grid-template-columns: minmax(260px, 0.68fr) minmax(560px, 1.32fr);
    gap: 34px;
}

.result-copy {
    align-self: center;
}

.result-copy h1 {
    max-width: 520px;
    font-size: clamp(2.1rem, 4vw, 3.8rem);
    line-height: 1.04;
}

.result-found {
    position: relative;
    display: grid;
    grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1fr);
    gap: 24px;
    overflow: hidden;
    border-color: rgba(15, 107, 143, 0.14);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(237, 242, 247, 0.9)),
        var(--surface);
    box-shadow: 0 28px 80px rgba(21, 32, 51, 0.14);
    animation: resultReveal 700ms ease both;
}

.result-found::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(15, 107, 143, 0.1), transparent 34%),
        linear-gradient(300deg, rgba(184, 134, 11, 0.11), transparent 42%);
    pointer-events: none;
}

.result-summary,
.result-data {
    position: relative;
    z-index: 1;
}

.result-summary {
    display: flex;
    flex-direction: column;
    padding: 22px;
    border-radius: 8px;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(10, 77, 102, 0.96), rgba(21, 128, 61, 0.9)),
        var(--primary-dark);
}

.result-found.is-failed .result-summary {
    background:
        linear-gradient(145deg, rgba(120, 53, 15, 0.96), rgba(180, 35, 24, 0.9)),
        var(--danger);
}

.result-kicker {
    margin: 6px 0 12px;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 800;
}

.result-summary h2 {
    margin-bottom: 8px;
    color: #fff;
    font-size: clamp(1.55rem, 2.6vw, 2.25rem);
    line-height: 1.08;
}

.result-school {
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.6;
}

.average-panel {
    display: grid;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 20px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
}

.average-panel span {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.9rem;
    font-weight: 800;
}

.average-panel strong {
    color: #fff;
    font-size: 1.85rem;
}

.result-summary .button.secondary {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

.result-summary .button.primary {
    color: var(--primary-dark);
    background: #fff;
}

.result-data {
    display: grid;
    gap: 18px;
    align-content: start;
}

.result-card h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.status-badge {
    width: fit-content;
    margin-bottom: 18px;
    padding: 8px 12px;
    border-radius: 999px;
    color: #fff;
    font-weight: 900;
    text-transform: uppercase;
}

.status-badge.passed {
    color: #ecfdf3;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.status-badge.failed {
    color: #fff1f0;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.detail-list {
    display: grid;
    gap: 8px;
    margin: 0 0 22px;
}

.detail-list div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 14px;
    padding: 0 0 10px;
    border-bottom: 1px solid var(--line);
}

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

dd {
    margin: 0;
    font-weight: 800;
}

.score-grid,
.score-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.score-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-grid span,
.score-list span {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
}

.score-list span {
    min-height: 76px;
    padding: 12px;
    border: 1px solid rgba(15, 107, 143, 0.08);
    background:
        linear-gradient(145deg, rgba(237, 242, 247, 0.95), rgba(255, 255, 255, 0.86));
    font-size: 0.9rem;
}

.score-grid strong,
.score-list strong {
    color: var(--text);
    font-size: 1.15rem;
}

.confetti {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.confetti span {
    position: absolute;
    top: -18px;
    left: 50%;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    transform: translateY(0) rotate(0);
    animation: confettiFall 1200ms ease-out forwards;
}

.confetti span:nth-child(3n + 1) {
    background: #b8860b;
}

.confetti span:nth-child(3n + 2) {
    background: #0f6b8f;
}

.confetti span:nth-child(3n + 3) {
    background: #15803d;
}

.confetti span:nth-child(1) { left: 10%; animation-delay: 20ms; }
.confetti span:nth-child(2) { left: 18%; animation-delay: 80ms; }
.confetti span:nth-child(3) { left: 26%; animation-delay: 140ms; }
.confetti span:nth-child(4) { left: 34%; animation-delay: 40ms; }
.confetti span:nth-child(5) { left: 42%; animation-delay: 170ms; }
.confetti span:nth-child(6) { left: 50%; animation-delay: 90ms; }
.confetti span:nth-child(7) { left: 58%; animation-delay: 10ms; }
.confetti span:nth-child(8) { left: 66%; animation-delay: 130ms; }
.confetti span:nth-child(9) { left: 74%; animation-delay: 60ms; }
.confetti span:nth-child(10) { left: 82%; animation-delay: 190ms; }
.confetti span:nth-child(11) { left: 90%; animation-delay: 110ms; }
.confetti span:nth-child(12) { left: 14%; animation-delay: 230ms; }
.confetti span:nth-child(13) { left: 30%; animation-delay: 260ms; }
.confetti span:nth-child(14) { left: 46%; animation-delay: 210ms; }
.confetti span:nth-child(15) { left: 62%; animation-delay: 250ms; }
.confetti span:nth-child(16) { left: 78%; animation-delay: 280ms; }
.confetti span:nth-child(17) { left: 22%; animation-delay: 310ms; }
.confetti span:nth-child(18) { left: 70%; animation-delay: 330ms; }

@keyframes resultReveal {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes confettiFall {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    12% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(250px) rotate(260deg);
    }
}

.section-head {
    justify-content: space-between;
    margin-bottom: 18px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 0.86rem;
    text-transform: uppercase;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 0 34px;
    color: var(--muted);
}

.site-footer div {
    display: grid;
    gap: 4px;
}

@media (max-width: 820px) {
    .nav-shell,
    .site-footer,
    .section-head,
    .search-row,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .hero,
    .auth-layout,
    .result-layout,
    .result-page,
    .result-found,
    .info-grid,
    .metric-grid,
    .steps,
    .score-grid,
    .score-list {
        grid-template-columns: 1fr;
    }

    .nav-shell {
        padding: 14px 0;
    }

    .nav-links {
        width: 100%;
    }

    .nav-links a {
        flex: 1 1 auto;
    }

    .detail-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .site-footer {
        display: grid;
    }

    .hero {
        min-height: auto;
        padding-top: 10px;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-title strong {
        font-size: 1.8rem;
    }

    .hero .search-panel {
        padding: 24px;
    }

    .result-found {
        gap: 18px;
    }

    .result-summary {
        padding: 20px;
    }

    .result-copy h1 {
        font-size: 2.4rem;
    }
}
