:root {
    --player-hue: 154;
    --panel: rgba(8, 15, 30, 0.78);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text: #f8fbff;
    --muted: rgba(231, 239, 255, 0.72);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at top, rgba(96, 142, 255, 0.18), transparent 28%),
        radial-gradient(circle at bottom, hsla(var(--player-hue), 90%, 58%, 0.18), transparent 34%),
        linear-gradient(180deg, #0b1322, #050913 65%, #02040b);
    color: var(--text);
    user-select: none;
    -webkit-user-select: none;
}

body {
    min-height: 100dvh;
}

.shell {
    min-height: 100dvh;
    height: 100dvh;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.topline,
.meta-row,
.player-card,
.touch-pad,
.pulse-banner {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 24px;
}

.eyebrow,
.meta-label {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 11px;
    color: hsla(var(--player-hue), 96%, 72%, 0.92);
}

.topline h1 {
    margin: 6px 0 0;
    font-size: clamp(26px, 7vw, 42px);
    line-height: 0.95;
}

#resetBtn {
    border: 0;
    border-radius: 999px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #ff627d, #ff8f51);
    box-shadow: 0 16px 32px rgba(255, 98, 125, 0.28);
}

.meta-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    border-radius: 18px;
    overflow: hidden;
    margin-top: auto;
}

.meta-card {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.02);
    min-width: 0;
}

.player-card {
    border-radius: 20px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.player-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.player-details {
    min-width: 0;
}

.player-glow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: hsl(var(--player-hue), 96%, 62%);
    box-shadow: 0 0 22px hsla(var(--player-hue), 96%, 62%, 0.66);
}

.player-name {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-text {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-box {
    text-align: right;
    flex: 0 0 auto;
}

#playerScore {
    display: block;
    font-size: clamp(26px, 7vw, 42px);
    font-weight: 800;
    color: hsl(var(--player-hue), 96%, 66%);
    line-height: 1;
}

.touch-pad {
    position: relative;
    flex: 0 0 auto;
    width: min(calc(100vw - 24px), calc(100dvh - 300px));
    max-width: 420px;
    aspect-ratio: 1 / 1;
    align-self: center;
    border-radius: 24px;
    overflow: hidden;
    touch-action: none;
    background:
        radial-gradient(circle at center, hsla(var(--player-hue), 86%, 60%, 0.2), rgba(14, 20, 36, 0.2) 40%, rgba(3, 7, 14, 0.94) 100%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
}

.pad-aura,
.pad-grid,
.pad-ring {
    position: absolute;
    inset: 0;
}

.pad-aura {
    background: radial-gradient(circle at center, hsla(var(--player-hue), 100%, 70%, 0.24), transparent 50%);
}

.pad-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 20% 20%;
    mask-image: radial-gradient(circle at center, black 32%, transparent 76%);
}

.pad-ring {
    inset: 10%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.touch-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(120px, 28%);
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.14) 35%, hsl(var(--player-hue), 92%, 58%) 100%);
    box-shadow:
        inset 0 3px 14px rgba(255, 255, 255, 0.34),
        0 18px 34px rgba(0, 0, 0, 0.36),
        0 0 32px hsla(var(--player-hue), 96%, 62%, 0.45);
    transition: transform 70ms linear;
}

.pad-copy {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-align: center;
    width: calc(100% - 28px);
}

.pulse-banner {
    border-radius: 999px;
    padding: 10px 14px;
    text-align: center;
    color: hsla(var(--player-hue), 98%, 72%, 0.96);
    transition: transform 180ms ease, opacity 180ms ease;
    font-size: 14px;
}

.pulse-banner.flash {
    transform: scale(1.02);
}

@media (max-width: 640px) {
    .shell {
        padding: 10px;
        gap: 8px;
    }

    .topline,
    .player-card {
        border-radius: 18px;
        padding: 12px;
    }

    .topline h1 {
        font-size: 24px;
    }

    .eyebrow,
    .meta-label {
        font-size: 9px;
        letter-spacing: 0.15em;
    }

    .touch-pad {
        width: min(calc(100vw - 20px), calc(100dvh - 270px));
        border-radius: 20px;
    }

    .player-name {
        font-size: 16px;
    }

    .status-text {
        font-size: 12px;
    }

    #playerScore {
        font-size: 28px;
    }

    .meta-card {
        padding: 9px 10px;
    }

    .pulse-banner {
        padding: 9px 12px;
        font-size: 13px;
    }
}

@media (max-height: 760px) {
    .touch-pad {
        width: min(calc(100vw - 24px), calc(100dvh - 290px));
    }
}

@media (max-height: 680px) {
    .shell {
        gap: 6px;
        padding: 8px;
    }

    .topline,
    .player-card {
        padding: 10px 12px;
    }

    .touch-pad {
        width: min(calc(100vw - 16px), calc(100dvh - 250px));
    }

    .meta-card {
        padding: 8px 10px;
    }

    .pulse-banner {
        padding: 8px 10px;
        font-size: 12px;
    }
}
