/* ==========================================================================
   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) 98%, 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;

    /* --- 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;
    /* Fixed padding for Ads */
    padding: 1rem 180px; 
    overflow-y: auto;
    transition: padding 0.4s ease-in-out;
}

/*.adsbygoogle {
    background-color: #f0f0f0;
    border: 2px dashed #ccc;
    opacity: 0.5;
}*/

body.ads-hidden {
    padding: 1rem;
}

#background-shader-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100lvh; /* Mobile viewport fix */
    z-index: -1;
}

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 --- */
/* Consolidated definition for all panel types */
.panel, 
.static-page-panel, 
.standalone-static-panel {
    /* 1. Math Base: White (Required for difference blending) */
    background-color: #ffffff;
    
    /* 2. Layers (Top to Bottom) */
    background-image: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 20%), /* Shine */
        linear-gradient(
            color-mix(in srgb, var(--panel-bg), black 6%), 
            color-mix(in srgb, var(--panel-bg), black 6%)
        ), /* Lifter */
        linear-gradient(var(--panel-bg), var(--panel-bg)), /* Colorizer */
        url('assets/shaders/confetti.webp'); /* Pattern */

    /* 3. Sizing & Blending */
    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;

    /* 4. Box Model */
    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); }

/* --- 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;
}

/* 3D Pop-out Buttons */
.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;
}
/* Squiggle Overlay */
.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 & Standard Dropdowns --- */
.base-input, 
.base-dropdown {
    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;
}

.base-input:focus,
.base-dropdown: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 (Custom) --- */
.multi-select-container {
    position: relative; width: 100%; min-width: 200px;
}

.multi-select-trigger {
    /* Mimic base-input styles */
    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;
    /* Add Arrow manually since it's a div */
    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; /* Fix z-index to be above other panels */
    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 --- */
.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); }

/* --- Scrollbars --- */
::-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;
}

/* --- Header --- */
.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 > 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);
}
.panel-header nav .base-button.header-nav-button:hover {
    background: color-mix(in srgb, var(--header-bg-start) 60%, white);
}
.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;
}

/* --- Content Grid --- */
.lobby-content {
    display: grid; grid-template-columns: 300px 1fr;
    gap: 18px; padding: 18px; align-items: stretch; flex-grow: 1; position: relative;
}
.lobby-content.static-view-active { grid-template-columns: 1fr; }
.lobby-content.static-view-active > #player-section { display: none; }

/* --- Controls (Right Side) --- */
.controls {
    position: relative; display: flex; flex-direction: column;
    gap: 14px; overflow-y: visible; height: 100%; padding: 0;
    /* Fix overflow issues */
    min-width: 0; width: 100%;
}

.controls > .panel,
#active-game-content,
#player-section {
    transition: opacity 0.3s ease-in-out;
}
.content-faded { opacity: 0; pointer-events: none; }

/* --- Footer --- */
.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 { height: 100%; min-width: 0; }
.lobby-content > #player-section { align-self: stretch; }

.player-section h2 {
    margin: 0 0 10px 0; font-size: 14px; color: var(--highlight-secondary);
    letter-spacing: 0.3px; display: flex; justify-content: space-between;
}
#host-status-indicator { font-weight: normal; color: var(--text-secondary); }

.player-list {
    display: grid; grid-auto-rows: var(--slot-height); gap: 0;
    position: relative; overflow-y: auto; 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;
}
.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; }
.player-tags { display: flex; gap: 5px; font-size: 0.75em; margin-bottom: 2px; }
.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; }

.player-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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;
}
.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; border-top: 1px solid var(--muted-line);
    display: flex; gap: 8px; justify-content: center;
}
#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: center; gap: 18px; }

#login-area { text-align: center; flex: 0 1 550px; max-width: 550px; }
#tips-panel { display: flex; flex-direction: column; flex: 0 1 350px; max-width: 350px; }

#profile-customization-box {
    padding: 20px; border-radius: 10px; max-width: 500px;
    margin: 20px auto; display: flex; flex-direction: column; align-items: center;
}
#login-profile-setup { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
#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; }

#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 {
    /* --- CONTROL SETTING --- */
    /* Change this one number to speed up or slow down the rotation */
    --time-per-tip: 12s; 
    
    /* --- Internal Calculations (Do not change) --- */
    --total-tips: 8; /* Must match the number of divs in your HTML */
    --cycle-duration: calc(var(--time-per-tip) * var(--total-tips));

    position: relative;
    flex-grow: 1;
    overflow: hidden;
    margin-top: 15px;
    min-height: 150px;
}

.tip {
    position: absolute;
    inset: 0;
    opacity: 0;
    /* Use the calculated total duration */
    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; }

/* Dynamic Delays based on the time-per-tip variable */
.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-header { display: grid; grid-template-columns: 1.85fr 1fr; gap: 20px; margin-bottom: 10px; }
.pre-lobby-grid { display: grid; grid-template-columns: 1.85fr 1fr; 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(140px, 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: 80%; 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; }

#game-specific-settings-area {
    background: var(--bg-secondary); border-radius: 8px; padding: 20px;
    border: 1px solid var(--border-color); min-height: 200px; height: 100%;
    display: flex; flex-direction: column;
}
#game-specific-settings-area .settings-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
#game-specific-settings-area label { font-weight: 500; color: var(--text-secondary); }
.setting-row { display: flex; align-items: center; gap: 15px; }
.setting-row input[type="number"] { width: 70px; text-align: center; }
#game-specific-settings-area.non-host-view .base-slider { display: none; }
#game-specific-settings-area.non-host-view .setting-row { justify-content: flex-start; }
.pre-lobby-settings { position: relative; }
.settings-icon { display: none; }

/* ==========================================================================
   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-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 */
#quiz-timer-container, #gtp-timer-container { position: relative; width: 80px; height: 80px; }
#quiz-timer-svg, #gtp-timer-svg { transform: rotate(-90deg); }
.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;
}
#quiz-timer-text, #gtp-timer-text {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2em; font-weight: bold; color: var(--text-primary);
}

/* --- Millionaire Quiz --- */
#millionaire-quiz-game-view .game-view-main { margin-top: 20px; justify-content: flex-start; }

#quiz-answers-container { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; }
#quiz-answers-container .choice-card {
    aspect-ratio: auto; height: auto; min-height: var(--slot-height);
    padding: 10px 20px; flex-direction: row; justify-content: flex-start; align-items: center; gap: 0;
}
#quiz-answers-container .choice-card.selected { animation: stickerSlap 350ms cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.choice-card-content { display: flex; align-items: center; gap: 15px; width: 100%; }
.quiz-answer-prefix { font-weight: bold; color: var(--highlight-secondary); transition: color 200ms ease, font-weight 200ms ease; }
#quiz-answers-container .choice-card.selected .quiz-answer-prefix { color: var(--text-primary); font-weight: 900; }
.quiz-answer-text { text-align: left; flex-grow: 1; }

.choice-card.locked-in { background-image: linear-gradient(135deg, var(--warning-color), #ffb868), 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>"); border-color: var(--warning-color); }
.choice-card.correct { background-image: linear-gradient(135deg, var(--success-color), #57e092), 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>"); border-color: var(--success-color); }
.choice-card.incorrect { background-image: linear-gradient(135deg, var(--error-color), #ff7a6b), 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>"); border-color: var(--error-color); opacity: 1 !important; }
.choice-card.disabled { opacity: 0.6; pointer-events: none; background-image: none; background-color: color-mix(in srgb, var(--bg-secondary) 97%, white); transform: none; }
.choice-card.eliminated-by-joker { opacity: 0.3 !important; pointer-events: none; transform: none; }

.quiz-answer-players { position: absolute; bottom: 5px; right: 10px; display: flex; gap: 4px; }
.player-icon-display { position: relative; width: 28px; height: 28px; }
.player-icon-display img { width: 100%; height: 100%; border-radius: 50%; border: 1px solid var(--highlight-secondary); object-fit: cover; }
.player-icon-tooltip {
    visibility: hidden; width: max-content; background-color: var(--bg-primary);
    color: var(--text-primary); text-align: center; border-radius: 4px; padding: 5px 8px;
    position: absolute; z-index: 10; bottom: 125%; left: 50%; transform: translateX(-50%);
    opacity: 0; transition: opacity 0.2s; font-size: 0.8em;
}
.player-icon-display:hover .player-icon-tooltip { visibility: visible; opacity: 1; }
#quiz-footer-buttons { display: flex; justify-content: center; align-items: center; gap: 15px; }
#quiz-lock-in-button, #quiz-next-round-button { min-width: 150px; }

#quiz-jokers-container { display: flex; justify-content: center; gap: 15px; margin-bottom: 20px; height: 100px; }
.joker-card {
    position: relative; width: 70px; height: 90px; background: var(--bg-tertiary);
    border: 2px solid var(--border-color); border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    padding: 0; font-family: inherit; font-weight: bold;
}
.joker-card:not(:disabled):hover { transform: translateY(-8px) scale(1.05); box-shadow: 0 10px 15px rgba(0, 0, 0, 0.4); }
.joker-icon { font-size: 2em; color: var(--highlight-secondary); }
.joker-tooltip {
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-5px);
    background-color: var(--bg-primary); color: var(--text-primary);
    padding: 5px 10px; border-radius: 4px; font-size: 0.8em; white-space: nowrap;
    opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease; pointer-events: none;
}
.joker-card:hover .joker-tooltip { opacity: 1; visibility: visible; }
.joker-card.used { background: var(--bg-secondary); }
.joker-card.used::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top right, transparent calc(50% - 2px), var(--text-secondary) calc(50% - 2px), var(--text-secondary) calc(50% + 2px), transparent calc(50% + 2px)); pointer-events: none;
}
.joker-card:disabled { cursor: not-allowed; opacity: 0.5; }

/* --- Image Guess --- */
#image-guess-game-view { text-align: center; }
#image-guess-game-view .game-view-main { gap: 0; }
#image-reveal-progress-bar-container {
    width: 100%; height: 30px; background-color: var(--bg-tertiary); flex-shrink: 0;
    position: relative; border-radius: 6px 6px 0 0; overflow: visible;
}
#image-reveal-progress-bar {
    height: 100%; width: 100%; background: linear-gradient(90deg, var(--highlight-primary), var(--highlight-secondary));
    float: right; position: relative; overflow: hidden;
}
#point-tiers-display { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
.point-tier {
    position: absolute; top: 50%; transform: translate(10px, -50%);
    color: rgba(255, 255, 255, 0.4); font-size: 0.9em; font-weight: bold;
    transition: color 0.3s ease, transform 0.3s ease, text-shadow 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); z-index: 2;
}
.point-tier::before {
    content: ''; position: absolute; top: 50%; left: 50%; width: 24px; height: 32px;
    background: var(--warning-color); transform: translate(-50%, -50%) scale(0.5); opacity: 0;
    z-index: -1; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.point-tier.active-tier { color: #fff; transform: translate(10px, -50%) scale(1.6); text-shadow: 0 0 8px rgba(255, 255, 255, 0.7); }
.point-tier.active-tier::before { transform: translate(-50%, -50%) scale(1); opacity: 1; }
#image-reveal-progress-bar.flash-active::after {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(to right, var(--warning-color) 20%, transparent 80%);
    background-size: 200% 100%; mix-blend-mode: additive;
    animation: tier-flash-gradient 0.6s ease-out forwards; pointer-events: none;
}
#image-display-container {
    width: 100%; flex-grow: 1; position: relative; display: flex; justify-content: center;
    align-items: center; min-height: 250px; background-color: var(--bg-primary);
    border-radius: 0 0 6px 6px; overflow: hidden;
}
#image-display-area { width: 100%; height: 100%; background-color: transparent; display: flex; justify-content: center; align-items: center; }
#glCanvas { display: block; max-width: 100%; max-height: 100%; }
#image-guess-controls-area { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
#game-button-container { display: flex; justify-content: center; align-items: center; gap: 15px; }

/* --- Guess The Price --- */
.gtp-product-display {
    text-align: center;
    display: flex;
    flex-direction: row; 
    gap: 20px;
    align-items: center; 
    justify-content: center;
    width: 100%;
    max-width: 1200px; 
}

/* 1. Features Area (Variable Width) */
#gtp-product-features {
    flex: 0 1 auto; 
    width: fit-content; 
    min-width: 220px; 
    max-width: 600px; 
    
    height: 360px; 
    background-color: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
    overflow: hidden; 
    box-sizing: border-box;
}

#gtp-product-features h4 { margin-top: 0; margin-bottom: 10px; color: var(--highlight-secondary); }
#gtp-product-features-list { 
    list-style-type: disc; 
    padding-left: 20px; 
    margin: 0; 
    font-size: 0.9em; 
    overflow-y: auto; 
    flex-grow: 1;
}
#gtp-product-features-list li { padding: 5px 0; }

/* 2. Results Area (Flex Width for Timeline) */
#gtp-results-area {
    flex: 1 1 500px; 
    min-width: 280px; 
    max-width: 100%;
    
    height: 360px; 
    background-color: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
    overflow: hidden; 
    box-sizing: border-box;
}

/* 3. Image Side (Auto Width) */
.gtp-image-container {
    flex: 0 1 auto; 
    height: 360px; 
    display: flex; 
    justify-content: center; 
    align-items: center;     
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
    min-width: 150px; 
}

#gtp-product-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.gtp-input-area { display: flex; align-items: center; gap: 10px; }
.gtp-price-adj-btn { width: 45px; height: 45px; font-size: 1.5em; padding: 0; line-height: 45px; text-align: center; }
.gtp-price-input-wrapper { position: relative; }
.gtp-price-input-wrapper span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 1.2em; color: var(--text-secondary); pointer-events: none; }
#gtp-price-input { width: 200px; font-size: 1.5em; text-align: center; padding-left: 35px; }
#gtp-lock-in-button { width: 100%; max-width: 310px; }

/* --- Guess The Price Results Updates --- */

#gtp-visual-results-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%; 
    position: relative;
    width: 100%; 
}

#gtp-list-view-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
    height: 100%; 
    overflow: hidden;
    padding: 0 5px;
}

/* Timeline specific adjustments */
#gtp-timeline-container {
    position: relative;
    height: 5px; 
    margin: 60px 0; 
    width: 100%;
    flex-shrink: 0;
}

#gtp-timeline-track {
    position: absolute; 
    top: 0; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to right, var(--border-color), var(--highlight-primary), var(--border-color));
    border-radius: 5px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

#gtp-timeline-labels {
    display: flex; 
    justify-content: space-between; 
    padding: 0 5px; 
    font-size: 0.9em; 
    color: var(--text-secondary);
    margin-top: -40px; 
}

/* Timeline Pins */
.gtp-timeline-player-guess {
    position: absolute;
    top: 50%; 
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    cursor: pointer;
    transition: z-index 0s, transform 0.3s ease;
}

.gtp-timeline-player-guess::after {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    border: 2px solid var(--highlight-secondary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.gtp-guess-bubble {
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    min-width: max-content;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.9;
}

.gtp-guess-bubble.shift-left { transform: translateX(calc(-50% - var(--gtp-bubble-h-shift))); }
.gtp-guess-bubble.shift-right { transform: translateX(calc(-50% + var(--gtp-bubble-h-shift))); }

.gtp-timeline-player-guess.pos-above .gtp-guess-bubble { bottom: 18px; transform-origin: bottom center; }
.gtp-timeline-player-guess.pos-below .gtp-guess-bubble { top: 18px; transform-origin: top center; }

.gtp-timeline-player-guess::before {
    content: '';
    position: absolute;
    width: 2px;
    background-color: rgba(255,255,255,0.3);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}
.gtp-timeline-player-guess.pos-above::before { bottom: 0; height: 18px; }
.gtp-timeline-player-guess.pos-below::before { top: 0; height: 18px; }

.gtp-guess-player-info {
    display: none;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    justify-content: center;
}
.gtp-guess-player-icon { width: 24px; height: 24px; border-radius: 50%; border: 1px solid #fff; }
.gtp-guess-player-name { font-size: 0.8em; color: var(--text-secondary); }

.gtp-guess-price { font-weight: bold; font-size: 0.9em; color: #fff; display: flex; align-items: center; gap: 4px; }
.gtp-indicator-arrow { font-size: 0.8em; }
.too-high .gtp-indicator-arrow { color: var(--error-color); transform: rotate(180deg); display: inline-block; }
.too-low .gtp-indicator-arrow { color: var(--success-color); }
.exact .gtp-indicator-arrow { display: none; }

.gtp-timeline-player-guess.winner::after { border-color: var(--warning-color); background-color: var(--warning-color); box-shadow: 0 0 10px var(--warning-color); }
.gtp-timeline-player-guess.winner .gtp-guess-bubble { border-color: var(--warning-color); z-index: 20; opacity: 1; }
.gtp-timeline-player-guess.winner .gtp-guess-price { color: var(--warning-color); }

.gtp-timeline-player-guess:hover, .gtp-timeline-player-guess.expanded { z-index: 100 !important; }
.gtp-timeline-player-guess:hover .gtp-guess-bubble, .gtp-timeline-player-guess.expanded .gtp-guess-bubble, .gtp-timeline-player-guess.winner .gtp-guess-bubble {
    background-color: var(--bg-secondary); border-color: var(--highlight-primary); transform: scale(1.1) translateX(-50%); z-index: 100; opacity: 1;
}
.gtp-timeline-player-guess:hover .gtp-guess-bubble.shift-left, .gtp-timeline-player-guess.expanded .gtp-guess-bubble.shift-left, .gtp-timeline-player-guess.winner .gtp-guess-bubble.shift-left {
    transform: scale(1.1) translateX(calc(-50% - var(--gtp-bubble-h-shift)));
}
.gtp-timeline-player-guess:hover .gtp-guess-bubble.shift-right, .gtp-timeline-player-guess.expanded .gtp-guess-bubble.shift-right, .gtp-timeline-player-guess.winner .gtp-guess-bubble.shift-right {
    transform: scale(1.1) translateX(calc(-50% + var(--gtp-bubble-h-shift)));
}
.gtp-timeline-player-guess.winner .gtp-guess-bubble { border-color: var(--warning-color); }
.gtp-timeline-player-guess:hover .gtp-guess-player-info, .gtp-timeline-player-guess.expanded .gtp-guess-player-info, .gtp-timeline-player-guess.winner .gtp-guess-player-info { display: flex; }

#gtp-timeline-correct-price-marker {
    position: absolute; top: -20px; bottom: -20px; 
    transform: translateX(-50%); width: 4px;
    z-index: 5; pointer-events: none;
}
#gtp-timeline-correct-price-marker .gtp-timeline-correct-price-line {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background-color: var(--highlight-primary);
    box-shadow: 0 0 10px rgba(var(--highlight-primary-rgb), 0.8);
    transform: scaleY(0); transition: transform 0.5s ease;
    border-radius: 2px;
}
#gtp-timeline-correct-price-marker.revealed .gtp-timeline-correct-price-line { transform: scaleY(1); }
.gtp-timeline-correct-price-label {
    position: absolute; bottom: 100%; left: 50%; 
    transform: translate(-50%, 2px);
    background-color: var(--highlight-primary); 
    color: #fff; padding: 4px 8px; border-radius: 4px; 
    font-weight: bold; white-space: nowrap; font-size: 0.9em;
    display: flex; flex-direction: column; align-items: center;
    opacity: 0; transition: opacity 0.3s; box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
.gtp-timeline-correct-price-label.shift-left { transform: translate(calc(-50% - var(--gtp-bubble-h-shift)), 2px); }
.gtp-timeline-correct-price-label.shift-right { transform: translate(calc(-50% + var(--gtp-bubble-h-shift)), 2px); }
#gtp-timeline-correct-price-marker.revealed .gtp-timeline-correct-price-label { opacity: 1; }
.gtp-timeline-correct-price-label span:first-child { font-size: 0.7em; opacity: 0.8; }

/* ==========================================================================
   UPDATED LIST VIEW & FOOTER STYLING
   ========================================================================== */
.gtp-results-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--muted-line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-shrink: 0; 
}

.gtp-list-header {
    background: var(--bg-tertiary);
    padding: 10px 12px; 
    border-radius: 6px; 
    margin-bottom: 12px;
    text-align: center; 
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.highlight-text { color: var(--highlight-primary); font-weight: 700; font-size: 1.1em; }

#gtp-list-scroll-area {
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Increased gap for better separation */
    padding: 5px;
    /* Custom scrollbar for webkit */
    scrollbar-width: thin;
    scrollbar-color: var(--highlight-primary) var(--bg-tertiary);
}

.gtp-list-row {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 10px 14px; 
    /* Darker card background to contrast with panel */
    background: var(--bg-tertiary); 
    border-radius: 8px; 
    flex-shrink: 0; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.gtp-list-row:hover {
    transform: translateY(-2px);
    background-color: color-mix(in srgb, var(--bg-tertiary) 90%, white);
}

/* Winner styling */
.gtp-list-row.is-winner { 
    border: 1px solid var(--warning-color);
}

.gtp-list-player { display: flex; align-items: center; gap: 10px; }
.gtp-list-icon { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255,255,255,0.2); }
.gtp-list-name { font-size: 0.95em; font-weight: 500; color: var(--text-primary); }

.gtp-list-price { 
    /* Standard font instead of monospace for cleaner look */
    font-family: var(--font-family); 
    font-weight: 700; 
    color: var(--highlight-secondary); 
    font-size: 1.05em;
}

.gtp-list-diff { 
    font-size: 0.85em; 
    color: var(--text-secondary); 
    margin-left: 8px; 
    font-style: italic;
}

#gtp-winner-detail-container { display: flex; align-items: center; text-align: left; }
.gtp-winner-label { font-size: 0.7em; color: var(--text-secondary); text-transform: uppercase; display: block; letter-spacing: 0.5px; margin-bottom: 2px; }
.gtp-winner-content { display: flex; align-items: center; gap: 10px; }
.gtp-winner-icon { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--warning-color); object-fit: cover; }
.gtp-winner-text-group { display: flex; flex-direction: column; justify-content: center; }
.gtp-winner-name { font-weight: 700; font-size: 0.95em; line-height: 1.2; }
.gtp-winner-price { color: var(--warning-color); font-weight: 700; font-size: 0.9em; }

.small-button {
    padding: 8px 16px;
    font-size: 0.9em;
    background: var(--bg-tertiary);
    border: 1px solid var(--highlight-secondary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.small-button:hover {
    background: var(--highlight-primary);
    border-color: var(--highlight-primary);
    color: white;
}


/* --- Shared Header Text Styles (Quiz & GTP) --- */
#quiz-question-text, 
#gtp-product-name {
    text-align: left;
    font-size: 1.4em;
    color: var(--text-primary);
    width: 100%;
    display: block;
    /* Wrapping logic */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

/* --- Order It --- */
#order-it-player-lives-area {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; padding: 10px;
    background-color: var(--bg-secondary); border-radius: 6px; flex-grow: 1;
}
.order-it-player-life-entry { display: flex; align-items: center; gap: 8px; }
.order-it-player-life-entry.eliminated { opacity: 0.6; }
.order-it-player-life-entry.current-turn .order-it-player-life-name { color: var(--highlight-secondary); font-weight: bold; }
.order-it-player-life-icon { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.order-it-player-life-name { font-size: 0.9em; font-weight: 500; }
.order-it-player-life-hearts { font-size: 1em; color: var(--error-color); letter-spacing: 1px; }

#order-it-scale-container, #order-it-unplaced-container {
    width: 100%; padding: 10px; background-color: var(--bg-secondary); border-radius: 6px;
    min-height: 175px; display: flex; flex-direction: column;
}
#order-it-scale-container { position: relative; }
.order-it-direction-indicator {
    position: absolute; width: 30px; top: 5px; bottom: 5px; z-index: 200;
    box-sizing: border-box; border-radius: 4px; background-color: var(--bg-tertiary);
    color: var(--highlight-secondary); display: flex; justify-content: center; align-items: center;
    font-size: 1.5em; font-weight: bold; user-select: none;
}
#order-it-direction-indicator-left { left: 5px; }
#order-it-direction-indicator-right { right: 5px; }

#order-it-unplaced-container h5 { margin-bottom: 10px; text-align: center; color: var(--text-secondary); }
#order-it-unplaced-items-area {
    display: flex; flex-wrap: wrap; gap: var(--order-it-grid-gap); padding: 10px;
    border: 1px dashed var(--border-color); border-radius: 4px; flex-grow: 1; min-height: 0;
    min-height: calc(var(--dynamic-item-size, 100px) + 20px); justify-content: center; align-items: center;
}
#order-it-scale-area {
    display: flex; gap: var(--order-it-grid-gap); min-height: calc(var(--dynamic-item-size, 100px) + 20px);
    justify-content: center; align-items: center; position: relative; border: 1px dashed var(--border-color);
    border-radius: 4px; flex-grow: 1; min-height: 0;
}
.order-it-scale-slot {
    border: 2px dashed var(--border-color); border-radius: 4px; display: flex; justify-content: center;
    align-items: center; font-size: 2em; font-weight: bold; color: var(--text-secondary); flex-shrink: 0; user-select: none;
}
.order-it-scale-slot.drop-hover { background-color: color-mix(in srgb, rgb(var(--highlight-primary-rgb)) 15%, var(--bg-secondary)); }

.order-it-item {
    min-width: 40px; min-height: 40px; background-color: var(--bg-tertiary); border: 1px solid var(--border-color);
    border-radius: 4px; display: flex; flex-direction: column; justify-content: flex-end; cursor: grab;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); user-select: none; position: relative; overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease, width 0.2s ease, height 0.2s ease;
    flex-shrink: 0;
}
.order-it-item.dragging { opacity: 0.5 !important; cursor: grabbing !important; transform: scale(1.05); }
.order-it-item.pending-confirmation { border-color: var(--warning-color); border-style: dashed; }
.order-it-item.preview-placement { border-color: var(--highlight-secondary); border-style: dotted !important; opacity: 0.6; }
.order-it-item.order-it-item-awaiting-reveal { border-color: var(--highlight-primary); }

.order-it-item-img-placeholder {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover;
    background-position: center; z-index: 1; background-color: var(--bg-primary);
}

.order-it-item-info { 
    position: relative; 
    z-index: 2; 
    background: rgba(var(--bg-tertiary-rgb), 0.90); 
    padding: 5px; 
    width: 100%; 
    text-align: center; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    min-height: auto;
}

/* Name Styling */
.order-it-item-name { 
    font-size: 0.7em; 
    line-height: 1.2; 
    font-weight: bold;
    color: #fff;
    
    display: block; 
    width: 100%;
    
    /* Default: Truncated */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    padding-right: 0; 
}

/* 
   Conditional Overflow Styling 
   Applied via JS only when text is too long
*/
.order-it-item-name.overflows {
    padding-right: 18px; /* Space for icon */
}

.order-it-item-name.overflows::after {
    content: '🔍'; 
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7em;
    opacity: 0.7;
    filter: grayscale(1);
    pointer-events: none;
}

/* Value Styling */
.order-it-item-value { 
    font-size: 0.6em; 
    line-height: 1.1; 
    color: var(--highlight-secondary);
}

#order-it-turn-timer {
    display: inline-block;
    font-size: 1.4em;
    color: white;
    margin-left: 12px; /* Space between button and timer */
    vertical-align: middle;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    font-variant-numeric: tabular-nums; /* Prevents jitter as numbers change */
    min-width: 2ch;
}

#order-it-turn-timer.critical {
    color: var(--error-color);
    animation: orderItTimerPulse 1s infinite;
}

/* Ensure container allows side-by-side elements */
#order-it-controls-area {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Hover State (Desktop) */
@media (hover: hover) {
    /* When hovering a text that needs expansion */
    .order-it-item-info.can-expand:hover .order-it-item-name {
        white-space: normal;       /* Wrap text */
        word-wrap: break-word;
        overflow: visible;
        padding-right: 0 !important; /* Remove icon space */
    }
    .order-it-item-info.can-expand:hover .order-it-item-name::after {
        display: none;             /* Hide icon */
    }
}

/* Click/Active State (Mobile or Click) */
.order-it-item-info.can-expand.expanded .order-it-item-name {
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
    padding-right: 0 !important;
}
.order-it-item-info.can-expand.expanded .order-it-item-name::after {
    display: none;
}

/* Existing Animations */
.order-it-item-shaking { animation: orderItShake 0.5s cubic-bezier(.36, .07, .19, .97) both infinite alternate; }
.order-it-item-glowing { animation: orderItGlow 1s ease-in-out infinite alternate; }
.order-it-item.order-it-item-flash-correct { --feedback-flash-bg-color: var(--success-color); --feedback-flash-border-color: var(--success-color); animation: orderItFlashFeedback 0.5s ease-out; }
.order-it-item.order-it-item-flash-incorrect { --feedback-flash-bg-color: var(--error-color); --feedback-flash-border-color: var(--error-color); animation: orderItFlashFeedback 0.5s ease-out; }
#order-it-controls-area { margin-top: auto; text-align: center; padding-top: 15px; }

/* --- 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 Pages (Rules, About) --- */
.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-page-panel h1, .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;
}
.static-page-panel h2 { font-size: 1.8em; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; color: var(--highlight-secondary); }
.standalone-static-panel h2, .static-page-panel h3, .standalone-static-panel h3 {
    font-size: 1.4em; color: var(--highlight-primary); margin-top: 25px; margin-bottom: 15px;
}
.static-page-panel p, .standalone-static-panel p, .static-page-panel li, .standalone-static-panel li { margin-bottom: 10px; }
.static-page-panel ul, .standalone-static-panel ul { padding-left: 20px; }
.static-page-panel a, .standalone-static-panel a { color: var(--highlight-primary); text-decoration: none; }
.static-page-panel a:hover, .standalone-static-panel a:hover { text-decoration: underline; }

.static-page-panel .back-button, .standalone-static-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;
}
.static-page-panel .back-button:hover, .standalone-static-panel .back-link:hover { text-decoration: underline; }
.title-icon { height: 1.2em; width: auto; margin-left: 15px; display: block; }

.about-content-box {
    background-color: var(--bg-secondary);
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.game-mode-description-box {
    background-color: var(--bg-secondary); padding: 15px 20px; border-radius: 8px;
    margin-top: 20px; 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);
}

/* Standalone Page */
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: 1px solid var(--border-color); font-size: 0.9em; color: var(--text-secondary); }

/* --- 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; /* Pill shape */
    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; /* Prevent squishing in flex container */
    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;
}
#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 Styles --- */
.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; /* Hidden by default */
    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;
}

/* ==========================================================================
   9. MEDIA QUERIES
   ========================================================================== */
@media (max-width: 980px) {
    .pre-lobby-header { display: none; }
    body { padding: 8px; overflow-x: hidden; }
    .ad-banner { display: none; }
    body.ads-hidden { padding: 8px; }

    #main-controls-area > .panel, #active-game-content { flex-grow: 1; flex-shrink: 1; min-height: 0; }
    .panel-wrapper { min-height: calc(100vh - 16px); min-height: calc(100lvh - 16px); height: auto; padding-top: 80px; }
    .panel-header { height: auto; min-height: 80px; padding: 10px 15px; flex-direction: column; align-items: flex-start; gap: 10px; }
    .panel-header > img { position: relative; top: 0; left: 0; width: 150px; margin-bottom: -45px; margin-left: -5px; }
    .panel-header nav { width: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }

    .lobby-content { grid-template-columns: 1fr; padding: 10px; gap: 10px; align-items: stretch; }
    .player-section { order: 2; min-height: 200px; max-height: 40vh; }
    .controls { order: 1; }

    #app-container.login-view-active .controls { flex-direction: column; align-items: center; }
    #login-profile-setup { flex-direction: column; }
    #login-area { width: 100%; }

    .pre-lobby-grid { grid-template-columns: 1fr; }
    .pre-lobby-header { grid-template-columns: 1fr; }
    .settings-icon { display: block; position: absolute; top: 10px; right: 10px; }
    #tips-panel { max-width: 550px; width: 100%; }

    .gtp-product-display { flex-direction: column; }
    .gtp-input-area { flex-wrap: wrap; justify-content: center; }
    #gtp-price-input { width: 150px; }

    #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 {
        position: relative; /* Was absolute */
        top: auto;
        left: auto;
        align-self: flex-start; /* Align to left edge of flex column */
        margin-bottom: 15px;    /* Push the H1 down */
        padding: 5px 0;         /* Remove horizontal padding to align with text */
    }

    .static-page-panel h1,
    .standalone-static-panel h1 {
        margin-top: 0;          /* Remove top margin since button now takes space */
        font-size: 1.8em;       /* Slightly smaller font for mobile */
    }
}

@media (max-width: 600px) {
    body { padding: 0; }
    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; }
    .panel-wrapper { background: transparent; box-shadow: none; border-radius: 0; padding-top: 60px; min-height: 100lvh; }

    .panel-header {
        position: fixed; width: 100%; left: 0; top: 0; border-radius: 0; padding: 8px 10px;
        flex-direction: row; justify-content: space-between; align-items: center; min-height: 60px; z-index: 201;
    }
    .panel-header > 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; }

    #quiz-timer-container, #gtp-timer-container { width: 48px; height: 48px; }
    .timer-background, .timer-progress { stroke-width: 8; }
    #quiz-timer-text, #gtp-timer-text { font-size: 1.5em; }

    .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;
    }

    #order-it-game-view .game-view-main { flex-direction: row; align-items: stretch; gap: 10px; overflow-y: hidden; }
    #order-it-scale-container { flex: 1; display: flex; flex-direction: column; align-items: stretch; overflow: hidden; position: relative; padding: 10px; }
    .order-it-direction-indicator { width: auto; left: 5px; right: 5px; }
    #order-it-direction-indicator-left { top: auto; bottom: 5px; }
    #order-it-direction-indicator-right { bottom: auto; top: 5px; }

    #order-it-unplaced-container { flex: 1; max-height: none; display: flex; flex-direction: column; overflow: hidden; }
    #order-it-scale-area { flex-direction: column-reverse; flex-grow: 1; min-height: 0; justify-content: flex-start; align-items: center; padding: 30px; }
    #order-it-unplaced-items-area { flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 5px; border: 1px dashed var(--border-color); flex-wrap: nowrap; }
    .order-it-item-info { font-size: 0.75em; }

    .gtp-product-display { flex-direction: column; }
    
    #gtp-results-area,
    #gtp-product-features,
    .gtp-image-container {
        /* FIX: Prevent shrinking clipping the bottom content */
        flex: 0 0 auto;
        width: 100%;
        min-width: 0; 
        max-width: none; 
        height: auto;
        min-height: 250px;
    }
    
    #gtp-visual-results-container { 
        height: auto; 
        min-height: 200px;
        padding-bottom: 20px; /* Ensure space for bubbles */
    }
    
    #gtp-list-view-container {
        height: auto;
        /* Limit scroll height on mobile so page doesn't get endless */
        max-height: 50vh; 
        overflow: hidden; /* Scroll area inside handles scrolling */
    }

    #gtp-list-scroll-area {
        /* Ensure scroll area takes height but respects parent max */
        max-height: 50vh; 
    }
    
    .gtp-results-footer { 
        flex-direction: column; 
        align-items: stretch; 
        text-align: center; 
        padding-bottom: 5px;
    }
    
    #gtp-winner-detail-container { justify-content: center; margin-bottom: 10px; }
    #gtp-toggle-view-button { width: 100%; }
}

/* ==========================================================================
   10. SIDE TAB MENU (MOBILE) & ANIMATIONS
   ========================================================================== */
.side-tab-menu {
    position: fixed; top: 0; left: -300px; width: 280px; height: 100lvh; height: 100vh;
    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%; }
.side-tab-button { width: 100%; display: block; margin-top: 10px; }

/* Shared Animation Triggers */
.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;
}

/* --- Keyframe Animations --- */

@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); }
}

