﻿:root {
    --bg: #20242b;
    --bg-panel: #2b3038;
    --accent: #3a7bd5;
    --accent-light: #6daeff;
    --border: #444b55;
    --text: #fafafa;
    --muted: #b0b6bf;
    --highlight: #00ffb3;
}


/* ===== GLOBAL ===== */

body {
    font-family: "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.5;
}

img {
    display: block;
}

header {
    background: var(--bg-panel);
    padding: 1rem 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5em;
    margin: 0;
}

#logo {
    height: 50px;
    width: auto;
    background-color: #fff;
    border-radius: 8px;
}


@media (max-width: 768px) {
    .hide-on-small {
        display: none;
    }
}

.no-live-games {
    text-align: center;
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #aaa;
    opacity: 0.85;
}

.no-live-games.hidden {
    display: none;
}


/* ===== FILTER CONTROLS ===== */

#controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.icon-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.3s;
}

.icon-btn:hover {
    background: var(--accent-light);
}

.icon-btn.open {
    transform: rotate(180deg);
}

#filterPanel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.4s ease;
}

#filterPanel.open {
    max-height: 300px;
    opacity: 1;
}

#boardFilter {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-top: 0.5rem;
}

#boardButtons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.board-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: background 0.2s ease, border 0.2s ease;
}

.board-btn:hover {
    background: var(--bg-panel);
}

.board-btn.active {
    background: var(--accent);
    border-color: var(--accent-light);
    color: #fff;
}

#filterActions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
}

#filterActions button {
    flex: 1 1 calc(50% - 0.25rem);
    max-width: calc(50% - 0.25rem);
    box-sizing: border-box;
}

#filterActions button#forceLarge {
    flex: 1 1 100%;
    max-width: 100%;
}

#forceLarge{
    display: none;
}

#forceLarge.active {
    background-color: var(--accent-light);
    color: #000;
}

@media (max-width: 768px) {
    #forceLarge {
        display: block;
        width: 100%;
    }

    #controls {
        display: flex;
        justify-content: flex-end;
        align-items: flex-start;
        gap: 0.5rem;
        position: relative;
        width: 100%;
    }

    #toggleControls {
        margin-top: -2.3rem;
    }
}


button.accent {
    background: var(--accent);
    color: #fff;
}

button.muted {
    background: var(--border);
    color: var(--muted);
}

button.accent:hover,
button.muted:hover {
    opacity: 0.85;
}



/* ===== BOARD GRID ===== */

main {
    display: flex;
    justify-content: center;
}

.boards-grid {
    display: grid;
    gap: 1.5rem;
    padding: 1.5rem;
    width: 100%;

    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
}

@media (max-width: 1296px) {
    .boards-grid {
        grid-template-columns: 1fr;
    }
}

.board {
    background: var(--bg-panel);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.6);
}

/* ===== BOARD VIEW ===== */

.board-header {
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1.4rem;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    margin-bottom: 1rem;
}

/* ===== LARGE BOARD ===== */

.scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: #141619;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.player {
    text-align: center;
    padding: 1rem;
    min-width: 0;
}

.player-name {
    font-size: 1.8rem;
    font-weight: 600;
    background: var(--accent);
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score {
    font-size: 6rem;
    font-weight: 800;
    color: var(--accent-light);
    text-shadow: 0 0 15px rgba(13,132,255,0.4);
}

.legs {
    font-size: 1.1rem;
    color: var(--muted);
    padding: 1rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.6rem;
}

.legs-score {
    font-size: 2.5rem;
}

.legs-label {
    font-size: 1.0rem;
    text-transform: uppercase;
}


/* ===== STATS TABLES ===== */

.player-stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.stats-table thead th {
    height: 34px;
    line-height: 34px;
    padding: 0.5rem 0.7rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stats-table td {
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.7rem;
    text-align: center;
    font-size: 0.9rem;
}

.stats-table--info {
    background: #141619;
}

.stats-table--score {
    background: #1a1c1f;
}

.stats-table--score thead th {
    background: var(--accent);
    color: #fff;
}

.stats-table--score td {
    font-size: 1.1rem;
    height: 42px;
    vertical-align: middle;
}

.stats-table--score tbody tr:nth-child(even),
.stats-table--info tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}


.highlight {
    --pulse-to: var(--highlight);
    --pulse-from: var(--accent);
    animation: pulse 1.2s ease-in-out;
}

.highlight--zero {
    --pulse-to: #e76f51;
    --pulse-from: var(--accent);
    animation: pulse 1.2s ease-in-out;
}

@keyframes pulse {
    0% {
        color: var(--pulse-from);
        text-shadow: none;
        transform: scale(1);
    }
    50% {
        color: var(--pulse-to);
        text-shadow: 0 0 15px var(--pulse-to);
        transform: scale(1.1);
    }
    100% {
        color: var(--pulse-from);
        text-shadow: none;
        transform: scale(1);
    }
}

.player .highlight--leg-winner,
.player-mobile .highlight--leg-winner,
.board-small-players .highlight--leg-winner,
.board-players .highlight--leg-winner {
    animation: winnerGlow 1.2s ease-out;
}

.legs .highlight--leg-winner,
.legs-mobile .highlight--leg-winner,
.player-value.highlight--leg-winner,
.player-stats .highlight--leg-winner{
    --pulse-to: rgba(255,215,0,0.9);
    --pulse-from: var(--muted);
    animation: pulse 1.2s ease-in-out;
}

@keyframes winnerGlow {
    0% {
        box-shadow:
                inset 0 0 0 rgba(255,215,0,0),
                0 0 0 rgba(0,0,0,0);
        transform: scale(1);
    }
    40% {
        box-shadow:
                inset 0 0 40px rgba(255,215,0,0.45),
                0 0 30px rgba(255,215,0,0.9);
        transform: scale(0.95);
    }
    100% {
        box-shadow:
                inset 0 0 0 rgba(255,215,0,0),
                0 0 0 rgba(0,0,0,0);
        transform: scale(1);
    }
}

/* ===== MEDIUM BOARD ===== */

.board-medium {
    border-radius: 8px;
    background: var(--bg-panel);
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.board-medium .board-header{
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.board-number {
    text-align: left;
    font-size: 1rem;
}

.board-best-of {
    text-align: right;
    font-size: 0.9rem;
    color: var(--muted);
}

.board-players {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    gap: 0.2rem;
}

.player-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.5rem;
    position: relative;
    min-width: 0;
}

.player-side-score{
    width: 100%;
    background: #141619;
    padding: 5px;
}

.player-name-medium {
    text-align: center;
    font-weight: bold;
    margin-bottom: 0.25rem;
    font-size: clamp(1.1rem, 2.0vw, 1.8rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.score-row {
    display: flex;
    width: 100%;
    align-items: center;
    margin-bottom: 0.25rem;
}

.score-row .last-score {
    flex: 0 0 20%;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--muted);
    text-align: center;
}

.score-row .left-score {
    flex: 0 0 60%;
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent-light);
    text-align: center;
}

.player-stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text);
    text-align: center;
    margin-top: 10px;
}

/* ===== SMALL BOARD ===== */

.board-small-header-top {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
}

.board-small-players {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.player-small-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #141619;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: background 0.3s ease;
    min-width: 0;
}

.player-name-small {
    flex: 2.5;
    font-weight: bold;
    text-align: left;
    color: var(--text);
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-value {
    flex: 1;
    text-align: center;
    font-weight: 600;
    color: var(--text);
}

.player-value.left-score {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent-light);
}

.player-value.last-score,
.player-value.darts {
    color: var(--muted);
    font-size: 0.95rem;
}

/* ===== LARGE BOARD MOBILE ===== */

.board-large-mobile {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 0.8rem;
    margin-bottom: 1rem;
    box-shadow: 0 0 12px rgba(0,0,0,0.5);
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.board-header-mobile {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--accent);
    text-align: center;
    margin-bottom: 0.5rem;
}

.scoreboard-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.player-mobile {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-name-mobile {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.score-mobile {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-light);
}

.legs-mobile {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-weight: bold;
    color: var(--muted);
    margin: 0.3rem 0;
}

.legs-score-mobile {
    font-size: 1.4rem;
}

.legs-label-mobile {
    font-size: 0.9rem;
    text-transform: uppercase;
}

.player-stats-container-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-stats-container-mobile table.stats-table {
    font-size: 0.8rem;
    width: 100%;
}

.player-stats-container-mobile table.stats-table td,
.player-stats-container-mobile table.stats-table th {
    padding: 0.25rem 0.4rem;
}


/* ===== LEAGUE BAR ===== */

.league-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    margin: 0.75rem auto 0;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.35);
    font-weight: 600;
    font-size: 30px;
}

.league-bar .team {
    max-width: 40%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.league-bar .score {
    font-size: 2.0rem;
    font-weight: 800;
    color: var(--accent-light);
    min-width: 80px;
    text-align: center;
}

@media (max-width: 768px) {
    .league-bar {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .league-bar .score {
        font-size: 1.3rem;
        min-width: 60px;
    }

    .league-bar .team {
        max-width: 35%;
        font-size: 0.95rem;
    }
}
