:root {
    --primary: #00f2ff;
    --secondary: #ff0055;
    --gold: #ffd700;
    --dark-bg: #0a0e17;
    --glass: rgba(10, 14, 23, 0.85);
    /* Slightly more opaque for readability */
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Exo 2', sans-serif;
    color: white;
    overflow: hidden;
    height: 100vh;
    background: black;
    font-size: 16px;
}

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('bg.png') no-repeat center center/cover;
    z-index: -1;
}

.overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(10, 14, 23, 0.4) 0%, rgba(10, 14, 23, 0.95) 100%);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    visibility: hidden;
    flex-direction: column;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    visibility: visible;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Setup Screen */
.main-title {
    font-family: 'Teko', sans-serif;
    font-size: 3rem;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
    line-height: 1;
}

.highlight {
    color: var(--gold);
}

.subtitle {
    color: #aaa;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.teams-input-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    /* Important for mobile */
}

.team-group {
    flex: 1;
    min-width: 250px;
}

.team-group h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-family: 'Teko', sans-serif;
    font-size: 1.8rem;
}

.team-away h2 {
    color: var(--secondary);
}

.input-wrapper {
    margin-bottom: 1rem;
    text-align: left;
}

.input-wrapper label {
    display: block;
    font-size: 0.8rem;
    color: #ccc;
    margin-bottom: 0.3rem;
}

.input-wrapper input[type="text"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px;
    color: white;
    font-family: inherit;
    border-radius: 5px;
    font-size: 1rem;
}

.input-wrapper input[type="range"] {
    width: 100%;
    height: 25px;
    /* Larger touch target */
}

.vs-badge {
    font-family: 'Teko';
    font-size: 2rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold);
    width: 100%;
    /* Break to new line on mobile if needed */
    order: 0;
}

.cyber-button {
    background: linear-gradient(45deg, var(--primary), #0077ff);
    color: black;
    font-family: 'Teko', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    padding: 15px 40px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    width: 100%;
    max-width: 300px;
}

.cyber-button:active {
    transform: scale(0.95);
}

.cyber-button.xs {
    font-size: 1.2rem;
    padding: 10px 20px;
    width: auto;
}

.cyber-button.secondary {
    background: linear-gradient(45deg, #ffffff, #aaaaaa);
}

/* Match Screen */
.broadcast-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

.scoreboard-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.scoreboard {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
    padding-bottom: 10px;
    width: 100%;
}

.team-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Teko';
    font-size: 1.5rem;
    /* Smaller for mobile */
    position: relative;
    flex: 1;
    justify-content: center;
}

.team-display.home {
    justify-content: flex-end;
}

.team-display.away {
    justify-content: flex-start;
}

.team-name {
    text-transform: uppercase;
    text-shadow: 0 2px 4px black;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    /* Truncate long names */
}

.score {
    background: white;
    color: black;
    padding: 0 10px;
    border-radius: 5px;
    min-width: 30px;
    text-align: center;
    font-size: 1.8rem;
}

.cards {
    display: flex;
    gap: 2px;
}

.card-icon {
    width: 10px;
    height: 14px;
    border-radius: 2px;
    display: inline-block;
}

.card-yellow {
    background: yellow;
}

.card-red {
    background: red;
}

.match-info {
    text-align: center;
    min-width: 60px;
}

.time-box {
    background: var(--secondary);
    padding: 2px 10px;
    font-weight: bold;
    font-family: 'Teko';
    font-size: 1.2rem;
    border-radius: 4px;
}

.extra-indicator {
    font-size: 0.7em;
    color: var(--gold);
}

.match-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}

.live-status {
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--gold);
    color: var(--gold);
    z-index: 10;
    text-align: center;
}

.visualizer {
    width: 120px;
    height: 120px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--primary);
    opacity: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.commentary-box {
    width: 95%;
    /* Wider on mobile */
    height: 120px;
    overflow-y: hidden;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    text-align: center;
    position: relative;
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

#commentary-list {
    list-style: none;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    padding: 0 10px;
}

#commentary-list li {
    font-size: 0.95rem;
    /* Readable size */
    text-shadow: 0 1px 3px black;
    animation: fadeInUp 0.3s ease;
    line-height: 1.4;
}

.commentary-event {
    color: var(--gold);
    font-weight: bold;
    font-size: 1.1rem !important;
}

.commentary-card {
    color: red;
    font-weight: bold;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-bar {
    width: 100%;
    padding: 10px 5%;
}

.stat-item {
    text-align: center;
    font-size: 0.8rem;
    color: #ccc;
}

.stat-graph {
    height: 6px;
    background: var(--secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
    position: relative;
}

.bar-home {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease;
}

/* Result Screen */
.result-panel h2 {
    font-family: 'Teko';
    font-size: 3rem;
    margin-bottom: 20px;
    color: white;
}

.final-score {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.final-team {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-team h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.big-score {
    font-family: 'Teko';
    font-size: 5rem;
    line-height: 1;
    color: var(--gold);
    text-shadow: 0 0 20px var(--gold);
}

.pen-result {
    font-size: 1rem;
    color: #ccc;
    margin-top: 5px;
}

.divider {
    font-size: 3rem;
    opacity: 0.5;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    max-width: 90%;
    padding: 1.5rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* Penalties */
.penalty-container {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--gold);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 10px;
    width: 90%;
}

.penalty-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.p-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Teko';
    font-size: 1.2rem;
}

.p-dots {
    display: flex;
    gap: 3px;
    margin-top: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #555;
}

.dot.goal {
    background: #0f0;
    box-shadow: 0 0 5px #0f0;
}

.dot.miss {
    background: #f00;
    box-shadow: 0 0 5px #f00;
}

/* Desktop overrides */
@media (min-width: 768px) {
    .teams-input-container {
        flex-direction: row;
        gap: 2rem;
    }

    .vs-badge {
        width: auto;
        order: unset;
    }

    .main-title {
        font-size: 4rem;
    }

    .scoreboard {
        font-size: 2.5rem;
        gap: 2rem;
    }

    .score {
        font-size: 2.5rem;
        min-width: 50px;
    }

    .team-display {
        font-size: 2.5rem;
    }

    .team-name {
        max-width: none;
    }

    .visualizer {
        width: 200px;
        height: 200px;
    }

    .big-score {
        font-size: 8rem;
    }

    .commentary-box {
        width: 60%;
        font-size: 1.2rem;
    }
}