/* style.css - Complete Master Version */
@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;
}

/* --- NEW: Fixed Background Layer --- */
#wheel-bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    transition: background-image 0.5s ease-in-out;
}

/* Subtle dark overlay to keep the wheel readable */
#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: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(60, 60, 60, 0.8);
    backdrop-filter: blur(5px);
    color: white;
    border: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2000;
    transition: transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .floating-round-btn:hover {
        background: rgba(80, 80, 80, 0.9);
        border-color: #777;
    }
}

/* --- Layout Structure --- */
.app-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    min-height: 100vh;
    width: 100%;
}

/* --- Wheel Panel (Left) --- */
.wheel-panel {
    flex: 2; 
    display: flex;
    flex-direction: column; /* This stacks Title on top of Wheel */
    justify-content: center; 
    align-items: center;
    padding: 10px 0; /* Adds some breathing room at the top/bottom */
    background: transparent; 
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    position: relative;
    top: 0;
    overflow: hidden;
}

.wheel-panel.full-width {
    flex: 1;
    width: 100%; /* Forces it to take the full viewport width */
    padding: 10px;
    height: 100vh;
}

.wheel-wrapper {
    position: relative;
    width: 90%; /* Scale based on the panel width */
    max-width: 550px;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
}

#pointer {
    position: absolute;
    top: 50%;
    right: -10px; /* Moves it outside the edge of the wheel */
    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));
}

#wheel-container {
    width: 100%;
    height: 100%;
    display: block;
    transform-origin: center center;
    transition: none; /* Ensures smooth spinning */
}

#spinBtn {
    /* Position it in the center */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Style */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    border: 4px solid #f0f0f0;
    color: #333;
    font-weight: 800;
    cursor: pointer;
    
    /* Static Depth (Fast to render) */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100;
    
    /* Smooth hover effect */
    transition: transform 0.1s ease, background 0.2s ease;
}

#spinBtn:hover {
    background: #fdfdfd;
    transform: translate(-50%, -50%) scale(1.05);
}

#spinBtn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

#wheel-container text {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    fill: #FFFFFF;
    
    /* REMOVED the stroke/border */
    paint-order: normal; 
    stroke: none;

    /* ADDED the "Lift" Shadow */
    /* Adjust the 3px to 5px if you want a "heavier" lift */
    filter: drop-shadow(0px 2px 3px rgba(0, 0, 0, 0.5));
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

/* --- Controls Panel (Right) --- */
.controls-panel {
    flex: 1;
    padding: 20px 40px 30px 40px;
    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);
    position: relative;
    max-height: 150vh;
    overflow: hidden;
}

.controls-panel.panel-hidden {
    display: none;
}

.hide-toggle-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.hide-toggle-btn:hover {
    background: #333;
    border-color: var(--accent);
}

/* --- Show Button (Floating) --- */
.show-toggle-btn {
    display: none; /* Controlled by JS */
    position: fixed;
    top: 20px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2a2a2a;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 2000;
    display: none; /* Set to none initially */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* Force centering for the icons */
.hide-toggle-btn svg, .show-toggle-btn svg {
    display: block;
}

/* --- Input Bar Styling --- */
/* Container for the whole input area */
.input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    align-items: stretch;
}

/* Combined wrapper: This makes the input and icon look like ONE bar */
.combined-field {
    display: flex;
    flex: 1;
    background: #252525;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden; /* Important to clip the liquid fill inside the icon area */
    transition: border-color 0.3s;
}

.combined-field:focus-within {
    border-color: #ff4757; /* Glows when you click to type */
}

#nameInputItem {
    flex: 1;
    background: transparent; /* Remove internal background */
    border: none; /* Remove internal border */
    color: white;
    padding: 12px 15px;
    outline: none;
    font-size: 16px;
}

/* UPLOAD ICON STYLING (Inside the bar) */
.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); /* Divider line between text and icon */
}

/* The Liquid Layer */
.upload-fill-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0; /* Changed from 0% to 0 for a cleaner base state */
    background: linear-gradient(to top, #2ed573, #7bed9f);
    transition: height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Added bounce */
    z-index: 1;
    pointer-events: none; /* Ensures it doesn't block clicks */
}

.upload-icon-wrapper img {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 2;
    filter: none;
    transition: transform 0.2s;
}

/* Success state */
.upload-icon-wrapper.ready {
    background: rgba(46, 213, 115, 0.15); /* Slightly stronger green tint */
}

.upload-icon-wrapper.ready .upload-fill-bar {
    /* Height is handled by JS for the animation, keep this empty */
}

.upload-icon-wrapper.ready img {
    transform: scale(1.1);
}

/* Add this to style.css */
@keyframes drainEffect {
    0% { transform: translateY(0); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.upload-icon-wrapper.draining img {
    animation: drainEffect 0.3s ease;
}

/* Wheel specific fixes */
#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: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 5px;
}

/* --- UNIVERSAL CUSTOM SCROLLBAR (Matches Entry List) --- */
/* This covers the Name List, the Results, and the Background Gallery */

/* 1. The background of the scrollbar (The Track) */
::-webkit-scrollbar {
    width: 8px; /* Slightly wider for better usability on your Dell */
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #161616; /* Matches your results-container background */
    border-radius: 10px;
}

/* 2. The moving handle (The Thumb) */
::-webkit-scrollbar-thumb {
    background: #333333; /* Matches your border color */
    border-radius: 10px;
    border: 2px solid #161616; /* Creates a padding effect around the thumb */
}

/* 3. The handle when you hover or scroll */
::-webkit-scrollbar-thumb:hover {
    background: var(--accent); /* Changes to your Red when hovering */
}

/* 4. Special styling for the Names List specifically to match the row border */
.names-list-container::-webkit-scrollbar-thumb {
    background: #444; 
}

.names-list-container::-webkit-scrollbar-thumb:active {
    background: var(--primary); /* Turns Blue when dragging */
}

/* Fix for Firefox */
* {
    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); }
}

.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); }

/* Style for the color circle on each name entry */
.color-indicator {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    margin-right: 12px;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.3);
    transition: transform 0.2s;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.color-indicator:hover {
    transform: scale(1.2);
}

/* Container for the name and circle */
.name-entry-left {
    display: flex;
    align-items: center;
    flex: 1;
}

/* Hide the actual color input but keep it functional */
.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; }
.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; }

/* --- 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: 20px; 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); }
.thumb { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 10px auto; }
.yes-no { background: conic-gradient(#2ed573 0deg 180deg, #ff4757 180deg 360deg); }
.alphabet { background: conic-gradient(#ffa502, #1e90ff, #3742fa, #ff4757, #ffa502); }
.numbers { background: conic-gradient(#444 0deg 90deg, #222 90deg 180deg, #444 180deg 270deg, #222 270deg 360deg); }
.fast-food { background: conic-gradient(#f1c40f, #e67e22, #e74c3c, #c0392b, #f1c40f); }

/* --- 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; }
.danger-btn { background: var(--accent); color: white; padding: 12px 20px; margin-right: 10px; }
#closeModal { background: #444; color: white; padding: 12px 20px; }

#winnerName {
    display: flex;
    justify-content: center;
    align-items: center; /* Locks letters to the vertical center */
    flex-wrap: wrap;
    gap: 5px;
    perspective: 1500px; /* Increased perspective for deeper depth */
    height: 100px;       /* Fixed height container to prevent shifting */
    margin: 20px 0;
}

.wave-letter {
    display: inline-block;
    font-size: 2.3rem; 
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    
    /* Force GPU rendering */
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform;
    
    /* The Animation */
    animation: zoomRipple 2s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* 3D Zoom Ripple: No Y-axis movement */
@keyframes zoomRipple {
    0%, 100% {
        /* Keep everything at 0 except Z */
        transform: translate3d(0, 0, 0); 
        opacity: 0.6;
    }
    50% {
        /* translate3d(x, y, z) - We only change Z */
        /* Increased to 150px to make the wave look much "bigger" */
        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);
    }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 800px) {
    .app-container { 
        flex-direction: column; 
        overflow-x: hidden;
    }

    .wheel-panel { 
        order: 1; 
        /* Reset flex to 1 so it doesn't try to take 3/4 of the height/width */
        flex: 1; 
        display: flex;
        justify-content: center;
        align-items: center;
        /* Balanced padding ensures the wheel stays in the middle */
        padding: 40px 0 20px 0; 
        min-height: auto; 
        height: auto;
        width: 100%; 
    }

    /* --- FIXED: Perfect Centering for Mobile Fullscreen --- */
    .wheel-panel.full-width {
        width: 100%;
        height: 100vh;
        padding: 0;       /* Removes padding that pushes wheel off-center */
        margin: 0;
        display: flex;    /* Enforce flex centering */
        justify-content: center;
        align-items: center;
    }

    .controls-panel { 
        order: 2; 
        flex: 1; 
        border-left: none; 
        border-top: 1px solid #333; 
    
    /* --- The Fix --- */
        padding: 20px;            /* Equal padding for all sides */
        width: 100%;             /* Ensure it spans the full width */
        box-sizing: border-box;  /* CRITICAL: Includes padding in the width calculation */
        overflow-x: hidden;      /* Prevents any horizontal scrolling */
    }
    
    #pointer {
        right: -10px;
    }

    .wheel-wrapper {
        /* This ensures the wheel is centered horizontally on the phone screen */
        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;
}

#spinBtn:active {
    transform: translate(-50%, -50%) scale(0.9) !important;
}

.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 Features Styling --- */

/* 1. 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;
}

/* 2. Active Tags List (Below the button) */
.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;
}

/* 3. The Portrait Modal Content */
.adv-modal-content {
    width: 90%;
    max-width: 380px; /* Portrait width */
    text-align: left;
    display: flex;
    flex-direction: column;
}

.adv-option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

.adv-option-item label {
    font-size: 14px;
    font-weight: 500;
    color: #bbb;
}

/* 4. Theme Dots */
.theme-picker {
    display: flex;
    gap: 10px;
}

.theme-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.theme-dot:hover {
    transform: scale(1.2);
}

.theme-dot.selected {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.reset-btn, .close-adv-btn {
    padding: 12px; /* Matching Shuffle/Sort padding */
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px; /* Matching the rest of your buttons */
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.reset-btn {
    flex: 1;
    background: #2f3542; /* Matches Sort button */
    color: white;
}

.close-adv-btn {
    flex: 1;
    background: var(--primary); /* Matches Add button */
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Container to fix the mobile "right-side" spacing and align buttons */
.results-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Base style: This uses your existing .clear-btn styles */
.clear-btn {
    flex: 1;           /* Makes them equal width */
    width: auto;       /* Overrides the width: 100% you have currently */
    margin-top: 0;     /* Controlled by container gap now */
    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;
}

/* Unique color for the Download button while keeping the same shape */
#downloadPdfBtn {
    background: #27ae60; /* Success Green */
}

/* Hover effects */
.clear-btn:hover {
    background: var(--accent); /* Your red hover */
    transform: translateY(-2px);
}

#downloadPdfBtn:hover {
    background: #2ecc71; /* Brighter green hover */
    transform: translateY(-2px);
}

/* 4. Add this to the very bottom */
#bgGalleryModal .adv-modal-content {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#bgGalleryModal h3 {
    margin: 0 0 10px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    background: #252525;
    z-index: 20;
}

.bg-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    max-height: 350px; 
    overflow-y: auto; 
    padding: 10px 5px; /* Fixed: Bottom/Top padding prevents overlap */
}

.bg-thumb-card { 
    background: #1a1a1a; 
    padding: 6px; 
    border-radius: 10px; 
    cursor: pointer; 
    border: 2px solid transparent; 
    transition: transform 0.2s ease;
    position: relative;
}

.bg-thumb-card:hover { 
    border-color: var(--primary); 
    transform: translateY(4px); /* Moves into the 10px padding, not under heading */
}

.bg-thumb-card img { 
    width: 100%; 
    height: 85px; 
    object-fit: cover; 
    border-radius: 6px; 
    display: block; 
}

.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-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.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;
}

/* This targets the shadow circle specifically */
.wheel-hover-overlay circle {
    /* Optional: adds a modern frosted glass look to the wheel while active */
    backdrop-filter: blur(2px); 
}

.curved-text {
    fill: #FFFFFF;
    font-size: 24px;
    font-weight: 900;
    text-transform: uppercase;
    /* Base spacing for the top text */
    letter-spacing: 1px;
    filter: drop-shadow(0 0 8px rgba(0,0,0,0.8));
    paint-order: stroke fill;
}

/* The bottom text naturally looks "squeezed". 
   Adding extra spacing (3px) makes it look like it matches the top.
*/
.curved-text.spacing-fix {
    letter-spacing: 3px; 
}

.wheel-hover-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

/* --- LOADING SCREEN CONTAINER --- */
#loading-screen {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.8s ease;
}

.pixel-loader-wrap {
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- THE ROLLING TRACK --- */
.track {
    position: relative;
    width: 100%;
    height: 120px;
}

#mini-wheel-container {
    position: absolute;
    bottom: 32px; 
    left: 0%;
    width: 60px;
    height: 60px;
    transform: translateX(-50%);
    will-change: left;
}

#mini-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #fff;
    background: conic-gradient(
        #ff4757 0deg 45deg, #ffa502 45deg 90deg, 
        #2ed573 90deg 135deg, #1e90ff 135deg 180deg,
        #3742fa 180deg 225deg, #8e44ad 225deg 270deg, 
        #f368e0 270deg 315deg, #ff9f43 315deg 360deg
    );
    transform: rotate(0deg); 
    will-change: transform;
    /* Box shadow makes it look like a physical 8-bit object */
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
}

/* --- PROGRESS BAR --- */
.pixel-bar-border {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 20px;
    border: 4px solid #fff;
    background: #000;
    overflow: hidden;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
}

#pixel-bar-fill {
    width: 0%;
    height: 100%;
    background: #ff4757;
    transition: background-color 0.2s steps(1);
    position: relative;
    overflow: hidden;
    transition: background-color 0s steps(1);
    box-shadow: inset -4px 0px 0px rgba(0,0,0,0.2);
}

/* --- PIXEL TEXTURE OVERLAY --- */
#pixel-bar-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(45deg, rgba(255,255,255,0.2) 25%, transparent 25%), 
        linear-gradient(-45deg, rgba(255,255,255,0.2) 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.2) 75%), 
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.2) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    animation: movePixels 1.5s infinite steps(8);
}

/* --- DYNAMIC STATUS TEXT & GLITCH --- */
.pixel-text {
    margin-top: 25px;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.glitch-active {
    animation: textGlitch 0.3s steps(2) forwards;
}

/* --- PERCENTAGE DISPLAY --- */
.pixel-pct {
    margin-top: 10px;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 28px;
    font-weight: 900;
}

/* --- ANIMATIONS --- */
@keyframes movePixels {
    from { background-position: 0 0, 0 4px, 4px -4px, -4px 0px; }
    to { background-position: 16px 0, 16px 4px, 20px -4px, 12px 0px; }
}

@keyframes textGlitch {
    0% { transform: translate(0); text-shadow: none; }
    20% { transform: translate(-3px, 2px); text-shadow: 2px 0 #ff4757, -2px 0 #1e90ff; }
    40% { transform: translate(3px, -2px); text-shadow: -2px 0 #ff4757, 2px 0 #1e90ff; }
    60% { transform: translate(-3px, -2px); opacity: 0.7; }
    80% { transform: translate(3px, 2px); }
    100% { transform: translate(0); text-shadow: none; opacity: 1; }
}

/* --- SMOOTH APP ENTRANCE --- */
.app-container {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 1s ease-out, transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.app-container.loaded {
    opacity: 1;
    transform: scale(1);
}

.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);
    
    /* Animation Properties */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 800px; /* Large enough to accommodate content */
    opacity: 1;
    overflow: hidden;
    visibility: visible;
}

/* The "Hidden" State */
.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;
}

/* --- Restored Original Heading Style --- */
.global-status-line {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #888; /* Original grey */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    /* Removed the green border and background */
}

/* --- ODOMETER DASHBOARD CONTAINER --- */
.odometer-dashboard {
    display: flex;
    justify-content: center;
    gap: 40px;
    background: transparent; /* Makes it blend into the panel */
    padding: 10px 0;
    margin: 0;
    border: none; /* Removed the heavy 4px borders */
}

.odo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* --- HEADER & LIVE DOT --- */
.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;
}

/* --- THE ODOMETER MECHANICAL LOOK --- */
.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; /* This hides the other numbers in the strip */
    background: #1a1a1a;
    margin: 0 1px;
    border-radius: 2px;
    position: relative;
}

.digit-strip {
    display: flex;
    flex-direction: column;
    /* Faster transition (0.5s instead of 0.8s) for higher frequency updates */
    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;
}

/* --- TENTHS DIGIT (The Red One) --- */
.digit-container:last-child .digit-strip span {
    background: #ff4757;
    color: #000;
}

/* --- ANIMATIONS --- */
@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; /* Light grey */
    font-family: Arial, sans-serif;
    margin-top: 6px;
    font-weight: bold;
}

.live-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;         /* Space between the bars and the text */
    margin-top: 25px;  /* Space between the odometer and this module */
    margin-bottom: 10px; /* Space below the entire module */
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    width: fit-content;
}

/* --- Minimal Bar Graph --- */
.live-bar-graph {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 18px;      /* Slightly taller for better visibility */
    margin-bottom: 4px; /* Internal spacing between graph and text */
}

.bar-segment {
    width: 3px;
    background: #333;
    border-radius: 1px;
    /* This transition makes the bars "slide" rather than jump */
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.active-bar {
    background: #2ed573; /* Green bar highlight */
    box-shadow: 0 0 5px rgba(46, 213, 115, 0.4);
}

/* --- User Count & Dot --- */
.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);
    /* Steady pulse instead of rapid flicker */
    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); }
}

#winnerImageContainer img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    /* Golden Border */
    border: 4px solid #ffd700; 
    border-radius: 12px;
    /* Golden Glow Effect */
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    
    /* Ensure no extra space around image */
    display: block;
    margin: 0 auto;
    margin-bottom: 20px;
    
    /* Animation to make it pop */
    animation: winnerPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#winnerImageContainer {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
}

@keyframes winnerPop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- 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; /* Prevents layout jump when title is loading */
    pointer-events: none;
}

/* The actual text styling */
#wheelTitleDisplay {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    color: white;
    margin: auto;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.6);
    cursor: pointer;
    pointer-events: auto; /* Re-enable clicking so you can click the title to edit */
    transition: transform 0.2s ease;
}

#wheelTitleDisplay:hover {
    transform: scale(1.05);
    color: var(--accent);
}

/* Hide container when empty */
.wheel-title-container.empty {
    display: none;
}

/* Title Input Modal Specifics */
#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;
}

/* Ensure title is visible on Mobile */
@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: space-between;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 10px 0 20px 0; /* Adjust spacing below stats */
}

.sl-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    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;
}

.sl-btn:hover {
    color: white;
}

.sl-btn img {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sl-btn:hover img {
    opacity: 1;
}

.sl-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
}

/* Specific styling for the 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);
}

/* Styling for the new Reset button in the bar */
.reset-danger-btn:hover {
    color: #ff4757 !important; /* Your accent red color */
}

.reset-danger-btn:hover img {
    filter: invert(34%) sepia(88%) border-radius(50%) saturate(4500%) hue-rotate(345deg) brightness(101%) contrast(101%);
    opacity: 1;
}

/* Adjust the bar for three items */
.save-load-bar {
    justify-content: space-around; /* Better spacing for 3 buttons */
}

/* --- 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;
    
    /* NEW: Smooth Fade-In when the script injects it */
    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;
}

/* --- The Fade Animation --- */
@keyframes fadeInFooter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hide footer specifically in fullscreen mode */
.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); }