/* ================================================================
   Quiz Wheel — Main Stylesheet
   ================================================================ */

:root {
    --bg-color: #1a1a2e;
    --panel-bg: #16213e;
    --primary-color: #0f3460;
    --accent-color: #e94560;
    --text-color: #e0e0e0;
    --highlight: #4cc9f0;
    --gold: #ffd700;
    --bonus-color: #2ecc71;
    --skip-color: #e74c3c;
}

/* --- Base --- */
body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(76, 201, 240, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(233, 69, 96, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(155, 89, 182, 0.04) 0%, transparent 40%);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3 {
    color: var(--highlight);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(76, 201, 240, 0.3);
}

h1 {
    font-size: 3em;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--highlight), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: rgba(255,255,255,0.35);
    font-size: 0.85em;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

/* --- Top Bar --- */
.top-bar {
    width: 100%;
    max-width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.top-bar-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.top-label {
    font-weight: bold;
    color: var(--text-color);
}

.top-label-spaced { margin-left: 20px; }

.top-select {
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.top-timer {
    width: 80px;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-weight: bold;
    text-align: center;
}

.add-team-block {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.add-team-title { font-size: 1em; margin-bottom: 10px; }
.add-team-row { display: flex; gap: 10px; }
.add-team-input { flex: 1; }

.tsparticles-layer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, 90vw);
    pointer-events: none;
}

.toast {
    background: var(--panel-bg);
    color: var(--text-color);
    padding: 14px 18px;
    border-radius: 10px;
    border-left: 4px solid var(--highlight);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-size: 0.95em;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast.toast-error { border-left-color: var(--skip-color); }
.toast.toast-warning { border-left-color: var(--gold); }
.toast.toast-info { border-left-color: var(--highlight); }
.toast-title { font-weight: bold; margin-bottom: 4px; }
.toast-body { color: rgba(255, 255, 255, 0.85); }

.admin-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s;
}

.admin-link:hover {
    background: var(--highlight);
    color: #000;
}

/* --- Layout --- */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    margin-bottom: 40px;
}

.panel {
    background: linear-gradient(145deg, rgba(22, 33, 62, 0.95), rgba(15, 20, 40, 0.98));
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, border-color 0.3s, box-shadow 0.3s;
}

.panel:hover {
    transform: translateY(-3px);
    border-color: rgba(76, 201, 240, 0.2);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(76, 201, 240, 0.05);
}

.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- Wheel --- */
#wheel-container {
    position: relative;
    width: 520px;
    height: 520px;
    margin: 20px auto;
}

.wheel-glow {
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(76, 201, 240, 0.15) 0%, rgba(76, 201, 240, 0.05) 40%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    transition: all 0.5s;
    filter: blur(2px);
}

.wheel-glow.spinning {
    background: radial-gradient(circle, rgba(233, 69, 96, 0.3) 0%, rgba(255, 215, 0, 0.1) 40%, transparent 70%);
    animation: wheelGlow 0.3s infinite alternate;
}

@keyframes wheelGlow {
    from { filter: blur(2px) brightness(1); transform: scale(1); }
    to { filter: blur(4px) brightness(1.6); transform: scale(1.03); }
}

canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

#spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ff6b6b 0%, var(--accent-color) 40%, #c0392b 100%);
    color: white;
    border: 4px solid rgba(255, 255, 255, 0.9);
    font-weight: bold;
    font-size: 1.2em;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(233, 69, 96, 0.6), inset 0 -3px 8px rgba(0,0,0,0.3), inset 0 3px 8px rgba(255,255,255,0.2);
    z-index: 10;
    transition: all 0.2s;
    animation: spinPulse 2s infinite;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

@keyframes spinPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(233, 69, 96, 0.4); }
    50% { box-shadow: 0 0 40px rgba(233, 69, 96, 0.8), 0 0 60px rgba(233, 69, 96, 0.3); }
}

#spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.8);
}

#spin-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: translate(-50%, -50%);
    box-shadow: none;
    animation: none;
}

#pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid var(--highlight);
    z-index: 15;
    filter: drop-shadow(0 0 8px var(--highlight));
}

/* --- Scoreboard --- */
.scoreboard-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.scoreboard-header h2 {
    margin: 0;
}

.scoreboard-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

ul#team-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

li.team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border-left: 4px solid transparent;
    transition: all 0.4s;
    position: relative;
    overflow: hidden;
}

li.team-item.active {
    background: rgba(76, 201, 240, 0.1);
    border-left: 4px solid var(--highlight);
    box-shadow: 0 0 15px rgba(76, 201, 240, 0.1);
}

li.team-item .team-name { font-size: 1.1em; font-weight: 600; }
li.team-item .team-score { font-size: 1.4em; color: var(--gold); font-weight: 800; }
li.team-item .team-row-right { display: flex; align-items: center; gap: 8px; }

.jackpot-transfer-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.jackpot-transfer-btn {
    padding: 14px 28px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    background: linear-gradient(45deg, #ffd700, #ff6b6b);
    color: #000;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: transform 0.2s;
}

.jackpot-transfer-btn:hover { transform: scale(1.1); }

.jackpot-transfer-skip {
    padding: 14px 28px;
    font-size: 1.1em;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    transition: transform 0.2s;
}

.jackpot-transfer-skip:hover { transform: scale(1.1); }

.new-game-cta {
    margin-top: 20px;
    padding: 16px 40px;
    font-size: 1.3em;
    font-weight: bold;
    border: none;
    border-radius: 14px;
    background: linear-gradient(45deg, #ffd700, #ff6b6b);
    color: #000;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
    transition: transform 0.2s;
}

.new-game-cta:hover { transform: scale(1.1); }

.team-delete-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.2);
    cursor: pointer;
    font-size: 1.1em;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 10px;
}

.team-delete-btn:hover {
    color: var(--skip-color);
    background: rgba(231, 76, 60, 0.15);
}

/* --- Controls & Form Elements --- */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    justify-content: center;
    align-items: center;
}

select, input {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-family: inherit;
    font-size: 1em;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--highlight);
}

button.action-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--highlight));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: opacity 0.2s;
}

button.action-btn:hover { opacity: 0.9; }

/* --- Current Team Banner --- */
.current-team-display {
    text-align: center;
    padding: 14px 28px;
    background: linear-gradient(135deg, rgba(76, 201, 240, 0.1), rgba(76, 201, 240, 0.03));
    border: 1px solid rgba(76, 201, 240, 0.3);
    border-radius: 16px;
    margin-bottom: 15px;
    box-shadow: 0 0 20px rgba(76, 201, 240, 0.05), inset 0 0 20px rgba(76, 201, 240, 0.03);
}

.current-team-display .label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.4);
}

.current-team-display .name {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--highlight);
}

/* --- Game Status Bar --- */
.game-status {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
    border: 1px solid rgba(255,255,255,0.08);
}

.status-badge .icon { font-size: 1.2em; }

.streak-badge { border-color: rgba(255, 107, 0, 0.2); }
.streak-badge.on-fire {
    border-color: #ff6b00;
    background: rgba(255, 107, 0, 0.1);
    animation: firePulse 1s infinite;
}

@keyframes firePulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 107, 0, 0.2); }
    50% { box-shadow: 0 0 15px rgba(255, 107, 0, 0.5); }
}

.round-badge { border-color: rgba(76, 201, 240, 0.2); }

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: linear-gradient(135deg, rgba(31, 64, 104, 0.97) 0%, rgba(22, 27, 34, 0.98) 100%);
    margin: 5% auto;
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    text-align: center;
    position: relative;
    box-shadow: 0 0 60px rgba(76, 201, 240, 0.25), 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    border: 2px solid rgba(76, 201, 240, 0.5);
    backdrop-filter: blur(20px);
}

.modal-content.bonus-mode {
    border-color: var(--bonus-color);
    box-shadow: 0 0 50px rgba(46, 204, 113, 0.3);
}

.modal-content.jackpot-mode {
    border-color: var(--gold);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 30px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover { color: white; }

.points-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.3em;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 4px 15px rgba(0,0,0,0.3);
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    letter-spacing: 1px;
}

.question-text {
    font-size: 2.2em;
    margin: 30px 0;
    line-height: 1.3;
    font-weight: 700;
    display: none;
}

.answer-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    min-height: 60px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    text-align: left;
}

.answer-box::-webkit-scrollbar { width: 6px; }
.answer-box::-webkit-scrollbar-thumb { background: rgba(46, 204, 113, 0.4); border-radius: 3px; }
.answer-box::-webkit-scrollbar-track { background: transparent; }

.answer-text { font-size: 1.8em; color: #2ecc71; font-weight: bold; line-height: 1.4; }
.answer-text.long-text { font-size: 1.2em; font-weight: 600; }

.timer-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
    display: none;
    position: relative;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #f39c12);
    width: 100%;
    transition: width 1s linear;
    border-radius: 5px;
}

.timer-digits {
    position: absolute;
    right: 8px;
    top: -22px;
    font-size: 0.85em;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    font-variant-numeric: tabular-nums;
}

.timer-digits.urgent { color: var(--skip-color); animation: timerPulse 0.5s infinite; }

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

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.split-award-box {
    width: min(520px, 95%);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(76, 201, 240, 0.25);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
}

.split-award-title {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--highlight);
    margin-bottom: 10px;
}

.split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.split-row label {
    font-weight: 600;
    text-align: left;
}

.split-count-input {
    width: 88px;
    text-align: center;
}

.split-select {
    min-width: 180px;
}

.split-award-hint {
    font-size: 0.88em;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 8px;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-large:hover { transform: scale(1.05); }
.btn-large:active { transform: scale(0.98); }

.btn-primary { background: var(--highlight); color: #000; box-shadow: 0 5px 15px rgba(76, 201, 240, 0.4); }
.btn-correct { background: linear-gradient(45deg, #27ae60, #2ecc71); color: white; box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4); }
.btn-incorrect { background: linear-gradient(45deg, #c0392b, #e74c3c); color: white; box-shadow: 0 5px 15px rgba(192, 57, 43, 0.4); }
.btn-show { background: linear-gradient(45deg, #e67e22, #f39c12); color: white; box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4); }

.multiplier-badge {
    display: inline-block;
    background: linear-gradient(45deg, var(--bonus-color), #27ae60);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    margin-left: 10px;
    animation: multiplierPulse 1s infinite;
}

@keyframes multiplierPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* --- Special Overlay (SKIP/BONUS) --- */
.special-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.special-overlay.show { display: flex; }

.special-message {
    text-align: center;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.special-message .emoji { font-size: 6em; display: block; margin-bottom: 15px; filter: drop-shadow(0 0 20px rgba(255,255,255,0.3)); }
.special-message .text { font-size: 3.5em; font-weight: 800; text-transform: uppercase; letter-spacing: 4px; }
.special-message .subtext { font-size: 1.2em; color: rgba(255,255,255,0.5); margin-top: 12px; letter-spacing: 1px; }

.skip-message .text { color: var(--skip-color); text-shadow: 0 0 40px rgba(231, 76, 60, 0.6), 0 0 80px rgba(231, 76, 60, 0.3); }
.bonus-message .text { color: var(--bonus-color); text-shadow: 0 0 40px rgba(46, 204, 113, 0.6), 0 0 80px rgba(46, 204, 113, 0.3); }

/* --- Score Popup Float --- */
.score-popup {
    position: absolute;
    right: 60px;
    top: 10px;
    color: var(--bonus-color);
    font-weight: 800;
    font-size: 1.2em;
    animation: scoreFloat 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-40px); }
}

/* --- Small utility buttons --- */
.reseed-btn, .new-game-btn, .undo-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.3);
    padding: 7px 8px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.7em;
    font-weight: 600;
    min-height: 34px;
    text-align: center;
    transition: all 0.3s;
}

.reseed-btn:hover { border-color: var(--accent-color); color: var(--accent-color); }

.new-game-btn {
    border-color: rgba(46, 204, 113, 0.3);
    color: rgba(46, 204, 113, 0.5);
}

.new-game-btn:hover {
    border-color: var(--bonus-color);
    color: var(--bonus-color);
    background: rgba(46, 204, 113, 0.08);
}

.undo-btn {
    border-color: rgba(241, 196, 15, 0.35);
    color: rgba(241, 196, 15, 0.75);
}

.undo-btn:hover {
    border-color: #f1c40f;
    color: #f1c40f;
    background: rgba(241, 196, 15, 0.08);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    #wheel-container { width: 360px; height: 360px; }
    canvas { width: 350px; height: 350px; }
    .scoreboard-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
