/* ================================================================
 * BASIS-SETUP & FONT
 * ================================================================ */
body, html {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100dvh; 
    overflow: hidden;
    background-color: #070810; /* Notch/Kamera Fix für Handys */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: none; 
    -webkit-touch-callout: none; 
    user-select: none;
}

/* Custom Scrollbar (Dünn & Transparent wie auf dem Handy) */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15); 
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3); 
}
/* Fallback für Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

#gameCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

#uiLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ================================================================
 * IN-GAME UI (Score, Ping, FPS, Toast)
 * ================================================================ */
.score-board {
    position: absolute;
    top: 20px;
    left: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0,255,255,0.8); 
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

.low-graphics-toggle {
    position: absolute;
    top: 75px;
    left: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.4);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    cursor: pointer;
    transition: background 0.2s;
}
.low-graphics-toggle:hover {
    background: rgba(0, 255, 255, 0.2);
}
.low-graphics-toggle input[type="checkbox"] {
    cursor: pointer;
    accent-color: #00ffff;
    width: 16px;
    height: 16px;
    margin: 0;
}
.low-graphics-toggle span {
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.ping-display {
    position: absolute;
    top: 115px; 
    left: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-family: monospace;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}
.uptime-display {
    position: absolute;
    top: 150px; 
    left: 20px;
    color: #00ffff;
    font-size: 14px;
    font-family: monospace;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}
.stats-display {
    position: absolute;
    top: 185px; 
    left: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-family: monospace;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}
.fps-display {
    position: absolute;
    top: 220px; 
    left: 20px;
    color: #ccff00;
    font-size: 14px;
    font-family: monospace;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

/* Neues FPS Toast Styling */
#fpsToast {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff3300, #ff8800);
    color: #fff;
    padding: 12px 20px;
    border-radius: 25px;
    font-family: Arial, sans-serif;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(255, 50, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    cursor: pointer;
    pointer-events: auto;
}
#fpsToast.show {
    top: 20px;
}
#fpsToast .close-btn {
    background: rgba(0,0,0,0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    line-height: 1;
}
#fpsToast .close-btn:hover {
    background: rgba(0,0,0,0.4);
}

/* --- Dynamische Status-Farben (Ping & Server Stats) --- */
.status-good { color: #39ff14 !important; }
.status-ok   { color: #ccff00 !important; }
.status-bad  { color: #ff3131 !important; }
.status-none { color: rgba(255, 255, 255, 0.8) !important; }

/* ================================================================
 * LEADERBOARD & MINIMAP
 * ================================================================ */
.leaderboard {
    position: absolute;
    top: 20px;
    right: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 10px;
    border-radius: 10px;
    min-width: 240px;
    max-width: 35vw;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
    pointer-events: auto;
}
.leaderboard .panel-header {
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 4px;
    margin-bottom: 6px;
}
.leaderboard .panel-title {
    font-size: 16px; 
    display: block;
    text-align: center;
    color: #fff;
    text-shadow: 0 0 5px rgba(0,255,255,0.8);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1px; 
    /* Cursor entfernt! Wird dynamisch durch .is-playing gesteuert */
    padding: 2px 5px;
    border-radius: 4px;
    transition: background 0.2s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
/* Zeigt den Pointer nur, wenn man NICHT aktiv spielt (im Menü oder als Zuschauer) */
body:not(.is-playing) .leaderboard-entry {
    cursor: pointer;
}
.leaderboard-entry:hover {
    background: rgba(255,255,255,0.1);
}

.leaderboard-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    pointer-events: none;
}
.leaderboard-score {
    margin-left: 15px;
    pointer-events: none;
}

.minimap-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    max-width: 45vw;
    max-height: 45vw;
    background: rgba(0,0,0,0.6);
    border: 2px solid rgba(0,255,255,0.3);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0,0,0,0.8);
    z-index: 50 !important;
    pointer-events: auto; 
    /* Cursor entfernt! Wird dynamisch gesteuert */
    transition: border-color 0.2s, box-shadow 0.2s;
}
/* Zeigt das Fadenkreuz auf der Minimap nur, wenn man NICHT aktiv spielt */
body:not(.is-playing) .minimap-container {
    cursor: crosshair;
}

.minimap-container:hover {
    border-color: rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}
#minimap {
    width: 100%;
    height: 100%;
}
.version-label {
    position: absolute;
    bottom: 0px;
    right: 0px;
    background-color: rgba(0, 0, 0, 0.75);
    color: rgba(255, 255, 255, 0.65);
    font-family: monospace;
    font-weight: bold;
    font-size: 11px;
    height: 18px;
    line-height: 18px;
    padding: 0 6px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10 !important; 
}

/* ================================================================
 * SPECTATOR MODUS UI 
 * ================================================================ */
.spectator-ui {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 20, 0.95);
    padding: 5px 10px; 
    border-radius: 15px;
    border: 1px solid rgba(0, 255, 255, 0.4); 
    display: flex;
    flex-direction: column; 
    align-items: center;
    gap: 5px; 
    pointer-events: auto;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
    z-index: 50;
    width: 260px; 
    box-sizing: border-box;
}
.spectator-ui .panel-header {
    display: flex;
    justify-content: center; 
    align-items: center;
    width: 100%;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 3px; 
    position: relative; 
}
.spectator-ui .panel-title {
    color: #00ffff;
    font-weight: bold;
    font-size: 13px; 
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    margin: 0; 
}
.spectator-controls {
    display: flex;
    align-items: center;
    gap: 8px; 
    width: 100%;
    justify-content: space-between;
}
.spectator-controls .design-btn {
    width: 26px; 
    height: 26px;
    font-size: 12px;
    flex-shrink: 0;
}
#spectatorTargetName {
    color: white;
    font-size: 15px; 
    font-weight: bold;
    text-align: center;
    text-shadow: 1px 1px 3px black;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px; 
    margin: 0 5px; 
    flex-grow: 1;
}
#specClose {
    color: #ff3131;
    border-color: #ff3131;
    font-size: 12px;
    width: 20px;
    height: 20px;
    box-shadow: 0 0 10px rgba(255, 49, 49, 0.2);
    position: absolute; 
    right: 0;
    top: 0px; 
    padding: 0;
}
#specClose:hover { background: rgba(255, 49, 49, 0.2); }

.spectator-zoom-ui {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 20, 0.95);
    padding: 5px 10px; 
    border-radius: 15px; 
    border: 1px solid rgba(0, 255, 255, 0.4); 
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px; 
    pointer-events: auto;
    z-index: 50;
    height: 34px; 
    width: 260px; 
    box-sizing: border-box;
}
.spectator-zoom-ui .design-btn {
    width: 26px; 
    height: 26px;
    font-size: 16px;
    flex-shrink: 0;
}
input[type=range] {
    accent-color: #00ffff;
    width: 100%;
    max-width: 140px;
    margin: 0 10px;
    cursor: pointer;
    height: 4px; 
}

/* ================================================================
 * MENU SCREEN & LOGO
 * ================================================================ */
#menuScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 20, 0.95);
    padding: 30px 25px; 
    border-radius: 20px;
    text-align: center;
    color: white;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 40px rgba(0,255,255,0.15), inset 0 0 20px rgba(255,0,255,0.1);
    border: 2px solid #00ffff;
    transition: opacity 0.3s;
    z-index: 100;
    max-height: 95vh;
    overflow-y: auto;
    width: 90%;
    max-width: 420px;
    box-sizing: border-box; 
}
.hidden { display: none !important; }

/* NEON TITLE (Alt) */
.neon-title {
    margin: 5px 0 20px 0; 
    font-size: 80px; 
    font-weight: bold;
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255,0,255,0.5);
}

/* SUPER NEON WORMS LOGO (Neu) */
.super-neon-logo {
    margin: 15px auto 30px auto; 
    padding: 10px 0; 
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content; 
    line-height: 0.9;
    user-select: none;
    mix-blend-mode: screen; 
}
.logo-super {
    display: flex;
    justify-content: space-between; 
    width: 100%; 
    font-size: clamp(1.8rem, 8vw, 2.2rem);
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.logo-super .jelly-letter {
    color: rgba(170, 255, 255, 0.5); 
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.4), 0 0 12px rgba(0, 255, 255, 0.8), 0 0 22px rgba(0, 200, 255, 0.5);
}
.logo-super .spacer { width: 0.8em; }

.logo-worms {
    display: flex;
    justify-content: center;
    gap: 0.03em; 
    font-size: clamp(3.5rem, 16vw, 4.8rem);
    font-family: 'Arial Black', Impact, sans-serif;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.logo-worms .jelly-letter {
    color: rgba(255, 179, 255, 0.5); 
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.4), 0 0 12px rgba(255, 0, 255, 0.8), 0 0 22px rgba(204, 0, 170, 0.5);
}

.jelly-letter {
    display: inline-block;
    transform-origin: center bottom;
    animation: random-wobble var(--dur, 3s) infinite ease-in-out alternate;
    animation-delay: var(--del, 0s);
}
@keyframes random-wobble {
    0% { transform: scale(1, 1) translate(0, 0) rotate(0deg); }
    33% { transform: scale(1.06, 0.94) translate(0, -3px) rotate(3deg); }
    66% { transform: scale(0.94, 1.06) translate(0, 3px) rotate(-3deg); }
    100% { transform: scale(1.02, 0.98) translate(0, -1px) rotate(1deg); }
}

/* Low-Graphics Modus Logo Fix */
body.low-gfx .jelly-letter {
    animation: none !important; 
    text-shadow: 0 0 4px rgba(255,255,255,0.4) !important; 
    transform: scale(1, 1) translate(0, 0) rotate(0deg) !important;
}
body.low-gfx .super-neon-logo {
    mix-blend-mode: normal !important; 
}


/* SERVER DROPDOWN */
.status-dropdown {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #ff9900;
    color: #ff9900;
    padding: 12px 15px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 20px;
    cursor: pointer;
    outline: none;
    appearance: auto; 
    -webkit-appearance: auto;
    text-align: center;
    box-shadow: 0 0 10px rgba(255, 153, 0, 0.2);
    transition: all 0.3s;
    width: 100%;
    max-width: 320px;
}
.status-dropdown.connected {
    border-color: #39ff14;
    color: #39ff14;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.2);
}
.status-dropdown.error {
    border-color: #ff3131;
    color: #ff3131;
    box-shadow: 0 0 10px rgba(255, 49, 49, 0.2);
}
.status-dropdown option {
    background: #0d0d1a;
    color: white;
}
@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px rgba(204,255,0,0.5); transform: scale(1); }
    50% { box-shadow: 0 0 15px rgba(204,255,0,0.8); transform: scale(1.02); }
    100% { box-shadow: 0 0 5px rgba(204,255,0,0.5); transform: scale(1); }
}
.waking-up {
    animation: pulse-glow 1.5s infinite;
    border-color: #ccff00 !important;
    color: #ccff00 !important;
}

/* Benachrichtigungen */
#gameOverText {
    font-size: 20px;
    color: #ff3131;
    margin-bottom: 15px;
    font-weight: bold;
    text-shadow: 0 0 10px #ff3131;
}
#nameError {
    color: #ff3131; font-size: 14px; font-weight: bold; 
    margin-bottom: 10px; display: none; text-shadow: 0 0 5px rgba(255,49,49,0.5);
}
#savedScoreNotification {
    display: none; background: rgba(57, 255, 20, 0.1); 
    border: 1px solid rgba(57, 255, 20, 0.4); padding: 10px 15px; 
    border-radius: 8px; margin-bottom: 15px; box-shadow: 0 0 10px rgba(57, 255, 20, 0.1);
}
#savedScoreTitle {
    color: #39ff14; font-weight: bold; font-size: 15px; 
    text-shadow: 0 0 5px rgba(57,255,20,0.5); margin-bottom: 4px;
}
.saved-score-text { color: rgba(255,255,255,0.9); font-size: 14px; }
#savedScoreDisplay { color: #ccff00; font-size: 16px; }

#personalHighScoreDisplay {
    display: none; font-size: 14px; font-weight: bold; color: #ffcc00; 
    margin-top: -5px; margin-bottom: 20px; text-shadow: 0 0 5px rgba(255, 204, 0, 0.4);
}

#nicknameInput {
    padding: 12px 20px;
    font-size: 20px;
    border-radius: 10px;
    border: 2px solid #bc13fe;
    background: rgba(0,0,0,0.5);
    color: white;
    margin-bottom: 25px;
    text-align: center;
    width: 250px;
    max-width: 90%; 
    outline: none;
    font-family: inherit;
    box-shadow: 0 0 10px rgba(188, 19, 254, 0.2);
    transition: all 0.3s;
}
#nicknameInput:focus {
    border-color: #39ff14;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}

/* --- UI: Live Preview & Pickers --- */
.preview-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 5px;
}
.skin-picker-wrapper { margin-bottom: 20px; }
.dual-picker-container { width: 340px; max-width: 100%; display: flex; justify-content: center; align-items: center; }

/* ALLGEMEINE DESIGN BUTTONS */
.design-btn {
    background: rgba(0,0,0,0.5);
    border: 1.5px solid #00ffff;
    color: #00ffff;
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(0,255,255,0.2);
    flex-shrink: 0; 
}
.design-btn:hover { background: rgba(0,255,255,0.2); transform: scale(1.1); }
.design-btn:active { transform: scale(0.9); }

/* WÜRFEL BUTTON */
#randomizeBtn {
    background: rgba(0,0,0,0.5);
    border: 1.5px solid #00ffff;
    color: #ffffff;
    font-size: 20px;
    width: 36px; 
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0,255,255,0.2);
    transition: transform 0.2s ease-out, background 0.2s;
    flex-shrink: 0;
    margin-left: 5px;
    padding: 0;
}
#randomizeBtn:hover { background: rgba(0,255,255,0.2); transform: scale(1.1); }
#randomizeBtn:active { transform: scale(0.9); }
.spin-anim { animation: dice-spin 0.4s ease-out; }
@keyframes dice-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* VERSTECKTER PLATZHALTER */
.hidden-spacer {
    visibility: hidden; 
    pointer-events: none; 
    width: 36px; 
    height: 36px;
    margin-right: 5px;
    border: none;
}

.live-preview-container {
    width: 100%;
    height: auto; 
    padding: 5px 0; 
    background: radial-gradient(ellipse, rgba(26,26,46,0.6) 0%, rgba(10,10,20,0) 70%);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
}
#previewCanvas {
    width: 340px; 
    height: auto; 
    max-width: 100%; 
    display: block;
}
.design-label {
    font-size: 12px;
    color: #00ffff;
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0,255,255,0.5);
}
.dual-picker-wrapper {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 20px;
    width: 100%;
}
.no-margin-bottom { margin-bottom: 0 !important; }
.picker-column { display: flex; flex-direction: column; align-items: center; }
.picker-label {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    margin-top: 6px; 
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}
.color-picker-container { display: flex; align-items: center; justify-content: center; }
.color-btn {
    background: rgba(0,0,0,0.5); border: 1px solid #ffffff; color: #ffffff;
    font-size: 10px; width: 16px; height: 16px; border-radius: 4px;
    cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; box-shadow: 0 0 5px rgba(255,255,255,0.1);
}
.color-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }
.color-btn:active { transform: scale(0.9); }
.color-preview {
    width: 16px; height: 16px; border-radius: 50%; margin: 0 10px;
    border: 1.5px solid white; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-buttons {
    display: flex; gap: 15px; justify-content: center; width: 100%;
}

button.play-btn, button.spectate-btn {
    background: rgba(0,0,0,0.6);
    color: #00ffff;
    border: 2px solid #00ffff;
    padding: 15px 25px;
    font-size: 18px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0,255,255,0.2);
    transition: all 0.1s;
    flex: 1; 
    max-width: 160px;
}
button.play-btn:hover, button.spectate-btn:hover { 
    background: rgba(0,255,255,0.1); transform: translateY(-2px); 
}
button.play-btn:active, button.spectate-btn:active { 
    transform: translateY(2px); 
}

#debugConsole {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 250px;
    max-width: 50vw;
    height: 110px;
    background: rgba(0, 0, 0, 0.5); 
    color: #39ff14;
    font-family: monospace;
    font-size: 10px; 
    z-index: 9999;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid rgba(57, 255, 20, 0.2);
    border-radius: 5px;
    pointer-events: none; 
    box-shadow: 0 0 5px rgba(57, 255, 20, 0.1);
    display: none; 
}

/* --- Debug Console Farben --- */
.debug-time { color: #aaaaaa; }
.debug-info { color: #39ff14; }
.debug-warn { color: #ffcc00; }
.debug-err  { color: #ff3131; font-weight: bold; }

/* ================================================================
 * RECONNECT OVERLAY
 * ================================================================ */
#reconnectOverlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    text-align: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.spinner {
    width: 50px; height: 50px;
    border: 5px solid rgba(0, 255, 255, 0.1);
    border-top: 5px solid #00ffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.reconnect-title {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    font-size: 24px;
    margin-bottom: 10px;
    margin-top: 0;
}
.reconnect-text {
    color: rgba(255,255,255,0.8);
    font-size: 16px;
    margin: 0;
}
.rejoin-fail-subtext {
    font-size: 14px;
    color: #ff9900;
    display: block;
    margin-top: 5px;
}

/* ================================================================
 * MOBILE RESPONSIVENESS
 * ================================================================ */
@media (max-width: 1024px), (max-height: 500px) {
    .score-board { top: 10px; left: 10px; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
    
    .low-graphics-toggle { top: 42px; left: 10px; font-size: 11px; padding: 2px 4px; border-radius: 6px; gap: 5px; }
    .low-graphics-toggle input[type="checkbox"] { width: 12px; height: 12px; }
    
    .spectator-ui { top: 10px; padding: 4px 8px; width: 220px; min-width: unset; gap: 4px; border-radius: 8px; }
    .spectator-ui .panel-header { padding-bottom: 4px; }
    .spectator-ui .panel-title { font-size: 12px; }
    #spectatorTargetName { font-size: 13px; max-width: 110px; margin: 0 5px; }
    .spectator-controls .design-btn { width: 22px; height: 22px; font-size: 10px;}
    .spectator-zoom-ui { bottom: 15px; padding: 3px 8px; width: 220px; height: 30px; gap: 6px;}
    .spectator-zoom-ui .design-btn { width: 22px; height: 22px; font-size: 14px;}
    input[type=range] { width: 100%; max-width: 110px; margin: 0 6px; }
    #specClose { font-size: 10px; width: 18px; height: 18px; top: 0;}
    
    .ping-display { top: 74px; left: 10px; font-size: 9px; padding: 1px 3px; border-radius: 4px; }
    .uptime-display { top: 96px; left: 10px; font-size: 9px; padding: 1px 3px; border-radius: 4px; }
    .stats-display { top: 118px; left: 10px; font-size: 9px; padding: 1px 3px; border-radius: 4px; }
    .fps-display { top: 140px; left: 10px; font-size: 9px; padding: 1px 3px; border-radius: 4px; }
    
    /* Leaderboard mobile noch schlanker */
    .leaderboard { top: 10px; right: 10px; font-size: 10px; padding: 4px; min-width: 130px; max-width: 35vw; border-radius: 6px; }
    .leaderboard .panel-title { font-size: 12px; margin-bottom: 2px; padding-bottom: 2px; }
    .leaderboard-entry { margin-bottom: 0px; padding: 1px 2px; }
    
    .minimap-container { bottom: 10px; right: 10px; width: 90px; height: 90px; border-radius: 6px; }
    
    #menuScreen { padding: 15px; width: 95%; max-width: 380px; border-radius: 12px; box-sizing: border-box; } 
    
    .neon-title { font-size: 80px; margin-bottom: 15px; } 
    
    .status-dropdown { font-size: 12px; padding: 8px 12px; margin-bottom: 15px; width: 95%; }
    #nicknameInput { font-size: 14px; padding: 8px; margin-bottom: 15px; border-radius: 6px; width: 220px; } 
    
    .action-buttons { gap: 10px; }
    button.play-btn, button.spectate-btn { font-size: 14px; padding: 10px 15px; max-width: 120px; }
    
    .preview-wrapper { gap: 5px; }
    .design-btn { width: 28px; height: 28px; font-size: 14px; }
    #randomizeBtn { width: 28px; height: 28px; font-size: 16px; margin-left: 5px; }
    .hidden-spacer { width: 28px; height: 28px; margin-right: 5px; }
    
    .dual-picker-wrapper { gap: 15px; margin-bottom: 10px; }
    .color-preview, .color-btn { width: 14px; height: 14px; font-size: 8px; margin: 0 6px; border-width: 1px; }
    .picker-label { font-size: 8px; margin-top: 4px; }
    .version-label { font-size: 9px; bottom: 0; right: 0; padding: 0 4px; height: 14px; line-height: 14px; }
}

@media (max-width: 768px) {
    #menuScreen {
        /* Zwingt die Box, an den Seiten zusammenzuschrumpfen (mehr äußerer Abstand) */
        width: calc(100% - 60px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

@media (max-height: 450px) {
    .stats-display, .uptime-display { display: none; }
    .low-graphics-toggle { top: 40px; }
    .ping-display { top: 72px; }
    .fps-display { top: 94px; }
    .minimap-container { width: 80px; height: 80px; }
    #menuScreen { padding: 10px; transform: translate(-50%, -50%) scale(0.85); }
}