/* style.css - Complete Master Version (Final Corrected) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;900&display=swap');

:root {
    --primary: #5c6bc0;
    --accent: #ff4757;
    --bg: #121212;
    --panel: #1e1e1e;
    --border: #333333;
    --text: #e0e0e0;
}

/* --- Disable tap highlight on all interactive elements --- */
*,
*::before,
*::after {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* --- Block background scroll when modal is open --- */
body.modal-open {
    touch-action: none;
    -ms-touch-action: none;
}

/* Edit icon focus style */
.edit-name-icon:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Delete cross focus style (for span with role=button) */
.delete-cross:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Fixed Background Layer --- */
#wheel-bg-layer {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; 
    z-index: -1; 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

#wheel-bg-layer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); 
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* --- Floating Fullscreen Button --- */
.floating-round-btn {
    position: fixed;
    top: 14px;
    left: 14px;
    width: 32px;
    height: 32px;
    border-radius: 25px;
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #999;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2000;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.floating-round-btn svg {
    width: 15px;
    height: 15px;
}

@media (hover: hover) {
    .floating-round-btn:hover {
        background: rgba(50, 50, 50, 0.8);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* --- Layout Structure (merged with loading animation properties) --- */
.app-container {
    display: flex;
    flex-direction: row;
    align-items: stretch; 
    min-height: 100vh;
    width: 100%;
}

.wheel-panel {
    flex: 2; 
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    padding: 10px 0;
    background: transparent; 
    height: 100vh; 
    position: sticky;
    top: 0;
    z-index: 1;
    overflow: hidden;
}

.wheel-panel.full-width {
    flex: 1;
    width: 100%;
    padding: 10px;
    height: 100vh;
}

.wheel-wrapper {
    position: relative;
    width: 90%;
    max-width: 550px;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
}

#pointer {
    position: absolute;
    top: 50%;
    right: -10px;
    transform: translateY(-50%) rotate(90deg);
    width: 0; 
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 35px solid var(--accent);
    z-index: 10;
    filter: drop-shadow(-3px 0px 4px rgba(0,0,0,0.3));
}

#pointer::before {
    content: "";
    position: absolute;
    top: -35px;
    left: -15px; 
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 0px solid transparent;
    border-top: 35px solid rgba(0, 0, 0, 0.2);
}

#wheel-container {
    width: 100%;
    height: 100%;
    display: block;
    transform-origin: center center;
    transition: none;
}

/* --- Controls Panel (Right) --- */
.controls-panel {
    flex: 0.9;
    padding: 20px 20px 30px 20px;
    background: var(--panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    zoom: 0.9;
    font-size: 0.95rem;
}

/* Firefox fallback for zoom */
@supports not (zoom: 1) {
    .controls-panel {
        transform: scale(0.9);
        transform-origin: top right;
    }
}

.controls-panel.panel-hidden {
    display: none;
}

/* --- Show Button (Floating) --- */
#showPanelBtn.floating-round-btn {
    top: 14px;
    right: 14px;
    left: auto;
    display: none;
}

#showPanelBtn.floating-round-btn.visible {
    display: flex;
}

/* --- Input Bar Styling --- */
.input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    align-items: stretch;
}

.combined-field {
    display: flex;
    flex: 1;
    background: #252525;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.combined-field:focus-within {
    border-color: #ff4757;
}

/* Fix: Input error visual feedback (script.js adds this class) */
.combined-field.input-error {
    border-color: var(--accent) !important;
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.3);
    animation: errorShake 0.4s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

#nameInputItem {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 12px 15px;
    outline: none;
    font-size: 16px;
}

/* UPLOAD ICON STYLING */
.upload-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    background: #1a1a1a;
    border-left: 1px solid var(--border);
}

.upload-fill-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: linear-gradient(to top, #2ed573, #7bed9f);
    transition: height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1;
    pointer-events: none;
}

.upload-icon-wrapper img {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 2;
    filter: none;
    transition: transform 0.2s;
}

.upload-icon-wrapper.ready {
    background: rgba(46, 213, 115, 0.15);
}

.upload-icon-wrapper.ready img {
    transform: scale(1.1);
}

@keyframes drainEffect {
    0% { transform: translateY(0); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.upload-icon-wrapper.draining img {
    animation: drainEffect 0.3s ease;
}

.upload-ready-state {
    background: #2ecc71 !important;
    color: #fff !important;
    border-color: #27ae60 !important;
    animation: upload-ready-pulse 1.5s ease-in-out infinite;
    font-weight: 600;
    cursor: pointer;
}

.upload-ready-state:hover {
    background: #27ae60 !important;
    transform: scale(1.03);
}

@keyframes upload-ready-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
    50% { box-shadow: 0 0 12px 4px rgba(46, 204, 113, 0.3); }
}

#wheel-container image {
    pointer-events: none;
}

#addNameBtn {
    background: var(--primary);
    color: white;
    padding: 0 20px;
}

.clear-circle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #333;
    color: #888;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    transition: 0.2s;
}

.clear-circle-btn:hover { background: var(--accent); color: white; }

/* --- Dynamic Name List --- */
.names-list-container {
    max-height: 288px;
    overflow-y: auto;
    margin-bottom: 0;
    padding-right: 5px;
    transition: max-height 0.05s linear;
}

/* --- UNIVERSAL CUSTOM SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #161616;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 10px;
    border: 2px solid #161616;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.names-list-container::-webkit-scrollbar-thumb {
    background: #444; 
}

.names-list-container::-webkit-scrollbar-thumb:active {
    background: var(--primary);
}

/* Firefox scrollbar — scoped to scrollable containers */
body,
.names-list-container,
.results-container,
.gallery-grid,
.adv-modal-body,
.gallery-grid-panel {
    scrollbar-width: thin;
    scrollbar-color: #444 #161616;
}

.name-entry-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252525;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    opacity: 0;
    animation: slideIn 0.4s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- New Entry Glow Effect --- */
@keyframes entryGlow {
    0% {
        box-shadow: 0 0 0px rgba(255, 255, 255, 0);
    }
    20% {
        box-shadow: 0 0 14px rgba(255, 255, 255, 0.5), inset 0 0 8px rgba(255, 255, 255, 0.08);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6), inset 0 0 12px rgba(255, 255, 255, 0.1);
    }
    100% {
        box-shadow: none;
    }
}

.name-entry-row.glow-new {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6), inset 0 0 12px rgba(255, 255, 255, 0.1);
    transition: box-shadow 1.4s ease;
}

.name-entry-row.glow-fade {
    box-shadow: none;
    transition: box-shadow 1.4s ease;
}

/* Inline edit input styling */
.inline-edit-input {
    flex: 1;
    background: #222;
    border: 1px solid var(--accent);
    color: white;
    padding: 2px 5px;
    border-radius: 4px;
    outline: none;
    font-size: 14px;
    min-width: 50px;
}

.inline-edit-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 6px rgba(92, 107, 192, 0.3);
}

.delete-cross {
    color: #666;
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.delete-cross:hover { color: var(--accent); }
.delete-cross:active { background: rgba(255, 71, 87, 0.2); }

/* --- Color Indicator: Ring (default) vs Filled (custom) --- */
.color-indicator {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    margin-right: 12px;
    cursor: pointer;
    border: 3px solid;
    border-color: var(--indicator-color);
    background: transparent;
    transition: transform 0.2s;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.color-indicator:hover {
    transform: scale(1.2);
}

.color-indicator.has-custom-color {
    background: var(--indicator-color);
    border-color: rgba(255, 255, 255, 0.3);
}

.name-entry-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.name-color-picker {
    position: absolute;
    visibility: hidden;
    width: 0;
    height: 0;
}

/* --- Tabs & Buttons --- */
.tabs-nav { display: flex; margin-bottom: 20px; border-bottom: 2px solid #333; }
.tab-link { flex: 1; background: transparent; color: #888; padding: 12px; font-weight: bold; border: none; cursor: pointer; }
.tab-link.active { color: #fff; border-bottom: 2px solid var(--accent); }

.tabs-viewport { 
    width: 100%; 
    overflow: hidden; 
    overscroll-behavior-x: none; 
}

.tabs-slider { display: flex; width: 200%; transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-pane { width: 50%; min-height: 450px; padding-top: 10px; }

.button-group { display: flex; gap: 10px; margin-bottom: 15px; }
button { cursor: pointer; border: none; border-radius: 8px; font-weight: 600; transition: all 0.2s; }
button:hover { filter: brightness(1.2); }

#shuffleBtn { background: #b3020b; color: white; flex: 1; padding: 12px; }
#sortBtn { background: #2f3542; color: white; flex: 1; padding: 12px; }

/* --- Results --- */
.results-container {
    background: #161616;
    border: 1px solid #333;
    border-radius: 8px;
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    margin-bottom: 25px;
}

.result-row { padding: 10px 0; border-bottom: 1px solid #222; }

.empty-msg {
    color: #666;
    text-align: center;
    font-size: 14px;
    padding: 40px 10px;
    margin: 0;
}

/* --- Templates (Bottom) --- */
.templates-outer-wrapper { width: 100%; max-width: 1200px; margin: 40px auto; padding: 0 20px; box-sizing: border-box; }
.template-toggle-wrapper { text-align: center; margin-bottom: 20px; }
.template-toggle-btn { background: #1a1a1a; border: 1px solid #333; color: #999; padding: 12px 30px; border-radius: 50px; cursor: pointer; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; padding: 20px; background: #0d0d0d; border-radius: 20px; }

.template-card {
    background: #161616;
    padding: 12px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #222;
    transition: 0.2s;
}

.template-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
}

.template-preview-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0d0d0d;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border: 1px solid #222;
}

.template-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.template-preview-fallback {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: white;
}

.template-label {
    display: block;
    text-align: center;
    color: #ccc;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 0 5px 0;
}




/* --- Winner Modal --- */
.modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.9); z-index: 3000; justify-content: center; align-items: center; }
.modal-content { background: #252525; padding: 40px; border-radius: 24px; text-align: center; border: 1px solid #444; min-width: 300px; }

/* Fix: Modal actions layout (used by multiple modals) */
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.danger-btn { background: var(--accent); color: white; padding: 12px 20px; margin-right: 10px; }
#closeModal, #closeTitleModalBtn { background: #444; color: white; padding: 12px 20px; }

/* ================================================
   DUPLICATE MODAL STYLING
   ================================================ */

.duplicate-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.duplicate-modal-actions button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#duplicateAddBtn {
    background: var(--primary, #ff4757);
    color: white;
    border: 2px solid var(--primary, #ff4757);
}

#duplicateAddBtn:hover {
    opacity: 0.85;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

#duplicateAddBtn:active {
    transform: translateY(0);
}

#duplicateNoBtn {
    background: #444;
    color: white;
    border: 2px solid #555;
}

#duplicateNoBtn:hover {
    background: #555;
    border-color: #666;
    opacity: 0.9;
}

#duplicateNoBtn:active {
    background: #333;
}

@media (max-width: 480px) {
    .duplicate-modal-actions {
        flex-direction: column;
    }

    .duplicate-modal-actions button {
        width: 100%;
    }
}

#winnerName {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    perspective: 1500px;
    height: 70px;
    margin: 20px 0;
}

.wave-letter {
    display: inline-block;
    font-size: 2.3rem; 
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform;
    animation: zoomRipple 2s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

@keyframes zoomRipple {
    0%, 100% {
        transform: translate3d(0, 0, 0); 
        opacity: 0.6;
    }
    50% {
        transform: translate3d(0, 0, 150px); 
        opacity: 1;
        text-shadow: 
            0 0 25px rgba(255, 215, 0, 1), 
            0 0 40px rgba(255, 215, 0, 0.4);
    }
}

/* --- Winner Image --- */
#winnerImageContainer {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
}

#winnerImageContainer img,
.winner-popup-img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border: 4px solid #ffd700; 
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    display: block;
    margin: 0 auto;
    margin-bottom: 20px;
    animation: winnerPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes winnerPop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 800px) {
    .app-container { 
        flex-direction: column; 
        overflow-x: hidden;
    }

    .wheel-panel { 
        order: 1; 
        flex: 1; 
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 40px 0 20px 0; 
        min-height: auto; 
        height: auto;
        width: 100%; 
    }

    .wheel-panel.full-width {
        width: 100%;
        height: 100vh;
        padding: 0;
        margin: 0;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .controls-panel { 
        order: 2; 
        flex: 1; 
        border-left: none; 
        border-top: 1px solid #333; 
        padding: 20px;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    #pointer {
        right: -10px;
    }

    .wheel-wrapper {
        margin: 0 auto;
        max-width: 85vw;
        position: relative;
    }
}

/* --- Global Click/Success Animations --- */
button:active, 
.template-card:active, 
.clear-circle-btn:active,
.delete-cross:active {
    transform: scale(0.94) !important;
    filter: brightness(0.8);
    transition: transform 0.05s linear;
}

.input-success {
    animation: successGlow 0.5s ease;
}

@keyframes successGlow {
    0% { border-color: var(--border); box-shadow: none; }
    50% { border-color: #2ed573; box-shadow: 0 0 10px rgba(46, 213, 115, 0.4); }
    100% { border-color: var(--border); box-shadow: none; }
}

/* ============================================================
   ADVANCED SETTINGS MODAL — GRID REDESIGN (No Emoji, Responsive, No Horizontal Scroll)
   ============================================================ */

.adv-grid-modal {
    width: 95%;
    max-width: 520px !important;
    max-height: 90vh !important;
    padding: 0 !important;
    border-radius: 20px !important;
    background: #141418 !important;
    border: 1px solid #2a2a30 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.03) !important;
    box-sizing: border-box !important;
}

/* ─── Header Bar ─── */
.adv-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #222228;
    flex-shrink: 0;
    gap: 10px;
}

.adv-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.adv-header-icon-img {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    opacity: 0.8;
}

.adv-header-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adv-header-sub {
    font-size: 0.72rem;
    color: #555;
    margin-top: 2px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adv-grid-modal .close-adv-x {
    font-size: 26px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    transition: all 0.2s;
    flex-shrink: 0;
    cursor: pointer;
    color: #888;
}

.adv-grid-modal .close-adv-x:hover {
    background: rgba(255, 71, 87, 0.15);
    color: var(--accent);
}

/* ─── Scrollable Body ─── */
.adv-grid-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 16px 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* ─── Section ─── */
.adv-section {
    margin-bottom: 22px;
}

.adv-section:last-child {
    margin-bottom: 10px;
}

.adv-section-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: #555;
    margin-bottom: 12px;
    padding-left: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.adv-section-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.5;
}

/* ═════════════════════════════════════════
   VISUAL PREVIEW CARDS (2×2 grid)
   ═════════════════════════════════════════ */

.adv-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.adv-preview-card {
    position: relative;
    background: #1c1c22;
    border: 1px solid #2a2a32;
    border-radius: 14px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.adv-preview-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(92, 107, 192, 0.12);
}

.adv-preview-card:active {
    transform: translateY(0) scale(0.98);
}

.adv-preview-card.has-content {
    border-color: rgba(92, 107, 192, 0.3);
}

.adv-preview-card.has-content .adv-card-status {
    color: var(--primary);
}

/* Badge */
.adv-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(92, 107, 192, 0.4);
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.adv-card-badge img {
    width: 12px;
    height: 12px;
}

@keyframes badgePop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Visual area */
.adv-card-visual {
    width: 100%;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #16161a;
    border-bottom: 1px solid #222228;
    overflow: hidden;
    position: relative;
}

.adv-card-visual img:not(.adv-card-placeholder-icon) {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.adv-card-placeholder {
    font-size: 24px;
    opacity: 0.25;
    user-select: none;
    transition: opacity 0.2s, transform 0.2s;
    color: #888;
}

.adv-card-placeholder-icon {
    width: 28px;
    height: 28px;
    opacity: 0.25;
    user-select: none;
    transition: opacity 0.2s, transform 0.2s;
}

.adv-preview-card:hover .adv-card-placeholder,
.adv-preview-card:hover .adv-card-placeholder-icon {
    opacity: 0.45;
    transform: scale(1.1);
}

.adv-card-visual .adv-title-preview {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    text-align: center;
    padding: 0 8px;
    word-break: break-word;
    line-height: 1.3;
    max-height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Info area */
.adv-card-info {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.adv-card-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adv-card-status {
    font-size: 0.65rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═════════════════════════════════════════
   BEHAVIOR TOGGLE CARDS — 2-COLUMN GRID
   ═════════════════════════════════════════ */

.adv-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.adv-toggle-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1c1c22;
    border: 1px solid #2a2a32;
    border-radius: 10px;
    padding: 10px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    min-width: 0;
    box-sizing: border-box;
}

.adv-toggle-card:hover {
    border-color: #3a3a44;
    background: #1f1f26;
}

.adv-toggle-card:has(input:checked) {
    border-color: rgba(92, 107, 192, 0.3);
    background: rgba(92, 107, 192, 0.06);
}

.adv-tc-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.adv-tc-icon img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.adv-tc-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.adv-tc-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: #ddd;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adv-tc-desc {
    font-size: 0.58rem;
    color: #555;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Toggle Switch — Compact ─── */
.adv-switch {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 20px;
}

.adv-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.adv-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #333;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.adv-switch-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: #888;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.adv-switch input:checked + .adv-switch-slider {
    background: var(--primary);
}

.adv-switch input:checked + .adv-switch-slider::before {
    transform: translateX(16px);
    background: #fff;
}

.adv-switch input:focus-visible + .adv-switch-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ═════════════════════════════════════════
   STYLE & PREFERENCES (includes Winner Sound Picker)
   ═════════════════════════════════════════ */

.adv-style-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.adv-select-card {
    background: #1c1c22;
    border: 1px solid #2a2a32;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: border-color 0.2s;
    min-width: 0;
    box-sizing: border-box;
}

.adv-select-card:hover {
    border-color: #3a3a44;
}

.adv-sc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
}

.adv-sc-icon-img {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.adv-sc-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #bbb;
    white-space: nowrap;
}

.adv-select {
    width: auto;
    min-width: 100px;
    max-width: 140px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #111115;
    color: #ddd;
    border: 1px solid #333;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: auto;
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
}

.adv-select:hover {
    border-color: #555;
}

.adv-select:focus {
    border-color: var(--primary);
    outline: none;
}

/* Theme Card */
.adv-theme-card {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between;
}

.adv-theme-picker {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.adv-theme-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    outline: none;
    flex-shrink: 0;
}

.adv-theme-dot:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(255,255,255,0.1);
}

.adv-theme-dot.selected {
    border-color: #fff;
    box-shadow: 0 0 14px rgba(255,255,255,0.2);
}

.adv-theme-check {
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    opacity: 0;
    transition: opacity 0.2s;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    pointer-events: none;
}

.adv-theme-dot.selected .adv-theme-check {
    opacity: 1;
}

/* ─── Winner Sound Card ─── */
.adv-sound-card {
    grid-column: 1 / -1;
}

.adv-sound-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.adv-sound-controls .adv-select {
    min-width: 110px;
    max-width: 160px;
}

.adv-sound-preview-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #222228;
    border: 1px solid #333;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.adv-sound-preview-btn:hover {
    background: #2a2a32;
    color: #fff;
    border-color: var(--primary);
}

.adv-sound-preview-btn:active {
    transform: scale(0.9);
}

.adv-sound-preview-btn.playing {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    animation: sound-pulse 0.8s ease-in-out infinite;
}

.adv-sound-preview-btn.playing svg {
    display: none;
}

.adv-sound-preview-btn.playing::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 2px;
    display: block;
}

@keyframes sound-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(92, 107, 192, 0.4); }
    50% { box-shadow: 0 0 12px 4px rgba(92, 107, 192, 0.25); }
}

/* ─── Footer ─── */
.adv-grid-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #222228;
    flex-shrink: 0;
    background: #141418;
}

.adv-footer-btn {
    flex: 1;
    padding: 11px 14px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
}

.adv-footer-btn img {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.adv-btn-reset {
    background: #222228;
    color: #888;
    border: 1px solid #333;
}

.adv-btn-reset:hover {
    background: #2a2a32;
    color: #ccc;
    border-color: #444;
}

.adv-btn-apply {
    background: var(--primary);
    color: #fff;
}

.adv-btn-apply:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(92, 107, 192, 0.3);
}

/* ============================================================
   ADVANCED SETTINGS MODAL — WIDE LAYOUT FOR DESKTOP/TABLET
   ============================================================ */

@media (min-width: 768px) {
    .adv-grid-modal {
        max-width: 720px !important;
        width: 95% !important;
    }

    .adv-grid-body {
        padding: 12px 24px 20px;
    }

    .adv-preview-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .adv-toggle-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .adv-style-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .adv-theme-card {
        grid-column: auto;
    }

    /* Sound card spans full width on 2-col grid */
    .adv-sound-card {
        grid-column: auto;
    }

    .adv-card-visual {
        height: 80px;
    }

    .adv-header-bar {
        padding: 20px 24px 16px;
    }

    .adv-grid-footer {
        padding: 14px 24px;
    }

    .adv-section {
        margin-bottom: 20px;
    }

    .adv-section:last-child {
        margin-bottom: 8px;
    }
}

@media (min-width: 1024px) {
    .adv-grid-modal {
        max-width: 820px !important;
    }

    .adv-grid-body {
        padding: 14px 28px 22px;
    }

    .adv-preview-grid {
        gap: 14px;
    }

    .adv-toggle-grid {
        gap: 12px;
    }

    .adv-style-grid {
        gap: 12px;
    }

    .adv-card-visual {
        height: 88px;
    }

    .adv-card-info {
        padding: 10px 12px;
    }

    .adv-card-name {
        font-size: 0.8rem;
    }

    .adv-card-status {
        font-size: 0.68rem;
    }

    .adv-toggle-card {
        padding: 12px 12px;
        gap: 10px;
    }

    .adv-tc-name {
        font-size: 0.78rem;
    }

    .adv-tc-desc {
        font-size: 0.62rem;
    }

    .adv-select-card {
        padding: 12px 14px;
    }

    .adv-sc-name {
        font-size: 0.8rem;
    }

    .adv-header-bar {
        padding: 22px 28px 16px;
    }

    .adv-grid-footer {
        padding: 16px 28px;
    }

    .adv-footer-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
}

@media (min-width: 1440px) {
    .adv-grid-modal {
        max-width: 880px !important;
    }
}

/* ─── Sound Card — Small Screen Stack ─── */
@media (max-width: 480px) {
    .adv-sound-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .adv-sound-controls {
        width: 100%;
    }

    .adv-sound-controls .adv-select {
        flex: 1;
        max-width: none;
    }
}

/* --- Advanced Features Styling --- */

/* The Launcher Button */
.adv-toggle-btn {
    width: 100%;
    margin-top: 15px;
    background: #1e1e1e;
    border: 1px dashed #555;
    color: #aaa;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.adv-toggle-btn:hover {
    border-color: var(--primary);
    color: #fff;
    background: #252525;
}

/* Active Tags List */
.active-features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.feature-tag {
    background: rgba(92, 107, 192, 0.15);
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.feature-tag .remove-tag {
    cursor: pointer;
    font-weight: bold;
    color: var(--accent);
    font-size: 16px;
    line-height: 1;
}

/* The Portrait Modal Content */
.adv-modal-content {
    width: 95%;
    max-width: 380px; 
    height: auto;
    max-height: 98vh; 
    text-align: left;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 15px;
}

.adv-modal-content .modal-header {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
    font-weight: 900;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

/* Fix: Advanced modal body needs scroll for many options */
.close-adv-x {
    cursor: pointer;
    font-size: 24px;
    color: #888;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.2s;
}

.close-adv-x:hover {
    color: var(--accent);
}

/* Single modal-footer rule */
.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.reset-btn, .close-adv-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.reset-btn {
    flex: 1;
    background: #2f3542;
    color: white;
}

.close-adv-btn {
    flex: 1;
    background: var(--primary);
    color: white;
}

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

/* Results actions container */
.results-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    width: 100%;
    box-sizing: border-box;
}

.clear-btn {
    flex: 1;
    width: auto;
    margin-top: 0;
    padding: 12px; 
    background: #2f3542; 
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#downloadPdfBtn {
    background: #27ae60;
}

.clear-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

#downloadPdfBtn:hover {
    background: #2ecc71;
    transform: translateY(-2px);
}

/* ============================================================
   SHARED GALLERY MODALS — Background, Wheel Image, Center Image
   ============================================================ */

.gallery-modal-content {
    max-width: 600px !important;
    max-height: 80vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.gallery-grid-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 10px;
    overflow-y: auto;
    margin-top: 15px;
    flex: 1;
    min-height: 0;
}

.gallery-modal-footer {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.gallery-thumb-card {
    background: #1a1a1a;
    padding: 6px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
    position: relative;
}

.gallery-thumb-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.gallery-thumb-card .gallery-thumb-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-thumb-card .gallery-thumb-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.gallery-thumb-card .gallery-thumb-label {
    padding: 5px 0;
    text-align: center;
    color: #aaa;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .gallery-modal-content {
        max-width: 95vw !important;
        max-height: 90vh !important;
    }

    .gallery-grid-panel {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
        padding: 8px;
    }
}

/* Gallery upload hints */
.gallery-upload-hints {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 10px;
    flex-shrink: 0;
}

.gallery-upload-hints ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.gallery-upload-hints li {
    font-size: 11px;
    color: #777;
    line-height: 1.5;
    position: relative;
    padding-left: 12px;
}

.gallery-upload-hints li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.gallery-upload-hints strong {
    color: #bbb;
    font-weight: 600;
}

/* --- Instructions --- */
.instructions-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    margin-top: 15px;
}

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.instructions-heading {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary, #5c6bc0);
    font-weight: 700;
}

.toggle-icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    padding: 0;
}

.instructions-content {
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    max-height: 500px;
}

.instructions-content.hidden {
    max-height: 0;
}

.instructions-content ul {
    margin: 12px 0 0 0;
    padding-left: 20px;
    list-style-type: none;
}

.instructions-content li {
    font-size: 13px;
    color: #bbb;
    margin-bottom: 8px;
    line-height: 1.4;
    position: relative;
}

.instructions-content li::before {
    content: "•";
    color: var(--primary, #5c6bc0);
    position: absolute;
    left: -15px;
    font-weight: bold;
}

/* --- Wheel Hover Overlay --- */
.wheel-hover-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    transition: opacity 0.6s ease, visibility 0.6s;
}

.wheel-hover-overlay circle {
    backdrop-filter: blur(2px); 
}

.curved-text {
    fill: #FFFFFF;
    font-size: 24px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    filter: drop-shadow(0 0 8px rgba(0,0,0,0.8));
    paint-order: stroke fill;
}

.curved-text.spacing-fix {
    letter-spacing: 3px; 
}

.wheel-hover-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

/* --- ODOMETER DASHBOARD --- */
.odometer-dashboard-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    padding-bottom: 25px;
    border-top: 1px solid var(--border);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 800px;
    opacity: 1;
    overflow: hidden;
    visibility: visible;
}

.odometer-dashboard-wrapper.stats-hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-color: transparent;
    visibility: hidden;
    pointer-events: none;
}

.global-status-line {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.odometer-dashboard {
    display: flex;
    justify-content: center;
    gap: 40px;
    background: transparent;
    padding: 10px 0;
    margin: 0;
    border: none;
}

.odo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.odo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.odo-label {
    color: #888;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: #ff4757;
    border-radius: 50%;
    box-shadow: 0 0 6px #ff4757;
    animation: pulseDot 2s infinite;
}

.odometer {
    display: flex;
    background: #000;
    border: 3px solid #444;
    padding: 5px;
    box-shadow: inset 0 0 10px rgba(0,0,0,1);
    border-radius: 4px;
}

.digit-container {
    width: 22px;
    height: 32px;
    overflow: hidden;
    background: #1a1a1a;
    margin: 0 1px;
    border-radius: 2px;
    position: relative;
}

.digit-strip {
    display: flex;
    flex-direction: column;
    transition: transform 0.5s cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.digit-strip span {
    display: block;
    width: 22px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    color: #eee;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 22px;
}

.digit-container:last-child .digit-strip span {
    background: #ff4757;
    color: #000;
}

@keyframes pulseDot {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

.flicker {
    animation: rapidFlicker 0.1s infinite !important;
    background-color: #fff !important;
    box-shadow: 0 0 12px #fff !important;
}

@keyframes rapidFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.reset-notice {
    font-size: 9px;
    color: #ffb8b8;
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.yt-style-total {
    font-size: 11px;
    color: #666;
    font-family: Arial, sans-serif;
    margin-top: 6px;
    font-weight: bold;
}

.live-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 25px;
    margin-bottom: 10px;
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    width: fit-content;
}

.live-bar-graph {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 18px;
    margin-bottom: 4px;
}

.bar-segment {
    width: 3px;
    background: #333;
    border-radius: 1px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.active-bar {
    background: #2ed573;
    box-shadow: 0 0 5px rgba(46, 213, 115, 0.4);
}

.live-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.green-dot {
    width: 7px;
    height: 7px;
    background-color: #2ed573;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(46, 213, 115, 0.6);
    animation: steadyPulse 2.5s infinite ease-in-out;
}

#live-user-count {
    color: #eee;
    font-family: 'Courier New', monospace;
    font-weight: 900;
    font-size: 14px;
}

.live-label {
    color: #666;
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
}

@keyframes steadyPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* --- WHEEL TITLE FEATURE --- */
.wheel-title-container {
    position: relative; 
    width: 100%;
    text-align: center;
    padding-top: 5px;
    padding-bottom: 10px;
    z-index: 50;
    min-height: 1.0em;
    pointer-events: none;
}

#wheelTitleDisplay {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    color: white;
    margin: auto;
    text-transform: none;
    letter-spacing: 2px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.6);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s ease;
}

#wheelTitleDisplay:hover {
    transform: scale(1.05);
    color: var(--accent);
}

.wheel-title-container.empty {
    display: none;
}

#wheelTitleInput {
    width: 100%;
    padding: 15px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    margin: 20px 0;
    box-sizing: border-box;
}

#wheelTitleInput:focus {
    border-color: var(--primary);
    outline: none;
}

@media (max-width: 800px) {
    #wheelTitleDisplay {
        font-size: 1.8rem;
    }
    .wheel-title-container {
        top: 2%;
    }
}

/* --- SAVE / LOAD BAR --- */
.save-load-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 0;
    margin: 10px 0 20px 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.sl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: none;
    border: none;
    color: #ccc;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px 10px;
    flex: 1;
    white-space: nowrap;
    min-width: 0;
}

.sl-btn:hover {
    color: white;
}

.sl-btn img,
.sl-btn svg {
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.sl-btn:hover img,
.sl-btn:hover svg {
    opacity: 1;
}

.sl-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0;
    flex-shrink: 0;
}

@media (max-width: 800px) {
    .sl-btn {
        font-size: 11px;
        padding: 5px 4px;
        gap: 4px;
    }

    .sl-btn img,
    .sl-btn svg {
        width: 14px;
        height: 14px;
    }

    .sl-btn span {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .sl-btn {
        font-size: 10px;
        padding: 5px 2px;
        gap: 3px;
    }

    .sl-btn img,
    .sl-btn svg {
        width: 12px;
        height: 12px;
    }

    .sl-btn span {
        font-size: 11px;
    }

    .save-load-bar {
        padding: 8px 0;
    }
}

/* Save Modal Input */
.modal-input {
    width: 100%;
    padding: 12px;
    background: #222;
    border: 1px solid #444;
    color: white;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    outline: none;
}

.modal-input:focus {
    border-color: var(--primary);
}

/* Reset button in the bar */
.reset-danger-btn:hover {
    color: #ff4757 !important;
}

.reset-danger-btn:hover img {
    filter: invert(34%) sepia(88%) saturate(4500%) hue-rotate(345deg) brightness(101%) contrast(101%);
    opacity: 1;
}

/* --- Stats Counter --- */
.stats {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-top: 10px;
}

/* --- Footer Styling --- */
.site-footer {
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 30px 20px;
    margin-top: 50px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    animation: fadeInFooter 0.5s ease-in-out forwards;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    opacity: 0.8;
    transition: color 0.2s, opacity 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
    opacity: 1;
}

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

.fullscreen-mode .site-footer {
    display: none !important;
}

/* --- Shared Static Page Styling --- */
.static-page {
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-family: 'Inter', sans-serif;
}

.content-container {
    max-width: 850px;
    margin: 40px auto;
    padding: 0 20px;
}

.static-content {
    background: var(--panel);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.static-content h1 { color: #fff; font-size: 2.5rem; margin-bottom: 20px; }
.static-content h2 { color: var(--primary); margin-top: 30px; }
.static-content p { opacity: 0.85; font-size: 1.1rem; margin-bottom: 20px; }

.back-btn {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
    transition: transform 0.2s;
}

.back-btn:hover { transform: translateX(-5px); }

/* --- CAPSULE NAVIGATION --- */
.nav-capsule {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 8px 14px;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: white;
    font-weight: 900;
    font-size: 1.1rem;
    opacity: 0.9;
}

.nav-brand img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 10px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

.nav-menu a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.nav-menu a:hover, .nav-menu a.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-menu a.active {
    background: var(--primary);
}

.nav-hide-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-hide-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}

.nav-hide-btn img {
    width: 30px;
    height: 30px;
    display: block;
    pointer-events: none;
    filter: none; 
    opacity: 0.8;
}

.nav-hide-btn:hover img {
    opacity: 1;
}

@media (max-width: 480px) {
    .nav-capsule {
        flex-wrap: wrap;
        border-radius: 20px;
        padding: 12px;
    }

    .nav-divider {
        display: none;
    }

    .nav-menu {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 10px;
    }

    .nav-brand {
        width: auto;
        flex: 1;
    }
}

/* --- UNIVERSAL COLOR PICKER --- */
.picker-modal-overlay {
    display: none; 
    position: fixed;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    /* Fix: z-index higher than share sidebar to prevent overlap */
    z-index: 10001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 10px; 
}

.picker-modal {
    background: #2f343f;
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #444;
    font-family: 'Inter', sans-serif;
    color: #eee;
    animation: pickerFadeIn 0.2s ease-out;
}

@keyframes pickerFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #252a33;
    border-bottom: 1px solid #383e4a;
}

.picker-header span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ccc;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr); 
    grid-auto-flow: row; 
    gap: 6px;
    padding: 15px;
    background: #1e222a;
    width: 100%;
    box-sizing: border-box;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1 / 1; 
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.1s;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: #fff;
    z-index: 5;
}

.color-swatch.selected {
    border: 2px solid white;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.picker-footer {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #252a33;
    border-top: 1px solid #383e4a;
    gap: 10px;
}

.custom-add-btn {
    background: #3b4252;
    color: #eceff4;
    border: 1px solid #4c566a;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.picker-preview {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #555;
    flex-shrink: 0;
}

#pickerHexInput {
    background: #1a1d23;
    border: 1px solid #444;
    padding: 6px 8px;
    border-radius: 4px;
    color: #00ff41; 
    font-family: monospace;
    flex: 1;
    min-width: 0;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.picker-actions {
    padding: 0 15px 15px 15px;
    background: #252a33;
}

.btn-default-reset {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid #444;
    color: #bbb;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-default-reset:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.picker-btn-select { 
    background: #43a047; 
    color: white; 
    padding: 6px 14px;
    border-radius: 4px;
    font-weight: 600;
}

.picker-btn-cancel { 
    background: transparent; 
    color: #999; 
    font-weight: 600;
}

@media (max-width: 340px) {
    .picker-grid { gap: 4px; padding: 10px; }
    #pickerHexInput { width: 70px; }
}

/* ============================================================
   WHEELTOCHOOSE Q&A SECTION — PREMIUM ACCORDION STYLE
   ============================================================ */

.wheeltochoose-guide-page {
    width: 100%;
    padding: 40px 20px;
    box-sizing: border-box;
}

.wheeltochoose-content-container {
    max-width: 900px;
    margin: 0 auto;
}

.wheeltochoose-static-content {
    background: transparent;
    padding: 0;
}

/* --- Hero --- */
.wheeltochoose-hero {
    text-align: center;
    padding: 40px 20px 30px;
    position: relative;
    overflow: hidden;
}

.wheeltochoose-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(92, 107, 192, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.wheeltochoose-hero h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.wheeltochoose-accent {
    color: var(--accent);
}

.wheeltochoose-tagline {
    font-size: 1.1rem;
    color: #999;
    max-width: 620px;
    margin: 0 auto;
    line-height: 1.7;
}

.wheeltochoose-tagline strong {
    color: var(--primary);
}

.wheeltochoose-hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.wheeltochoose-hero-stat {
    text-align: center;
}

.wheeltochoose-stat-number {
    display: block;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

.wheeltochoose-stat-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 6px;
    display: block;
}

/* --- Divider --- */
.wheeltochoose-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    border-radius: 3px;
    margin: 40px 0;
}

/* --- Section Label --- */
.wheeltochoose-section-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    background: rgba(92, 107, 192, 0.1);
    border: 1px solid rgba(92, 107, 192, 0.2);
    padding: 6px 16px;
    border-radius: 50px;
    margin-bottom: 20px;
}

/* --- Quick Jump --- */
.wheeltochoose-quick-jump h2 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 15px;
    font-weight: 800;
}

.wheeltochoose-jump-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.wheeltochoose-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.wheeltochoose-pill:hover {
    border-color: var(--primary);
    color: #fff;
    background: rgba(92, 107, 192, 0.1);
}

/* --- FAQ Section --- */
.wheeltochoose-faq-section h2 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 25px;
    font-weight: 800;
}

/* --- Accordion Cards --- */
.wheeltochoose-faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wheeltochoose-faq-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.wheeltochoose-faq-card:hover {
    border-color: rgba(92, 107, 192, 0.3);
}

.wheeltochoose-faq-card.wheeltochoose-open {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(92, 107, 192, 0.08);
}

/* Header */
.wheeltochoose-faq-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.wheeltochoose-faq-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.wheeltochoose-faq-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(92, 107, 192, 0.12);
    border: 2px solid rgba(92, 107, 192, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
    color: var(--primary);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.wheeltochoose-faq-card.wheeltochoose-open .wheeltochoose-faq-num {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.wheeltochoose-faq-title {
    flex: 1;
    color: #ddd;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}

.wheeltochoose-faq-card.wheeltochoose-open .wheeltochoose-faq-title {
    color: #fff;
}

.wheeltochoose-faq-chevron {
    width: 20px;
    height: 20px;
    color: #555;
    flex-shrink: 0;
    transition: transform 0.3s ease, color 0.3s ease;
}

.wheeltochoose-faq-card.wheeltochoose-open .wheeltochoose-faq-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

/* Body */
.wheeltochoose-faq-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    padding: 0 25px;
}

.wheeltochoose-faq-card.wheeltochoose-open .wheeltochoose-faq-body {
    max-height: 1200px;
    padding: 0 25px 25px;
}

.wheeltochoose-faq-body p {
    color: #999;
    font-size: 0.95rem;
    line-height: 1.75;
    margin: 0 0 12px;
}

.wheeltochoose-faq-body p:last-child {
    margin-bottom: 0;
}

.wheeltochoose-faq-body strong {
    color: #ccc;
}

.wheeltochoose-faq-body ul,
.wheeltochoose-faq-body ol {
    padding-left: 20px;
    margin: 10px 0;
}

.wheeltochoose-faq-body li {
    color: #888;
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 8px;
}

.wheeltochoose-faq-body li strong {
    color: #bbb;
}

.wheeltochoose-faq-body code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

.wheeltochoose-faq-body h4 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ddd;
    margin: 24px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.wheeltochoose-faq-body h4:first-of-type {
    margin-top: 16px;
}

/* FAQ Image */
.wheeltochoose-faq-image {
    display: block;
    width: 100%;
    max-width: 75%;
    height: auto;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
    margin: 0 auto 20px auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .wheeltochoose-hero h1 {
        font-size: 1.8rem;
    }
    
    .wheeltochoose-faq-image {
        max-width: 100%;
    }

    .wheeltochoose-hero-stats {
        gap: 25px;
    }

    .wheeltochoose-stat-number {
        font-size: 1.7rem;
    }

    .wheeltochoose-faq-header {
        padding: 16px 18px;
        gap: 12px;
    }

    .wheeltochoose-faq-num {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .wheeltochoose-faq-title {
        font-size: 0.9rem;
    }

    .wheeltochoose-faq-body {
        padding: 0 18px;
    }

    .wheeltochoose-faq-card.wheeltochoose-open .wheeltochoose-faq-body {
        padding: 0 18px 20px;
    }

    .wheeltochoose-jump-pills {
        gap: 6px;
    }

    .wheeltochoose-pill {
        padding: 6px 12px;
        font-size: 0.72rem;
    }

    .wheeltochoose-quick-jump h2,
    .wheeltochoose-faq-section h2 {
        font-size: 1.4rem;
    }
}

/* Print */
@media print {
    .wheeltochoose-guide-page {
        padding: 0 !important;
    }

    .wheeltochoose-hero,
    .wheeltochoose-quick-jump,
    .wheeltochoose-divider,
    .wheeltochoose-faq-chevron,
    .wheeltochoose-faq-num {
        display: none !important;
    }

    .wheeltochoose-faq-body {
        max-height: none !important;
        padding: 10px 0 !important;
        overflow: visible !important;
    }

    .wheeltochoose-faq-card {
        border: 1px solid #ccc !important;
        background: transparent !important;
        break-inside: avoid;
    }

    .wheeltochoose-faq-title {
        color: #000 !important;
    }

    .wheeltochoose-faq-body p,
    .wheeltochoose-faq-body li {
        color: #333 !important;
    }

    .wheeltochoose-faq-body strong {
        color: #000 !important;
    }

    .wheeltochoose-faq-image {
        max-width: 100% !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .wheeltochoose-faq-card,
    .wheeltochoose-faq-num,
    .wheeltochoose-faq-chevron,
    .wheeltochoose-faq-body,
    .wheeltochoose-pill {
        transition: none;
    }

    .wheeltochoose-faq-card:hover {
        transform: none;
        box-shadow: none;
    }

    .wheeltochoose-faq-image:hover {
        transform: none;
    }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .wheeltochoose-faq-image:hover {
        transform: none;
        filter: none;
        border-color: rgba(255, 255, 255, 0.08);
    }

    .wheeltochoose-pill:hover {
        background: rgba(255, 255, 255, 0.04);
        border-color: rgba(255, 255, 255, 0.1);
        color: #aaa;
    }
}

/* --- Sharing Sidebar --- FIXED VERSION */
.share-sidebar-wrapper {
    position: fixed;
    top: 50%;
    left: -55px; 
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 9999;
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                opacity 0.6s ease,
                visibility 0.6s;
    opacity: 0;           
    visibility: hidden;
    pointer-events: none; 
}

.share-sidebar-wrapper.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.share-sidebar-wrapper.open {
    left: 0;
}

body.controls-hidden .share-sidebar-wrapper {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    left: -100px;
}

.share-toggle-btn {
    position: absolute;
    right: -15px;
    width: 15px;
    height: 50px;
    background: #1c1c1c;
    border: none;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    outline: none;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    z-index: 2;
}

.share-toggle-btn img {
    width: 25px;
    height: 25px;
    transition: transform 0.3s ease;
    filter: none;
}

.share-sidebar-wrapper.open #sideArrow {
    transform: rotate(180deg);
}

.share-tray {
    width: 55px;
    background: #1c1c1c;
    border: none;
    border-left: none;
    border-radius: 0 12px 12px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.tray-icon {
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    transition: background 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    margin: 0;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    text-decoration: none;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tray-icon:first-child { border-radius: 0; }
.tray-icon:last-child { border-radius: 0; }

.tray-icon:hover {
    background: #333;
}

.tray-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: none;       
    pointer-events: none;
    flex-shrink: 0;
}

#copyTooltip {
    visibility: hidden;
    position: absolute;
    left: 65px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff4757;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s;
}

#copyTooltip::after {
    content: "";
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 5px solid #ff4757;
}

#copyTooltip.show {
    visibility: visible;
    opacity: 1;
}

/* --- WEIGHTED SLICES CONTROLS --- */
.weight-controls {
    display: none;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    margin-right: 10px;
    height: 28px;
}

body.weights-active .weight-controls {
    display: flex;
}

.weight-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    width: 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.weight-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.weight-val {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: white;
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    user-select: none;
}

/* --- Community Gallery --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    overflow-y: auto;
    max-height: 60vh; 
    padding: 10px 15px 40px 15px;
    align-items: stretch; 
}

.gallery-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #333;
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 280px; 
    height: auto;
}

.gallery-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.gallery-preview-box {
    width: 100%;
    aspect-ratio: 1 / 1; 
    background: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #333;
    padding: 12px;
    box-sizing: border-box;
    max-height: 180px; 
}

.gallery-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gallery-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}

.gallery-info h4 {
    margin: 0 0 2px 0; 
    color: white;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-info p { 
    margin: 0; 
    color: #888; 
    font-size: 12px; 
}

.gallery-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: auto; 
    padding-top: 3px;
    padding-bottom: 5px; 
}

.gallery-tag {
    background: #333;
    color: #ccc;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: lowercase;
}

/* --- Share Wizard --- */
.share-modal-refined {
    width: 460px !important;
    height: 540px !important; 
    padding: 40px 35px 35px 35px !important;
    position: relative;
    border-radius: 24px !important;
    background: #111 !important;
    border: 1px solid #222;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header-refined h3 { 
    margin: 0; 
    font-size: 22px; 
    color: #fff; 
    font-weight: 800;
    text-align: left;
}

.corner-close {
    position: absolute;
    top: 35px;
    right: 35px;
    font-size: 24px !important;
    color: #444;
    cursor: pointer;
}

.share-wizard-progress {
    display: flex;
    align-items: center;
    margin: 25px 0 30px 0;
}

.wizard-step {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 8px 18px;
    border-radius: 50px;
    background: #1a1a1a;
    color: #555;
    transition: 0.3s ease;
}

.wizard-step.active {
    background: var(--primary);
    color: #ffffff !important;
}

.wizard-line { flex: 1; height: 1px; background: #222; margin: 0 15px; }

.step-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Fix: Step header in share wizard */
.step-header {
    margin-bottom: 20px;
    text-align: left;
}

.step-header h4 {
    margin: 0 0 5px 0;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

.step-header p {
    margin: 0;
    color: #666;
    font-size: 13px;
}

.tc-box {
    background: #080808;
    border: 1px solid #1a1a1a;
    border-radius: 16px;
    padding: 25px 30px;
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tc-box ul { 
    padding: 0; 
    margin: 0; 
    list-style: none;
    text-align: left;
}

.tc-box li { 
    color: #888; 
    font-size: 14px; 
    margin-bottom: 12px; 
    line-height: 1.5; 
    display: flex;
    align-items: flex-start;
}

.tc-box li::before { 
    content: "•"; 
    color: var(--primary); 
    margin-right: 12px; 
    font-weight: bold; 
}

.input-group { margin-bottom: 18px; text-align: left; }

.modal-label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 700; 
    font-size: 11px; 
    color: #444; 
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: left;
}

/* Share wizard modal input overrides */
.share-modal-refined .modal-input {
    width: 100% !important;
    background: #1a1a1a !important;
    border: 1px solid #333 !important;
    border-radius: 12px !important;
    padding: 14px 16px !important;
    color: #fff !important;
    text-align: left;
}

.visibility-card {
    background: #080808;
    border: 1px solid #222;
    padding: 20px;
    border-radius: 16px;
    margin-top: auto;
    margin-bottom: 5px;
    text-align: left;
}

.separator { height: 1px; background: #1a1a1a; margin: 12px 0; }

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    text-align: left;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary); 
}

.label-text { color: #888; font-size: 14px; text-align: left; }

.option-desc {
    text-align: left;
}

.option-desc b { 
    display: block; 
    color: #eee; 
    font-size: 14px; 
    margin-bottom: 2px; 
}

.option-desc p { 
    margin: 0; 
    color: #555; 
    font-size: 12px; 
}

.modal-actions-refined { 
    display: flex; 
    gap: 12px; 
    margin-top: auto; 
    padding-top: 20px;
}

.primary-btn, .secondary-btn {
    height: 52px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    flex: 1;
    border: none;
    transition: 0.2s;
}

.primary-btn { background: var(--primary); color: white; }
.primary-btn:disabled { opacity: 0.2; cursor: not-allowed; }
.secondary-btn { background: #222; color: #888; border: 1px solid #333; }
.secondary-btn:hover { color: #fff; background: #282828; }

@media (max-width: 600px) {
    .share-modal-refined { width: 95% !important; height: auto !important; padding: 30px 20px !important; }
}

/* --- Gallery Top Tags --- */
.gallery-top-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #222;
}

.top-tag-capsule {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 50px;
    cursor: pointer;
    text-transform: lowercase;
    transition: all 0.2s ease;
    user-select: none;
}

.top-tag-capsule:hover {
    background: #2a2a2a;
    color: #fff;
    border-color: #555;
}

.top-tag-capsule.active-tag {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

/* --- CENTER IMAGE OVERLAY (Non-Spinning) --- */
.center-image-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 15;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.center-image-overlay.active {
    display: flex;
}

.center-image-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* ============================================================
   ACCESSIBILITY, COMPATIBILITY & POLISH
   ============================================================ */

/* --- Text Selection --- */
::selection {
    background: var(--primary);
    color: #fff;
}

::-moz-selection {
    background: var(--primary);
    color: #fff;
}

/* --- Focus-Visible for Keyboard Navigation --- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible,
[role="button"]:focus-visible,
[role="radio"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Template cards keyboard focus */
.template-card:focus-visible {
    border-color: var(--primary);
    transform: translateY(-5px);
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    box-shadow: 0 0 15px rgba(92, 107, 192, 0.3);
}

/* Close X buttons focus */
.close-adv-x:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
    color: var(--accent);
}

/* Upload button focus */
.upload-icon-wrapper:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: rgba(92, 107, 192, 0.2);
}

/* Tab buttons focus */
.tab-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* Nav links focus */
.nav-menu a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Share tray icon focus */
.tray-icon:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: #333;
}

/* Color swatch focus */
.color-swatch:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    transform: scale(1.15);
}

/* --- Noscript Fallback --- */
noscript > div {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

noscript h1 {
    font-size: 2rem;
    margin-bottom: 15px;
}

noscript p {
    font-size: 1.1rem;
    max-width: 500px;
    line-height: 1.6;
    opacity: 0.8;
}

/* --- Reduced Motion Preferences --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .name-entry-row {
        opacity: 1;
        animation: none;
    }

    .wave-letter {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .live-dot,
    .green-dot {
        animation: none;
    }

    .site-footer {
        animation: none;
        opacity: 1;
    }

    .template-card:hover {
        transform: none;
    }

    .picker-modal {
        animation: none;
    }

    .share-sidebar-wrapper {
        transition: none;
    }

    .instructions-content {
        transition: none;
    }
    
    .modal.modal-visible,
    .modal.modal-closing,
    .modal .modal-content,
    .modal .adv-modal-content,
    .modal .share-modal-refined {
        transition: none !important;
        transform: none !important;
    }

    .modal.modal-visible .modal-content,
    .modal.modal-visible .adv-modal-content,
    .modal.modal-visible .share-modal-refined {
        opacity: 1;
        transform: none !important;
    }
}

/* --- Print Styles --- */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }

    .wheel-panel,
    .controls-panel,
    #loading-screen,
    .floating-round-btn,
    .show-toggle-btn,
    .share-sidebar-wrapper,
    .odometer-dashboard-wrapper,
    .templates-outer-wrapper,
    .site-footer,
    .modal,
    .picker-modal-overlay,
    #fullscreenBtn,
    .nav-capsule,
    .save-load-bar,
    .button-group,
    .input-container,
    .adv-toggle-btn,
    .active-features-list,
    .stats,
    .instructions-wrapper,
    .tabs-nav,
    noscript {
        display: none !important;
    }
    
    .wheeltochoose-guide-page {
        padding: 0 !important;
    }

    .wheeltochoose-static-content {
        background: transparent !important;
        border: none !important;
        padding: 20px !important;
    }

    .wheeltochoose-page-header h1 {
        color: #000 !important;
        font-size: 1.8rem !important;
    }

    .wheeltochoose-faq-question h2 {
        color: #000 !important;
    }

    .wheeltochoose-faq-answer p,
    .wheeltochoose-faq-answer li {
        color: #333 !important;
    }

    .wheeltochoose-faq-answer strong {
        color: #000 !important;
    }

    .wheeltochoose-faq-image {
        max-width: 100% !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

    .wheeltochoose-faq-icon {
        display: none !important;
    }

    a {
        color: #000 !important;
        text-decoration: underline !important;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8rem;
        color: #666;
    }

    .footer-links a[href]::after,
    .nav-menu a[href]::after {
        content: none;
    }
}

/* --- High Contrast Mode Support --- */
@media (forced-colors: active) {
    .color-indicator {
        border: 2px solid ButtonText;
    }

    .tab-link.active {
        border-bottom-color: Highlight;
    }

    button:focus-visible,
    a:focus-visible {
        outline: 2px solid Highlight;
    }

    .live-dot,
    .green-dot {
        background-color: Highlight;
    }
}

/* --- Touch Device Improvements --- */
@media (hover: none) and (pointer: coarse) {
    .delete-cross {
        padding: 8px 12px;
        font-size: 24px;
    }

    .color-indicator {
        width: 20px;
        height: 20px;
    }

    .weight-btn {
        width: 32px;
        min-height: 36px;
    }

    .clear-circle-btn {
        width: 38px;
        height: 38px;
    }

    .theme-dot {
        width: 28px;
        height: 28px;
    }

    .sl-btn {
        padding: 8px;
    }

    .tray-icon {
        width: 60px;
        height: 60px;
    }

    .template-card:hover {
        transform: none;
        border-color: #222;
    }

    .gallery-thumb-card:hover {
        transform: none;
    }
}

/* --- Very Small Screens --- */
@media (max-width: 360px) {
    .nav-brand span {
        font-size: 0.9rem;
    }

    .nav-brand img {
        width: 24px;
        height: 24px;
    }

    #wheelTitleDisplay {
        font-size: 1.4rem;
    }

    .share-modal-refined {
        padding: 20px 15px !important;
    }

    .wizard-step {
        font-size: 10px;
        padding: 6px 12px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }

    .odometer-dashboard {
        gap: 20px;
    }

    .digit-container {
        width: 18px;
        height: 28px;
    }

    .digit-strip span {
        width: 18px;
        height: 28px;
        line-height: 28px;
        font-size: 18px;
    }
}

/* --- Landscape Phone Fix --- */
@media (max-height: 500px) and (orientation: landscape) {
    .wheel-panel {
        height: auto;
        min-height: 100vh;
        position: relative;
    }

    .wheel-wrapper {
        max-width: 70vh;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }

    .adv-modal-content {
        max-height: 85vh;
    }
}

/* --- Clickable Wheel Canvas --- */
#wheel-container canvas {
    cursor: pointer;
    transition: filter 0.2s ease;
}

@media (hover: hover) {
    #wheel-container canvas:hover {
        filter: brightness(1.05);
    }
}

#wheel-container canvas:active {
    filter: brightness(0.95);
}

/* ============================================================
   MODAL & POPUP ANIMATIONS — Lightweight Professional
   ============================================================ */

/* --- Animated states only — does NOT touch default .modal rule --- */
.modal.modal-visible {
    opacity: 1;
    visibility: visible;
}

.modal.modal-visible,
.modal.modal-closing {
    display: flex !important;
    transition: opacity 0.25s ease, visibility 0.25s;
}

/* --- Modal Content Slide + Fade --- */
.modal .modal-content,
.modal .adv-modal-content,
.modal .share-modal-refined {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
}

.modal.modal-visible .modal-content,
.modal.modal-visible .adv-modal-content,
.modal.modal-visible .share-modal-refined {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* --- Closing Animation --- */
.modal.modal-closing {
    opacity: 0;
}

.modal.modal-closing .modal-content,
.modal.modal-closing .adv-modal-content,
.modal.modal-closing .share-modal-refined {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.15s ease;
}

/* ============================================================
   ENTRY LIST RESIZE HANDLE (Drag Up/Down)
   ============================================================ */

.entry-resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 26px;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 10;
    touch-action: none;
    margin: 0;
    padding: 3px 0 6px;
    flex-shrink: 0;
    pointer-events: none;
}

.entry-resize-handle img {
    width: 28px;
    height: 28px;
    opacity: 0.35;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    cursor: ns-resize;
    touch-action: none;
}

.entry-resize-handle:hover img {
    opacity: 0.7;
}

.entry-resize-handle.dragging img {
    opacity: 1;
}

/* Prevent text selection while dragging */
body.resize-dragging {
    cursor: ns-resize !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
}

body.resize-dragging * {
    cursor: ns-resize !important;
}

/* Touch device — bigger hit area */
@media (hover: none) and (pointer: coarse) {
    .entry-resize-handle {
        height: 34px;
        padding: 3px 0 6px;
    }

    .entry-resize-handle img {
        width: 34px;
        height: 34px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .entry-resize-handle img {
        transition: none;
    }
    
    .names-list-container {
        transition: none;
    }
}

/* ============================================================
   LIVE BACKGROUND ANIMATION — Canvas & Gallery
   ============================================================ */

/* --- Animation Canvas (behind wheel) --- */
.bg-anim-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.bg-anim-canvas.active {
    opacity: 1;
}

/* Ensure wheel content stays above animation */
.wheel-wrapper {
    z-index: 2;
    position: relative;
}

.wheel-title-container {
    z-index: 3;
}

/* --- Gallery Modal Tweaks --- */
.bg-anim-gallery-modal {
    max-width: 640px !important;
}

.bg-anim-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 12px !important;
    padding: 12px !important;
}

/* --- Preview Card in Gallery --- */
.bg-anim-thumb-card {
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.bg-anim-thumb-card:hover {
    box-shadow: 0 4px 20px rgba(92, 107, 192, 0.15);
}

.bg-anim-preview-wrap {
    background: #0a0a0f !important;
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
}

.bg-anim-preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

.bg-anim-thumb-desc {
    padding: 0 6px 8px;
    text-align: center;
    color: #555;
    font-size: 10px;
    line-height: 1.3;
}

/* --- Advanced Preview Card Animation Indicator --- */
#advVisualBgAnim {
    position: relative;
    overflow: hidden;
}

#advVisualBgAnim canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .bg-anim-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
        gap: 10px !important;
    }

    .bg-anim-gallery-modal {
        max-width: 95vw !important;
        max-height: 90vh !important;
    }
}

@media (min-width: 768px) {
    .bg-anim-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }

    /* 5 cards in the visual preview grid with the new addition */
    .adv-preview-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1024px) {
    .adv-preview-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ============================================================
   ADV CARD — LIVE BG ANIMATION MINI PREVIEW (inside adv modal)
   ============================================================ */

#advVisualBgAnim {
    position: relative;
    overflow: hidden;
}

.adv-bg-anim-preview-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 1;
    background: #0a0a0f;
}

.adv-bg-anim-name-overlay {
    position: relative;
    z-index: 2;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    text-align: center;
    padding: 0 6px;
    word-break: break-word;
    line-height: 1.3;
    max-height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

/* Ensure the visual area centers the overlay text */
#advVisualBgAnim.adv-card-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wheeltochoose-date-updated {
    text-align: center;
    margin-top: 12px;
}

.wheeltochoose-date-updated time {
    font-size: 0.75rem;
    color: #555;
    font-style: italic;
}