@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700;900&display=swap');

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: #111;
    color: #fff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* 3D Container */
#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* HTML Labels (Names hovering over 3D objects) */
#labels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none; /* Let clicks pass through to UI or canvas */
}

.player-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 1px 1px 2px black;
    transition: opacity 0.2s, transform 0.1s linear;
    border: 2px solid transparent;
}



/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Only children should receive events */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Floating Background Icons */
#floating-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0; /* Behind the setup screens */
    pointer-events: none;
}

.floating-joint {
    position: absolute;
    background-image: url('joint.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.15; /* Subtle transparency */
    animation: floatUp 15s linear infinite;
    bottom: -100px;
}

@keyframes floatUp {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-120vh) rotate(360deg); }
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    text-align: center;
}

.screen.active {
    display: flex;
}

/* Specific Screens Overrides */
/* 🌿 Modern Dashboard Setup Screen 🌿 */
.dashboard.active {
    display: flex !important;
}

.dashboard {
    max-width: 1400px;
    width: 98%;
    height: 90vh;
    max-height: 900px;
    padding: 0;
    background: transparent;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    grid-template-rows: 1fr;
    gap: 16px;
    width: 100%;
    height: 100%;
    align-items: stretch;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.dashboard-grid.solo-main {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.dashboard-grid.solo-main .main-card {
    width: auto;
    min-width: 600px;
    height: auto;
    max-height: 80vh;
    padding: 1.5rem;
}

.dashboard-grid.solo-main .feed-card,
.dashboard-grid.solo-main .dashboard-side {
    display: none;
}

.dashboard-card {
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 28px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    overflow: hidden;
    height: 100%;
}

.feed-card {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    padding: 20px;
}

.main-card {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    height: 100%;
}

.main-card-section {
    display: none;
    flex-direction: column;
    width: 100%;
    height: auto;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-out;
    justify-content: center;
    align-items: center;
}

#main-verify-content, #main-lobby-content {
    max-width: 600px;
}

.main-card-section.active {
    display: flex !important;
}

#main-setup-content {
    justify-content: space-between;
    align-items: center;
}

#main-verify-content h2, #main-lobby-content h2 {
    font-size: 1.5rem;
    color: #00ff88;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 900;
}

#main-verify-content p, #main-lobby-content p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 15px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

#main-verify-content .verify-instruction {
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.2);
    padding: 15px;
    border-radius: 20px;
    margin: 10px 0;
    width: 100%;
    text-align: center;
}

#main-verify-content strong {
    color: #00ff88;
    font-size: 1.4rem;
    padding: 2px 8px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 6px;
}

/* Lobby specific */
.lobby-stats-row {
    margin: 5px 0 15px 0;
    display: flex;
    justify-content: center;
}

.l-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 12px 24px;
    border-radius: 18px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.l-stat strong {
    color: #00ff88;
    font-size: 1.4rem;
}

.lobby-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
}

.l-setting {
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.l-setting label {
    font-size: 0.65rem;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.4);
}

.l-setting input, .l-setting select {
    background: transparent;
    border: none;
    padding: 5px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    width: 100%;
    color: #fff;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

/* Custom Arrow for Select */
.l-setting select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300ff88' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.l-setting option {
    background: #111;
    color: #fff;
    padding: 10px;
}

#main-history-content h2, #main-settings-content h2 {
    font-size: 1.2rem;
    color: #00ff88;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.danger-btn {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

.dashboard-side {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Main Card Elements */
.tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    font-weight: 300;
}

.setup-controls {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.secondary-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 255, 136, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.1);
}

/* How to Play Section */
.how-to-play {
    width: 100%;
    max-width: 650px;
    margin-top: 30px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.how-to-play h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 16px;
    text-align: center;
}

.steps {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.step {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

.step:hover {
    background: rgba(255, 255, 255, 0.04);
}

.step span {
    background: linear-gradient(135deg, #00ff88, #00e67a);
    color: #000;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3);
}

/* Global Stats Grid */
.stats-card {
    flex: 0 0 auto;
    padding: 16px 20px;
    height: auto;
}

.stats-card h3 {
    margin-bottom: 10px;
}

.feed-card {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
}

.leaderboard-card {
    flex: 1;
    min-height: 0;
}

.stats-card h3, .leaderboard-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #00ff88;
    margin-bottom: 16px;
    font-weight: 700;
    text-align: center;
}

.feed-header h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #00ff88;
    margin-bottom: 0;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.global-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.g-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 5px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.g-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.g-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

/* Leaderboard List */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

.leaderboard-list::-webkit-scrollbar {
    width: 3px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.leader-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.leader-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 255, 136, 0.1);
    transform: translateX(4px);
}

.leader-rank {
    font-weight: 800;
    color: #00ff88;
    width: 20px;
    font-size: 0.8rem;
}

.leader-name {
    flex: 1;
    text-align: left;
    margin-left: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leader-wins {
    font-weight: 700;
    color: #ffd700;
    font-size: 0.9rem;
}

/* Live Feed */
.feed-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: #ff4444;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.6);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.5); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(255, 68, 68, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); }
}

.live-feed-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding: 4px;
    padding-right: 8px;
    height: 100%;
}

.live-feed-content::-webkit-scrollbar {
    width: 3px;
}

.feed-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 14px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.feed-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 255, 136, 0.2);
    transform: translateX(4px);
}

.feed-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.feed-streamer-badge {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.feed-streamer-badge.recent {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

.feed-streamer-name {
    flex: 1;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-time-stamp {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
}

.feed-item-details {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 10px;
    border-radius: 10px;
    position: relative;
}

.has-tooltip {
    cursor: help;
}

.winner-name.multi {
    text-decoration: underline dotted rgba(255, 215, 0, 0.4);
}

/* Tooltip Style */
.winner-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 14px;
    width: 200px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.feed-item-details:hover .winner-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip-winner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.t-rank {
    font-weight: 900;
    color: #00ff88;
    font-size: 0.7rem;
    min-width: 20px;
}

.t-name {
    font-size: 0.85rem;
    color: #fff;
    font-weight: 500;
}

.winner-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    font-weight: 600;
}

.winner-name {
    color: #ffd700;
    font-weight: 700;
    font-size: 0.85rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.loading {
    color: rgba(255, 255, 255, 0.2);
    font-style: italic;
    font-size: 0.8rem;
    padding: 10px;
}

/* Modern Screens (Verify, Lobby, Settings etc.) */
#settings-screen {
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 50px 40px;
    width: 100%;
    max-width: 400px;
    transform: translateY(0);
}

.winner-layout {
    display: flex;
    gap: 30px;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 10px;
}

.winner-column, .stats-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.winner-column h2, .stats-column h2 {
    font-size: 1.5rem;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.scrollable-list {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scrollable-list::-webkit-scrollbar {
    width: 6px;
}

.scrollable-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.stat-title {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.4rem;
    color: #00ff88;
    font-weight: bold;
}

#lobby-screen h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

#lobby-screen p {
    color: #a0a0a0;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

#lobby-screen strong {
    color: #00ff88;
}

select:focus {
    border-color: #00ff88 !important;
}

select:hover {
    border-color: #00e67a;
}

input:focus {
    border-color: #00ff88;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15);
    background: rgba(0, 0, 0, 0.6);
}

/* Custom Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    padding: 0;
    border: none;
    height: 10px;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #00ff88;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

input[type="range"]:focus::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.15);
}

input {
    padding: 12px 20px;
    font-size: 1.1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    text-align: center;
    transition: all 0.3s ease;
    width: 100%;
}

#game-logo {
    width: 100%;
    max-width: 280px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 10px 15px rgba(0, 255, 136, 0.15));
    transition: transform 0.3s ease;
}

#game-logo:hover {
    transform: scale(1.02) rotate(-1deg);
}

#setup-screen p {
    color: #a0a0a0;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: none;
    font-size: 1rem;
    margin-bottom: 35px;
}

#channel-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    text-transform: none;
    font-weight: 500;
    letter-spacing: 1px;
    box-shadow: none;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    padding: 16px 20px;
    border-radius: 10px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 15px;
}

#channel-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
    letter-spacing: 0;
}

#channel-input:focus {
    border-color: #00ff88;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15);
    background: rgba(0, 0, 0, 0.6);
}

#connect-btn, #start-race-btn, #restart-btn, .secondary-btn {
    background: #00ff88;
    color: #000;
    text-shadow: none;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 16px 40px;
    border-radius: 10px;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
    text-transform: uppercase;
    cursor: pointer;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

#connect-btn:hover, #start-race-btn:hover, #restart-btn:hover {
    background: #00e67a;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.3);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

#connect-btn:active, #start-race-btn:active, #restart-btn:active, .secondary-btn:active {
    transform: translateY(0);
}

/* Modernized Settings Design */
.settings-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #aaa;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#volume-value {
    color: #00ff88;
    font-weight: bold;
    font-size: 1.1rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
}

#volume-icon {
    font-size: 1.2rem;
    width: 25px;
}

#setup-status.error:not(:empty) {
    display: none;
}

#race-screen {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    padding: 12px 30px;
    pointer-events: none;
    z-index: 20;
    height: auto;
    width: max-content;
    flex-direction: row;
    align-items: center;
    gap: 30px;
}

.race-stats {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.stat-icon {
    opacity: 0.8;
    margin-right: 2px;
}

.stat-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

.race-commands {
    display: flex;
    gap: 20px;
    align-items: center;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

.command-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.command-item .cmd-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.command-item.puff .cmd-text {
    color: #00ff88;
}

.command-item.spliff .cmd-text {
    color: #ff4444;
}

.command-item .cmd-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Player List Card */
#player-list-card {
    position: absolute;
    right: 20px;
    top: 20px;
    bottom: 20px;
    width: 220px;
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    display: none; /* hidden initially */
    flex-direction: column;
    pointer-events: auto; /* allow clicks inside */
    z-index: 20;
    overflow: hidden;
}

#player-list-card.active {
    display: flex;
}

#player-list-card .header {
    padding: 15px 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#player-list-card .list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#player-list-card .list::-webkit-scrollbar {
    width: 4px;
}

#player-list-card .list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.player-list-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.02);
    color: white;
    padding: 8px 12px;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 400;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
}

.player-list-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.main-card-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #00ff88;
    font-size: 1.5rem;
    text-align: center;
}

.lobby-stats-row {
    margin-bottom: 25px;
    text-align: center;
}

.l-stat {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 1.1rem;
}

.lobby-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.l-setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.l-setting label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.l-setting input, .l-setting select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.l-setting input:focus, .l-setting select:focus {
    border-color: #00ff88;
    background: rgba(255, 255, 255, 0.08);
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, #00ff88, #00cc6e);
    color: #000;
    border: none;
    padding: 18px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 20px rgba(0, 255, 136, 0.2);
}

.primary-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 255, 136, 0.4);
}

/* Animations for Feedback */
@keyframes flashGreen {
    0% { background: rgba(0, 255, 136, 0.8); color: #fff; text-shadow: 0 0 5px #00ff88; box-shadow: 0 0 10px #00ff88; }
    100% { background: rgba(255, 255, 255, 0.05); color: white; text-shadow: none; box-shadow: none; }
}

@keyframes flashPurple {
    0% { background: rgba(187, 0, 255, 0.8); color: #fff; text-shadow: 0 0 5px #bb00ff; box-shadow: 0 0 10px #bb00ff; }
    100% { background: rgba(255, 255, 255, 0.05); color: white; text-shadow: none; box-shadow: none; }
}

@keyframes flashRed {
    0% { background: rgba(255, 68, 68, 0.8); color: #fff; text-shadow: 0 0 5px #ff4444; box-shadow: 0 0 10px #ff4444; transform: scale(1.05); }
    100% { background: rgba(255, 255, 255, 0.05); color: white; text-shadow: none; box-shadow: none; transform: scale(1); }
}

.flash-green { animation: flashGreen 0.6s ease-out; }
.flash-purple { animation: flashPurple 0.8s ease-out; }
.flash-red { animation: flashRed 0.6s ease-out; }

/* 3D Label Feedback Classes */
@keyframes coughShake {
    0% { transform: translate(-50%, -50%) scale(1.1) rotate(0deg); }
    25% { transform: translate(-52%, -52%) scale(1.1) rotate(-2deg); }
    50% { transform: translate(-48%, -48%) scale(1.1) rotate(2deg); }
    75% { transform: translate(-52%, -48%) scale(1.1) rotate(-1deg); }
    100% { transform: translate(-50%, -50%) scale(1.1) rotate(0deg); }
}

@keyframes listShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

.player-label.is-coughing {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ff4444;
    color: #ff4444;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
    animation: coughShake 0.2s infinite;
}

.player-list-item.is-coughing {
    border: 1px solid #ff4444;
    box-shadow: inset 0 0 10px rgba(255, 68, 68, 0.1);
    animation: listShake 0.2s infinite;
}

@keyframes labelFlashGreen {
    0% { background: rgba(0, 255, 136, 0.9); border-color: #00ff88; color: #fff; text-shadow: 0 0 8px #00ff88; transform: translate(-50%, -50%) scale(1.2); }
    100% { background: rgba(0, 0, 0, 0.7); border-color: transparent; color: white; text-shadow: 1px 1px 2px black; transform: translate(-50%, -50%) scale(1); }
}

@keyframes labelFlashPurple {
    0% { background: rgba(187, 0, 255, 0.9); border-color: #bb00ff; color: #fff; text-shadow: 0 0 8px #bb00ff; transform: translate(-50%, -50%) scale(1.3); }
    100% { background: rgba(0, 0, 0, 0.7); border-color: transparent; color: white; text-shadow: 1px 1px 2px black; transform: translate(-50%, -50%) scale(1); }
}

@keyframes labelFlashRed {
    0% { background: rgba(255, 68, 68, 0.9); border-color: #ff4444; color: #fff; text-shadow: 0 0 8px #ff4444; transform: translate(-50%, -50%) scale(1.2) rotate(5deg); }
    100% { background: rgba(0, 0, 0, 0.7); border-color: transparent; color: white; text-shadow: 1px 1px 2px black; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.player-label.flash-green { animation: labelFlashGreen 0.6s ease-out; }
.player-label.flash-purple { animation: labelFlashPurple 0.8s ease-out; }
.player-label.flash-red { animation: labelFlashRed 0.6s ease-out; }

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

h2 {
    font-size: 2rem;
    color: #4CAF50;
    margin: 20px 0;
}

p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #ccc;
}



.error {
    color: #ff4444;
    font-size: 0.9rem;
    margin-top: 10px;
    margin-bottom: 0;
    min-height: auto;
}