:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text: #111111;
    --muted: #666666;
    --line: #dddddd;
    --primary: #111111;
    --primary-text: #ffffff;
    --accent: #0f6b4f;
    --gold: #d4af37;
    --danger: #b42318;
    --shadow: 0 14px 35px rgba(17, 17, 17, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(180deg, rgba(15, 107, 79, 0.08), transparent 320px),
        var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

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

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0 10px;
}

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

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-text);
}

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

.site-footer {
    padding: 24px 0 30px;
    color: var(--muted);
    font-size: 14px;
}

.hero,
.champion-view {
    display: grid;
    min-height: min(620px, calc(100vh - 140px));
    align-content: center;
    gap: 18px;
    padding: 28px 0;
}

.hero h1,
.champion-view h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(42px, 10vw, 86px);
    line-height: 0.95;
    letter-spacing: 0;
}

.hero-copy,
.champion-view > p {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.5;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-actions,
.form-actions,
.header-actions,
.round-actions,
.draw-actions,
.match-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 18px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:active {
    transform: translateY(1px);
}

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

.button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--primary-text);
}

.button-secondary {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.button-ghost {
    background: transparent;
}

.button-large {
    min-height: 58px;
    padding: 16px 22px;
    font-size: 17px;
}

.page-heading,
.tournament-header,
.screen-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-heading {
    align-items: flex-start;
    flex-direction: column;
}

.page-heading h1,
.tournament-header h1 {
    margin: 0;
    font-size: clamp(34px, 7vw, 58px);
    line-height: 1;
    letter-spacing: 0;
}

.page-heading p,
.tournament-header p {
    margin: 6px 0 0;
    color: var(--muted);
}

.panel,
.tournament-card,
.match-card,
.champion-strip {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
}

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

.field {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 800;
}

.field span {
    font-size: 14px;
}

.field input,
.field select {
    display: block;
    width: 100%;
    height: 50px;
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #ffffff;
    color: var(--text);
    line-height: 1.2;
}

.field select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px;
    background-repeat: no-repeat;
    background-size: 6px 6px, 6px 6px;
    padding-right: 38px;
}

.field input:focus,
.field select:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(15, 107, 79, 0.14);
}

.field input.field-error {
    border-color: var(--danger);
    outline: 3px solid rgba(180, 35, 24, 0.14);
}

.players-grid {
    display: grid;
    gap: 12px;
}

.error-list {
    margin: 0 0 18px;
    padding-left: 20px;
    color: var(--danger);
    font-weight: 700;
}

.card-list,
.matches-grid,
.screen-matches {
    display: grid;
    gap: 14px;
}

.tournament-card {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.tournament-card h2,
.match-card h3,
.champion-strip h2 {
    margin: 0;
}

.tournament-card p,
.match-card p,
.champion-strip p {
    margin: 6px 0 0;
}

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

.empty-state {
    display: grid;
    gap: 14px;
    justify-items: start;
}

.tournament-root {
    display: grid;
    gap: 18px;
}

.tournament-header {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.loading-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    background: var(--surface);
    color: var(--muted);
}

.draw-panel {
    display: grid;
    gap: 18px;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chip-list span {
    border: 1px solid rgba(15, 107, 79, 0.2);
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(15, 107, 79, 0.08);
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
}

.match-card {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.match-completed {
    border-color: rgba(15, 107, 79, 0.35);
    background: linear-gradient(180deg, rgba(15, 107, 79, 0.07), #ffffff);
}

.match-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.match-topline strong {
    color: var(--accent);
}

.match-card h3 {
    font-size: 22px;
    line-height: 1.18;
}

.match-card h3 span {
    color: var(--muted);
    font-size: 16px;
}

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

.round-actions {
    justify-content: flex-end;
}

.champion-strip {
    display: grid;
    gap: 8px;
    padding: 22px;
    border-color: rgba(212, 175, 55, 0.5);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), #ffffff 60%);
}

.champion-strip p {
    color: var(--gold);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.champion-strip h2 {
    font-size: clamp(34px, 8vw, 68px);
    line-height: 1;
}

.roulette-area:empty {
    display: none;
}

.roulette-box {
    display: grid;
    gap: 14px;
    justify-items: center;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.roulette-wheel {
    display: grid;
    width: min(72vw, 260px);
    aspect-ratio: 1;
    place-items: center;
    border: 10px solid var(--primary);
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #ffffff 0 34%, transparent 35%),
        conic-gradient(from 0deg, var(--gold), var(--accent), #111111, var(--gold));
    color: #ffffff;
    text-align: center;
    box-shadow: var(--shadow);
}

.roulette-wheel span {
    display: grid;
    width: 62%;
    min-height: 62%;
    place-items: center;
    border-radius: 50%;
    padding: 14px;
    background: #ffffff;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.roulette-wheel.is-spinning {
    animation: roulette-spin 0.42s linear infinite;
}

@keyframes roulette-spin {
    to {
        transform: rotate(360deg);
    }
}

.roulette-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
}

.roulette-preview {
    width: 100%;
    color: var(--muted);
}

.toast-message {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 20;
    max-width: min(420px, calc(100% - 32px));
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--primary);
    color: var(--primary-text);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-message.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-error {
    background: var(--danger);
}

.screen-body {
    background: #101312;
    color: #ffffff;
}

.screen-body .site-header,
.screen-body .site-footer {
    display: none;
}

.screen-body .site-main {
    width: min(1440px, calc(100% - 40px));
    padding: 28px 0;
}

.screen-header {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    padding-bottom: 18px;
}

.screen-header h1 {
    margin: 0;
    font-size: clamp(42px, 7vw, 96px);
    line-height: 0.95;
}

.screen-header p,
.screen-header strong {
    color: var(--gold);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.screen-matches {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.screen-body .match-card,
.screen-body .panel {
    border-color: rgba(255, 255, 255, 0.16);
    background: #181d1b;
    color: #ffffff;
}

.screen-body .match-completed {
    border-color: rgba(212, 175, 55, 0.6);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.16), #181d1b);
}

.screen-body .muted,
.screen-body .match-topline,
.screen-body .match-card h3 span {
    color: rgba(255, 255, 255, 0.7);
}

.screen-champion {
    display: grid;
    justify-items: center;
    margin: 24px 0;
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    padding: 28px;
    background: rgba(212, 175, 55, 0.12);
}

.screen-champion span {
    color: var(--gold);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.screen-champion h2 {
    margin: 8px 0 0;
    font-size: clamp(44px, 10vw, 120px);
    line-height: 0.95;
}

@media (min-width: 720px) {
    .players-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .tournament-card {
        grid-template-columns: 1fr auto;
        align-items: center;
    }
}

@media (max-width: 640px) {
    .page-heading,
    .tournament-header,
    .screen-header {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-actions,
    .form-actions,
    .header-actions,
    .round-actions,
    .draw-actions,
    .match-actions {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .site-main {
        padding-top: 14px;
    }
}
