*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #080e1e;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
}

#scaleWrapper {
    width: 1920px;
    height: 1080px;
    transform-origin: top left;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
}

/* ============================================================
   MATCH BOARD
   ============================================================ */
#boardMatch {
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #1a2f6e 0%, #0f1d47 100%);
    border-radius: 32px;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.match-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 64px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.match-feld {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
}

.match-disc {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 32px;
    border-radius: 30px;
}

.preparing-badge {
    font-size: 20px;
    font-weight: 700;
    background: rgba(147, 51, 234, 0.25);
    color: #c084fc;
    border: 1px solid rgba(147, 51, 234, 0.5);
    padding: 8px 24px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.match-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.player-row {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 64px;
    min-height: 0;
    overflow: visible;
    /* Glow darf über den Row-Bereich hinausgehen */
}

.player-row:first-child {
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.player-left {
    display: flex;
    align-items: center;
    gap: 32px;
    flex: 1;
    min-width: 0;
    /* kein overflow:hidden — sonst wird Glow/text-shadow abgeschnitten */
    padding: 10px 0;
    /* Raum für Glow-Effekte oben/unten */
}

.serve-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    transition: all 0.3s;
    /* Dot braucht eigenen Raum damit Glow nicht abgeschnitten wird */
    margin-left: 4px;
}

.serve-dot.active {
    background: #f6c90e;
    box-shadow: 0 0 28px rgba(246, 201, 14, 0.95);
}

.player-names {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
    /* kein overflow:hidden — text-shadow wird sonst links abgeschnitten */
    padding-left: 2px;
    /* Kleiner Offset damit Glow links Platz hat */
}

.pname {
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 0.3s;
    color: rgba(255, 255, 255, 0.4);
}

.pname-a {
    font-size: 80px;
    line-height: 1.1;
}

.pname-b {
    font-size: 80px;
    line-height: 1.1;
}

.pname.is-server {
    color: #ffffff;
    text-shadow: 0 0 40px rgba(246, 201, 14, 0.55), 0 0 80px rgba(246, 201, 14, 0.2);
}

.player-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    padding-left: 40px;
}

.set-boxes {
    display: flex;
    gap: 14px;
    align-items: center;
}

.set-box {
    width: 88px;
    height: 88px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 900;
    transition: all 0.3s;
}

.set-box.won {
    background: rgba(72, 187, 120, 0.2);
    border: 3px solid #48bb78;
    color: #48bb78;
    box-shadow: 0 0 18px rgba(72, 187, 120, 0.3);
}

.set-box.lost {
    background: rgba(239, 68, 68, 0.12);
    border: 2px solid rgba(239, 68, 68, 0.35);
    color: rgba(239, 68, 68, 0.7);
}

.player-score {
    width: 180px;
    height: 148px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 108px;
    font-weight: 900;
    color: #ffffff;
    flex-shrink: 0;
    transition: all 0.2s;
}

.player-score.serving {
    background: rgba(246, 201, 14, 0.18);
    border: 3px solid #f6c90e;
    box-shadow: 0 0 48px rgba(246, 201, 14, 0.5);
    animation: servePulse 2s infinite;
}

.player-score.updated {
    animation: scorePopIn 0.4s ease-out;
}

/* ============================================================
   IDLE
   ============================================================ */
#boardIdle {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.idle-feld {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.18);
}

.idle-text {
    font-size: 26px;
    font-weight: 400;
    letter-spacing: 7px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   WON
   ============================================================ */
#boardWon {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.won-trophy-placeholder {
    display: none;
}

.won-name {
    font-size: 110px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    padding: 0 60px;
}

.won-sets {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.won-set-box {
    min-width: 140px;
    padding: 16px 28px;
    border-radius: 20px;
    font-size: 56px;
    font-weight: 900;
    text-align: center;
}

.won-set-box.won {
    background: rgba(72, 187, 120, 0.2);
    border: 3px solid #48bb78;
    color: #48bb78;
}

.won-set-box.lost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.35);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes scorePopIn {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes servePulse {

    0%,
    100% {
        box-shadow: 0 0 24px rgba(246, 201, 14, 0.4);
    }

    50% {
        box-shadow: 0 0 60px rgba(246, 201, 14, 0.9);
    }
}