:root {
    --bg-dark: #071521;
    --bg-panel: rgba(9, 31, 52, 0.88);
    --bg-panel-strong: rgba(7, 23, 39, 0.96);
    --cyan: #23c6ff;
    --cyan-soft: rgba(35, 198, 255, 0.18);
    --cyan-strong: #60deff;
    --green: #38e185;
    --green-soft: rgba(56, 225, 133, 0.18);
    --orange: #ffae42;
    --text-main: #eff8ff;
    --text-muted: #9cc0d9;
    --border: rgba(96, 222, 255, 0.22);
    --shadow: 0 25px 65px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top, rgba(39, 146, 255, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(34, 237, 255, 0.18), transparent 30%),
        linear-gradient(160deg, #030d15, #06192b 38%, #081b30 70%, #06111d);
    color: var(--text-main);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    pointer-events: none;
}

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

.page-shell {
    position: relative;
    width: min(1380px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.page-shell__glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(35, 198, 255, 0.16), transparent 42%),
        radial-gradient(circle at 10% 10%, rgba(0, 148, 255, 0.18), transparent 18%);
    filter: blur(20px);
    pointer-events: none;
}

.hero,
.tournament-hero,
.content-panel,
.side-panel,
.bracket-panel,
.results-panel {
    position: relative;
    z-index: 1;
}

.hero,
.tournament-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
    padding: 28px 32px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(6, 31, 50, 0.96), rgba(9, 24, 38, 0.92));
    box-shadow: var(--shadow);
}

.hero h1,
.tournament-hero h1,
.section-head h2,
.empty-state h3,
.modal__header h3 {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
    font-weight: 400;
}

.hero h1,
.tournament-hero h1 {
    font-size: clamp(3rem, 6vw, 5.6rem);
    line-height: 0.95;
    text-shadow: 0 0 22px rgba(35, 198, 255, 0.32);
}

.hero p,
.tournament-hero p,
.modal__header p,
.empty-state p,
.result-card span,
.tournament-card__meta,
.team-list__placeholder,
.match-score,
.section-head__count {
    color: var(--text-muted);
}

.hero__copy,
.hero__actions,
.hero__actions--stacked {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero__eyebrow,
.section-head__eyebrow,
.modal__eyebrow {
    display: inline-flex;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--cyan-strong);
    background: rgba(35, 198, 255, 0.12);
    border: 1px solid rgba(96, 222, 255, 0.2);
}

.action-button,
.icon-button,
.status-pill,
.champion-chip {
    border: 1px solid rgba(96, 222, 255, 0.28);
    border-radius: 16px;
    color: var(--text-main);
}

.action-button {
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(20, 53, 84, 0.95), rgba(9, 37, 60, 0.95));
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.action-button:hover,
.icon-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 22px rgba(35, 198, 255, 0.18);
    border-color: rgba(96, 222, 255, 0.55);
}

.action-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.action-button--primary {
    background: linear-gradient(135deg, #12b8ff, #0b5fff);
}

.content-panel,
.side-panel,
.bracket-panel,
.results-panel {
    margin-top: 24px;
    padding: 28px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    box-shadow: var(--shadow);
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 22px;
}

.section-head--compact {
    margin-bottom: 16px;
}

.section-head__count,
.status-pill,
.champion-chip,
.tournament-card__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
}

.status-pill--ready,
.champion-chip,
.tournament-card__status--live {
    color: #d6ffe9;
    border-color: rgba(56, 225, 133, 0.35);
    background: var(--green-soft);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.tournament-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 220px;
    padding: 24px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(6, 27, 45, 0.98), rgba(7, 18, 30, 0.9));
    border: 1px solid rgba(96, 222, 255, 0.18);
    transition: transform 180ms ease, border-color 180ms ease;
}

.tournament-card:hover {
    transform: translateY(-4px);
    border-color: rgba(96, 222, 255, 0.48);
}

.tournament-card h3 {
    margin: 0;
    font-size: 1.65rem;
}

.tournament-card__meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.95rem;
}

.tournament-card__cta {
    margin-top: auto;
    color: var(--cyan-strong);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.empty-state {
    padding: 36px;
    border-radius: 24px;
    text-align: center;
    border: 1px dashed rgba(96, 222, 255, 0.24);
    background: rgba(255, 255, 255, 0.02);
}

.empty-state--compact {
    padding: 28px;
}

.flash-stack {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.flash {
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid;
}

.flash--success {
    background: rgba(56, 225, 133, 0.14);
    border-color: rgba(56, 225, 133, 0.32);
    color: #d9ffe8;
}

.flash--error {
    background: rgba(255, 92, 92, 0.12);
    border-color: rgba(255, 92, 92, 0.26);
    color: #ffd7d7;
}

.tournament-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
}

.side-panel {
    align-self: start;
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-list__item {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(96, 222, 255, 0.14);
}

.bracket-shell-board {
    overflow-x: auto;
    padding: 8px 6px 16px;
}

.bracket-board {
    display: grid;
    grid-template-columns: minmax(540px, 1fr) 360px minmax(540px, 1fr);
    gap: 28px;
    min-width: 1560px;
    padding: 14px;
    border-radius: 28px;
    background:
        radial-gradient(circle at center, rgba(35, 198, 255, 0.14), transparent 46%),
        linear-gradient(180deg, rgba(5, 24, 39, 0.95), rgba(8, 18, 28, 0.95));
    border: 1px solid rgba(96, 222, 255, 0.18);
    align-items: start;
}

.bracket-side {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.bracket-side--right {
    flex-direction: row;
}

.round-column,
.final-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-width: 250px;
}

.round-column__title {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.82rem;
    color: var(--cyan-strong);
}

.round-grid {
    display: grid;
    grid-template-rows: repeat(var(--grid-rows), minmax(110px, 1fr));
    gap: 0;
    min-height: calc(var(--grid-rows) * 110px);
}

.match-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    min-height: 94px;
    width: 100%;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid rgba(96, 222, 255, 0.18);
    background: linear-gradient(145deg, rgba(13, 46, 72, 0.98), rgba(8, 31, 49, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.match-card::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -18px;
    width: 18px;
    height: 2px;
    background: rgba(96, 222, 255, 0.4);
}

.bracket-side--right .match-card::after {
    left: -18px;
    right: auto;
}

.final-column .match-card::after,
.round-column:last-child .match-card::after {
    display: none;
}

.match-card--final {
    justify-content: center;
    min-height: 180px;
    margin-top: 122px;
    background: linear-gradient(145deg, rgba(23, 55, 91, 0.98), rgba(12, 35, 61, 0.98));
}

.match-card__teams {
    display: grid;
    gap: 10px;
}

.team-slot {
    position: relative;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(96, 222, 255, 0.16);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
}

.team-slot::after {
    content: "";
    position: absolute;
    inset: auto 12px 0 12px;
    height: 2px;
    background: rgba(96, 222, 255, 0.16);
}

.team-slot--winner {
    border-color: rgba(56, 225, 133, 0.42);
    background: rgba(56, 225, 133, 0.14);
    box-shadow: inset 5px 0 0 rgba(56, 225, 133, 0.95);
}

.team-slot--winner::after {
    background: rgba(56, 225, 133, 0.95);
}

.team-slot--bye {
    opacity: 0.6;
    font-style: italic;
}

.match-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.match-score {
    font-size: 0.85rem;
}

.match-score--pending {
    color: var(--cyan-strong);
}

.icon-button {
    width: 38px;
    height: 38px;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.icon-button--edit {
    background: rgba(255, 174, 66, 0.12);
    border-color: rgba(255, 174, 66, 0.32);
}

.icon-button span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 1.35rem;
    line-height: 1;
}

.winner-banner {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(255, 174, 66, 0.4);
    background: rgba(255, 174, 66, 0.14);
    text-align: center;
}

.winner-banner span {
    color: #ffd49b;
    font-size: 0.82rem;
    letter-spacing: 0.2em;
}

.winner-banner strong {
    font-size: 1.4rem;
}

.results-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.result-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(96, 222, 255, 0.14);
}

.result-card__round {
    color: var(--cyan-strong);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
}

.result-card__meta {
    font-size: 0.84rem;
}

.back-link {
    display: inline-flex;
    margin-bottom: 12px;
    color: var(--cyan-strong);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 8, 14, 0.72);
    backdrop-filter: blur(8px);
}

.modal__panel {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    padding: 28px;
    border-radius: 26px;
    border: 1px solid rgba(96, 222, 255, 0.2);
    background: var(--bg-panel-strong);
    box-shadow: var(--shadow);
}

.modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    font-size: 1.4rem;
    cursor: pointer;
}

.modal__header {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.modal__form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-size: 0.92rem;
    color: var(--text-muted);
}

.field input,
.field select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(96, 222, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: rgba(96, 222, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(35, 198, 255, 0.12);
}

@media (max-width: 1040px) {
    .tournament-layout {
        grid-template-columns: 1fr;
    }

    .hero,
    .tournament-hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100% - 20px, 1380px);
        padding-top: 20px;
    }

    .hero,
    .tournament-hero,
    .content-panel,
    .side-panel,
    .bracket-panel,
    .results-panel {
        padding: 22px;
        border-radius: 24px;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero h1,
    .tournament-hero h1 {
        font-size: 3.2rem;
    }
}
