@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    --bg: radial-gradient(circle at 20% 20%, rgba(45, 190, 255, 0.25), rgba(6, 10, 22, 1) 55%);
    --panel: rgba(10, 14, 26, 0.85);
    --panel-border: rgba(61, 152, 255, 0.25);
    --accent: #3d98ff;
    --accent-strong: #5efdde;
    --accent-glow: 0 0 20px rgba(61, 152, 255, 0.55);
    --text: #f2f6ff;
    --muted: #9eb7d9;
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 32px;
    font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.shell {
    width: 100%;
    max-width: 1900px;
    padding: 32px;
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(4, 6, 12, 0.6);
    backdrop-filter: blur(18px);
    box-shadow: 0 35px 90px rgba(0, 0, 0, 0.5);
}

.masthead {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.masthead__brand {
    flex: 1 1 320px;
}

.masthead__brand h1 {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 3vw, 3rem);
}

.masthead__brand p {
    margin: 0;
    color: var(--muted);
}

.masthead__meta {
    flex: 1 1 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.selection-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--muted);
}

.selection-grid select {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 8px 12px;
    font-weight: 600;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.stat__value {
    font-size: 1.3rem;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 28px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn--primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #02060d;
    box-shadow: var(--accent-glow);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn:not(:disabled):hover {
    transform: translateY(-2px);
}

.lang-switch {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    font-weight: 600;
}

.lang-btn.is-active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

.layout {
    margin-top: 32px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 25px 70px rgba(5, 8, 18, 0.55);
}

.match-hud {
    margin-bottom: 18px;
}

.score-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.score-card {
    flex: 1 1 auto;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
}

.score-card .team-tag {
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.score-card .score {
    font-size: clamp(2rem, 5vw, 3rem);
}

.score-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.score-center__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.score-center__actions .btn {
    width: 100%;
}

.score-center .clock {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
}

.score-card.is-home {
    border-color: rgba(71, 181, 255, 0.5);
}

.score-card.is-away {
    border-color: rgba(255, 116, 133, 0.5);
}


.stage {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(61, 152, 255, 0.4);
    background: radial-gradient(circle at 50% 50%, rgba(20, 40, 70, 0.8), rgba(5, 8, 18, 0.9));
}

.stage--wide canvas {
    width: 100%;
}

.goal-banner {
    position: relative;
    margin: 12px auto 0;
    max-width: 420px;
    padding: 14px 24px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.08);
    text-align: center;
    font-size: clamp(1.4rem, 3vw, 2.6rem);
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #fffbe8;
    text-transform: uppercase;
    box-shadow: 0 0 25px rgba(255, 196, 0, 0.45);
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.goal-banner--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.goal-banner--hidden {
    pointer-events: none;
}

canvas {
    width: 100%;
    height: auto;
    display: block;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.control-grid ul {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}


.status-bar {
    margin-top: 26px;
    text-align: center;
    border-radius: 999px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.08);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 16, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay__panel {
    background: var(--panel);
    border-radius: 20px;
    padding: 32px;
    width: min(420px, 92%);
    text-align: center;
    border: 1px solid var(--panel-border);
}

.overlay__stats {
    list-style: none;
    margin: 24px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.overlay__stats li {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.overlay__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.tactics-modal {
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 14, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    transition: opacity 0.2s ease;
}

.tactics-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.tactics-modal__panel {
    width: min(460px, 90%);
    background: var(--panel);
    border-radius: 22px;
    border: 1px solid var(--panel-border);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.tactics-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tactics-modal__close {
    background: transparent;
    border: 0;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.tactics-modal__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tactics-modal__body label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--muted);
}

.tactics-modal__body select {
    border-radius: 12px;
    border: 1px solid rgba(61, 152, 255, 0.4);
    background: rgba(6, 24, 54, 0.95);
    color: #ffffff;
    padding: 10px 12px;
    font-weight: 600;
}

.tactics-modal__body select option {
    color: #0a0f1c;
    background: #f1f5f9;
}

.tactics-preview {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
}

#previewCanvas {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 1024px) {
    body {
        padding: 16px;
    }

    .shell {
        padding: 20px;
    }

    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .lang-switch {
        width: 100%;
        justify-content: space-between;
    }
}
