*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0d0d1a;
    --panel: #141428;
    --border: rgba(255,255,255,0.08);
    --accent: #4fc3f7;
    --gold: #ffd700;
    --green: #2ecc71;
    --red: #e74c3c;
    --text: #e0e0f0;
    --muted: #8888aa;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg) url('/assets/img/bg_fuchs.jpg') center/cover no-repeat fixed;
    color: var(--text);
}

body::before {
    content: '';
    position: fixed; inset: 0; z-index: 0;
    background: rgba(8, 12, 28, 0.80);
    pointer-events: none;
}

#monitor { position: relative; z-index: 1; }

#monitor {
    display: grid;
    grid-template-columns: 290px 1fr 340px;
    grid-template-rows: 56px 1fr;
    height: 100vh;
    gap: 0;
}

/* Far-left panel: prizes */
#left-panel {
    grid-row: 2;
    background: var(--panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px 12px 16px;
}
#left-panel .panel-title {
    font-size: 0.95rem; font-weight: 800; color: var(--accent);
    text-transform: uppercase; letter-spacing: 1px;
    padding: 4px 4px 10px; position: sticky; top: 0; background: var(--panel);
}
#left-panel #prizes-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
#left-panel #prizes-list li {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 7px 9px;
}
#left-panel #prizes-list li.special { border-color: rgba(255,215,0,0.4); background: rgba(255,215,0,0.06); }
#left-panel #prizes-list li.out { opacity: 0.4; }
#left-panel .prize-thumb {
    width: 46px; height: 46px; flex-shrink: 0; border-radius: 8px;
    background: #fff; object-fit: contain; padding: 3px;
}
#left-panel .prize-noimg { width: 46px; height: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.06); border-radius: 8px; font-size: 1.4rem; }
#left-panel .prize-meta { flex: 1; min-width: 0; }
#left-panel .prize-name { font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
#left-panel .prize-sub { display: flex; gap: 8px; align-items: baseline; margin-top: 3px; }
#left-panel .prize-cost { color: var(--gold); font-weight: 800; font-size: 0.92rem; }
#left-panel .prize-stock { color: var(--muted); font-size: 0.72rem; }
#left-panel li.out .prize-stock { color: var(--red); }
#left-panel li.special .prize-name { color: var(--gold); }

/* Header */
#header {
    grid-column: 1 / -1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    background: linear-gradient(135deg, #1a1a3e, #0d1b2a);
    border-bottom: 1px solid var(--border);
}
#header h1 { font-size: 1.2rem; font-weight: 700; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; display: flex; align-items: center; gap: 14px; }
#header .header-title-logo { height: 42px; width: auto; background: #fff; padding: 4px 10px; border-radius: 8px; }
#header .header-right { display: flex; align-items: center; gap: 20px; font-size: 0.85rem; color: var(--muted); }
#header .header-logo { height: 38px; width: auto; background: #fff; padding: 4px 8px; border-radius: 6px; }

#logo-box {
    background: #fff; padding: 22px 18px;
    display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid var(--border);
}
#logo-box img { width: 100%; max-width: 320px; height: auto; max-height: 170px; object-fit: contain; }

/* Left: wheel area — top-aligned so the wheel never jumps when the
   question/banner appear below/above it. */
#wheel-area {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding: 18px 16px 16px;
    position: relative;
    overflow: hidden;
}

#wheel-wrap {
    position: relative;
    width: 100%; max-width: 500px; aspect-ratio: 1;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

#wheel-canvas { display: block; }

/* Category banner above the wheel — always reserves its space (toggled via
   visibility, not display) so the wheel position stays fixed. */
#category-banner {
    min-height: 58px;
    margin-bottom: 12px;
    padding: 10px 30px;
    border-radius: 50px;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(1.1rem, 2.2vw, 1.7rem);
    font-weight: 800;
    color: #fff;
    text-align: center;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.45);
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
    max-width: 92%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* FUCHS logo in the center hub of the wheel (stays upright, doesn't rotate) */
#wheel-logo {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 23%; max-width: 135px; aspect-ratio: 1;
    background: #fff; border-radius: 50%; padding: 12px;
    object-fit: contain;
    box-shadow: 0 3px 14px rgba(0,0,0,0.45);
    border: 3px solid rgba(255,255,255,0.9);
    pointer-events: none; z-index: 5;
}

/* Sections overlay */
.monitor-section { display: none; }
.monitor-section.active { display: block; }

#section-idle .idle-msg, #section-waiting .waiting-msg {
    text-align: center; margin-top: 16px;
}

#section-idle .idle-msg h2 { font-size: 1.5rem; color: var(--muted); }
#section-waiting .waiting-msg h2 { font-size: 1.6rem; color: var(--accent); }

/* Segment result banner */
#segment-result {
    position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%);
    padding: 10px 32px; border-radius: 50px;
    font-size: 1.5rem; font-weight: 800; color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    white-space: nowrap;
    transition: transform 0.3s;
}
#segment-result.pop { transform: translateX(-50%) scale(1.15); }

/* Question overlay */
#section-question, #section-answer_reveal {
    width: 100%; max-width: 780px; margin: 0 auto;
    padding: 0 16px;
}

.q-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px; flex-wrap: wrap;
}
#q-category { background: rgba(255,255,255,0.1); padding: 4px 14px; border-radius: 20px; font-size: 0.85rem; }
#q-points { font-size: 1rem; color: var(--gold); font-weight: 700; }
#q-multiplier {
    background: var(--red); color: #fff; padding: 2px 10px; border-radius: 12px;
    font-weight: 800; font-size: 1rem;
}

#q-text {
    font-size: clamp(1rem, 2vw, 1.4rem); font-weight: 600;
    margin-bottom: 20px; line-height: 1.4;
    color: #fff;
}

.answers-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.answer-btn {
    background: rgba(255,255,255,0.07);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 12px; padding: 14px 18px;
    color: var(--text); font-size: clamp(0.85rem, 1.5vw, 1rem);
    text-align: left; line-height: 1.35;
    transition: background 0.2s, border-color 0.2s;
    cursor: default;
}
.answer-btn.correct { background: rgba(46,204,113,0.25); border-color: var(--green); color: #fff; }
.answer-btn.wrong   { background: rgba(231,76,60,0.25);  border-color: var(--red);   color: #fff; }
.answer-btn.selected { border-color: var(--accent); }

/* Timer */
.timer-wrap {
    display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
#timer-value {
    font-size: 2.8rem; font-weight: 900; color: var(--accent);
    min-width: 2.5ch; text-align: center;
}
.timer-bar-wrap {
    flex: 1; height: 10px; background: rgba(255,255,255,0.1); border-radius: 5px; overflow: hidden;
}
#timer-bar { height: 100%; width: 100%; transition: width 0.9s linear, background 0.5s; border-radius: 5px; }

/* Points delta */
.points-delta { font-size: 2.5rem; font-weight: 900; text-align: center; margin: 12px 0; }
.points-delta.positive { color: var(--green); }
.points-delta.negative { color: var(--red); }

#timeout-label { display: none; color: var(--red); font-size: 1.2rem; font-weight: 700; text-align: center; margin-top: 8px; }

/* Right panel */
#right-panel {
    display: flex; flex-direction: column;
    background: var(--panel);
    border-left: 1px solid var(--border);
    overflow: hidden;
}

/* Join invite banner */
@keyframes invitePulse {
    0%, 100% { opacity: 1; text-shadow: 0 0 8px var(--accent), 0 0 20px var(--accent), 0 0 40px rgba(79,195,247,0.4); }
    50%       { opacity: 0.75; text-shadow: 0 0 4px var(--accent), 0 0 10px rgba(79,195,247,0.3); }
}
@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50%       { transform: translateY(5px); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

#join-invite {
    padding: 14px 12px 8px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border-bottom: 1px solid var(--border);
    background: rgba(79,195,247,0.04);
}
#join-invite-text {
    font-size: 1rem; font-weight: 800;
    color: var(--accent);
    text-transform: uppercase; letter-spacing: 0.5px;
    text-align: center;
    animation: invitePulse 2s ease-in-out infinite;
    transition: opacity 0.4s;
}
#join-invite-text.fade-out { opacity: 0; }
#join-invite-arrow {
    font-size: 1.1rem; color: var(--accent);
    animation: arrowBounce 1s ease-in-out infinite;
}

/* QR section */
#qr-section {
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
#qr-section img { width: 240px; height: 240px; max-width: 90%; border-radius: 10px; background: #fff; padding: 8px; }
#qr-section .qr-label { font-size: 0.95rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }
#qr-section .qr-url { font-size: 0.7rem; color: var(--muted); word-break: break-all; text-align: center; }

/* Current player */
#current-player {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(79,195,247,0.06);
}
#current-player .player-name { font-size: 1rem; font-weight: 700; color: var(--accent); }
#current-player .player-pts  { font-size: 1rem; font-weight: 700; color: var(--gold); }
#current-player .no-player   { font-size: 0.9rem; color: var(--muted); }

/* Queue */
#queue-section { padding: 8px 16px 4px; border-bottom: 1px solid var(--border); }
#queue-section h3, #ranking-section h3, #prizes-section h3 {
    font-size: 0.7rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px;
}
#queue-list, #ranking-list, #prizes-list { list-style: none; }
#queue-list li, #ranking-list li, #prizes-list li {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 0; font-size: 0.82rem; border-bottom: 1px solid rgba(255,255,255,0.04);
}
#queue-list li .q-pos { min-width: 18px; color: var(--muted); font-size: 0.75rem; }
#queue-list li .q-name { flex: 1; }
#queue-list li .q-pts  { color: var(--gold); font-size: 0.78rem; }
li.empty { color: var(--muted); font-style: italic; }

/* Ranking */
#ranking-section { padding: 8px 16px 4px; border-bottom: 1px solid var(--border); }
#ranking-list li .rank-pos { min-width: 26px; font-size: 1rem; }
#ranking-list li .rank-name { flex: 1; }
#ranking-list li .rank-pts  { font-weight: 700; color: var(--gold); }
#ranking-list li.rank-1 .rank-name { color: #ffd700; font-weight: 700; }
#ranking-list li.rank-2 .rank-name { color: #c0c0c0; }
#ranking-list li.rank-3 .rank-name { color: #cd7f32; }

/* Prizes */
#prizes-section { padding: 8px 16px; flex: 1; overflow-y: auto; }
#prizes-list li { flex-wrap: wrap; }
#prizes-list li .star { color: var(--gold); margin-right: 2px; }
#prizes-list li .prize-name { flex: 1; min-width: 80px; }
#prizes-list li .prize-cost { color: var(--accent); font-size: 0.78rem; white-space: nowrap; }
#prizes-list li .prize-stock { color: var(--muted); font-size: 0.72rem; min-width: 36px; text-align: right; }
#prizes-list li.special .prize-name { color: var(--gold); }
#prizes-list li.out .prize-name, #prizes-list li.out .prize-cost { opacity: 0.4; }
#prizes-list li.out .prize-stock { color: var(--red); }
