:root {
    --primary: #2357d9;
    --primary-dark: #172f77;
    --accent: #0f9f6e;
    --warning: #b7791f;
    --danger: #dc2626;
    --ink: #172033;
    --muted: #64748b;
    --line: #dbe4f0;
    --soft: #f6f8fb;
    --card: #ffffff;
    --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--soft);
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.75;
}

a {
    color: inherit;
}

.site-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

.site-nav,
.site-links,
.auth-links,
.hero-actions,
.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.site-nav {
    justify-content: space-between;
    margin-bottom: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-dark);
    font-weight: 900;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    letter-spacing: 0;
}

.nav-link,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--primary);
    font-weight: 900;
    text-decoration: none;
}

.btn.primary {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 10px 22px rgba(35, 87, 217, 0.18);
}

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

.google-signin {
    display: grid;
    gap: 9px;
    margin: 22px 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 750;
    text-align: center;
}

.google-signin .google-signin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 52px;
    padding: 10px 18px;
    border: 1px solid #d0d7e2;
    border-radius: 10px;
    background: #fff;
    color: #1f2937;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.08);
    font-weight: 900;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.google-signin .google-signin-button:hover {
    border-color: #9aa8bc;
    box-shadow: 0 7px 16px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.google-signin .google-signin-button:focus-visible {
    outline: 3px solid rgba(66, 133, 244, 0.32);
    outline-offset: 2px;
}

.google-signin .google-signin-mark {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
}

.google-signin .google-signin-mark svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hero {
    display: grid;
    gap: 16px;
    padding: clamp(24px, 4vw, 40px);
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-weight: 900;
}

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

h1 {
    max-width: 820px;
    margin-bottom: 0;
    color: var(--primary-dark);
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.18;
}

.lead {
    max-width: 820px;
    margin-bottom: 0;
    color: #475569;
    font-size: 1.06rem;
    font-weight: 750;
}

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

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

.panel {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.panel h2,
.panel h3 {
    margin-bottom: 8px;
    color: var(--primary-dark);
}

.panel p,
.panel li {
    color: #475569;
    font-weight: 700;
}

.clean-list {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.clean-list li {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

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

.level-choice-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-card,
.level-choice-card,
.placement-question,
.result-card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.featured-choice {
    border-color: rgba(35, 87, 217, 0.45);
    box-shadow: var(--shadow);
}

.route-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 8px;
    background: #e8eefc;
    color: var(--primary-dark);
    font-weight: 900;
    font-size: 0.86rem;
}

.choice-card h2,
.level-choice-card h2,
.placement-question h2,
.result-card h2 {
    margin: 10px 0 8px;
    color: var(--primary-dark);
}

.choice-card p,
.level-choice-card p,
.placement-question p,
.result-card p {
    color: #475569;
    font-weight: 700;
}

.direct-start-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.level-price {
    display: block;
    margin: 14px 0;
    color: var(--accent);
    font-size: 1.05rem;
}

.placement-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.placement-summary span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--soft);
    border: 1px solid var(--line);
    color: var(--primary-dark);
    font-weight: 900;
}

.placement-form {
    display: grid;
    gap: 14px;
}

.placement-question {
    margin: 0;
}

.placement-question legend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 900;
}

.placement-question legend span {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
}

.question-prompt {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    color: var(--ink);
    font-size: 1.1rem;
}

.placement-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    color: var(--ink);
    font-weight: 900;
    cursor: pointer;
}

.option-row:has(input:checked) {
    border-color: var(--primary);
    background: #e8eefc;
}

.option-row input {
    accent-color: var(--primary);
}

.placement-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    bottom: 0;
    padding: 14px 0;
    background: var(--soft);
    border-top: 1px solid var(--line);
}

.result-card {
    margin-top: 18px;
    border-color: rgba(15, 159, 110, 0.45);
}

.result-score {
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 900;
}

.result-sections li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.legal-note {
    color: var(--warning);
    font-weight: 900;
}

.footer {
    margin-top: 24px;
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-weight: 800;
}

.footer-links {
    margin-top: 8px;
}

@media (max-width: 860px) {
    .site-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-links,
    .auth-links,
    .hero-actions,
    .footer-links {
        width: 100%;
    }

    .nav-link,
    .btn {
        flex: 1 1 145px;
    }

    .grid,
    .two-col,
    .choice-grid,
    .level-choice-grid {
        grid-template-columns: 1fr;
    }

    .direct-start-panel,
    .placement-actions {
        align-items: stretch;
        flex-direction: column;
    }

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

@media (max-width: 520px) {
    .placement-options {
        grid-template-columns: 1fr;
    }
}

.placement-form[hidden],
.placement-question[hidden],
.result-card[hidden] {
    display: none !important;
}

.placement-notice {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-weight: 800;
}

.placement-progress-panel {
    position: sticky;
    top: 10px;
    z-index: 5;
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
}

.placement-progress-copy,
.placement-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.placement-progress-copy strong {
    color: var(--primary-dark);
    font-size: 1.05rem;
}

.placement-progress-copy span,
.placement-progress-meta {
    color: #64748b;
    font-size: 0.92rem;
    font-weight: 800;
}

.placement-progress-track,
.result-section-track {
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: #e2e8f0;
}

.placement-progress-track > span,
.result-section-track > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 220ms ease;
}

.placement-reset {
    padding: 0;
    border: 0;
    background: transparent;
    color: #b45309;
    font: inherit;
    cursor: pointer;
}

.placement-question-stage {
    min-height: 390px;
}

.placement-form.is-enhanced .placement-question {
    animation: placement-question-in 180ms ease-out;
}

.placement-question.has-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.placement-question-error {
    margin: 12px 0 0 !important;
    color: #b91c1c !important;
}

.placement-step-actions {
    justify-content: space-between;
    margin-top: 0;
}

.placement-step-actions .btn {
    min-width: 150px;
    min-height: 48px;
}

.placement-shortcut-hint,
.placement-secondary-action {
    color: #64748b;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.placement-secondary-action {
    margin-top: 18px;
}

.placement-result-card {
    padding: clamp(20px, 4vw, 34px);
}

.placement-result-heading {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 24px;
    margin: 18px 0;
}

.placement-score-ring {
    position: relative;
    display: grid;
    place-items: center;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--score) * 3.6deg), #e2e8f0 0);
    text-align: center;
}

.placement-score-ring::before {
    position: absolute;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: #fff;
    content: "";
}

.placement-score-ring strong,
.placement-score-ring span {
    position: relative;
    z-index: 1;
}

.placement-score-ring strong {
    color: var(--primary-dark);
    font-size: 1.7rem;
}

.placement-score-ring span {
    margin-top: -28px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
}

.result-track {
    color: var(--accent) !important;
    font-size: 1.05rem;
}

.placement-reason {
    padding: 14px 16px;
    border-inline-start: 4px solid var(--primary);
    border-radius: 6px;
    background: #eff6ff;
}

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

.placement-insight {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.placement-insight h3,
.placement-insight p {
    margin-bottom: 4px;
}

.placement-insight.is-strength {
    border-color: rgba(16, 185, 129, 0.35);
    background: #ecfdf5;
}

.placement-insight.is-focus {
    border-color: rgba(245, 158, 11, 0.4);
    background: #fffbeb;
}

.placement-report-title {
    margin: 24px 0 12px;
    color: var(--primary-dark);
}

.result-sections {
    display: grid;
    gap: 10px;
}

.result-section-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    align-items: center;
    gap: 7px 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.result-section-row > div:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-section-row > div:first-child span {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 800;
}

.result-section-score {
    color: var(--primary-dark);
    font-weight: 900;
}

.result-section-track {
    grid-column: 1 / -1;
    height: 7px;
}

.result-section-needs_review .result-section-track > span {
    background: #f59e0b;
}

.placement-result-actions {
    margin-top: 22px;
}

@keyframes placement-question-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 680px) {
    .placement-progress-copy,
    .placement-progress-meta,
    .placement-result-heading {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .placement-progress-copy,
    .placement-progress-meta {
        flex-direction: column;
    }

    .placement-progress-panel {
        position: static;
    }

    .placement-question-stage {
        min-height: 0;
    }

    .placement-question {
        padding: 16px;
    }

    .question-prompt {
        display: flex;
        width: 100%;
        overflow-wrap: anywhere;
    }

    .placement-step-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .placement-score-ring {
        margin-inline: auto;
    }

    .placement-insights {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .placement-form.is-enhanced .placement-question,
    .placement-progress-track > span,
    .result-section-track > span {
        animation: none;
        transition: none;
    }
}
