/* ========================================
   Base Styles & Layout
   ======================================== */
:root {
    /* Holographic Theme (Default) */
    --bg-dark: #0a0a12;
    --bg-panel: rgba(255, 255, 255, 0.05);
    --primary: #00f2ea;
    --secondary: #ff0050;
    --accent: #ffee00;
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);

    --grad-holo: linear-gradient(135deg, rgba(0, 242, 234, 0.8), rgba(255, 0, 80, 0.8));
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);

    --font-main: 'Outfit', sans-serif;
}

/* Neon Theme Override */
[data-theme="neon"] {
    --bg-dark: #050510;
    --primary: #39ff14;
    --secondary: #ff1493;
    --grad-holo: linear-gradient(135deg, #39ff14, #ff1493);
}

/* Pastel Theme Override */
[data-theme="pastel"] {
    --bg-dark: #f0f4f8;
    --bg-panel: white;
    --text-main: #334;
    --text-muted: #778;
    --primary: #ffb7b2;
    --secondary: #b5ead7;
    --grad-holo: linear-gradient(135deg, #ff9aa2, #c7ceea);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    transition: background 0.5s ease;
}

/* Layout Wrapper */
.layout-wrapper {
    display: grid;
    grid-template-columns: 350px 1fr;
    height: 100vh;
}

/* ========================================
   Sidebar Controls
   ======================================== */
.controls-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border-right: var(--glass-border);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 10;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.controls-panel::-webkit-scrollbar {
    width: 6px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.app-title {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -2px;
    background: var(--grad-holo);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-title span {
    font-weight: 300;
}

.input-group label,
.settings-group label,
.winner-history label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 1rem;
    font-family: inherit;
    resize: none;
    margin-bottom: 1rem;
}

[data-theme="pastel"] textarea {
    background: #f5f5f5;
    color: #333;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--grad-holo);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

/* Gen-Z Theme */
[data-theme="gen-z"] {
    --bg-dark: #FFFFFF;
    --bg-panel: #F0F0F0;
    --text-main: #000000;
    --text-muted: #555555;
    --primary: #FF3B30;
    /* Bright Red */
    --secondary: #007AFF;
    /* Bright Blue */
    --grad-holo: linear-gradient(90deg, #FF3B30, #FFCC00, #007AFF);
}

/* Sunset Theme */
[data-theme="sunset"] {
    --bg-dark: #2D142C;
    --primary: #EE4540;
    --secondary: #C72C41;
    --grad-holo: linear-gradient(to right, #EE4540, #C72C41, #801336);
}

/* Ocean Theme */
[data-theme="ocean"] {
    --bg-dark: #001f3f;
    --primary: #7FDBFF;
    --secondary: #0074D9;
    --grad-holo: linear-gradient(to bottom right, #7FDBFF, #0074D9, #001f3f);
}

/* Forest Theme */
[data-theme="forest"] {
    --bg-dark: #1a2f1a;
    --primary: #2ecc71;
    --secondary: #27ae60;
    --text-muted: #8dad8d;
    --grad-holo: linear-gradient(135deg, #2ecc71, #27ae60, #16a085);
}

/* Midnight Theme */
[data-theme="midnight"] {
    --bg-dark: #191970;
    --bg-panel: rgba(0, 0, 0, 0.3);
    --primary: #483d8b;
    --secondary: #6a5acd;
    --grad-holo: linear-gradient(to right, #191970, #483d8b, #6a5acd);
}

/* Candy Theme */
[data-theme="candy"] {
    --bg-dark: #FFF0F5;
    --bg-panel: #FFFAF0;
    --text-main: #DB7093;
    --text-muted: #FFB6C1;
    --primary: #FF69B4;
    --secondary: #FF1493;
    --grad-holo: linear-gradient(45deg, #FF69B4, #FF1493, #FFB6C1);
}

/* Cyberpunk Theme */
[data-theme="cyberpunk"] {
    --bg-dark: #0b0b0b;
    --primary: #fcee0a;
    --secondary: #00f0ff;
    --grad-holo: linear-gradient(to right, #fcee0a, #ff003c, #00f0ff);
}

/* Retro Theme */
[data-theme="retro"] {
    --bg-dark: #2c2c2c;
    /* Vintage Noise */
    --primary: #e67e22;
    --secondary: #d35400;
    --text-main: #ecf0f1;
    --grad-holo: linear-gradient(120deg, #e67e22, #f1c40f, #d35400);
}

/* Luxury Theme */
[data-theme="luxury"] {
    --bg-dark: #000000;
    --text-main: #D4AF37;
    --primary: #FFD700;
    --secondary: #C0C0C0;
    --grad-holo: linear-gradient(to bottom, #D4AF37, #FFD700, #C0C0C0);
}

/* Monochrome Theme */
[data-theme="monochrome"] {
    --bg-dark: #333333;
    --text-main: #ffffff;
    --bg-panel: #444;
    --primary: #999;
    --secondary: #eee;
    --grad-holo: linear-gradient(to right, #000, #fff);
}


/* Storm Theme */
[data-theme="storm"] {
    --bg-dark: #2c3e50;
    --bg-panel: rgba(44, 62, 80, 0.8);
    --primary: #3498db;
    --secondary: #2980b9;
    --grad-holo: linear-gradient(to right, #3498db, #2c3e50);
}

/* Deep Sea Theme */
[data-theme="deepsea"] {
    --bg-dark: #001f3f;
    --bg-panel: rgba(0, 31, 63, 0.8);
    --primary: #7FDBFF;
    --secondary: #0074D9;
    --grad-holo: linear-gradient(to bottom, #001f3f, #0074D9);
}

/* Space Theme */
[data-theme="space"] {
    --bg-dark: #000000;
    --bg-panel: rgba(255, 255, 255, 0.1);
    --primary: #9b59b6;
    --secondary: #8e44ad;
    --grad-holo: linear-gradient(45deg, #000000, #9b59b6);
}

/* Cyber Theme */
[data-theme="cyber"] {
    --bg-dark: #000000;
    --bg-panel: rgba(0, 255, 0, 0.1);
    --primary: #00ff00;
    --secondary: #008000;
    --grad-holo: linear-gradient(90deg, #00ff00, #000000);
}

/* Shiny Theme */
[data-theme="shiny"] {
    --bg-dark: #f0f0f0;
    --bg-panel: #ffffff;
    --primary: #ffcc00;
    --secondary: #ff9900;
    --grad-holo: linear-gradient(135deg, #ffcc00, #ff9900, #ffff00);
}

/* Party Theme */
[data-theme="party"] {
    --bg-dark: #1a1a1a;
    --bg-panel: rgba(255, 255, 255, 0.1);
    --primary: #ff00ff;
    --secondary: #00ffff;
    --grad-holo: linear-gradient(to right, #ff00ff, #00ffff, #ffff00);
}

/* Fizzy Theme */
[data-theme="fizzy"] {
    --bg-dark: #ffefd5;
    --bg-panel: #ffffff;
    --primary: #ffa500;
    --secondary: #ff4500;
    --grad-holo: linear-gradient(45deg, #ffa500, #ff4500);
}

/* Kinetic Theme */
[data-theme="kinetic"] {
    --bg-dark: #222222;
    --bg-panel: #333333;
    --primary: #e74c3c;
    --secondary: #c0392b;
    --grad-holo: linear-gradient(to left, #e74c3c, #c0392b);
}

/* Snow Theme */
[data-theme="snow"] {
    --bg-dark: #f8f9fa;
    --bg-panel: #ffffff;
    --primary: #a0c4ff;
    --secondary: #b9d6f2;
    --grad-holo: linear-gradient(to bottom, #a0c4ff, #ffffff);
}

/* OS Theme */
[data-theme="os"] {
    --bg-dark: #000000;
    --bg-panel: #1c1c1e;
    --primary: #0a84ff;
    --secondary: #30d158;
    --grad-holo: linear-gradient(to right, #0a84ff, #30d158);
}

/* Matrix Theme */
[data-theme="matrix"] {
    --bg-dark: #000000;
    --bg-panel: rgba(0, 255, 0, 0.05);
    --primary: #00ff00;
    --secondary: #003300;
    --text-main: #00ff00;
    --text-muted: #00aa00;
    --grad-holo: linear-gradient(to bottom, #00ff00, #003300);
}

/* Sugar Theme */
[data-theme="sugar"] {
    --bg-dark: #ffe4e1;
    --bg-panel: #fff0f5;
    --primary: #ff69b4;
    --secondary: #db7093;
    --grad-holo: linear-gradient(to right, #ff69b4, #db7093);
}

/* Coffee Theme */
[data-theme="coffee"] {
    --bg-dark: #3e2723;
    --bg-panel: #4e342e;
    --primary: #d7ccc8;
    --secondary: #a1887f;
    --text-main: #efebe9;
    --grad-holo: linear-gradient(to bottom, #3e2723, #d7ccc8);
}

/* Nature Theme */
[data-theme="nature"] {
    --bg-dark: #2e7d32;
    --bg-panel: #388e3c;
    --primary: #81c784;
    --secondary: #66bb6a;
    --grad-holo: linear-gradient(to right, #2e7d32, #81c784);
}

/* Dracula Theme */
[data-theme="dracula"] {
    --bg-dark: #282a36;
    --bg-panel: #44475a;
    --primary: #bd93f9;
    --secondary: #ff79c6;
    --grad-holo: linear-gradient(to right, #bd93f9, #ff79c6);
}

/* 3D Fun Theme */
[data-theme="3d"] {
    --bg-dark: #e0e0e0;
    --bg-panel: #f0f0f0;
    --primary: #ff5722;
    --secondary: #ff9800;
    --grad-holo: linear-gradient(135deg, #ff5722, #ff9800);
}

/* Rainbow Theme */
[data-theme="rainbow"] {
    --bg-dark: #222;
    --bg-panel: #333;
    --primary: #ff0000;
    --secondary: #0000ff;
    --grad-holo: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
}

/* Theme Grid Layout */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
}

/* Theme Select */
.theme-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 1rem 1.2rem;
    border-radius: 12px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);

    /* Custom Arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.theme-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.theme-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 242, 234, 0.2);
    background: rgba(0, 0, 0, 0.2);
}

.theme-select option {
    background-color: #1a1a1a;
    color: white;
    padding: 10px;
}

[data-theme="minimal"] .theme-select,
[data-theme="paper"] .theme-select {
    border: 1px solid #333;
    background: #fff;
    color: #333;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.theme-btn {
    padding: 0.5rem;
    background: transparent;
    border: var(--glass-border);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.6rem;
    font-weight: 700;
    transition: all 0.2s;
    height: 40px;
    /* Uniform height */
}

/* Result Actions & Option */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.remove-option {
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-btn.active {
    background: var(--text-main);
    color: var(--bg-dark);
}

.winner-history {
    margin-top: 1rem;
}

#historyList {
    list-style: none;
}

#historyList li {
    padding: 0.5rem 0;
    border-bottom: var(--glass-border);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    opacity: 0.8;
}

/* ========================================
   Main Stage
   ======================================== */
.stage-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.02), transparent 70%);
}

.spin-trigger {
    margin-top: 3rem;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: none;
    background: var(--grad-holo);
    color: white;
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(0, 242, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
}

.spin-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 0 50px rgba(0, 242, 234, 0.6);
}

.spin-trigger:active {
    transform: scale(0.95);
}

/* ========================================
   Result Overlay
   ======================================== */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.result-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.result-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4rem;
    border-radius: 20px;
    text-align: center;
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-overlay.hidden .result-card {
    transform: translateY(50px);
}

.result-label {
    font-size: 1rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 1rem;
}

.winner-name {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 2rem;
    background: var(--grad-holo);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#confettiCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Responsive */
@media (max-width: 900px) {
    .layout-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .controls-panel {
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        height: auto;
    }

    textarea {
        display: none;
        /* Hide editing in mobile for simplicity or make modal */
    }
}