:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #162033;
    background: #f5f7fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.app-shell {
    min-height: 100vh;
    background: linear-gradient(135deg, #f7fbff 0%, #eef4ff 52%, #fff8ed 100%);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.84);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(14px);
}

.brand,
.nav-link,
.button {
    text-decoration: none;
}

.brand {
    color: #07142d;
    font-weight: 800;
    letter-spacing: -0.02em;
}

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

.nav-link {
    padding: 9px 12px;
    border-radius: 999px;
    color: #526173;
    font-size: 14px;
    font-weight: 700;
}

.nav-link:hover,
.nav-link.active {
    background: #e7f8f5;
    color: #0f766e;
}

.page {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.hero,
.page-header {
    padding: 32px 0 20px;
}

.participant-hero {
    max-width: 860px;
}

.hero h1,
.page-header h1 {
    margin: 14px 0;
    color: #07142d;
    font-size: clamp(34px, 5.8vw, 56px);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.page-header h1 {
    max-width: 760px;
}

.lead,
.page-header p {
    max-width: 720px;
    margin: 0;
    color: #526173;
    font-size: 19px;
    line-height: 1.6;
}

.badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: #dff3ff;
    color: #075985;
    font-weight: 800;
}

.actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

.button-primary {
    background: #0f766e;
    color: #ffffff;
}

.button-primary:hover {
    background: #115e59;
}

.button-secondary {
    background: #ffffff;
    color: #0f766e;
}

.button-secondary:hover {
    background: #ecfeff;
}

.button-small {
    min-height: 36px;
    padding: 8px 12px;
    background: #edf7f5;
    color: #0f766e;
    box-shadow: none;
}

.grid,
.stats-grid,
.form-grid,
.bracket-grid,
.ranking-inputs,
.final-picks,
.checkbox-grid {
    display: grid;
    gap: 16px;
}

.grid,
.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.form-grid,
.ranking-inputs,
.final-picks,
.checkbox-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.bracket-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.panel,
.card,
.notice,
.stat-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.07);
}

.panel,
.notice {
    margin-top: 16px;
    padding: 22px;
    border-radius: 20px;
}

.panel.narrow {
    max-width: 520px;
}

.group-card {
    scroll-margin-top: 92px;
}

.card,
.stat-card {
    padding: 18px;
    border-radius: 18px;
}

.card h3,
.panel h2,
.notice h3 {
    margin-top: 0;
    color: #07142d;
}

.card p,
.panel p,
.notice p {
    color: #526173;
    line-height: 1.55;
}

.rules-panel {
    margin-top: 4px;
}

.rule-list {
    display: grid;
    gap: 12px;
}

.rule-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: start;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: #ffffff;
}

.rule-number {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #f59e0b;
    color: #ffffff;
    font-weight: 900;
}

.rule-item p {
    margin: 5px 0 0;
}

.team-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.team-chip {
    display: inline-flex;
    padding: 7px 11px;
    border-radius: 999px;
    background: #eef7ff;
    color: #075985;
    font-size: 13px;
    font-weight: 800;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #d8e1ed;
    border-radius: 14px;
    background: #ffffff;
    color: #22304a;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.checkbox-field:hover {
    background: #f0f9ff;
    border-color: #0f766e;
}

.checkbox-field-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.checkbox-field-disabled:hover {
    background: #ffffff;
    border-color: #d8e1ed;
}

.third-place-counter {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 16px;
}

.counter-value {
    font-size: 28px;
    font-weight: 900;
    color: #0f766e;
}

.counter-label {
    font-size: 15px;
    font-weight: 700;
    color: #526173;
}

.list {
    margin: 12px 0 0;
    padding-left: 20px;
    color: #526173;
    line-height: 1.7;
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: #22304a;
    font-weight: 800;
}

.input,
.score-input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #d8e1ed;
    border-radius: 12px;
    padding: 10px 12px;
    color: #172033;
    font: inherit;
    background: #ffffff;
}

.score-input {
    max-width: 84px;
}

.compact-select {
    min-width: 150px;
}

.final-picks {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e7edf5;
}

.phase-title {
    margin: 28px 0 12px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 16px;
}

.table th,
.table td {
    padding: 13px 12px;
    border-bottom: 1px solid #e7edf5;
    text-align: left;
}

.table th {
    color: #526173;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table tr:last-child td {
    border-bottom: 0;
}

.helper-text {
    color: #6b778c;
    font-size: 14px;
}

.error-text {
    margin: 10px 0 0;
    color: #b91c1c;
    font-size: 14px;
    font-weight: 800;
}

.group-order-error {
    display: inline-flex;
    padding: 8px 10px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
}

.success-text {
    margin: 10px 0 0;
    color: #0f766e;
    font-size: 14px;
    font-weight: 800;
}

.pot-banner {
    display: inline-flex;
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #e7f8f5;
    color: #0f766e;
    font-weight: 900;
}

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 20px;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .page {
        width: min(100% - 28px, 1120px);
        padding-top: 20px;
    }

    .panel,
    .notice,
    .card {
        padding: 20px;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .match-result {
        grid-template-columns: 1fr auto;
    }

    .form-grid,
    .ranking-inputs,
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero h1,
    .page-header h1 {
        font-size: 28px;
    }

    .lead,
    .page-header p {
        font-size: 16px;
    }

    .topbar {
        padding: 10px 14px;
    }

    .nav-link {
        padding: 7px 10px;
        font-size: 13px;
    }

    .page {
        padding: 14px 0 28px;
    }
}

.notice {
    background: #fff7df;
}

.stat-card {
    display: grid;
    gap: 4px;
}

.stat-value {
    color: #0f766e;
    font-size: 34px;
    font-weight: 900;
}

.stat-label {
    color: #526173;
    font-weight: 800;
}

.points {
    color: #0f766e;
    font-weight: 900;
}

.match-result {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid #e7edf5;
}

.match-result:last-child {
    border-bottom: 0;
}

.score-pill,
.status-pill {
    display: inline-flex;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.score-pill {
    background: #e7f8f5;
    color: #0f766e;
}

.status-pill {
    background: #eef2f7;
    color: #526173;
}

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 20px;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .page {
        width: min(100% - 28px, 1120px);
        padding-top: 20px;
    }

    .panel,
    .notice,
    .card {
        padding: 20px;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .match-result {
        grid-template-columns: 1fr auto;
    }
}
