/**
 * Boomfection - Main Stylesheet
 * @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de
 */

/* ============================================================================
   CSS VARIABLES / DESIGN TOKENS
   ============================================================================ */

:root {
    /* Colors - Primary */
    --color-primary: #ff8c32;
    --color-primary-dark: #e07020;
    --color-primary-light: #ffaa55;
    --color-primary-glow: rgba(255, 140, 50, 0.4);

    /* Colors - Background */
    --color-bg-dark: #0a0a0f;
    --color-bg-medium: #1a1a2e;
    --color-bg-light: #2a2a3a;
    --color-bg-panel: rgba(15, 15, 25, 0.95);

    /* Colors - Text */
    --color-text: #e0e0e0;
    --color-text-muted: #888888;
    --color-text-dark: #666666;

    /* Colors - Status */
    --color-success: #64c864;
    --color-warning: #ffc832;
    --color-error: #ff5050;
    --color-info: #64c8ff;

    /* Colors - Players */
    --color-player-red: #e63946;
    --color-player-blue: #4361ee;
    --color-player-green: #2a9d8f;
    --color-player-yellow: #f4a261;
    --color-player-purple: #9b5de5;
    --color-player-cyan: #00b4d8;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-round: 50%;
    --radius-pill: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--color-primary-glow);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Typography */
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;

    /* Z-Index */
    --z-base: 1;
    --z-dropdown: 100;
    --z-modal: 1000;
    --z-toast: 2000;
}

/* ============================================================================
   RESET & BASE
   ============================================================================ */

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

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Custom selection color matching theme */
::selection {
    background: rgba(0, 255, 136, 0.25);
    color: #fff;
}

::-moz-selection {
    background: rgba(0, 255, 136, 0.25);
    color: #fff;
}

/* Custom scrollbar (dark theme) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 10, 20, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.2);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.4);
    border: 1px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-corner {
    background: rgba(10, 10, 20, 0.6);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 136, 0.2) rgba(10, 10, 20, 0.6);
}

/* ============================================================================
   ACCESSIBILITY UTILITIES
   ============================================================================ */

/* Screen-reader only: visually hidden but accessible to AT */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip-to-content link */
.skip-link {
    position: absolute;
    top: -9999px;
    left: 0;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: var(--color-primary);
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 0 0 var(--radius-md) 0;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* Focus-visible: keyboard-only focus ring for all interactive elements */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Suppress focus outline for mouse users where browsers don't support :focus-visible */
:focus:not(:focus-visible) {
    outline: none;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: linear-gradient(135deg, var(--color-bg-dark) 0%, var(--color-bg-medium) 50%, var(--color-bg-dark) 100%);
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1, h2, h3, h4 {
    color: var(--color-primary);
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-center { text-align: center; }

/* ============================================================================
   LAYOUT
   ============================================================================ */

#app {
    display: flex;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for iOS Safari address bar */
    width: 100vw;
}

#canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

canvas:active {
    cursor: grabbing;
}

/* ============================================================================
   PANELS
   ============================================================================ */

.panel {
    position: absolute;
    background: var(--color-bg-panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 140, 50, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    box-shadow: var(--shadow-lg);
}

.panel.hidden {
    display: none !important;
}

.panel-header {
    margin-bottom: var(--space-lg);
}

.panel-header h2 {
    margin-bottom: var(--space-xs);
}

.panel-header .subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Panel Positions */
.panel-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.panel-top-left {
    top: var(--space-lg);
    left: var(--space-lg);
}

.panel-top-right {
    top: var(--space-lg);
    right: var(--space-lg);
}

.panel-bottom-left {
    bottom: var(--space-lg);
    left: var(--space-lg);
}

.panel-bottom-right {
    bottom: var(--space-lg);
    right: var(--space-lg);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(255, 140, 50, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: linear-gradient(135deg, #3a3a5a 0%, #2a2a4a 100%);
    color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #4a4a6a 0%, #3a3a5a 100%);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--space-lg) var(--space-xl);
    font-size: 1.125rem;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--color-accent);
    margin-top: var(--space-xs);
    opacity: 0.85;
}

.form-control {
    width: 100%;
    padding: var(--space-md);
    background: var(--color-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none; /* custom focus style below */
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 140, 50, 0.2);
}

.form-control:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 140, 50, 0.2);
}

.form-control::placeholder {
    color: var(--color-text-dark);
}

.form-row {
    display: flex;
    gap: var(--space-md);
}

.form-row > * {
    flex: 1;
}

/* Checkbox */
.checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* ============================================================================
   COLOR PICKER
   ============================================================================ */

.color-picker {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-round);
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #fff;
}

.color-option.selected::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-round);
    animation: pulse-ring 1.5s ease infinite;
}

@keyframes pulse-ring {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.color-option.taken {
    opacity: 0.3;
    cursor: not-allowed;
    transform: scale(0.9);
}

.color-option.taken::before {
    content: '✕';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.7);
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
}

.color-option.taken:hover {
    transform: scale(0.9);
}

/* ============================================================================
   VIRUS PICKER
   ============================================================================ */

.virus-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.virus-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: rgba(40, 40, 60, 0.3);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.virus-option:hover {
    background: rgba(50, 50, 70, 0.5);
    transform: translateY(-2px);
}

.virus-option.selected {
    border-color: var(--color-primary);
    background: rgba(255, 140, 50, 0.1);
}

.virus-option .virus-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.virus-option .virus-name {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-align: center;
}

.virus-option.selected .virus-name {
    color: var(--color-primary);
}

/* Compact Variants */
.color-picker.compact {
    gap: 12px;
}

.color-picker.compact .color-option {
    width: 28px;
    height: 28px;
    border-width: 2px;
}

.virus-picker.compact {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.virus-picker.compact .virus-option {
    padding: var(--space-xs) 2px;
    min-width: 0;
}

.virus-picker.compact .virus-option .virus-icon {
    font-size: 1.1rem;
}

.virus-picker.compact .virus-option .virus-name {
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ============================================================================
   COSMETICS - Kosmetik-Panel Styles
   ============================================================================ */

.cosmetic-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    text-align: center;
}

.cosmetic-stat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-xs);
}

.cosmetic-stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.cosmetic-stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cosmetic-category-title {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cosmetic-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.cosmetic-grid-wide {
    grid-template-columns: repeat(3, 1fr);
}

.cosmetic-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-align: center;
}

.cosmetic-item:hover:not(.cosmetic-locked) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.cosmetic-item.cosmetic-active {
    border-color: var(--color-primary);
    background: rgba(var(--color-primary-rgb, 255, 140, 50), 0.15);
    box-shadow: 0 0 12px rgba(var(--color-primary-rgb, 255, 140, 50), 0.3);
}

.cosmetic-item.cosmetic-locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.cosmetic-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.cosmetic-name {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cosmetic-req {
    font-size: 0.6rem;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

/* Player cosmetic indicators in lobby/game lists */
.player-skin-icon {
    font-size: 0.9rem;
    margin-right: 4px;
    line-height: 1;
}

.player-title-badge {
    font-size: 0.65rem;
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb, 255, 140, 50), 0.15);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: 4px;
    white-space: nowrap;
}

/* Form compact styles */
.form-row.compact {
    gap: var(--space-lg);
    align-items: flex-end;
}

.form-control-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.85rem;
}

/* Options row (inline checkboxes) */
.options-row {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-sm) 0;
    margin-bottom: var(--space-sm);
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.checkbox-inline:has(input:checked) span {
    color: var(--color-primary);
}

/* Random fill range slider */
.random-fill-range {
    background: rgba(40, 40, 60, 0.3);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.range-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.range-label-row label {
    font-size: 0.8rem;
    margin: 0;
}

.range-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-primary);
    font-weight: 600;
}

.dual-range-container {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}

.dual-range-container .range-slider {
    position: absolute;
    left: 0;
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.dual-range-container .range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 6px var(--color-primary-glow);
}

.dual-range-container .range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: none;
}

.dual-range-container::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 140, 50, 0.2);
    border-radius: 2px;
}

.range-marks {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--color-text-dark);
    padding: 0;
    margin-top: 4px;
}

.range-marks span {
    width: 18px;
    text-align: center;
}

/* Slot configurator compact */
.slot-configurator.compact .slot-config {
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-xs);
}

.slot-configurator.compact .slot-config select {
    padding: 2px 4px;
    font-size: 0.75rem;
    min-width: 55px;
}

.slot-configurator.compact .slot-label {
    font-size: 0.8rem;
    min-width: 45px;
}

/* ============================================================================
   GAME CODE DISPLAY
   ============================================================================ */

.game-code {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: 6px;
    text-align: center;
    color: var(--color-primary);
    padding: var(--space-md);
    background: rgba(255, 140, 50, 0.1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    user-select: all;
}

.game-code-input {
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    font-size: 1.5rem;
    font-family: var(--font-mono);
}

/* ============================================================================
   PLAYER LIST
   ============================================================================ */

.player-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.player-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(40, 40, 60, 0.3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.player-item:hover {
    background: rgba(50, 50, 70, 0.4);
}

.player-item.current {
    border: 1px solid var(--color-primary);
    background: rgba(255, 140, 50, 0.1);
}

.player-item.eliminated {
    opacity: 0.4;
}

.player-item.eliminated .player-name {
    text-decoration: line-through;
}

.player-item.disconnected {
    opacity: 0.5;
}

.player-item.empty {
    opacity: 0.4;
    border-style: dashed;
}

.player-item.empty .player-color {
    border: 2px dashed #555;
    background: transparent !important;
}

.player-color {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-round);
    flex-shrink: 0;
}

.player-name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-stats {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.player-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: #fff;
    text-transform: uppercase;
    font-weight: 600;
}

.player-badge.ai {
    background: var(--color-secondary);
}

.player-badge.offline {
    background: var(--color-error);
    animation: pulse-warning 1s ease-in-out infinite;
}

.player-badge.thinking {
    background: var(--color-warning);
    color: #000;
    animation: thinking-pulse 0.8s ease-in-out infinite;
    white-space: nowrap;
}

.player-badge.thinking::after {
    content: '';
    display: inline-block;
    animation: thinking-dots 1.4s infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes thinking-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes thinking-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Player item thinking state */
.player-item.thinking {
    background: rgba(255, 180, 50, 0.15);
}

.player-item.thinking .player-color {
    animation: thinking-glow 1s ease-in-out infinite;
}

@keyframes thinking-glow {
    0%, 100% {
        box-shadow: 0 0 5px currentColor;
    }
    50% {
        box-shadow: 0 0 15px currentColor, 0 0 25px currentColor;
    }
}

.btn-remove-ai {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: rgba(255, 60, 60, 0.3);
    color: var(--color-danger);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    margin-left: auto;
    transition: all var(--transition-fast);
}

.btn-remove-ai:hover {
    background: var(--color-danger);
    color: #fff;
}

/* AI Controls */
.ai-controls {
    padding: var(--space-sm);
    background: rgba(100, 100, 120, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================================
   SLOT CONFIGURATOR - Create Panel
   ============================================================================ */

.slot-configurator {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-sm);
    background: rgba(30, 30, 40, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slot-config-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(40, 40, 60, 0.5);
    border-radius: var(--radius-md);
}

.slot-config-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 100px;
}

.slot-number {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.slot-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    font-weight: 600;
}

.slot-badge.host {
    background: var(--color-primary);
    color: #fff;
}

.slot-config-info {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.slot-config-controls {
    display: flex;
    gap: var(--space-sm);
    flex: 1;
}

.slot-config-controls .form-control-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    min-height: 32px;
}

/* ============================================================================
   SLOT LIST - Lobby Panel
   ============================================================================ */

.slot-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.slot-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(40, 40, 60, 0.4);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
}

.slot-item.filled {
    background: rgba(60, 60, 80, 0.5);
}

.slot-item.empty {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: rgba(30, 30, 50, 0.3);
}

.slot-item.blocked {
    opacity: 0.5;
    background: rgba(40, 40, 50, 0.3);
}

.slot-item.ai {
    background: rgba(100, 80, 150, 0.3);
    border: 1px solid rgba(155, 93, 229, 0.3);
}

.slot-item.disconnected {
    opacity: 0.6;
}

.slot-color {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-round);
    flex-shrink: 0;
}

.slot-color.empty-color {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    background: transparent;
}

.slot-status-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.slot-label {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slot-status {
    font-size: 0.9rem;
    margin-left: auto;
}

.slot-status.ready {
    color: var(--color-success);
}

.slot-status.waiting {
    color: var(--color-text-muted);
}

.btn-slot-edit {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all var(--transition-fast);
    opacity: 0;
}

.slot-item:hover .btn-slot-edit {
    opacity: 1;
}

.btn-slot-edit:hover {
    background: var(--color-primary);
    color: #fff;
}

/* Kompakte Slots für viele Spieler (7+) */
.slot-list.compact-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
}

.slot-list.compact-slots .slot-item {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
    font-size: 0.85rem;
}

.slot-list.compact-slots .slot-color {
    width: 18px;
    height: 18px;
}

.slot-list.compact-slots .slot-status-icon {
    width: 18px;
    height: 18px;
    font-size: 0.75rem;
}

.slot-list.compact-slots .btn-slot-edit {
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
}

/* Extra kompakt für 9-10 Spieler */
.slot-list.extra-compact-slots {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.slot-list.extra-compact-slots .slot-item {
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-xs);
    font-size: 0.8rem;
}

.slot-list.extra-compact-slots .slot-color {
    width: 14px;
    height: 14px;
}

.slot-list.extra-compact-slots .slot-status-icon {
    width: 14px;
    height: 14px;
    font-size: 0.7rem;
}

.slot-list.extra-compact-slots .slot-label {
    max-width: 80px;
}

/* ============================================================================
   SLOT EDIT MODAL
   ============================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--color-bg-panel);
    border: 1px solid rgba(255, 140, 50, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    width: 90%;
    max-width: 320px;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: var(--space-lg);
    color: var(--color-primary);
}

@keyframes animate-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: animate-scale-in 0.2s ease;
}

/* Flex utilities */
.flex-1 {
    flex: 1;
}

/* ============================================================================
   CURRENT TURN INDICATOR
   ============================================================================ */

.turn-indicator {
    padding: var(--space-md);
    background: rgba(255, 140, 50, 0.15);
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: var(--space-md);
}

.turn-indicator .label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.turn-indicator .name {
    font-size: 1.3rem;
    font-weight: 600;
}

.turn-indicator.my-turn {
    background: rgba(100, 200, 100, 0.15);
    border: 1px solid rgba(100, 200, 100, 0.3);
    animation: pulse-glow 2s ease infinite;
}

.turn-indicator .placement-hint {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(100, 200, 255, 0.2);
    border: 1px solid rgba(100, 200, 255, 0.4);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--color-info);
    animation: pulse-glow 1.5s ease infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(100, 200, 100, 0.2); }
    50% { box-shadow: 0 0 20px rgba(100, 200, 100, 0.4); }
}

/* ============================================================================
   CHAT
   ============================================================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 280px;
    background: var(--color-bg-panel);
    border: 1px solid rgba(255, 140, 50, 0.2);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.chat-message {
    margin-bottom: var(--space-sm);
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-message .sender {
    font-weight: 600;
}

.chat-message .text {
    color: var(--color-text-muted);
}

.chat-message.system {
    color: var(--color-primary);
    font-style: italic;
}

.chat-input-container {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-container input {
    flex: 1;
    padding: var(--space-md);
    background: rgba(30, 30, 40, 0.8);
    border: none;
    color: var(--color-text);
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    background: rgba(40, 40, 50, 0.9);
}

.chat-input-container button {
    padding: var(--space-md) var(--space-lg);
    background: var(--color-primary);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.chat-input-container button:hover {
    background: var(--color-primary-dark);
}

/* ============================================================================
   GAME LIST
   ============================================================================ */

.games-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
}

.game-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: rgba(40, 40, 60, 0.5);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.game-list-item:hover {
    background: rgba(60, 60, 80, 0.6);
}

.game-list-item .info {
    flex: 1;
}

.game-list-item .host {
    font-weight: 600;
    margin-bottom: 2px;
}

.game-list-item .meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.game-list-item .join-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
}

.game-list-item.has-password {
    border-left: 3px solid var(--color-warning, #f0ad4e);
}

.game-list-item .lock-icon {
    font-size: 0.9em;
    margin-right: 4px;
    opacity: 0.9;
}

.no-games {
    text-align: center;
    color: var(--color-text-dark);
    padding: var(--space-xxl);
}

.badge-speed {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: var(--radius-pill, 20px);
    background: var(--color-warning, #f0ad4e);
    color: #000;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Live-Spiel und Zuschauer Badges
 * @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de */
.badge-playing {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: var(--radius-pill, 20px);
    background: #e74c3c;
    color: #fff;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 6px;
    vertical-align: middle;
    animation: pulse-badge 1.5s ease infinite;
}

.badge-spectator {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: var(--radius-pill, 20px);
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-text-muted);
    margin-left: 4px;
    vertical-align: middle;
}

.game-list-item.is-playing {
    opacity: 0.85;
    border-left: 2px solid #e74c3c;
}

/* Spectate button in game list
 * @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de */
.spectate-btn {
    padding: 4px 12px;
    border: 1px solid rgba(100, 200, 255, 0.4);
    background: rgba(100, 200, 255, 0.12);
    color: #64c8ff;
    border-radius: var(--radius-pill, 20px);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.spectate-btn:hover {
    background: rgba(100, 200, 255, 0.25);
    border-color: rgba(100, 200, 255, 0.6);
}
.spectate-btn.small {
    padding: 2px 8px;
    font-size: 0.65rem;
}

/* Spectator badge (eye icon + count) in game/landing lists */
.spectator-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    color: var(--color-text-muted, #999);
    margin-left: 6px;
    white-space: nowrap;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================================================
   CONNECTION STATUS
   ============================================================================ */

.connection-status {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: var(--z-toast);
    transition: all var(--transition-normal);
}

.connection-status.connected {
    background: rgba(100, 200, 100, 0.2);
    color: var(--color-success);
    border: 1px solid rgba(100, 200, 100, 0.4);
}

.connection-status.disconnected {
    background: rgba(255, 80, 80, 0.2);
    color: var(--color-error);
    border: 1px solid rgba(255, 80, 80, 0.4);
}

.connection-status.connecting {
    background: rgba(255, 200, 50, 0.2);
    color: var(--color-warning);
    border: 1px solid rgba(255, 200, 50, 0.4);
}

/* ============================================================================
   ROUND INDICATOR
   ============================================================================ */

.round-indicator {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-bg-panel);
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    border: 1px solid rgba(255, 140, 50, 0.2);
}

/* ============================================================================
   WINNER OVERLAY
   ============================================================================ */

.winner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn 0.5s ease;
}

.winner-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.winner-content {
    text-align: center;
    animation: scaleIn 0.5s ease 0.2s both;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.winner-content h1 {
    font-size: 3.5rem;
    margin-bottom: var(--space-lg);
    text-shadow: 0 0 30px var(--color-primary-glow);
}

.winner-content .winner-name {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: var(--space-xl);
}

.winner-content .stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
    color: var(--color-text-muted);
}

.winner-content .stat {
    text-align: center;
}

.winner-content .stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text);
}

.winner-content .stat-label {
    font-size: 0.85rem;
}

/* Points Winner Section */
.points-winner-section {
    margin: var(--space-lg) 0;
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 140, 50, 0.05) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--radius-lg);
    animation: fadeIn 0.5s ease 0.5s both;
}

.points-winner-section.hidden {
    display: none;
}

.points-winner-section.my-points-victory {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 140, 50, 0.1) 100%);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.points-winner-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
    margin: 0 auto var(--space-sm);
}

.points-winner-label {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.points-winner-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.points-winner-score {
    font-size: 1.1rem;
    color: #ffd700;
    font-weight: 500;
}

/* Final Ranking */
.final-ranking {
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    animation: fadeIn 0.5s ease 0.6s both;
}

.final-ranking-title {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.final-ranking-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.final-rank-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.final-rank-item.my-rank {
    background: rgba(255, 140, 50, 0.15);
    border: 1px solid rgba(255, 140, 50, 0.3);
}

.rank-position {
    width: 28px;
    text-align: center;
    font-size: 1.1rem;
}

.rank-name {
    flex: 1;
    font-weight: 500;
    text-align: left;
}

.rank-points {
    color: #ffd700;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

.rank-crown {
    font-size: 1rem;
    margin-left: var(--space-xs);
}

/* Player Stats Detail (Post-Game)
 * @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de */
.player-stats-detail {
    margin: var(--space-md) 0;
    animation: fadeIn 0.5s ease 0.8s both;
}
.stats-detail-title {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}
.stats-detail-grid {
    display: grid;
    grid-template-columns: 1fr repeat(4, 55px);
    gap: 2px 0;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
}
.stats-header {
    display: contents;
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}
.stats-header span {
    padding: 2px 4px;
    text-align: center;
}
.stats-header span:first-child {
    text-align: left;
}
.stats-row {
    display: contents;
}
.stats-row span {
    padding: 3px 4px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.stats-row .stats-player {
    text-align: left;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================================
   TOOLTIP
   ============================================================================ */

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 140, 50, 0.5);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: var(--z-dropdown);
    max-width: 200px;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip-title {
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
}

.tooltip-label {
    color: var(--color-text-muted);
}

/* ============================================================================
   PILL NOTIFICATION
   ============================================================================ */

.pill-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 0 30px rgba(255, 140, 50, 0.5);
}

.pill-notification.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pill-notification .pill-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    animation: pill-pulse 1s ease-in-out infinite;
}

.pill-notification .pill-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.pill-notification .pill-type {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
}

.pill-notification .pill-effect {
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

@keyframes pill-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 140, 50, 0.5); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 140, 50, 0.8); }
}

/* Pill type colors */
.pill-notification.neutralizer .pill-icon { background: linear-gradient(135deg, #888, #666); }
.pill-notification.mutation1 .pill-icon { background: linear-gradient(135deg, #4cff4c, #2a2); }
.pill-notification.mutation2 .pill-icon { background: linear-gradient(135deg, #b04cff, #82e); }
.pill-notification.mutation3 .pill-icon { background: linear-gradient(135deg, #ff4cb0, #e28); }
.pill-notification.swallow .pill-icon { background: linear-gradient(135deg, #222, #000); }
.pill-notification.boost .pill-icon { background: linear-gradient(135deg, #ffff00, #cc0); }
.pill-notification.freeze .pill-icon { background: linear-gradient(135deg, #4cffff, #0cc); }
.pill-notification.sniper .pill-icon { background: linear-gradient(135deg, #ff8000, #c60); }
.pill-notification.shuffle .pill-icon { background: linear-gradient(135deg, #ff00ff, #c0c); }
.pill-notification.magnet .pill-icon { background: linear-gradient(135deg, #ff0000, #c00); }
.pill-notification.poison .pill-icon { background: linear-gradient(135deg, #80ff00, #6c0); }
.pill-notification.mystery .pill-icon { background: linear-gradient(135deg, #fff, #ccc); }

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 140, 50, 0.2);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-round);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-xxl);
    color: var(--color-text-muted);
}

/* ============================================================================
   CAMERA SYNC CONTROLS
   ============================================================================ */

.camera-sync-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sync-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    flex: 1;
}

.sync-toggle input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.sync-toggle-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.sync-toggle:hover .sync-toggle-label,
.sync-toggle input:checked + .sync-toggle-label {
    color: var(--color-text);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* ============================================================================
   TURN NOTIFICATION
   ============================================================================ */

.turn-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.turn-notification.visible {
    opacity: 1;
}

.turn-notification-content {
    padding: var(--space-lg) var(--space-xxl);
    border-radius: var(--radius-lg);
    background: var(--turn-color, var(--color-primary));
    box-shadow:
        0 0 40px var(--turn-color, var(--color-primary)),
        0 0 80px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.turn-notification.visible .turn-notification-content {
    transform: scale(1);
}

.turn-notification-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Eigener Zug - größer und auffälliger */
.turn-notification.my-turn .turn-notification-content {
    padding: var(--space-xl) var(--space-xxl);
    animation: pulse-glow 0.5s ease-out;
}

.turn-notification.my-turn .turn-notification-name {
    font-size: 2.5rem;
}

.turn-notification.my-turn .turn-notification-content::before {
    content: '▶ ';
    margin-right: var(--space-sm);
}

.turn-notification.my-turn .turn-notification-content::after {
    content: ' ◀';
    margin-left: var(--space-sm);
}

@keyframes pulse-glow {
    0% {
        box-shadow:
            0 0 40px var(--turn-color, var(--color-primary)),
            0 0 80px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            0 0 60px var(--turn-color, var(--color-primary)),
            0 0 120px var(--turn-color, var(--color-primary)),
            0 0 80px rgba(0, 0, 0, 0.5);
    }
    100% {
        box-shadow:
            0 0 40px var(--turn-color, var(--color-primary)),
            0 0 80px rgba(0, 0, 0, 0.5);
    }
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
    }

    .panel {
        padding: 12px 16px;
        border-radius: var(--radius-lg);
        max-height: calc(100dvh - 60px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .panel-center {
        width: calc(100% - 32px) !important;
        max-width: 400px;
        max-height: calc(100dvh - 60px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .panel-top-left,
    .panel-bottom-left {
        left: var(--space-md);
        right: var(--space-md);
        width: auto !important;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.1rem; }

    .game-code {
        font-size: 1.8rem;
        letter-spacing: 4px;
    }

    .btn {
        padding: var(--space-md);
    }

    .color-option {
        width: 36px;
        height: 36px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        margin-bottom: 8px;
    }

    .form-control {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    label {
        font-size: 0.85rem;
    }

    .winner-content h1 {
        font-size: 2.5rem;
    }

    .winner-content .winner-name {
        font-size: 1.8rem;
    }

    .chat-container {
        height: 200px;
    }

    .round-indicator {
        top: var(--space-md);
        right: var(--space-md);
        font-size: 0.8rem;
        padding: var(--space-xs) var(--space-md);
    }

    .cosmetic-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .cosmetic-grid-wide {
        grid-template-columns: repeat(2, 1fr);
    }

    .cosmetic-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Canvas: fill available space in portrait */
    #canvas-container {
        height: 100dvh;
        min-height: 250px;
    }

    /* Auth header: compact on mobile */
    .auth-header {
        padding: 4px 10px;
        gap: 4px;
        font-size: 0.75rem;
    }

    .auth-nav-link {
        font-size: 0.7rem;
        padding: 2px 4px;
    }

    .auth-username {
        font-size: 0.75rem;
    }

    .auth-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }
}

/* Portrait-specific canvas sizing */
@media (max-width: 768px) and (orientation: portrait) {
    #app {
        height: 100dvh;
        flex-direction: column;
    }

    #canvas-container {
        height: 100dvh;
        flex: 1;
    }
}

@media (max-width: 480px) {
    .panel-top-left {
        top: auto;
        bottom: var(--space-md);
    }

    .panel {
        padding: 8px 12px;
    }

    .panel-center {
        max-height: calc(100dvh - 40px);
    }

    .connection-status {
        font-size: 0.65rem;
        padding: var(--space-xs) var(--space-sm);
    }

    .virus-picker {
        grid-template-columns: repeat(2, 1fr);
    }

    .virus-option {
        padding: var(--space-sm);
    }

    .virus-option .virus-icon {
        font-size: 1.2rem;
    }

    .player-list {
        max-height: 150px;
        overflow-y: auto;
    }

    .turn-indicator .name {
        font-size: 1.1rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    h1 { font-size: 1.3rem; }
    h2 { font-size: 1rem; }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .panel-center {
        max-height: 90vh;
        overflow-y: auto;
    }

    .panel-header {
        margin-bottom: var(--space-md);
    }

    .panel-header h1 {
        font-size: 1.5rem;
    }

    .form-group {
        margin-bottom: var(--space-sm);
    }

    .game-code {
        font-size: 1.5rem;
        padding: var(--space-sm);
        margin-bottom: var(--space-md);
    }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .color-option {
        width: 44px;
        height: 44px;
    }

    .virus-option {
        min-height: 60px;
    }

    .quickchat-btn {
        min-height: 40px;
        min-width: 80px;
    }

    .chat-input-container input {
        font-size: 16px; /* Prevents iOS zoom */
    }

    .form-control {
        font-size: 16px; /* Prevents iOS zoom */
        min-height: 44px;
    }

    /* Feature 8: Larger touch targets for game elements */
    .color-option {
        width: 56px;
        height: 56px;
    }

    .virus-option {
        min-height: 72px;
    }

    .btn {
        min-height: 48px;
    }

    /* Feature 6: Fullscreen button (touch devices only) */
    .fullscreen-btn {
        display: flex;
    }
}

/* ============================================================================
   ROTATE DEVICE HINT (Feature 5)
   ============================================================================ */

/* Rotate hint: dismissible top banner (not a full-screen blocker) */
.rotate-hint {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: #fff;
    font-size: 0.8rem;
    text-align: center;
    padding: 8px 16px;
}

.rotate-hint-icon {
    font-size: 1.2rem;
    animation: rotateHintPulse 2s ease-in-out infinite;
}

@keyframes rotateHintPulse {
    0%, 100% { transform: rotate(0deg); opacity: 0.8; }
    50% { transform: rotate(15deg); opacity: 1; }
}

.rotate-hint-dismiss {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1rem;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-round);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: var(--space-sm);
    flex-shrink: 0;
}

@media (max-width: 768px) and (orientation: portrait) {
    .rotate-hint:not(.dismissed) {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rotate-hint-icon {
        animation: none;
    }
}

/* ============================================================================
   FULLSCREEN BUTTON (Feature 6)
   ============================================================================ */

.fullscreen-btn {
    display: none; /* Shown only on touch devices via @media (pointer: coarse) */
    position: fixed;
    top: var(--space-md);
    right: 70px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 140, 50, 0.4);
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.fullscreen-btn:hover,
.fullscreen-btn:active {
    background: rgba(255, 140, 50, 0.2);
    box-shadow: 0 0 12px rgba(255, 140, 50, 0.3);
}

/* ============================================================================
   MOBILE GAME HUD (Feature 7)
   ============================================================================ */

@media (max-width: 768px) {
    #game-ui {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: auto !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: var(--space-sm) var(--space-md);
        max-height: 35vh;
        overflow-y: auto;
        z-index: 500;
    }

    #game-ui .player-list {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xs);
        max-height: none;
    }

    #game-ui .player-item {
        flex: 1 1 45%;
        padding: var(--space-xs);
        font-size: 0.8rem;
    }

    #chat-panel {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        width: auto !important;
        max-height: 40vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        z-index: 501;
        transition: transform var(--transition-normal);
    }

    #chat-panel.hidden {
        transform: translateY(100%);
    }

    #quickchat-panel {
        bottom: auto;
        top: 0;
        left: 0;
        right: 0;
        width: auto !important;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }

    #round-indicator {
        top: var(--space-sm);
        right: var(--space-sm);
        font-size: 0.75rem;
        padding: var(--space-xs) var(--space-sm);
    }

    .turn-indicator .name {
        font-size: 1rem;
    }

    .current-turn {
        padding: var(--space-xs) var(--space-sm);
        margin-bottom: var(--space-sm);
    }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-up {
    animation: slideUp 0.3s ease;
}

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

.animate-bounce {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.flex-wrap { flex-wrap: wrap; }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.w-full { width: 100%; }

/* ============================================================================
   SOUND CONTROLS
   ============================================================================ */

.sound-controls {
    position: fixed;
    top: var(--space-md);
    right: 120px; /* Neben connection-status */
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    z-index: var(--z-toast);
}

.btn-sound {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(30, 30, 40, 0.8);
    border-radius: var(--radius-round);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 140, 50, 0.2);
}

.btn-sound:hover {
    background: rgba(50, 50, 60, 0.9);
    border-color: rgba(255, 140, 50, 0.5);
}

.btn-sound:active {
    transform: scale(0.95);
}

.btn-sound .sound-icon {
    display: block;
    line-height: 1;
}

.btn-sound.muted {
    opacity: 0.6;
}

.btn-sound.muted .sound-icon-on {
    display: none;
}

.btn-sound.muted .sound-icon-off {
    display: block;
}

.btn-sound:not(.muted) .sound-icon-on {
    display: block;
}

.btn-sound:not(.muted) .sound-icon-off {
    display: none;
}

.sound-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 140, 50, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-normal), width var(--transition-normal);
    width: 0;
}

.sound-controls:hover .sound-slider,
.sound-slider:focus {
    opacity: 1;
    width: 80px;
}

.sound-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--color-primary-glow);
    transition: transform var(--transition-fast);
}

.sound-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.sound-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px var(--color-primary-glow);
}

/* Responsive Sound Controls */
@media (max-width: 768px) {
    .sound-controls {
        right: 100px;
    }

    .btn-sound {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .sound-controls:hover .sound-slider,
    .sound-slider:focus {
        width: 60px;
    }
}

@media (max-width: 480px) {
    .sound-controls {
        right: auto;
        left: var(--space-md);
        top: auto;
        bottom: var(--space-md);
    }

    .sound-slider {
        display: none;
    }
}

/* ============================================================================
   GAME SETTINGS TOGGLE
   @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de
   ============================================================================ */

.game-settings-toggle {
    position: fixed;
    top: var(--space-md);
    right: 60px;
    z-index: var(--z-toast);
}

.game-settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    min-width: 220px;
    backdrop-filter: blur(10px);
}

.game-settings-dropdown.hidden {
    display: none;
}

.gs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.gs-row label {
    flex-shrink: 0;
    white-space: nowrap;
}

.gs-row input[type="range"] {
    width: 70px;
    height: 4px;
    accent-color: var(--color-primary);
}

.gs-row select {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    font-size: 0.78rem;
}

.gs-row input[type="checkbox"] {
    accent-color: var(--color-primary);
}

.gs-row span {
    min-width: 35px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ============================================================================
   STATS PANEL
   ============================================================================ */

#stats-panel {
    top: var(--space-lg);
    right: var(--space-lg);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255, 140, 50, 0.2);
    margin-bottom: var(--space-md);
}

.stats-round {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.stats-round span {
    font-weight: bold;
    color: var(--color-primary);
}

.stats-timers-inline {
    display: flex;
    gap: var(--space-md);
}

.timer-inline {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.timer-inline span {
    color: var(--color-primary);
    font-weight: bold;
}

.timer-inline.turn span {
    color: var(--color-info);
}

.stats-ranking {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 200px;
    overflow-y: auto;
}

.ranking-item {
    display: grid;
    grid-template-columns: 20px 12px 1fr 45px 35px 35px;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.ranking-item.is-me {
    background: rgba(255, 140, 50, 0.15);
    border: 1px solid rgba(255, 140, 50, 0.3);
}

.ranking-item.eliminated {
    opacity: 0.4;
    text-decoration: line-through;
}

.ranking-position {
    font-weight: bold;
    color: var(--color-primary);
}

.ranking-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.ranking-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-points,
.ranking-fields,
.ranking-value,
.ranking-percent {
    text-align: right;
    font-family: var(--font-mono);
}

.ranking-points {
    color: #ffd700;
    font-weight: bold;
}

.ranking-percent {
    color: var(--color-primary);
    font-weight: bold;
}

.stats-total {
    display: flex;
    justify-content: space-between;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 140, 50, 0.2);
    margin-top: var(--space-md);
}

.total-label {
    color: var(--color-text-muted);
}

/* ============================================================================
   PUNKTE & STATISTIK ANZEIGE
   ============================================================================ */

.points-display {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 140, 50, 0.1) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    position: relative;
    overflow: hidden;
}

.points-main {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.points-icon {
    font-size: 1.5rem;
}

.points-value {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    font-family: var(--font-mono);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.points-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

.points-change {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    font-weight: bold;
    color: #4ade80;
    animation: points-pop 0.6s ease-out forwards;
}

.points-change.negative {
    color: #f87171;
}

@keyframes points-pop {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-100%) scale(1);
    }
}

/* Statistik-Reihen */
.my-stats,
.field-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
}

.stat-row .stat-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.stat-row .stat-label {
    flex: 1;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.stat-row .stat-value {
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--color-text);
    min-width: 35px;
    text-align: right;
}

.stat-row.neutral .stat-value {
    color: #888;
}

.stats-divider {
    height: 1px;
    background: rgba(255, 140, 50, 0.2);
    margin: var(--space-sm) 0;
}

.total-value {
    font-weight: bold;
    color: var(--color-info);
}

/* Stats Panel Responsive */
@media (max-width: 768px) {
    #stats-panel {
        top: auto;
        bottom: var(--space-lg);
        right: var(--space-md);
        left: var(--space-md);
        width: auto !important;
    }

    .stats-header {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .stats-ranking {
        max-height: 120px;
    }

    .ranking-item {
        grid-template-columns: 20px 10px 1fr 35px 35px 35px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    .stats-timers-inline {
        width: 100%;
        justify-content: space-between;
    }

    .timer-inline {
        font-size: 0.8rem;
    }

    .ranking-item {
        grid-template-columns: 18px 10px 1fr 30px 30px;
        font-size: 0.7rem;
    }

    .ranking-value {
        display: none;
    }
}

/* ============================================================================
   COMBO COUNTER
   ============================================================================ */

.combo-counter {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.combo-counter:not(.hidden) {
    opacity: 1;
}

.combo-counter .combo-number {
    font-size: 120px;
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow: 
        0 0 20px var(--combo-color, #ff8c32),
        0 0 40px var(--combo-color, #ff8c32),
        0 0 60px var(--combo-color, #ff8c32),
        0 4px 0 rgba(0,0,0,0.3);
    animation: combo-pulse 0.3s ease-out;
}

.combo-counter .combo-text {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--combo-color, #ff8c32);
    text-transform: uppercase;
    text-shadow:
        0 0 20px var(--combo-color, #ff8c32),
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000,
        0 3px 6px rgba(0, 0, 0, 0.8);
    margin-top: -10px;
}

.combo-counter.combo-mega .combo-number {
    font-size: 150px;
    animation: combo-mega 0.4s ease-out;
}

.combo-counter.combo-mega .combo-text {
    font-size: 40px;
    text-shadow:
        0 0 30px var(--combo-color, #ff8c32),
        -3px -3px 0 #000,
        3px -3px 0 #000,
        -3px 3px 0 #000,
        3px 3px 0 #000,
        0 4px 8px rgba(0, 0, 0, 0.9);
}

.combo-counter.combo-unstoppable .combo-number {
    font-size: 180px;
    animation: combo-unstoppable 0.5s ease-out;
}

.combo-counter.combo-unstoppable .combo-text {
    font-size: 48px;
    letter-spacing: 12px;
    text-shadow:
        0 0 40px var(--combo-color, #ff8c32),
        -4px -4px 0 #000,
        4px -4px 0 #000,
        -4px 4px 0 #000,
        4px 4px 0 #000,
        0 5px 10px rgba(0, 0, 0, 0.9);
}

@keyframes combo-pulse {
    0% { transform: scale(1.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes combo-mega {
    0% { transform: scale(2); opacity: 0; }
    30% { transform: scale(1.2) rotate(-3deg); }
    60% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes combo-unstoppable {
    0% { transform: scale(2.5); opacity: 0; }
    20% { transform: scale(1.3) rotate(-5deg); }
    40% { transform: scale(1.2) rotate(4deg); }
    60% { transform: scale(1.15) rotate(-2deg); }
    80% { transform: scale(1.05) rotate(1deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Weitere Combo-Stufen */
.combo-counter.combo-double .combo-number { font-size: 100px; }
.combo-counter.combo-triple .combo-number { font-size: 110px; }
.combo-counter.combo-great .combo-number { font-size: 120px; }
.combo-counter.combo-super .combo-number { font-size: 130px; animation: combo-mega 0.4s ease-out; }
.combo-counter.combo-amazing .combo-number { font-size: 140px; animation: combo-mega 0.4s ease-out; }
.combo-counter.combo-ultra .combo-number { font-size: 150px; animation: combo-mega 0.4s ease-out; }
.combo-counter.combo-monster .combo-number { font-size: 160px; animation: combo-unstoppable 0.5s ease-out; }
.combo-counter.combo-rampage .combo-number { font-size: 165px; animation: combo-unstoppable 0.5s ease-out; }
.combo-counter.combo-insane .combo-number { font-size: 170px; animation: combo-unstoppable 0.5s ease-out; }
.combo-counter.combo-godlike .combo-number { font-size: 180px; animation: combo-epic 0.6s ease-out; }
.combo-counter.combo-domination .combo-number { font-size: 185px; animation: combo-epic 0.6s ease-out; }
.combo-counter.combo-apocalypse .combo-number { font-size: 190px; animation: combo-epic 0.6s ease-out; }
.combo-counter.combo-catastrophe .combo-number { font-size: 195px; animation: combo-legendary 0.7s ease-out; }
.combo-counter.combo-legendary .combo-number { font-size: 200px; animation: combo-legendary 0.7s ease-out; }
.combo-counter.combo-mythical .combo-number { font-size: 210px; animation: combo-legendary 0.7s ease-out; }
.combo-counter.combo-infinite .combo-number { font-size: 220px; animation: combo-perfection 0.8s ease-out; }
.combo-counter.combo-transcendent .combo-number { font-size: 230px; animation: combo-perfection 0.8s ease-out; }
.combo-counter.combo-perfection .combo-number { font-size: 250px; animation: combo-perfection 0.8s ease-out; }

/* Combo Text Größen */
.combo-counter.combo-double .combo-text,
.combo-counter.combo-triple .combo-text,
.combo-counter.combo-great .combo-text { font-size: 28px; }

.combo-counter.combo-super .combo-text,
.combo-counter.combo-amazing .combo-text { font-size: 34px; }

.combo-counter.combo-ultra .combo-text,
.combo-counter.combo-monster .combo-text,
.combo-counter.combo-rampage .combo-text { font-size: 40px; }

.combo-counter.combo-insane .combo-text,
.combo-counter.combo-godlike .combo-text,
.combo-counter.combo-domination .combo-text { font-size: 48px; letter-spacing: 10px; }

.combo-counter.combo-apocalypse .combo-text,
.combo-counter.combo-catastrophe .combo-text,
.combo-counter.combo-legendary .combo-text { font-size: 54px; letter-spacing: 12px; }

.combo-counter.combo-mythical .combo-text,
.combo-counter.combo-infinite .combo-text,
.combo-counter.combo-transcendent .combo-text { font-size: 60px; letter-spacing: 14px; }

.combo-counter.combo-perfection .combo-text { font-size: 70px; letter-spacing: 16px; }

/* Epic Animation */
@keyframes combo-epic {
    0% { transform: scale(3); opacity: 0; }
    15% { transform: scale(1.4) rotate(-6deg); }
    30% { transform: scale(1.25) rotate(5deg); }
    45% { transform: scale(1.15) rotate(-3deg); }
    60% { transform: scale(1.1) rotate(2deg); }
    80% { transform: scale(1.03) rotate(-1deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Legendary Animation */
@keyframes combo-legendary {
    0% { transform: scale(3.5); opacity: 0; filter: brightness(2); }
    10% { transform: scale(1.5) rotate(-8deg); filter: brightness(1.5); }
    25% { transform: scale(1.3) rotate(6deg); }
    40% { transform: scale(1.2) rotate(-4deg); }
    55% { transform: scale(1.12) rotate(3deg); }
    70% { transform: scale(1.06) rotate(-2deg); }
    85% { transform: scale(1.02) rotate(1deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; filter: brightness(1); }
}

/* Perfection Animation */
@keyframes combo-perfection {
    0% { transform: scale(4); opacity: 0; filter: brightness(3) hue-rotate(0deg); }
    10% { transform: scale(1.6) rotate(-10deg); filter: brightness(2) hue-rotate(30deg); }
    20% { transform: scale(1.4) rotate(8deg); filter: brightness(1.8) hue-rotate(60deg); }
    35% { transform: scale(1.25) rotate(-5deg); filter: brightness(1.5) hue-rotate(90deg); }
    50% { transform: scale(1.15) rotate(4deg); filter: brightness(1.3) hue-rotate(120deg); }
    65% { transform: scale(1.08) rotate(-2deg); filter: brightness(1.2) hue-rotate(150deg); }
    80% { transform: scale(1.03) rotate(1deg); filter: brightness(1.1) hue-rotate(180deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; filter: brightness(1) hue-rotate(0deg); }
}

/* Spezielle Farben für höhere Combos */
.combo-counter.combo-godlike { --combo-color: #ffd700; }
.combo-counter.combo-domination { --combo-color: #ff6b00; }
.combo-counter.combo-apocalypse { --combo-color: #ff0000; }
.combo-counter.combo-catastrophe { --combo-color: #ff00ff; }
.combo-counter.combo-legendary { --combo-color: #00ffff; }
.combo-counter.combo-mythical { --combo-color: #00ff00; }
.combo-counter.combo-infinite { --combo-color: #ff00aa; }
.combo-counter.combo-transcendent { --combo-color: #aa00ff; }
.combo-counter.combo-perfection {
    --combo-color: #ffffff;
    animation: rainbow-glow 1s linear infinite;
}

@keyframes rainbow-glow {
    0% { filter: hue-rotate(0deg) drop-shadow(0 0 30px #ff0000); }
    25% { filter: hue-rotate(90deg) drop-shadow(0 0 30px #00ff00); }
    50% { filter: hue-rotate(180deg) drop-shadow(0 0 30px #0000ff); }
    75% { filter: hue-rotate(270deg) drop-shadow(0 0 30px #ff00ff); }
    100% { filter: hue-rotate(360deg) drop-shadow(0 0 30px #ff0000); }
}

/* ============================================================================
   ELIMINATION OVERLAY
   ============================================================================ */

.elimination-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(255,0,0,0.2) 0%, transparent 70%);
    opacity: 0;
    animation: elimination-flash 1.5s ease-out forwards;
}

.elimination-overlay .elimination-text {
    font-size: 80px;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 
        0 0 30px #ff0000,
        0 0 60px #ff0000,
        0 0 90px #ff0000,
        0 6px 0 #990000;
    letter-spacing: 10px;
    animation: elimination-shake 0.5s ease-out;
}

.elimination-overlay .elimination-player {
    font-size: 36px;
    font-weight: 600;
    color: var(--player-color, #fff);
    text-shadow: 0 0 20px var(--player-color, #fff);
    margin-top: 10px;
    opacity: 0;
    animation: elimination-player-fade 1s ease-out 0.3s forwards;
}

@keyframes elimination-flash {
    0% { opacity: 0; }
    10% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes elimination-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

@keyframes elimination-player-fade {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   CONQUEST WAVE (Field Color Transition)
   ============================================================================ */

.conquest-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid var(--conquest-color, #fff);
    box-shadow: 
        0 0 10px var(--conquest-color, #fff),
        0 0 20px var(--conquest-color, #fff),
        inset 0 0 10px var(--conquest-color, #fff);
    pointer-events: none;
    animation: conquest-expand 0.6s ease-out forwards;
}

@keyframes conquest-expand {
    0% { 
        width: 10px; 
        height: 10px; 
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }
    100% { 
        width: 80px; 
        height: 80px; 
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ============================================================================
   VICTORY SCREEN ENHANCEMENTS
   ============================================================================ */

.winner-overlay.celebrating {
    background: radial-gradient(ellipse at center, 
        rgba(var(--winner-color-rgb, 255,140,50), 0.3) 0%, 
        rgba(0,0,0,0.9) 100%);
}

.winner-overlay.celebrating .winner-content {
    animation: victory-entrance 0.8s ease-out;
}

.winner-overlay.celebrating .winner-name {
    animation: victory-glow 2s ease-in-out infinite;
}

@keyframes victory-entrance {
    0% { 
        opacity: 0; 
        transform: scale(0.5) translateY(50px);
    }
    50% { 
        transform: scale(1.1) translateY(-10px);
    }
    100% { 
        opacity: 1; 
        transform: scale(1) translateY(0);
    }
}

@keyframes victory-glow {
    0%, 100% {
        text-shadow:
            0 0 20px currentColor,
            0 0 40px currentColor;
    }
    50% {
        text-shadow:
            0 0 40px currentColor,
            0 0 80px currentColor,
            0 0 120px currentColor;
    }
}

/* Victory Title Animation */
.victory-title {
    font-size: 4rem !important;
    color: #ffd700 !important;
    text-shadow:
        0 0 30px #ffd700,
        0 0 60px #ff8c32,
        0 0 90px #ff4444;
    animation: victory-title-pulse 1.5s ease-in-out infinite;
}

@keyframes victory-title-pulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

/* Winner Overlay Victory Glow */
.winner-overlay.victory-glow {
    background: radial-gradient(ellipse at center,
        rgba(255, 215, 0, 0.2) 0%,
        rgba(255, 140, 50, 0.15) 30%,
        rgba(0, 0, 0, 0.95) 100%);
}

.winner-overlay.victory-glow .winner-content {
    animation: victory-entrance 0.8s ease-out;
}

.winner-overlay.victory-glow .winner-name {
    animation: victory-glow 2s ease-in-out infinite;
}

/* Confetti Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confetti-fall linear forwards;
}

.confetti.square { border-radius: 2px; }
.confetti.circle { border-radius: 50%; }
.confetti.ribbon { 
    width: 5px; 
    height: 20px; 
    border-radius: 2px;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Screen shake effect */
.screen-shake {
    animation: screen-shake 0.4s ease-out;
}

@keyframes screen-shake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5px, -5px); }
    20% { transform: translate(5px, -5px); }
    30% { transform: translate(-5px, 5px); }
    40% { transform: translate(5px, 5px); }
    50% { transform: translate(-3px, -3px); }
    60% { transform: translate(3px, -3px); }
    70% { transform: translate(-3px, 3px); }
    80% { transform: translate(3px, 3px); }
    90% { transform: translate(-1px, -1px); }
}

/* Epic chain reaction: subtle cinematic zoom for 10+ field chains */
#canvas-container.epic-chain {
    transition: transform 0.4s ease-out;
    transform: scale(1.02);
}

@media (prefers-reduced-motion: reduce) {
    #canvas-container.epic-chain {
        transition: none;
        transform: none;
    }
}

/* =========================================================================
   V-019: SEASONAL LEADERBOARDS
   ========================================================================= */

.season-selector {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.season-selector select {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #fff);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
    cursor: pointer;
    max-width: 200px;
}

.season-selector select:focus {
    outline: none;
    border-color: var(--primary, #00d4ff);
}

.season-badge {
    display: none;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    padding: 4px var(--space-md);
    margin-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

/* =========================================================================
   V-020: DAILY QUESTS
   ========================================================================= */

.quest-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm);
}

.quest-item {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.05));
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    transition: border-color 0.3s ease;
}

.quest-item.quest-completed {
    border-color: var(--success, #4caf50);
    background: rgba(76, 175, 80, 0.1);
}

.quest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.quest-desc {
    font-size: 0.85rem;
    color: var(--text-primary, #fff);
    flex: 1;
}

.quest-points {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--warning, #ffc107);
    margin-left: var(--space-sm);
    white-space: nowrap;
}

.quest-completed .quest-points {
    color: var(--success, #4caf50);
}

.quest-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary, rgba(0, 0, 0, 0.3));
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}

.quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #00d4ff), var(--primary-light, #4de8ff));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.quest-completed .quest-progress-fill {
    background: linear-gradient(90deg, var(--success, #4caf50), #66bb6a);
}

.quest-progress-text {
    font-size: 0.7rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
    text-align: right;
}

.quest-completed .quest-progress-text {
    color: var(--success, #4caf50);
}

/* Leaderboard stat styles */
.lb-points,
.lb-games {
    font-weight: 600;
    color: var(--primary, #00d4ff);
}

@media (max-width: 768px) {
    .season-selector select {
        max-width: 150px;
        font-size: 0.75rem;
    }

    #daily-quests {
        width: 240px !important;
    }

    .quest-desc {
        font-size: 0.75rem;
    }
}

/* ============================================================================
   PAGE LOADING OVERLAY
   @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de
   ============================================================================ */

.page-loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg-dark, #0a0a0f);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.4s ease;
}

.page-loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.page-loading-logo {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: var(--space-lg, 24px);
}

.page-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--color-primary, #ff8c32);
    border-radius: 50%;
    animation: pageLoadSpin 0.8s linear infinite;
}

@keyframes pageLoadSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   REDUCED MOTION — Global fallback
   @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .btn .btn-spinner,
    .page-loading-spinner {
        animation-duration: 1.5s;
    }
    .modal-card.modal-shake {
        animation: none;
    }
    .auth-success-check {
        animation: none;
    }
    .connection-status.connected .connection-dot,
    .connection-status.connecting .connection-dot {
        animation: none;
    }
    .toast.animate-slide-in {
        animation: none;
        opacity: 1;
    }
    .toast-progress {
        animation: none;
        width: 0;
    }
}

/* =========================================================================
 * SPECTATOR MODE
 * @copyright reDim GmbH | @link https://www.redim.de | @contact team@redim.de
 * ========================================================================= */

.spectator-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 8px 16px;
    background: linear-gradient(90deg, rgba(100, 200, 255, 0.15) 0%, rgba(100, 200, 255, 0.08) 50%, rgba(100, 200, 255, 0.15) 100%);
    border-bottom: 1px solid rgba(100, 200, 255, 0.2);
    color: #64c8ff;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    z-index: 50;
    flex-wrap: wrap;
}

.spectator-banner .spectator-count {
    font-size: 0.75rem;
    color: var(--color-text-muted, #999);
}

.spectator-banner .spectator-back-btn {
    padding: 4px 14px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: var(--radius-pill, 20px);
    cursor: pointer;
    transition: background 0.2s;
}

.spectator-banner .spectator-back-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Spectator mode: hide game controls */
.spectator-mode #chat-panel,
.spectator-mode #quickchat-panel,
.spectator-mode .turn-actions,
.spectator-mode #btn-exit-game {
    display: none !important;
}

/* ============================================================================
   MOBILE PORTRAIT FIXES (375-430px)
   ============================================================================ */
#main-menu { width: 420px; max-width: 100%; }
#create-panel { width: 480px; max-width: 100%; }

@media (max-width: 480px) {
    .combo-counter .combo-number { font-size: clamp(48px, 20vw, 80px) !important; }
    .combo-counter .combo-text { font-size: clamp(16px, 5vw, 22px) !important; letter-spacing: 3px !important; }
    .options-row { flex-wrap: wrap; gap: 4px; }
    .game-settings-toggle { right: 112px; }
    .game-settings-dropdown { right: auto; left: 0; max-width: calc(100vw - 32px); }
    #daily-quests { width: calc(100vw - 32px) !important; }
    .landing-link { min-height: 44px; display: inline-flex; align-items: center; }
    .panel-header h1 { font-size: 1.6rem !important; letter-spacing: 1px !important; }
    #game-ui { max-height: 25vh; overflow-y: auto; }
    #chat-panel { max-height: 30vh; bottom: calc(25vh + 8px); }
    .quickchat-panel { bottom: calc(25vh + 8px); }
}
@media (pointer: coarse) {
    .btn-slot-edit { opacity: 1; }
    .slot-config-controls .form-control-sm, .slot-configurator select { min-height: 44px; font-size: 16px; }
    .rotate-hint-dismiss { width: 44px; height: 44px; }
}

/* Panel default widths (replaces inline style= attributes) */
#matchmaking-panel { width: 420px; max-width: 100%; }
#campaign-panel { width: 520px; max-width: 100%; }
#friends-panel { width: 280px; max-width: 100%; }
#games-list-panel { width: 520px; max-width: 100%; }
#join-panel { width: 450px; max-width: 100%; }
#lobby-panel { width: 380px; max-width: 100%; }
#game-ui { width: 300px; max-width: 100%; }
#stats-panel { width: 280px; max-width: 100%; }

/* Chat: auf Mobile collapsed by default, Button zum Öffnen */
@media (max-width: 768px) {
    #chat-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 35vh;
        z-index: 600;
        transform: translateY(calc(100% - 36px)); /* nur Header-Bar sichtbar */
        transition: transform 0.3s ease;
    }
    #chat-panel.chat-open {
        transform: translateY(0);
    }
    #chat-panel::before {
        content: '💬 Chat';
        display: block;
        text-align: center;
        padding: 8px;
        cursor: pointer;
        background: rgba(0,0,0,0.8);
        border-bottom: 1px solid rgba(0,255,136,0.2);
        font-size: 0.75rem;
        color: rgba(255,255,255,0.6);
    }
    .quickchat-panel {
        bottom: 36px;
    }
}
