/* ==========================================================================
   1. VARIABLES & CONFIGURATION
   ========================================================================== */
:root {
    /* --- Colors: Backgrounds --- */
    --bg-primary: #23233f;
    --bg-secondary: #262942;
    --bg-tertiary: rgb(50, 48, 82);
    --bg-tertiary-rgb: 35, 35, 60;
    --panel-bg: var(--bg-tertiary);

    /* --- Colors: Header Gradient --- */
    --header-bg-start: #4a148c;
    --header-bg-end: #6a1b9a;

    /* --- Colors: Text --- */
    --text-primary: #e0e0e6;
    --text-secondary: #a0a8c0;

    /* --- Colors: Highlights & Accents --- */
    --highlight-primary: #957fe4;
    --highlight-primary-rgb: 138, 111, 240;
    --highlight-secondary: #b8a8f0;
    --accent-blue: #5070b0;

    /* --- Colors: Feedback --- */
    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --warning-color: #f39c12;

    /* --- UI Elements --- */
    --border-color: #353550;
    --input-bg: var(--bg-primary);
    --input-border: var(--border-color);
    --muted-line: color-mix(in srgb, var(--border-color) 92%, white);

    --scrollbar-track-color: var(--bg-tertiary);
    --scrollbar-thumb-color: var(--highlight-primary);

    /* --- Dimensions & Settings --- */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --slot-height: 56px;
    --player-icon-size: 38px;
    --login-icon-select-size: 48px;
    --login-icon-preview-size: 80px;
    --arrow-size: 8px;
    --order-it-grid-gap: 10px;
    
    /* Layout Sizes */
    --sidebar-width: 300px;
    --sidebar-min-width: 76px;

    /* --- Animations --- */
    --nm-css-transition-duration: 400ms;
    --nm-large-wave-duration: 600ms;

    --gtp-bubble-h-shift: 40%;
}

/* ==========================================================================
   2. RESET & GLOBAL LAYOUT
   ========================================================================== */
* { box-sizing: border-box; }

html, body {
    min-height: 100%;
    margin: 0;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: #fff;
    padding: 1rem 180px; /* Fixed padding for Ads */
    overflow-y: auto;
    transition: padding 0.4s ease-in-out;
    padding-left: max(180px, env(safe-area-inset-left));
    padding-right: max(180px, env(safe-area-inset-right));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

body.ads-hidden { 
    padding: 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

#background-shader-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
    transform: translateZ(0); /* Forces GPU composite layer, preventing the fixed canvas from scrolling with the body on mobile */
}

h1, h2, h3, h4, h5, p { margin: 0; }

/* --- Ad Banners --- */
.ad-banner {
    position: fixed;
    top: 0; bottom: 0;
    width: 160px;
    padding: 1rem 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
    transition: transform 0.4s ease-in-out;
    overflow: hidden;
}

#left-ad-banner { left: 10px; }
#right-ad-banner { right: 10px; }

body.ads-hidden .ad-banner { transform: translateY(100vh); }

/* ==========================================================================
   3. UI COMPONENTS (Buttons, Inputs, Panels)
   ========================================================================== */

/* --- Unified Panel Style --- */
:is(.panel, .static-page-panel, .standalone-static-panel, .static-content-panel) {
    background-color: #ffffff;
    background-image: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 20%),
        linear-gradient(color-mix(in srgb, var(--panel-bg), black 6%), color-mix(in srgb, var(--panel-bg), black 6%)),
        linear-gradient(var(--panel-bg), var(--panel-bg)),
        url('/assets/shaders/confetti.webp');
    background-size: 100% 100%, 100% 100%, 100% 100%, 500.5px 500.5px;
    background-repeat: no-repeat, repeat, repeat, repeat;
    background-attachment: scroll, local, local, local;
    background-blend-mode: overlay, lighten, multiply, difference;
    border-radius: 10px;
    box-shadow: -2px -2px 6px rgba(255, 255, 255, 0.03), 3px 3px 8px rgba(0, 0, 0, 0.25);
    padding: 20px;
    position: relative;
    display: flex; flex-direction: column;
    overflow: visible; flex-shrink: 0;
    isolation: isolate;
    color: var(--text-primary);
}

.panel > h2, .panel > h3 { margin-bottom: 15px; color: var(--highlight-secondary); }

.subpanel {
    margin-top: 12px; padding: 12px;
    border-radius: 8px; background: var(--bg-secondary);
    color: #ffd9a6; font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.subpanel h4 { margin-bottom: 5px; color: var(--highlight-secondary); }
.subpanel p { font-size: 0.9em; color: var(--text-secondary); }

/* --- Unified Typography for Static/Content Panels --- */
:is(.static-content-panel, .static-page-panel, .standalone-static-panel) h1 {
    color: #fff; font-size: 2.2em; text-align: center;
    margin-bottom: 30px; margin-top: 0;
    display: flex; align-items: center; justify-content: center;
}

:is(.static-content-panel, .static-page-panel, .standalone-static-panel) h2 {
    font-size: 1.8em;
    padding-bottom: 10px; color: var(--highlight-secondary);
    margin-top: 25px; margin-bottom: 15px;
}

:is(.static-content-panel, .static-page-panel, .standalone-static-panel) h3 {
    font-size: 1.4em; color: var(--highlight-primary);
    margin-top: 25px; margin-bottom: 15px;
}

:is(.static-content-panel, .static-page-panel, .standalone-static-panel) ul {
    padding-left: 20px; line-height: 1.6;
}

:is(.static-content-panel, .static-page-panel, .standalone-static-panel) li {
    margin-bottom: 10px; color: var(--text-primary);
}

:is(.static-content-panel, .static-page-panel, .standalone-static-panel) p {
    line-height: 1.6; margin-bottom: 15px;
}

:is(.static-page-panel, .standalone-static-panel) a {
    color: var(--highlight-primary); text-decoration: none;
}
:is(.static-page-panel, .standalone-static-panel) a:hover { text-decoration: underline; }

/* --- Buttons --- */
.base-button {
    display: inline-block; padding: 10px 18px;
    border-radius: 8px; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--highlight-primary), var(--highlight-secondary));
    color: #fff; font-weight: 600; text-decoration: none; text-align: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: transform 120ms ease, filter 120ms;
}
.base-button:hover { filter: brightness(1.1); }
.base-button:active { transform: scale(.98); }
.base-button:disabled {
    background: var(--text-secondary); color: var(--bg-tertiary);
    cursor: not-allowed; transform: none; filter: none; opacity: 0.5;
}

.option-popout {
    background: linear-gradient(135deg, var(--highlight-primary), var(--highlight-secondary));
    display: inline-block; padding: 12px 24px;
    border-radius: 8px; color: #fff; font-weight: 700;
    text-align: center; cursor: pointer; border: none;
    transform: translateY(0);
    box-shadow: 0 0 0 color-mix(in oklab, var(--highlight-primary), black 40%);
    transition: transform 230ms cubic-bezier(.2, .8, .2, 1), box-shadow 230ms cubic-bezier(.2, .8, .2, 1);
    will-change: transform, box-shadow; position: relative; isolation: isolate;
}
.option-popout::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='8' viewBox='0 0 40 8'><path d='M0 6 L8 2 L16 6 L24 2 L32 6 L40 2' stroke='white' stroke-opacity='0.14' stroke-width='1' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-size: 40px 8px; background-repeat: repeat; mix-blend-mode: overlay;
}
.option-popout:hover { transform: translateY(-10px); box-shadow: 0 10px 0 color-mix(in oklab, var(--highlight-primary), rgb(31, 16, 58) 50%); }
.option-popout:active { transform: translateY(-8px); box-shadow: 0 8px 0 color-mix(in oklab, var(--highlight-primary), rgb(31, 16, 58) 50%); }
.option-popout:disabled {
    transform: translateY(0); box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    background-image: none; background-color: var(--text-secondary);
    opacity: 0.5; cursor: not-allowed;
}

.waiting-button {
    display: inline-flex; align-items: center;
    padding: 10px 18px; border-radius: 8px;
    background: var(--bg-secondary); color: var(--text-secondary);
    font-weight: 600; text-align: center; border: 1px solid var(--border-color);
}

.waiting-spinner {
    margin-right: 10px; width: 20px; height: 20px;
    border-radius: 50%; border: 4px solid rgba(var(--highlight-primary-rgb), 0.2);
    border-top-color: var(--highlight-primary);
    animation: playful-spin 3.0s cubic-bezier(0.55, -0.8, 0.27, 0.5) infinite;
    flex-shrink: 0; display: inline-block; box-sizing: border-box;
}

/* --- Inputs & Dropdowns --- */
.base-input, .base-dropdown, .base-checkbox {
    padding: 10px 12px; border-radius: 8px;
    background: var(--input-bg); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: inherit; font-size: 1em;
    max-width: 100%;
}

.base-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.base-checkbox:checked {
    background-color: var(--highlight-primary);
    border-color: var(--highlight-primary);
}

.base-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.base-input:focus, .base-dropdown:focus, .base-checkbox:focus {
    outline: none; border-color: var(--highlight-primary);
    box-shadow: 0 0 0 2px rgba(var(--highlight-primary-rgb), 0.3);
}
.base-dropdown {
    -webkit-appearance: none; appearance: none;
    padding: 8px 2.5rem 8px 12px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 0.8rem center;
    background-size: 1em; cursor: pointer;
}
.base-dropdown:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Multi-Select Dropdown --- */
.multi-select-container { position: relative; width: 100%; min-width: min(200px, 100%); }
.multi-select-trigger {
    position: relative; cursor: pointer; user-select: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding: 10px 12px; border-radius: 8px;
    background: var(--input-bg); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: inherit; font-size: 1em;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 0.8rem center; background-size: 1em;
}
.multi-select-options {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-tertiary); border: 1px solid var(--border-color);
    border-radius: 8px; margin-top: 5px; max-height: 250px; overflow-y: auto;
    z-index: 500; display: none; box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.multi-select-options.show { display: block; animation: popInFromTop 0.2s ease-out; }
.multi-select-option {
    padding: 10px 15px; cursor: pointer; display: flex;
    align-items: center; gap: 10px;
    border-bottom: 1px solid var(--muted-line);
    transition: background-color 0.1s;
}
.multi-select-option:last-child { border-bottom: none; }
.multi-select-option:hover { background-color: var(--bg-secondary); }
.multi-select-all-option { background-color: rgba(var(--bg-tertiary-rgb), 0.8); font-weight: bold; border-bottom: 2px solid var(--border-color); }
.multi-select-checkbox {
    width: 18px; height: 18px; border: 2px solid var(--text-secondary);
    border-radius: 4px; position: relative;
    transition: border-color 0.2s, background-color 0.2s;
}
.multi-select-option.selected .multi-select-checkbox { background-color: var(--highlight-primary); border-color: var(--highlight-primary); }
.multi-select-option.selected .multi-select-checkbox::after {
    content: '✓'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); color: white; font-size: 12px; font-weight: bold;
}

/* --- Sliders & Scrollbars --- */
.base-slider {
    width: 100%; appearance: none; height: 6px;
    border-radius: 8px; background: var(--border-color);
    outline: none; flex-grow: 1;
}
.base-slider::-webkit-slider-thumb {
    appearance: none; width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(180deg, var(--highlight-secondary), var(--highlight-primary));
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5); cursor: pointer; transition: transform 120ms;
}
.base-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.base-slider::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(180deg, var(--highlight-secondary), var(--highlight-primary));
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5); cursor: pointer; border: none; transition: transform 120ms;
}
.base-slider::-moz-range-thumb:hover { transform: scale(1.15); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); border-radius: 8px; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--highlight-primary), var(--highlight-secondary));
    border-radius: 8px; border: 2px solid rgba(0, 0, 0, 0.25);
}
::-webkit-scrollbar-thumb:hover { filter: brightness(1.1); }

/* ==========================================================================
   4. MAIN LAYOUT & HEADER
   ========================================================================== */
.panel-wrapper {
    width: 100%; max-width: 1400px; margin: 0 auto;
    border-radius: 14px; background: var(--bg-primary);
    box-shadow: -8px -8px 30px rgba(120, 30, 200, 0.03), 10px 18px 40px rgba(0, 0, 0, 0.55);
    display: flex; flex-direction: column;
    min-height: calc(100vh - 2rem); min-height: calc(100lvh - 2rem);
    position: relative; padding-top: 100px; overflow: visible; z-index: 6;
}

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 30px;
    background: linear-gradient(90deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
    position: absolute; flex-shrink: 0;
    top: 0; left: 0; width: 100%; height: 100px; z-index: 10;
}
.panel-header > a { display: contents; }
#header-logo-img {
    position: sticky; width: 250px; height: auto;
    top: -60px; left: 30px; transform: none; z-index: 20;
}
.panel-header h1 { margin: 0; color: var(--highlight-primary); font-size: 35px; letter-spacing: 0.6px; }
.panel-header nav { display: flex; gap: 24px; align-items: center; color: #fff; font-size: 0.95rem; }
.header-nav-group { display: flex; align-items: center; gap: 12px; }

.panel-header nav .base-button.header-nav-button {
    padding: 6px 14px; box-shadow: none;
    background: color-mix(in srgb, var(--header-bg-start) 80%, white);
    font-size: 0.95rem; line-height: normal;
    display: inline-flex; align-items: center; justify-content: center;
    height: auto; min-height: 34px;
}
.panel-header nav .base-button.header-nav-button:hover {
    background: color-mix(in srgb, var(--header-bg-start) 60%, white); filter: brightness(1.1);
}
.panel-header::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 18px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent); pointer-events: none;
}

.lobby-content {
    display: grid; 
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr; /* Fill remaining height */
    gap: 18px; padding: 18px; align-items: stretch; /* Panel stretch behavior */
    flex: 1 1 auto; 
    position: relative; min-height: 0; 
    transition: grid-template-columns 0.3s ease;
}
.lobby-content.static-view-active { grid-template-columns: 1fr; }
.lobby-content.static-view-active > #player-section { display: none; }
.lobby-content.player-section-minimized { grid-template-columns: var(--sidebar-min-width) 1fr; }

.controls {
    position: relative; display: flex; flex-direction: column;
    gap: 14px; overflow-y: visible; 
    padding: 0; min-width: 0; width: 100%;
}
.controls > .panel, #active-game-content {
    flex-grow: 1; /* Stretch to fill available vertical space */
    transition: opacity 0.3s ease-in-out;
}
.content-faded { opacity: 0; pointer-events: none; }

.lobby-footer {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    gap: 5px 15px; padding: 15px 20px; font-size: 0.85rem;
    color: var(--text-secondary); border-top: 1px solid var(--muted-line);
    margin-top: auto; flex-shrink: 0;
}
.lobby-footer a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s ease; }
.lobby-footer a:hover { color: var(--text-primary); text-decoration: underline; }

/* ==========================================================================
   5. SIDEBAR: PLAYER LIST
   ========================================================================== */
.player-section { min-width: 0; align-self: stretch; transition: padding 0.3s ease; overflow: hidden; } 
.player-section-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.player-header-title {
    margin: 0; font-size: 14px; color: var(--highlight-secondary);
    letter-spacing: 0.3px; display: flex; justify-content: space-between; flex-grow: 1;
}
#host-status-indicator { font-weight: normal; color: var(--text-secondary); }

.circular-toggle-btn {
    display: none; /* Hidden by default (Desktop & Mobile) */
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 50%; width: 28px; height: 28px; cursor: pointer;
    align-items: center; justify-content: center; color: var(--text-primary);
    transition: transform 0.3s ease, background 0.2s; flex-shrink: 0; margin-left: 10px;
}
.circular-toggle-btn:hover { background: var(--bg-primary); }
.circular-toggle-btn svg { width: 16px; height: 16px; transition: transform 0.3s ease; }

.player-list {
    display: grid; grid-auto-rows: var(--slot-height); gap: 0;
    position: relative; overflow-y: auto; overflow-x: hidden; flex-grow: 1; padding-right: 6px;
    background-image: linear-gradient(to bottom, transparent calc(100% - 1px), var(--muted-line) calc(100% - 1px));
    background-size: 100% var(--slot-height); background-repeat: repeat-y;
    mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
    min-height: 0;
}

.player {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    height: calc(var(--slot-height) - 8px); margin: 4px 0;
    background-color: color-mix(in srgb, var(--bg-tertiary) 95%, white);
    border-radius: 8px; transition: background-color 180ms, transform 120ms;
    overflow: hidden;
}
.player:hover { background-color: color-mix(in srgb, var(--bg-tertiary) 85%, white); transform: translateY(-2px); }
.player.current-turn-player {
    background: color-mix(in srgb, rgb(var(--highlight-primary-rgb)) 15%, var(--bg-secondary));
    border: 1px solid var(--highlight-primary);
    animation: colorPulse 2s ease-in-out infinite alternate;
}
#its-your-turn-message { color: white; margin: 0 auto; }
.player.eliminated { opacity: 0.5; background: var(--bg-primary); }
.player.eliminated .player-name { text-decoration: line-through; }

.player-icon-img { width: var(--player-icon-size); height: var(--player-icon-size); border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.player-details-center { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
    overflow-x: auto; 
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.player-details-center::-webkit-scrollbar { display: none; }
.player-tags { display: flex; gap: 5px; font-size: 0.75em; margin-bottom: 2px; white-space: nowrap; flex-shrink: 0; }
.host-marker { background-color: var(--accent-blue); color: var(--text-primary); padding: 1px 4px; border-radius: 3px; font-weight: 500; }
.you-marker { background-color: var(--text-secondary); color: var(--bg-primary); padding: 1px 4px; border-radius: 3px; font-weight: 500; }
.mod-marker { background-color: #FFD700; color: #000; padding: 1px 4px; border-radius: 3px; font-weight: 500; }

.player-name { font-weight: 500; white-space: nowrap; display: block; flex-shrink: 0; }
.player-name.disconnected-text { font-style: italic; }
.player-score { color: var(--highlight-secondary); font-weight: bold; font-size: 1.1em; }

.player-score-container { position: relative; display: flex; align-items: center; justify-content: flex-end; min-width: 40px; flex-shrink: 0; }
.player-score-change {
    position: absolute; right: 100%; margin-right: 5px; font-weight: bold;
    animation: score-change-animation 1.5s ease-out forwards; white-space: nowrap; z-index: 10;
}
.player-score-change.positive { color: var(--success-color); }
.player-score-change.negative { color: var(--error-color); }

#player-section-footer {
    margin-top: auto; padding-top: 10px;
    display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
#player-section-footer .base-button {
    flex: 1; padding: 8px 10px; font-size: 0.85rem; box-shadow: none;
    background: color-mix(in srgb, var(--bg-secondary) 85%, white);
}
#player-section-footer .base-button:hover { background: color-mix(in srgb, var(--bg-secondary) 70%, white); filter: brightness(1); }

/* ==========================================================================
   6. VIEWS: LOGIN & PRE-LOBBY
   ========================================================================== */
#app-container.login-view-active .lobby-content { grid-template-columns: 1fr; }
#app-container.login-view-active .controls { 
    flex-direction: row; 
    justify-content: center; 
    align-items: flex-start;
    gap: 18px; 
    flex-wrap: wrap; 
}

#login-area { text-align: center; flex: 0 1 550px; max-width: 550px; min-height: 0; width: 100%; box-sizing: border-box; }
#tips-panel { display: flex; flex-direction: column; flex: 0 1 350px; max-width: 350px; min-height: 0; width: 100%; box-sizing: border-box; }

#profile-customization-box {
    padding: 20px; border-radius: 10px; max-width: 500px; width: 100%; box-sizing: border-box;
    margin: 20px auto; display: flex; flex-direction: column; align-items: center;
}
#login-profile-setup { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; width: 100%; justify-content: center; }
#selected-icon-preview-container {
    width: var(--login-icon-preview-size); height: var(--login-icon-preview-size);
    border-radius: 50%; overflow: hidden; border: 3px solid var(--highlight-primary);
    background-color: var(--input-bg); flex-shrink: 0;
}
#selected-icon-preview { width: 100%; height: 100%; object-fit: cover; }
#username-input { flex-grow: 1; max-width: 280px; min-width: 0; width: 100%; }

#player-icon-label-container { margin-top: 10px; margin-bottom: 8px; }
#icon-selection-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#icon-selection-strip { display: flex; gap: 8px; width: calc(var(--login-icon-select-size) * 4 + 24px); }

.icon-option-selectable {
    width: var(--login-icon-select-size); height: var(--login-icon-select-size);
    border-radius: 50%; border: 3px solid transparent; cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
    background-color: var(--input-bg); object-fit: cover; flex-shrink: 0;
}
.icon-option-selectable:hover { border-color: var(--highlight-secondary); transform: scale(1.1); }
.icon-option-selectable.selected { border-color: var(--highlight-primary); transform: scale(1.1); }

.icon-scroll-arrow {
    background: transparent; border: none; color: var(--text-primary);
    cursor: pointer; padding: 5px; opacity: 0.7; transition: opacity 0.2s ease;
}
.icon-scroll-arrow:hover { opacity: 1; }
.icon-scroll-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.icon-scroll-arrow::before {
    content: ''; display: inline-block; width: 0; height: 0;
    border-top: var(--arrow-size) solid transparent; border-bottom: var(--arrow-size) solid transparent;
}
#icon-scroll-left::before { border-right: calc(var(--arrow-size) * 1.2) solid var(--text-primary); }
#icon-scroll-right::before { border-left: calc(var(--arrow-size) * 1.2) solid var(--text-primary); }
#join-button { margin-top: 20px; }

/* Tips Rotating Panel */
#tips-container {
    --time-per-tip: 12s; --total-tips: 8; --cycle-duration: calc(var(--time-per-tip) * var(--total-tips));
    position: relative; flex-grow: 1; overflow: hidden; margin-top: 15px; 
    min-height: 120px; 
}
.tip {
    position: absolute; inset: 0; opacity: 0;
    animation: rotate-tips var(--cycle-duration) linear infinite;
    display: flex; flex-direction: column; gap: 8px;
    background: var(--bg-secondary); padding: 15px;
    border-radius: 8px; border: 1px solid var(--border-color);
    overflow-y: auto; z-index: 0; pointer-events: none;
}
.tip h3 { color: var(--highlight-secondary); margin-bottom: 5px; }
.tip p { font-size: 0.9em; color: var(--text-secondary); line-height: 1.5; }
.tip:nth-child(1) { animation-delay: calc(var(--time-per-tip) * 0); }
.tip:nth-child(2) { animation-delay: calc(var(--time-per-tip) * 1); }
.tip:nth-child(3) { animation-delay: calc(var(--time-per-tip) * 2); }
.tip:nth-child(4) { animation-delay: calc(var(--time-per-tip) * 3); }
.tip:nth-child(5) { animation-delay: calc(var(--time-per-tip) * 4); }
.tip:nth-child(6) { animation-delay: calc(var(--time-per-tip) * 5); }
.tip:nth-child(7) { animation-delay: calc(var(--time-per-tip) * 6); }
.tip:nth-child(8) { animation-delay: calc(var(--time-per-tip) * 7); }

/* Pre-Lobby */
#pre-lobby-controls { gap: 10px; }
.pre-lobby-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; flex-grow: 1; }
.pre-lobby-games { display: flex; flex-direction: column; gap: 20px; }

.choice-card-container { 
    display: grid; 
    gap: 10px; 
    grid-template-columns: repeat(auto-fill, minmax(min(140px, calc(50% - 5px)), 1fr)); 
}
.choice-card {
    padding: 15px; border-radius: 8px; background-color: var(--bg-secondary);
    cursor: pointer; border: 1px solid transparent;
    transition: transform 160ms ease, box-shadow 160ms, border-color 160ms, background-image 160ms;
    text-align: center; position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 10px; aspect-ratio: 1 / 1;
}
.choice-card:hover { transform: translateY(-4px); border-color: var(--highlight-secondary); }
.choice-card.selected {
    color: #fff; font-weight: 600;
    background: linear-gradient(135deg, var(--highlight-primary), var(--highlight-secondary));
    border-color: var(--highlight-secondary);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
    position: relative; isolation: isolate;
}
.choice-card.selected::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='8' viewBox='0 0 40 8'><path d='M0 6 L8 2 L16 6 L24 2 L32 6 L40 2' stroke='white' stroke-opacity='0.12' stroke-width='1' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-size: 40px 8px; background-repeat: repeat; mix-blend-mode: overlay;
}

.game-mode-icon { width: 90%; height: 80%; max-width: 100px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); }
.choice-card.selected .game-mode-icon { filter: brightness(0) invert(1) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); }
.game-mode-name { font-size: 0.9em; font-weight: 500; }

.client-game-display {
    display: flex; justify-content: center; align-items: center;
    width: 150px; aspect-ratio: 1 / 1; background: var(--bg-secondary); border-radius: 8px;
}
#selected-game-icon-client { width: 100px; height: 100px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); }
#waiting-for-host-game-selection { color: var(--text-secondary); font-style: italic; }
#start-game-button { margin-top: auto; padding-top: 20px; align-self: center; width: 100%; max-width: 350px; }
.pre-lobby-footer { margin-top: auto; padding-top: 20px; display: flex; justify-content: space-between; align-items: center; }
.pre-lobby-footer .status-message { margin-right: auto; }

/* --- Base Tab Menu Component & Alignment --- */
.pre-lobby-games > h3 {
    height: 24px;
    line-height: 24px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.pre-lobby-settings {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.base-tabs {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none; /* Connects seamlessly with panel */
    border-radius: 8px 8px 0 0;
    padding: 4px 4px 0 4px;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    
    /* Perfect Alignment Math: 
       Top edge aligns because grid items start at the same Y-coordinate.
       Bottom edge aligns because Left H3 (24px) + Flex Gap (20px) = 44px. */
    height: 44px;
    margin-top: 0;
}

.base-tab-button {
    flex: 1 1 0px; 
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 12px; /* Increased side padding slightly for better left alignment */
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Left-aligns the text */
}

.base-tab-button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.base-tab-button.active {
    background: var(--highlight-primary);
    color: #fff;
}

.base-tab-content {
    display: none;
}

.base-tab-content.active {
    display: flex;
}

/* --- Settings Containers --- */
:is(#game-specific-settings-area, #lobby-settings-area) {
    background: var(--bg-secondary); 
    border-radius: 0 0 8px 8px; /* Square top connects to tabs */
    padding: 20px;
    border: 1px solid var(--border-color); 
    min-height: 200px; 
    height: 100%;
    flex-direction: column;
    min-width: 0;
    box-sizing: border-box;
}

:is(#game-specific-settings-area, #lobby-settings-area) .settings-group { 
    display: flex; flex-direction: column; gap: 15px; margin-bottom: 15px; 
}

:is(#game-specific-settings-area, #lobby-settings-area) label { 
    font-weight: 500; color: var(--text-secondary); font-size: 1rem; cursor: pointer;
}

#game-specific-settings-area.non-host-view .base-slider { display: none; }
/* --- Strict Row Layout for Toggles & Sliders --- */
.setting-row { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    flex-wrap: nowrap !important; /* Force strictly one row */
    max-width: 100%; 
    min-width: 0; 
}

.setting-row label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
}

.setting-row input[type="range"],
.setting-row .base-slider {
    flex: 2 1 100px;
    min-width: 50px;
    margin: 0;
}

.setting-row input[type="number"],
.setting-row .base-input {
    width: 70px !important;
    flex: 0 0 70px;
    text-align: center;
    padding: 8px 4px;
}

.setting-row input[type="checkbox"],
.setting-row .base-checkbox {
    flex: 0 0 20px; /* Lock checkbox size */
    margin: 0;
}

#game-specific-settings-area.non-host-view .setting-row { justify-content: flex-start; }

/* ==========================================================================
   7. GAME VIEWS
   ========================================================================== */
#active-game-content {
    position: relative; flex-grow: 1; overflow: visible; padding: 20px;
    display: flex; flex-direction: column; gap: 15px;
}
.game-view-panel {
    position: relative; flex-grow: 1; padding: 0; display: flex; flex-direction: column;
    min-height: 0; overflow: visible; gap: 15px;
}
.game-view-header {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; flex-shrink: 0; background-color: var(--bg-secondary);
    padding: 15px 25px; border-radius: 10px; gap: 20px;
}
.game-view-caption { flex-grow: 1; min-width: 0; gap: 20px; }
.game-view-timer-wrapper { flex-shrink: 0; }

.game-view-main {
    flex-grow: 1; display: flex; flex-direction: column;
    justify-content: center; align-items: center; width: 100%; min-height: 0; gap: 15px;
}
.game-view-controls {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 15px; width: 100%; margin-top: auto; flex-shrink: 0;
}

/* Countdown */
#countdown-area { 
    display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
}
#countdown-timer-display-wrapper { display: flex; justify-content: center; align-items: center; min-height: 120px; }
.countdown-number {
    font-weight: 900; font-size: 6rem; color: #fff;
    text-shadow: 0 0 26px rgba(var(--highlight-primary-rgb), 0.35);
    animation: countdownAnim 1s ease-out forwards; display: block;
}
#countdown-prompt-text.unified-popup-bubble {
    opacity: 1; transform: none; transition: none; margin: 20px auto 0;
    padding: 15px 25px; width: auto; max-width: 90%; display: inline-block;
    font-size: 1.1em; font-weight: 500; line-height: 1.4; color: var(--highlight-secondary);
}

/* Timers */
.timer-background { fill: var(--bg-tertiary); stroke: var(--border-color); stroke-width: 10; }
.timer-progress {
    fill: none; stroke: var(--warning-color); stroke-width: 10; stroke-linecap: round;
    transition: stroke 0.3s ease-in-out, stroke-dashoffset 0.1s linear;
}

/* --- Inter-Round Leaderboard --- */
#inter-round-leaderboard-view {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 20px;
}
.leaderboard-container {
    display: flex; flex-direction: column; width: 100%; max-width: 600px;
    position: relative; min-height: 300px;
}
.leaderboard-row {
    display: flex; align-items: center; gap: 15px; background: var(--bg-secondary);
    padding: 12px 20px; border-radius: 10px; border: 1px solid var(--border-color);
    position: absolute; width: 100%; height: 64px; left: 0;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
}
.leaderboard-rank { font-size: 1.4em; font-weight: bold; color: var(--text-secondary); width: 40px; text-align: left; transition: color 0.3s; }
.leaderboard-row.rank-1 .leaderboard-rank { color: #FFD700; }
.leaderboard-row.rank-2 .leaderboard-rank { color: #C0C0C0; }
.leaderboard-row.rank-3 .leaderboard-rank { color: #CD7F32; }
.leaderboard-icon { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color); }
.leaderboard-name { flex-grow: 1; text-align: left; font-size: 1.2em; font-weight: 500; }
.leaderboard-score-container { position: relative; display: flex; align-items: center; justify-content: flex-end; min-width: 100px; }
.leaderboard-score { font-size: 1.4em; font-weight: bold; color: var(--highlight-secondary); min-width: 50px; text-align: right; }

.leaderboard-indicator-wrapper {
    position: relative;
    width: 60px;
    height: 24px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.leaderboard-indicator-wrapper .indicator-item {
    position: absolute;
    white-space: nowrap;
    font-weight: bold;
    font-size: 1.4em;
    opacity: 1;
    visibility: visible;
}

.leaderboard-indicator-wrapper .indicator-arrow {
    font-size: 1.2em;
}

.leaderboard-indicator-wrapper.alternate .indicator-arrow {
    animation: leaderboard-fade-alternate 6s infinite;
}

.leaderboard-indicator-wrapper.alternate .indicator-points {
    animation: leaderboard-fade-alternate-reverse 6s infinite;
}

@keyframes leaderboard-fade-alternate {
    0%, 40% { opacity: 1; visibility: visible; }
    50%, 90% { opacity: 0; visibility: hidden; }
    100% { opacity: 1; visibility: visible; }
}

@keyframes leaderboard-fade-alternate-reverse {
    0%, 40% { opacity: 0; visibility: hidden; }
    50%, 90% { opacity: 1; visibility: visible; }
    100% { opacity: 0; visibility: hidden; }
}

.leaderboard-indicator-wrapper .indicator-points {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.leaderboard-indicator-wrapper .indicator-points.visible {
    opacity: 1;
    transform: translateY(0);
}

.indicator-points.positive { color: var(--success-color); }
.indicator-points.negative { color: var(--error-color); }

.leaderboard-indicator-wrapper .rank-change-indicator {
    opacity: 1;
    transform: scale(1);
    transition: none;
    width: auto;
    height: auto;
    display: inline-flex;
}

.leaderboard-row.current-player {
    background: color-mix(in srgb, rgb(var(--highlight-primary-rgb)) 15%, var(--bg-secondary));
    border: 1px solid var(--highlight-primary);
    animation: colorPulse 2s ease-in-out infinite alternate;
    z-index: 100 !important;
}

.rank-change-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1.2em;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rank-change-indicator.visible {
    opacity: 1;
    transform: scale(1);
}

.rank-change-indicator.up {
    color: var(--success-color);
}

.rank-change-indicator.down {
    color: var(--error-color);
}

/* --- Podium --- */
#podium-view { justify-content: space-between; align-items: center; gap: 20px; text-align: center; }
#podium-title { font-size: 2.5em; color: var(--highlight-secondary); text-shadow: 0 0 10px rgba(var(--highlight-primary-rgb), 0.5); }
#podium-container { display: flex; justify-content: center; align-items: center; gap: 40px; width: 100%; flex-grow: 1; }
#podium-main { display: flex; align-items: flex-end; justify-content: center; gap: 10px; flex-direction: row; height: 330px; }

.podium-position { display: flex; flex-direction: column; align-items: center; width: 160px; }
.podium-player-info { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: -2px; position: relative; z-index: 2; }
.podium-column {
    display: flex; justify-content: center; align-items: center; width: 100%; border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, color-mix(in srgb, rgb(var(--highlight-primary-rgb)) 20%, var(--bg-secondary)), color-mix(in srgb, rgb(var(--highlight-primary-rgb)) 5%, var(--bg-secondary)));
    border: 2px solid var(--highlight-primary); border-bottom: none; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    height: 0; overflow: hidden; transition: height 3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.podium-position-2 { order: 1; }
.podium-position-1 { order: 2; }
.podium-position-3 { order: 3; }
.podium-column-1 {
    background: linear-gradient(180deg, color-mix(in srgb, #FFD700 30%, var(--bg-secondary)), color-mix(in srgb, #FFD700 10%, var(--bg-secondary)));
    border-color: #FFD700;
}
.podium-column-1.grow { height: 180px; }
.podium-column-2.grow { height: 130px; }
.podium-column-3.grow { height: 90px; }
.podium-place { font-size: 2em; font-weight: bold; color: var(--highlight-secondary); }
.podium-position-1 .podium-place { color: #FFD700; }
.podium-player-icon { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; }
.podium-player-name { font-size: 1.2em; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; text-align: center; }
.podium-player-score { font-size: 2.8em; font-weight: bold; color: #fff; text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }

#podium-others-list-container { width: 250px; opacity: 0; transform: translateX(20px); }
#podium-others-list-container.animate-fade-in { animation: fadeInRight 0.5s ease forwards 2.5s; }
#podium-others-list {
    display: flex; flex-direction: column; gap: 8px; background-color: var(--bg-tertiary);
    padding: 10px; border-radius: 8px; max-height: 280px; overflow-y: auto; text-align: left;
}
.podium-other-player { display: flex; align-items: center; gap: 10px; padding: 5px; }
.podium-other-player-rank { font-weight: bold; color: var(--text-secondary); width: 25px; text-align: right; }
.podium-other-player-icon { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.podium-other-player-details { flex-grow: 1; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.podium-other-player-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-other-player-score { font-weight: bold; color: var(--highlight-secondary); }
#podium-footer { min-height: 50px; display: flex; justify-content: center; align-items: center; }

/* ==========================================================================
   8. OVERLAYS & STATIC PAGES
   ========================================================================== */
.static-page-panel {
    position: absolute !important; inset: 18px !important; width: auto; height: auto;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease; z-index: 100;
    overflow-y: auto; scrollbar-gutter: stable;
}
.static-page-panel.visible { opacity: 1; pointer-events: auto; }

.static-content-panel {
    position: relative; 
}

.static-page-panel .back-button, 
.standalone-static-panel .back-link,
.static-content-panel .back-link {
    position: absolute; top: 20px; left: 20px; font-size: 0.9em; background: none; border: none;
    color: var(--highlight-primary); cursor: pointer; padding: 5px 10px; text-decoration: none; z-index: 10;
    font-weight: bold;
}
.static-page-panel .back-button:hover, .standalone-static-panel .back-link:hover, .static-content-panel .back-link:hover { text-decoration: underline; }

.panel-scroll-wrapper h1 {
    margin-top: 50px; 
}

.title-icon { height: 1.2em; width: auto; margin-left: 15px; display: block; }

.about-content-box, .game-mode-description-box {
    background-color: var(--bg-secondary); padding: 15px 20px;
    border-radius: 8px; margin-top: 20px;
}
.game-mode-description-box { display: flex; gap: 20px; align-items: center; }
.game-mode-description-text-content { flex: 1; }
.game-mode-screenshot {
    flex-shrink: 0; width: 320px; height: 180px; object-fit: cover;
    border-radius: 8px; border: 2px solid var(--highlight-primary); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.standalone-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; box-sizing: border-box; overflow: hidden; }
.standalone-static-panel { max-width: 1000px; width: 100%; max-height: 90vh; overflow-y: auto; }
.standalone-static-panel .imprint-section { margin-top: 40px; padding-top: 20px; border-top: 2px solid var(--muted-line); font-size: 0.9em; color: var(--text-secondary); }

/* --- Blog Specific Styles --- */
.blog-entry {
    background-color: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.blog-entry-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
    max-width: 100%; 
}

.blog-list-image {
    width: 280px;
    max-width: 35%; 
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    order: 2; 
    flex-shrink: 0;
}

.blog-title {
    color: #fff !important;
    font-weight: bold;
    font-size: 1.8em;
    margin-bottom: 5px !important;
    margin-top: 0px !important;
    text-align: left; 
}
.blog-meta {
    color: var(--highlight-secondary);
    font-size: 0.85em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    padding-top: 10px;
    border-bottom: 2px solid var(--muted-line);
    border-top: 2px solid var(--muted-line);
}

.blog-divider {
    border: 0;
    height: 2px;
    background: var(--muted-line);
    margin: 30px 0;
}

.blog-body {
    line-height: 1.6;
    position: relative;
}
.blog-body h3 {
    color: var(--highlight-secondary);
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1.2em;
}
.blog-body p {
    margin-bottom: 15px;
}
.blog-body ul {
    margin-bottom: 15px;
    padding-left: 20px;
}
.blog-body li {
    margin-bottom: 5px;
}

.blog-preview-text {
    max-height: 5.4em; 
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
    color: var(--text-primary);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

.read-further-link {
    color: var(--highlight-primary);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
}

.read-further-link:hover {
    text-decoration: underline;
}

/* Hide elements in article view */
.is-article-view .back-link,
.is-article-view .blog-main-title {
    display: none;
}

/* --- Elegant Blog Layout --- */
.blog-post-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.blog-breadcrumb {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.blog-breadcrumb a {
    color: var(--highlight-primary);
    text-decoration: none;
}

.blog-post-title {
    font-size: 2.8em !important;
    text-align: left !important;
    justify-self: start !important;
    line-height: 1.1;
}

.blog-post-meta {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-style: italic;
}

/* Rich Text Refinement */
.blog-rich-text {
    line-height: 1.8;
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
}

.blog-rich-text h2 {
    font-size: 1.8em;
    color: var(--highlight-secondary);
    margin-top: 1.5em;
    border: none; 
}

.blog-rich-text p {
    margin-bottom: 1.5em;
}

.blog-rich-text img {
    border: 1px solid rgba(255,255,255,0.1);
    padding: 5px;
    background: rgba(0,0,0,0.2);
}

/* Mobile handling for the blog list */
@media (max-width: 768px) {
    .blog-entry-content {
        flex-direction: column;
        gap: 15px;
    }
    .blog-list-image {
        width: 100%;
        max-width: 100%; 
        height: auto;
        order: 1; 
    }
    .blog-body {
        order: 2; 
    }
}

/* --- Player Interaction Context Menu --- */
.context-menu {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 4000;
    min-width: 160px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.context-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    font-size: 0.9em;
    color: var(--highlight-secondary);
}

.context-menu-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.4em;
    padding: 0 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.context-menu-close:hover {
    color: var(--text-primary);
}

.context-menu-body {
    padding: 8px;
}

#player-interaction-menu .base-button {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.85rem;
    box-shadow: none;
    background: color-mix(in srgb, var(--bg-secondary) 85%, white);
}

#player-interaction-menu .base-button:hover {
    background: color-mix(in srgb, var(--bg-secondary) 70%, white);
    filter: brightness(1);
}

/* --- Notifications --- */
#generic-notification-popup {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(150%);
    background-color: var(--bg-tertiary); color: var(--text-primary); padding: 15px 40px 15px 25px;
    border-radius: 8px; box-shadow: 0 0 15px rgba(0, 0, 0, 0.3); z-index: 2000;
    display: flex; align-items: center; gap: 15px; opacity: 0; pointer-events: none;
    transition: opacity var(--nm-css-transition-duration) cubic-bezier(0.25, 0.8, 0.25, 1), transform var(--nm-css-transition-duration) cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 280px; max-width: 400px; text-align: left; border-top: 3px solid var(--highlight-primary);
}
#generic-notification-popup.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#generic-notification-popup.hide { display: none !important; }

.notification-manager-close-btn {
    position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; background: transparent;
    border: none; color: var(--text-secondary); font-size: 1.8em; line-height: 1; cursor: pointer;
    opacity: 0.7; transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
    padding: 0; display: flex; align-items: center; justify-content: center;
}
.notification-manager-close-btn:hover { opacity: 1; transform: scale(1.1); color: var(--text-primary); }
.notification-manager-close-btn.large-close { top: 10px; right: 10px; width: 32px; height: 32px; font-size: 2.2em; z-index: 10; }
.notification-manager-icon-style { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--highlight-secondary); flex-shrink: 0; }
.notification-manager-icon-style.large { width: 60px; height: 60px; border-width: 3px; z-index: 1; position: relative; display: block; }
.notification-manager-text-style { font-size: 0.95em; margin: 0; line-height: 1.4; color: var(--text-primary); }
.notification-manager-text-style.large { font-size: 1.2em; font-weight: 500; margin-top: 0; z-index: 1; position: relative; display: block; min-height: 1.5em; }

#large-notification-overlay.hide-large { display: none !important; }
#large-notification-popup { display: flex; flex-direction: column; align-items: center; gap: 15px; overflow: visible; }
#large-notification-popup.large-notification-green-border { border-color: var(--success-color) !important; box-shadow: 0 0 20px rgba(10, 200, 110, 0.7); }
#large-notification-popup.large-notification-green-border .wave-animation-element { background-color: var(--success-color); }

.wave-animation-element {
    position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; background-color: var(--highlight-primary);
    border-radius: 50%; transform: translate(-50%, -50%) scale(0); opacity: 0; pointer-events: none; z-index: 0;
}
#large-notification-overlay.show-large .wave-animation-element { animation: maskingWave var(--nm-large-wave-duration) cubic-bezier(0.2, 0.7, 0.4, 1) forwards; }
#global-shatter-overlay-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 3001; display: none; }

/* --- Game Content Footer --- */
#active-game-content-footer {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; margin-top: auto; gap: 10px; position: relative;
}
#central-waiting-message { max-width: 800px; width:auto; margin-left: auto; margin-right: auto; }
.status-message { color: var(--text-secondary); font-style: italic; }

#game-round-display {
    white-space: nowrap; margin-left: auto; height: fit-content; width: fit-content;
    background-color: var(--bg-primary); color: var(--text-primary); padding: 6px 12px;
    border-radius: 20px; border: 2px solid var(--highlight-secondary);
    font-size: 0.9em; font-weight: 600; z-index: 100; display: inline-flex; align-items: center; gap: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
#current-round-number { color: var(--highlight-secondary); font-weight: bold; }

/* --- Game Prompt --- */
#prompt-bubble::after {
    content: ''; position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
    border: 9px solid transparent; border-top-color: var(--highlight-primary);
}
#prompt-text { font-size: 1.8em; font-weight: 500; color: var(--text-primary); margin: 0; }
#persistent-prompt-display {
    position: relative; margin-right: auto; width: 44px; height: 44px;
    flex-shrink: 0; opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
}
#persistent-prompt-display.visible { opacity: 1; pointer-events: auto; }
#persistent-prompt-toggle {
    width: 100%; height: 100%; border-radius: 50%; background: var(--bg-primary);
    border: 2px solid var(--highlight-secondary); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    cursor: help; display: flex; justify-content: center; align-items: center;
    font-size: 1.8em; font-weight: bold; color: var(--highlight-secondary); transition: background-color 0.2s ease, border-color 0.2s ease;
}
#persistent-prompt-display:hover #persistent-prompt-toggle { background-color: var(--highlight-primary); border-color: #fff; }
#persistent-prompt-text {
    left: 0; position: absolute; bottom: calc(100% + 10px); width: max-content; max-width: 300px;
    padding: 12px 15px; background: var(--bg-primary); border-radius: 6px; box-shadow: 0 3px 15px rgba(0, 0, 0, 0.5);
    font-size: 0.9em; color: var(--text-secondary); opacity: 0; transform: translateY(10px); pointer-events: none;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out; z-index: 20;
}
#persistent-prompt-display:hover #persistent-prompt-text { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* --- Unified Popup Overlay --- */
.unified-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6);
    display: flex; justify-content: center; align-items: center; z-index: 3000; opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}
.unified-popup-bubble {
    position: relative; background: var(--bg-tertiary); border: 2px solid var(--highlight-primary);
    border-radius: 12px; padding: 30px 40px; max-width: 500px; width: 90%; text-align: center;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5); transform: scale(0.8); opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease-in-out;
}
.unified-overlay.visible, .unified-overlay.show-large { opacity: 1; pointer-events: auto; }
.unified-overlay.visible .unified-popup-bubble, .unified-overlay.show-large .unified-popup-bubble { transform: scale(1); opacity: 1; }

/* --- Volume Control --- */
#volume-control-container { position: relative; display: flex; align-items: center; }
#volume-icon-button {
    background: color-mix(in srgb, var(--header-bg-start) 80%, white); border: none; box-shadow: none;
    padding: 8px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    line-height: 0; transition: background-color 0.2s ease;
}
#volume-icon-button:hover { background: color-mix(in srgb, var(--header-bg-start) 60%, white); }
#volume-icon-button svg { width: 20px; height: 20px; fill: #fff; transition: transform 0.2s ease; }

#volume-slider-wrapper {
    position: absolute; z-index: 10; top: calc(100% + 8px); left: 50%; width: 150px;
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(-10px); pointer-events: none;
    transition: opacity 250ms cubic-bezier(0.25, 0.8, 0.25, 1), transform 250ms cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s 250ms;
}
#volume-slider-wrapper::before, #volume-slider-wrapper::after {
    content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent;
}
#volume-slider-wrapper::before { transform: translateX(-50%); border-bottom: 8px solid var(--border-color); }
#volume-slider-wrapper::after { transform: translateX(-50%) translateY(1px); border-bottom: 7px solid var(--bg-secondary); border-left-width: 7px; border-right-width: 7px; }
#volume-control-container:hover #volume-slider-wrapper {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); pointer-events: auto; transition-delay: 0s;
}
#volume-slider { width: 100%; }

/* --- Patch Notes Toggle --- */
.patch-header { cursor: pointer; user-select: none; padding: 5px 0; transition: opacity 0.2s; }
.patch-header:hover { opacity: 0.8; }
.patch-arrow { display: inline-block; transition: transform 0.3s ease; margin-left: 10px; font-size: 0.8em; color: var(--highlight-primary); }
.patch-arrow.rotated { transform: rotate(180deg); }
.patch-body { display: none; overflow: hidden; animation: popInFromTop 0.2s ease-out; }
.patch-body.expanded { display: block; }
.patch-section-title { margin-top: 12px; margin-bottom: 4px; color: white; }
.patch-note-item { padding-left: 15px; margin-bottom: 4px; color: var(--text-secondary); line-height: 1.4; }

/* Landing Page Start Button */
#landing-start-container {
    display: flex; justify-content: center; width: 100%; margin-top: 40px;
    padding-top: 30px; padding-bottom: 20px; border-top: 2px solid var(--muted-line);
}

/* Side Tab Button */
.side-tab-section .base-button.side-tab-button, .side-tab-button {
    width: 100%; display: block; margin-bottom: 10px; text-align: left;
    padding: 12px 18px; font-size: 1rem;
    font-family: var(--font-family); line-height: 1.5;
    box-sizing: border-box; text-decoration: none; cursor: pointer; margin-top: 10px;
}

/* ==========================================================================
   9. MEDIA QUERIES
   ========================================================================== */

/* 1. Tablet & Small Laptops (Side-by-side but narrower) */
@media (max-width: 1366px) and (min-width: 769px) {
    :root {
        --sidebar-width: 280px; 
    }

    /* Prevent header from growing vertically and overlapping content */
    .panel-header { padding: 15px 20px; }
    #header-logo-img { width: 180px; top: -40px; }
    .panel-header nav { gap: 12px; }
    .panel-header nav .base-button.header-nav-button { padding: 6px 10px; font-size: 0.85rem; }

    /* Fix Layout Shift & Implement Expandable Sidebar Overlap */
    .lobby-content { 
        grid-template-columns: var(--sidebar-min-width) 1fr;
        padding: 10px; gap: 10px; align-items: start; 
    } 

    .controls {
        grid-column: 2; /* Force controls into the second column to clear space for minimized sidebar */
        width: 100%;
    }

    .circular-toggle-btn {
        display: flex; /* Show toggle button ONLY on tablet */
    }

    .player-section {
        position: relative; /* Stays in normal flow vertically */
        z-index: 50; /* Ensure it overlaps .controls visually when expanded */
        width: var(--sidebar-width);
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
        box-shadow: 6px 0 20px rgba(0,0,0,0.4); /* Shadow over right content when expanded */
        /* background-color override removed so the .panel confetti pattern remains visible */
    }

    /* Minimized State (Tablet only) */
    .player-section.minimized {
        width: var(--sidebar-min-width);
        box-shadow: none; /* No shadow when minimized */
        /* background-color: transparent removed so the minimized panel keeps the pattern too */
    }

    .player-section.minimized .player-header-title { display: none; }
    .player-section.minimized .player-section-header { justify-content: center; }
    .player-section.minimized .circular-toggle-btn { margin-left: 0; }
    .player-section.minimized .circular-toggle-btn svg { transform: rotate(180deg); }
    .player-section.minimized .player-details-center,
    .player-section.minimized .player-score-container,
    .player-section.minimized #player-section-footer { display: none !important; }
    
    /* Clean Minimized List Styles */
    .player-section.minimized .player { padding: 8px 0; justify-content: center; background-color: transparent; box-shadow: none; }
    .player-section.minimized .player:hover { transform: none; background-color: rgba(255,255,255,0.05); }
    .player-section.minimized .player-icon-img { margin: 0; }
    
    /* Removes the horizontal dividing lines between players in minimized view */
    .player-section.minimized .player-list { background-image: none; mask-image: none; }

    /* Shrink the right column width for Tablet Settings */
    .pre-lobby-grid { grid-template-columns: 1fr 280px; }

    #tips-panel { max-width: 100%; width: 100%; }

    #podium-container { flex-direction: column; align-items: center; gap: 20px; justify-content: center; margin-top: 20px; }
    #podium-main { height: 290px; gap: 5px; min-width: 0; max-width: 100%; }
    .podium-position { width: 80px; }
    .podium-player-icon { width: 40px; height: 40px; }
    .podium-player-score { font-size: 1.5em; }

    #podium-others-list-container { width: 100%; transform: none; opacity: 1; animation: none; margin-top: 20px; }
    #podium-others-list { max-height: 200px; overflow-y: auto; }

    .game-mode-description-box { flex-direction: column; }
    .game-mode-screenshot { width: 100%; max-width: 400px; height: auto; }
    
    .static-page-panel .back-button, 
    .standalone-static-panel .back-link,
    .static-content-panel .back-link {
        position: relative; top: auto; left: auto; align-self: flex-start;
        margin-bottom: 15px; padding: 5px 0;
    }
    .static-content-panel h1, .static-page-panel h1, .standalone-static-panel h1 { margin-top: 0; font-size: 1.8em; }
    .static-page-panel, .standalone-static-panel {
        background-attachment: scroll !important; transform: translateZ(0); will-change: scroll-position; -webkit-overflow-scrolling: touch;
    }
}

/* 2. Phones (Stacked Layout) */
@media (max-width: 768px) {
    .static-page-panel .back-button, 
    .standalone-static-panel .back-link,
    .static-content-panel .back-link {
        position: relative; top: auto; left: auto; align-self: flex-start;
        margin-bottom: 15px; padding: 5px 0;
    }
    .static-content-panel h1, .static-page-panel h1, .standalone-static-panel h1 { margin-top: 0; font-size: 1.8em; }
    .static-page-panel, .standalone-static-panel {
        background-attachment: scroll !important; transform: translateZ(0); will-change: scroll-position; -webkit-overflow-scrolling: touch;
    }

    .game-mode-description-box { flex-direction: column; }
    .game-mode-screenshot { width: 100%; max-width: 100%; height: auto; }

    /* Stack components cleanly outside grid rows */
    .lobby-content { display: flex !important; flex-direction: column !important; }
    .controls { order: 1; width: 100%; flex: 1 1 auto; }
    
    /* Revert player section from overflowing */
    .player-section { 
        position: relative;
        width: 100%;
        height: auto; 
        max-height: 40vh; 
        order: 2; 
        box-shadow: none;
        z-index: 1;
        left: 0; top: 0;
        flex: 0 0 auto;
    }
    
    /* Ensure toggle button is hidden on mobile */
    .circular-toggle-btn { display: none !important; }
    
    /* Pre-lobby adjustments */
    .pre-lobby-grid { grid-template-columns: 1fr; min-width: 0; width: 100%; }

    body { padding: 0; min-height: 100vh; min-height: 100lvh; } 
    body.ads-hidden { padding: 0; }

    #generic-notification-popup { top: 20px; bottom: auto; transform: translateX(-50%) translateY(-150%); }
    #generic-notification-popup.show { transform: translateX(-50%) translateY(0); }

    #persistent-prompt-text { font-size: 0.75em; width: 500%; }
    
    .lobby-footer { 
        background: var(--bg-primary); 
        border-top: 1px solid rgba(255, 255, 255, 0.1); 
        padding: 12px 0; 
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        margin-top: auto; 
    }
    .panel-wrapper { 
        background: transparent; 
        box-shadow: none; 
        border-radius: 0; 
        padding-top: 60px; 
        min-height: 100vh; 
        min-height: 100lvh; 
        display: flex;
        flex-direction: column;
    }
    
    #app-container.login-view-active .lobby-content {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 10px; 
        padding: 10px; 
    }
    
    #app-container.login-view-active .controls {
        flex: 1 1 auto; 
        flex-direction: column; /* Stack vertically */
        justify-content: flex-start;
        align-items: center; 
        gap: 10px; 
    }

    #login-area {
        flex: 0 0 auto; /* Prevent it from trying to be 550px tall */
        width: 100%;
    }
    
    #login-profile-setup { flex-wrap: wrap; }
    
    #tips-panel { 
        width: 100%; 
        max-width: 100%; 
        flex: 1 1 auto; /* Grow vertically to fill the remaining space */
    }
    
    #tips-container { height: auto; min-height: 180px; flex-grow: 1; }

    .panel-header {
        position: fixed; width: 100%; left: 0; top: 0; border-radius: 0; padding: 0 10px;
        flex-direction: row; justify-content: space-between; align-items: center; height: 60px; z-index: 201;
    }
    #header-logo-img {
        position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: auto;
        max-height: 44px; margin-bottom: 0; margin-left: 0;
    }
    .panel-header nav { display: none; }

    #side-tab-toggle-button { display: inline-flex !important; background: transparent; box-shadow: none; padding: 5px; color: var(--text-primary); font-size: 1.5em; order: -1; }
    #side-tab-toggle-button:hover { background: rgba(255, 255, 255, 0.1); }

    .game-view-header { position: relative; flex-direction: column; align-items: center; }
    .game-view-caption { padding-top: 10px; width: 100%; text-align: justify; }
    .game-view-timer-wrapper { position: absolute; top: 0px; right: 0px; z-index: 10; margin: -10px; }

    .timer-background, .timer-progress { stroke-width: 8; }

    .choice-card-container { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .game-mode-icon { width: 70%; height: 70%; }
    .game-mode-name { font-size: 0.85em; }

    .panel { padding: 15px; max-width: 100%; }
    .game-view-panel { padding-bottom: 60px; }
    #main-controls-area { overflow-x: hidden;}
    .waiting-button { font-size: 0.75em; }
    .joker-card { width: 60px; height: 80px; }
    .joker-icon { font-size: 1.8em; }

    .multi-select-options { top: auto; bottom: 100%; margin-top: 0; margin-bottom: 5px; }
    .multi-select-options.show { animation: popInFromBottom 0.2s ease-out; }
}

/* ==========================================================================
   10. DESKTOP & TABLET SHARED ENHANCEMENTS
   ========================================================================== */
@media (min-width: 769px) {
    #app-container.login-view-active .lobby-content {
        display: flex; flex-direction: column; justify-content: center; min-height: 100%;
    }
    
    #app-container.login-view-active .controls {
        display: flex; flex-direction: row; justify-content: center; align-items: stretch; gap: 20px;
    }
    
    #app-container.login-view-active #tips-panel { align-self: stretch; }
    
    #app-container:not(.login-view-active) .lobby-content { height: 100%; }
    #app-container:not(.login-view-active) .controls { height: 100%; }
}

/* ==========================================================================
   11. SIDE TAB MENU (MOBILE) & ANIMATIONS
   ========================================================================== */
.side-tab-menu {
    position: fixed; top: 0; left: -300px; width: 280px; height: 100vh; height: 100lvh;
    background: var(--bg-secondary); box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    z-index: 1000; transition: left 0.3s ease-in-out; display: flex; flex-direction: column;
    padding: 20px; overflow-y: auto;
}
.side-tab-menu.open { left: 0; }
.side-tab-close-button {
    position: absolute; top: 10px; right: 10px; background: transparent;
    border: none; color: var(--text-secondary); font-size: 1.8em; cursor: pointer;
    padding: 5px; line-height: 1; transition: color 0.2s ease;
}
.side-tab-close-button:hover { color: var(--text-primary); }
.side-tab-content { flex-grow: 1; display: flex; flex-direction: column; gap: 20px; padding-top: 40px; }
.side-tab-section { padding-bottom: 15px; border-bottom: 1px solid var(--muted-line); }
.side-tab-section:last-child { border-bottom: none; }

#volume-control-container-mobile { display: flex; align-items: center; gap: 10px; }
#volume-icon-button-mobile {
    background: color-mix(in srgb, var(--bg-tertiary) 90%, white); border: none; box-shadow: none;
    padding: 8px; border-radius: 8px; cursor: pointer; display: flex; align-items: center;
    justify-content: center; line-height: 0; transition: background-color 0.2s ease;
}
#volume-icon-button-mobile:hover { background: color-mix(in srgb, var(--bg-tertiary) 80%, white); }
#volume-icon-button-mobile svg { width: 20px; height: 20px; fill: #fff; }
#volume-slider-mobile { width: 100%; flex-grow: 1; }
#language-selector-container-mobile .base-dropdown { width: 100%; }

.anim-pop-in { animation: popInFromTop 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards; }
#millionaire-quiz-game-view.intro-animation .game-view-header,
#millionaire-quiz-game-view.intro-animation #quiz-answers-container .choice-card,
#millionaire-quiz-game-view.intro-animation .game-view-controls { opacity: 0; pointer-events: none; }

/* Keyframes */
@keyframes colorPulse { 0% { border-color: var(--highlight-primary); } 50% { border-color: white; } 100% { border-color: var(--highlight-primary); } }
@keyframes popInFromTop { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popInFromBottom { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes correctAnswerCelebration { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes confettiBurst { 0% { opacity: 1; transform: scale(0) rotate(0deg); } 100% { opacity: 0; transform: scale(1.5) rotate(180deg); } }
@keyframes stickerSlap { 0% { transform: scale(1.1) rotate(var(--sticker-tilt, 0deg)); opacity: 0.8; } 50% { transform: scale(0.98) rotate(calc(var(--sticker-tilt, 0deg) * -0.5)); } 100% { transform: scale(1) rotate(0deg); opacity: 1; } }
@keyframes orderItShake { 10%, 90% { transform: translate3d(-1px, 0, 0); } 20%, 80% { transform: translate3d(2px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-3px, 0, 0); } 40%, 60% { transform: translate3d(3px, 0, 0); } }
@keyframes orderItGlow { from { box-shadow: 0 0 5px 2px rgba(var(--highlight-primary-rgb), 0.4); } to { box-shadow: 0 0 15px 5px rgba(var(--highlight-primary-rgb), 0.7); } }
@keyframes orderItFlashFeedback { 50% { background-color: var(--feedback-flash-bg-color); border-color: var(--feedback-flash-border-color); transform: scale(1.05); } }
@keyframes maskingWave { 0% { transform: translate(-50%, -50%) scale(0); opacity: 0.6; } 70% { opacity: 0.2; } 100% { transform: translate(-50%, -50%) scale(40); opacity: 0; } }
@keyframes fadeInRight { to { opacity: 1; transform: translateX(0); } }
@keyframes rotate-tips {
    0% { opacity: 0; transform: translateY(10px); z-index: 1; pointer-events: none; }
    0.5% { opacity: 1; transform: translateY(0); z-index: 1; pointer-events: auto; }
    12% { opacity: 1; transform: translateY(0); z-index: 1; pointer-events: auto; }
    12.5% { opacity: 0; transform: translateY(-10px); z-index: 0; pointer-events: none; }
    100% { opacity: 0; transform: translateY(-10px); z-index: 0; pointer-events: none; }
}
@keyframes countdownAnim {
    0% { transform: scale(.6); opacity: 0; }
    20% { transform: scale(1.1); opacity: 1; color: var(--highlight-secondary); }
    80% { transform: scale(0.95); color: var(--highlight-primary); }
    100% { transform: scale(0.9); opacity: 0; }
}
@keyframes score-change-animation { 0% { opacity: 1; transform: translateY(0) scale(1.2); } 100% { opacity: 0; transform: translateY(-20px) scale(0.8); } }
@keyframes tier-flash-gradient { from { background-position: 100% 0; opacity: 0.9; } to { background-position: 0% 0; opacity: 0; } }
@keyframes winnerPulse { from { transform: translate(-50%, -50%) scale(1.2); } to { transform: translate(-50%, -50%) scale(1.3); } }
@keyframes orderItTimerPulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: 0.8; } 100% { transform: scale(1); opacity: 1; } }
@keyframes playful-spin { 0% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(540deg) scale(1.1); } 100% { transform: rotate(1080deg) scale(1); } }

/* ==========================================================================
   12. COOKIE CONSENT BANNER
   ========================================================================== */
#cookie-consent-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    background: var(--bg-tertiary);
    border: 2px solid var(--highlight-primary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    z-index: 9999;
    padding: 25px;
    color: var(--text-primary);
    transition: opacity 0.5s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cookie-consent-content h3 {
    margin: 0 0 10px 0;
    color: var(--highlight-secondary);
    font-size: 1.3em;
}

.cookie-consent-content p {
    font-size: 0.95em;
    margin: 0 0 20px 0;
    line-height: 1.5;
    color: var(--text-secondary);
}

.cookie-consent-content strong {
    color: var(--text-primary);
}

.cookie-consent-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.cookie-consent-buttons .base-button {
    padding: 10px 25px;
    font-size: 1em;
    min-width: 120px;
}

#cookie-reject-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: none;
    background-image: none;
}

#cookie-reject-btn:hover {
    background: var(--bg-primary);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    #cookie-consent-banner {
        bottom: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
        padding: 20px;
    }
    
    .cookie-consent-buttons {
        justify-content: stretch;
        flex-direction: column;
        gap: 10px;
    }
    
    .cookie-consent-buttons .base-button {
        width: 100%;
    }
}

/* ==========================================================================
   13. SPECTATOR MODE
   ========================================================================== */
body.is-spectator #image-guess-input,
body.is-spectator #image-guess-submit-button,
body.is-spectator #main-game-button {
    display: none !important;
}

/* End of Spectator Mode */