:root {
    color-scheme: light;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg-surface: #f7f8ff;
    --bg-panel: #ffffff;
    --bg-muted: rgba(255, 255, 255, 0.65);
    --border: rgba(30, 41, 59, 0.12);
    --shadow: 0 20px 45px -24px rgba(15, 23, 42, 0.4);
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #0f172a;
    --text-muted: #475569;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.16), transparent 45%),
                radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.18), transparent 40%),
                var(--bg-surface);
    color: var(--text-main);
}

.app-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem clamp(1rem, 4vw, 3rem) 3rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.hero {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.85), rgba(14, 165, 233, 0.82));
    color: white;
    border-radius: 24px;
    padding: clamp(1.75rem, 4vw, 2.75rem);
    box-shadow: 0 30px 60px -38px rgba(15, 23, 42, 0.7);
}

.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.6rem);
    letter-spacing: -0.04em;
}

.hero__tagline {
    margin-top: 0.75rem;
    max-width: 36ch;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
}

.hero__cta {
    display: flex;
    gap: 0.75rem;
}

.btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.btn--primary {
    background: white;
    color: var(--primary-dark);
    box-shadow: 0 10px 25px -18px rgba(15, 23, 42, 0.7);
}

.btn--primary:hover {
    transform: translateY(-1px);
}

.btn--ghost {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.28);
}

.btn--subtle {
    background: transparent;
    color: var(--primary-dark);
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.btn--subtle:hover {
    border-color: var(--primary-dark);
    background: rgba(99, 102, 241, 0.08);
}

.layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 2rem;
}

.panel {
    background: var(--bg-panel);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 500;
}

.field span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

textarea,
input,
select {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0.85rem 1rem;
    font: inherit;
    background: rgba(248, 249, 255, 0.84);
    transition: border 150ms ease, box-shadow 150ms ease;
}

textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.field small {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.field-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.examples {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.examples h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.chip {
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.1rem;
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-dark);
    transition: transform 120ms ease, background 120ms ease;
}

.chip:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

#status {
    min-height: 1.5rem;
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: none;
}

#status.show {
    display: block;
}

.summary__grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.summary-card {
    background: var(--primary-light);
    border-radius: 18px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.summary-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

.summary-card .metric {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.summary-card .submetric {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.comparison {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comparison__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.comparison__meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 255, 0.92);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

th,
td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 0.95rem;
}

th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

tbody tr:last-child td {
    border-bottom: none;
}

.result-deck {
    display: grid;
    gap: 1.5rem;
}

.result-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    padding: 1.75rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 20px 40px -36px rgba(15, 23, 42, 0.6);
}

.result-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.result-card__header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.result-card__subtitle {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.badge {
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-weight: 600;
    font-size: 0.85rem;
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-muted);
}

.badge--excellent {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge--good {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.badge--average {
    background: rgba(245, 158, 11, 0.16);
    color: var(--warning);
}

.badge--poor {
    background: rgba(239, 68, 68, 0.16);
    color: var(--danger);
}

.result-card__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat span:first-child {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.stat span:last-child {
    font-size: 1.2rem;
    font-weight: 700;
}

.steps-table tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.08);
}

.steps-table td:nth-child(3) {
    font-weight: 700;
}

.steps-table .fault {
    color: var(--danger);
}

.steps-table .hit {
    color: var(--success);
}

.result-card__details summary {
    cursor: pointer;
    font-weight: 600;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .panel {
        border-radius: 20px;
    }

    .hero {
        border-radius: 20px;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 2rem 1.25rem 2.5rem;
    }

    .hero__cta {
        width: 100%;
        justify-content: stretch;
    }

    .hero__cta .btn {
        flex: 1;
        justify-content: center;
    }

    table {
        min-width: unset;
    }
}
