/* === Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    background: #4a4a6a;
    color: #eee;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn:hover { background: #5a5a8a; }
.btn-primary { background: #e94560; font-size: 1.1rem; padding: 0.8rem 2rem; }
.btn-primary:hover { background: #ff6b81; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-tiny { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #e74c3c; }
.btn-mute { background: #c0392b; }
.btn-mute:hover { background: #e74c3c; }
.btn-mute.muted { background: #27ae60; }
.btn-mute.muted:hover { background: #2ecc71; }
.btn-back { background: #e67e22; }
.btn-back:hover { background: #f39c12; }
.btn-next { background: #27ae60; font-size: 1.2rem; padding: 1rem 2rem; }
.btn-next:hover { background: #2ecc71; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; color: #aaa; font-size: 0.9rem; }
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #16213e;
    color: #eee;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}
.form-group input, input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #16213e;
    color: #eee;
    font-size: 1rem;
}

.error { background: #c0392b; padding: 0.5rem 1rem; border-radius: 6px; margin-bottom: 1rem; }

/* === Login Page === */
.login-page { display: flex; justify-content: center; align-items: center; }
.login-container {
    max-width: 400px;
    width: 90%;
    padding: 2rem;
    background: #16213e;
    border-radius: 12px;
}
.login-container h1 { text-align: center; margin-bottom: 1.5rem; color: #e94560; }
.login-container .btn-primary { width: 100%; margin-top: 0.5rem; }
.token-hint { text-align: center; color: #27ae60; font-size: 0.9rem; margin-top: 1rem; }
.admin-links { margin-top: 1.5rem; text-align: center; }
.admin-links p { color: #666; font-size: 0.85rem; margin-bottom: 0.5rem; }
.admin-links .btn-small { margin: 0.2rem; }

/* === Contestant Page === */
.contestant-page { display: flex; justify-content: center; align-items: center; }
.contestant-container {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    height: 100vh;
    justify-content: center;
}
.question-area { text-align: center; padding: 1rem; }
.question-area .category-name { font-size: 0.9rem; color: #aaa; margin-bottom: 0.5rem; }
.question-area .question-text { font-size: 1.3rem; font-weight: 600; }

.buzzer-button {
    width: 80vw;
    height: 80vw;
    max-width: 300px;
    max-height: 300px;
    border-radius: 50%;
    border: 6px solid #333;
    background: #4a4a6a;
    color: #666;
    font-size: 2rem;
    font-weight: 700;
    cursor: not-allowed;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.buzzer-button.active {
    background: #e94560;
    border-color: #ff6b81;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 0 40px rgba(233, 69, 96, 0.5);
    animation: pulse 1.5s infinite;
}
.buzzer-button.pressed {
    background: #27ae60;
    border-color: #2ecc71;
    color: #fff;
    animation: none;
    box-shadow: 0 0 40px rgba(39, 174, 96, 0.5);
}
.buzzer-button:disabled { cursor: not-allowed; }

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

.status-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 1rem;
    font-size: 0.85rem;
    color: #888;
}
.connection-status.connected { color: #27ae60; }
.connection-status.reconnecting { color: #e67e22; }
.connection-status.disconnected { color: #e74c3c; }

.buzz-result { font-size: 1.2rem; font-weight: 600; color: #27ae60; min-height: 1.5rem; }

/* === Moderator Page === */
.moderator-page { display: flex; justify-content: center; align-items: stretch; }
.moderator-container {
    width: 100%;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100vh;
    overflow: hidden;
}

/* Breadcrumb bar */
.mod-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #16213e;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.mod-sep { color: #555; }
.mod-volume { margin-left: auto; display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; }
.mod-version { color: #555; font-size: 0.7rem; margin-left: 0.5rem; }
.mod-volume input[type="range"] { width: 80px; }

/* 3-panel body */
.mod-body {
    display: grid;
    grid-template-columns: 1fr 1fr 220px;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left panel — notes + category tree */
.mod-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}
.mod-notes-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.mod-notes-container h3 {
    color: #f1c40f;
    font-size: 0.9rem;
    margin: 0 0 0.3rem 0;
}
.mod-question-detail {
    background: #16213e;
    border: 2px solid #2980b9;
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
}
.mod-question-detail .question-text {
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    line-height: 1.4;
}
.mod-notes {
    background: rgba(241,196,15,0.08);
    border: 1px solid #f1c40f;
    border-radius: 6px;
    padding: 0.8rem;
    font-size: 1.3rem;
    line-height: 1.6;
    color: #f1c40f;
    flex: 1;
    overflow-y: auto;
    white-space: pre-wrap;
}
.mod-category-tree {
    font-size: 0.8rem;
    color: #888;
    overflow-y: auto;
    max-height: 25vh;
    flex-shrink: 1;
}
.mod-tree-cat { margin-bottom: 0.2rem; }
.mod-tree-cat-name { color: #aaa; font-weight: 600; padding: 0.15rem 0.3rem; border-radius: 3px; }
.mod-tree-cat-name.active { color: #e94560; background: rgba(233,69,96,0.1); }
.mod-tree-q { padding-left: 1rem; color: #666; padding: 0.1rem 0.3rem; border-radius: 3px; }
.mod-tree-q.active { color: #fff; font-weight: 600; background: rgba(255,255,255,0.08); }

/* Center panel */
.mod-center {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    justify-content: flex-start;
    padding: 0.5rem;
}

/* Betting grid done markers (moderator) */
.mod-betting-cell.done { opacity: 0.35; cursor: default; pointer-events: none; }
.mod-betting-cell .bet-done-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 900; color: rgba(255,255,255,0.7); text-shadow: 0 2px 6px rgba(0,0,0,0.8); pointer-events: none; }

/* Right panel (Teilnehmer) */
.mod-right {
    background: #16213e;
    border-radius: 8px;
    padding: 0.5rem;
    overflow-y: auto;
    border: 1px solid #333;
}
.mod-right h3 {
    text-align: center;
    color: #2980b9;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}
.mod-contestant-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    font-size: 0.85rem;
    border-radius: 4px;
    margin-bottom: 2px;
    border-left: 4px solid transparent;
}
.mod-contestant-row:first-child { background: rgba(241,196,15,0.1); }
.mod-contestant-row.dragging { opacity: 0.3; }
.mod-speaker-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.mod-speaker-btn:hover { background: rgba(233,69,96,0.3); }
.mod-speaker-btn.target { background: rgba(233,69,96,0.4); box-shadow: 0 0 0 2px #e94560; }
.interactive-panel { background: rgba(233,69,96,0.15); border: 1px solid #e94560; border-radius: 8px; padding: 0.8rem; margin: 0.5rem 0; text-align: center; }
.interactive-info { margin-bottom: 0.5rem; color: #ccc; }
.btn-interactive { background: #e94560; color: #fff; font-size: 1.1rem; padding: 0.6rem 1.5rem; border: none; border-radius: 6px; cursor: pointer; }
.btn-interactive:hover { background: #ff6b81; }
.interactive-config { background: rgba(255,255,255,0.05); border: 1px solid #444; border-radius: 6px; padding: 0.5rem; margin-top: 0.3rem; }
.interactive-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; font-size: 0.85rem; }
.interactive-row label { min-width: 100px; color: #aaa; }
.interactive-row select, .interactive-row input[type="file"] { flex: 1; }
.interactive-audio-name { color: #888; font-size: 0.8rem; }
.interactive-sound-indicator { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 5rem; animation: pulse-sound 0.5s ease-in-out infinite alternate; z-index: 1000; }
@keyframes pulse-sound { from { opacity: 0.5; transform: translate(-50%, -50%) scale(1); } to { opacity: 1; transform: translate(-50%, -50%) scale(1.3); } }

/* Betting grids */
.betting-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 1rem; width: 100%; max-width: 400px; margin: 0 auto; }
.betting-cell { border-radius: 12px; padding: 1.2rem 0.5rem; text-align: center; font-size: 1.1rem; font-weight: 600; color: #fff; cursor: pointer; text-shadow: 0 1px 2px rgba(0,0,0,0.5); transition: transform 0.15s, box-shadow 0.15s; user-select: none; }
.betting-cell:active { transform: scale(0.95); }
.betting-cell.selected { box-shadow: 0 0 0 4px #f1c40f, 0 0 16px rgba(241,196,15,0.5); transform: scale(1.05); }
.betting-cell.winner { box-shadow: 0 0 0 4px #2ecc71, 0 0 24px rgba(46,204,113,0.6); animation: winner-pulse 0.6s ease-in-out infinite alternate; }
@keyframes winner-pulse { from { box-shadow: 0 0 0 4px #2ecc71, 0 0 16px rgba(46,204,113,0.4); } to { box-shadow: 0 0 0 6px #2ecc71, 0 0 32px rgba(46,204,113,0.7); } }

/* Moderator betting */
.betting-panel-mod { background: rgba(255,255,255,0.03); border: 1px solid #444; border-radius: 8px; padding: 0.5rem; margin: 0.5rem 0; }
.betting-panel-mod h4 { margin: 0 0 0.5rem 0; color: #f1c40f; font-size: 0.9rem; text-align: center; }

/* Betting split: grid + contestants side-by-side */
.betting-split { display: flex; gap: 0.5rem; width: 100%; min-height: 0; }
.betting-split-left { flex: 1; min-width: 0; }
.betting-split-left h4 { margin: 0 0 0.4rem 0; color: #f1c40f; font-size: 0.85rem; text-align: center; }
.betting-split-right { width: 200px; flex-shrink: 0; background: #16213e; border: 1px solid #333; border-radius: 8px; padding: 0.4rem; display: flex; flex-direction: column; min-height: 0; }
.betting-split-right h4 { margin: 0 0 0.3rem 0; color: #2980b9; font-size: 0.8rem; text-align: center; }
.betting-contestant-list { overflow-y: auto; flex: 1; }
.betting-contestant-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.3rem;
    font-size: 0.75rem;
    border-radius: 3px;
    margin-bottom: 1px;
    border-left: 3px solid transparent;
}
.betting-contestant-row:hover { background: rgba(255,255,255,0.05); }
.bc-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-points { font-weight: 700; color: #f1c40f; min-width: 2rem; text-align: right; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.betting-contestant-row .sb-btn { width: 20px; height: 20px; font-size: 0.75rem; }

.mod-betting-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mod-betting-cell { border-radius: 6px; padding: 0.5rem; text-align: center; color: #fff; font-size: 0.75rem; text-shadow: 0 1px 2px rgba(0,0,0,0.5); position: relative; }
.mod-betting-cell .bet-name { font-weight: 600; }
.mod-betting-cell .bet-count { font-size: 0.7rem; opacity: 0.9; }
.mod-betting-cell.winner { box-shadow: 0 0 0 3px #2ecc71; }

/* Projection betting */
.projection-betting-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; margin: 0 auto; }
.projection-betting-cell { border-radius: 16px; padding: 1rem 0.75rem; text-align: center; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.5); transition: all 0.3s; min-width: 0; overflow: hidden; position: relative; }
.projection-betting-cell .pbet-name { font-size: 1.5rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.projection-betting-cell .pbet-count { font-size: 0.9rem; margin-top: 0.3rem; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.projection-betting-cell.winner { box-shadow: 0 0 0 6px #2ecc71, 0 0 40px rgba(46,204,113,0.5); transform: scale(1.05); }

/* Projection betting grid done markers (LED wall) */
.projection-betting-cell.done { opacity: 0.25; }
.projection-betting-cell .pbet-done-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; font-weight: 900; color: rgba(255,255,255,0.7); text-shadow: 0 2px 8px rgba(0,0,0,0.9); pointer-events: none; }

/* Betting winner full-screen image */
.projection-betting-winner-img {
    position: relative;
    width: 100%;
    max-width: 80vw;
    text-align: center;
}
.projection-betting-winner-img img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 0 0 6px #2ecc71, 0 0 40px rgba(46,204,113,0.5);
}
.pbet-winner-label {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    margin-top: 1rem;
}

/* Betting option image thumbnail in admin */
.bet-img-thumb { width: 24px; height: 24px; object-fit: cover; border-radius: 3px; }
.bet-img-btn { cursor: pointer; font-size: 0.8rem; }

/* Admin betting config */
.betting-grid-config { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 0.3rem; }
.betting-option-config { display: flex; align-items: center; gap: 4px; }
.betting-option-config input[type="color"] { width: 28px; height: 28px; border: none; cursor: pointer; }
.betting-option-config input[type="text"] { flex: 1; min-width: 0; font-size: 0.8rem; padding: 2px 4px; }
.q-type-select { font-size: 0.7rem; padding: 1px 2px; background: #2a2a3e; color: #ccc; border: 1px solid #444; border-radius: 4px; }
.moderator-scoreboard { background: rgba(255,255,255,0.03); border: 1px solid #333; border-radius: 8px; padding: 0.5rem; margin: 0.5rem 0; }
.moderator-scoreboard h4 { margin: 0 0 0.3rem 0; font-size: 0.9rem; color: #f1c40f; }
.scoreboard-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.4rem; font-size: 0.85rem; }
.scoreboard-row:first-child { background: rgba(241,196,15,0.1); border-radius: 4px; }
.sb-rank { min-width: 1.5rem; font-weight: 700; color: #aaa; }
.sb-name { flex: 1; }
.sb-points { font-weight: 700; color: #f1c40f; }
.sb-time { color: #888; font-size: 0.8rem; }
.sb-btn { width: 24px; height: 24px; border: none; border-radius: 4px; cursor: pointer; font-weight: 700; font-size: 0.9rem; line-height: 1; padding: 0; }
.sb-plus { background: #27ae60; color: #fff; }
.sb-plus:hover { background: #2ecc71; }
.sb-minus { background: #e74c3c; color: #fff; }
.sb-minus:hover { background: #c0392b; }

/* Admin scoreboard rows */
.admin-score-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.4rem; font-size: 0.85rem; border-left: 4px solid transparent; border-radius: 4px; margin-bottom: 2px; }
.admin-score-row:first-child { background: rgba(241,196,15,0.1); }
.admin-score-rank { min-width: 1.5rem; font-weight: 700; color: #aaa; }
.admin-score-name { flex: 1; }
.admin-score-points { font-weight: 700; color: #f1c40f; min-width: 4rem; text-align: right; }
.sb-drag { cursor: grab; color: #555; font-size: 0.9rem; touch-action: none; user-select: none; }
.scoreboard-row.dragging { opacity: 0.3; }
.scoreboard-row .drag-clone { border: 1px solid #e94560; background: #1a1a2e; }
.moderator-container .controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 0.5rem 0;
    flex-shrink: 0;
}
.moderator-container .btn-back { padding: 1rem 2rem; font-size: 1rem; }
.moderator-container .btn-next { padding: 1.5rem 3rem; font-size: 1.5rem; }

/* === Projection Page === */
.projection-page {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.projection-video {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    object-fit: cover;
    z-index: 0;
}
.projection-container {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
.projection-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    text-align: center;
    padding: 3rem;
}
.projection-content .category-name { font-size: 4rem; font-weight: 700; }
.projection-content .question-text { font-size: 3rem; font-weight: 600; line-height: 1.3; }
.projection-content .buzz-indicator {
    font-size: 1.5rem;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
}
.projection-content .buzz-indicator.active {
    background: #e94560;
    color: #fff;
    animation: pulse 1s infinite;
}

/* === Shared: Buzz List === */
.buzz-list, .buzz-results { display: flex; flex-direction: column; gap: 0.3rem; }
.buzz-entry {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    font-size: 1.1rem;
}
.buzz-pos { font-weight: 700; min-width: 2rem; color: #e94560; }
.buzz-name { flex: 1; }
.buzz-time { color: #aaa; font-variant-numeric: tabular-nums; }
.buzz-time.missed { color: #e67e22; font-style: italic; }
.buzz-entry.buzz-missed { opacity: 0.6; }
.buzz-entry.buzz-position-1 .buzz-pos { color: #f1c40f; font-size: 1.3rem; }

/* Projection buzz entries are bigger */
.projection-content .buzz-entry { font-size: 2rem; padding: 0.8rem 1.5rem; }
.projection-content .buzz-pos { font-size: 2.5rem; min-width: 3rem; }

/* === State Badges === */
.state-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    background: #333;
}
.state-start { background: #2c3e50; }
.state-intro { background: #8e44ad; }
.state-question { background: #2980b9; }
.state-hotphase { background: #e94560; animation: pulse 1s infinite; }
.state-results { background: #27ae60; }
.state-muted { background: #e67e22; }

/* === Admin Page === */
.admin-page { padding: 1rem; }
.admin-container { max-width: 1200px; margin: 0 auto; }
.admin-container h1 { margin-bottom: 0; color: #e94560; }
.project-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.project-switcher { display: flex; align-items: center; gap: 0.5rem; }
.project-switcher select { background: #16213e; color: #eee; border: 1px solid #444; border-radius: 6px; padding: 0.4rem 0.6rem; font-size: 0.9rem; }
.project-switcher input { width: 140px; }
.admin-section { margin-bottom: 1.5rem; }
.admin-edit { border-bottom: 2px solid #333; padding-bottom: 1.5rem; }
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.cat-type { color: #8e44ad; font-size: 0.8rem; }
.panel {
    background: #16213e;
    border-radius: 8px;
    padding: 1rem;
}
.panel h2 { font-size: 1rem; color: #aaa; margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.panel h3 { font-size: 0.9rem; color: #888; margin: 1rem 0 0.5rem; }
.panel-wide { grid-column: span 2; }

.category-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.3rem;
}
.category-item.selected { background: rgba(233, 69, 96, 0.15); }
.category-item .cat-name { flex: 1; cursor: pointer; }
.category-item .cat-name:hover { color: #e94560; }
.category-child-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem 0.2rem 1.5rem;
    font-size: 0.8rem;
    color: #888;
    border-radius: 4px;
    cursor: pointer;
}
.category-child-item:hover { color: #e94560; background: rgba(233,69,96,0.05); }
.category-child-item.selected { color: #fff; background: rgba(233,69,96,0.15); }

.question-wrapper {
    margin-bottom: 2px;
    border-radius: 4px;
    border: 1px solid transparent;
}
.question-wrapper:has(.question-item.expanded) {
    border-color: #2980b9;
    background: rgba(41,128,185,0.05);
}
.question-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}
.question-item:hover { background: rgba(255,255,255,0.05); }
.question-item.expanded { background: rgba(41,128,185,0.1); }
.question-item .q-num { color: #666; min-width: 2rem; }
.question-item .q-text { flex: 1; }
.q-edit-input { width: 100%; padding: 0.2rem 0.4rem; font-size: inherit; background: #16213e; color: #eee; border: 1px solid #e94560; border-radius: 4px; }

/* Expanded question editor */
.question-editor {
    padding: 0.5rem 0.5rem 0.5rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.qe-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.qe-row label { min-width: 40px; color: #aaa; }
.qe-text-input {
    flex: 1;
    padding: 0.3rem 0.5rem;
    background: #16213e;
    color: #eee;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 0.85rem;
}
.qe-text-input:focus { border-color: #2980b9; outline: none; }

/* === AI Panel (Moderator) === */
.ai-panel {
    background: rgba(241,196,15,0.05);
    border: 1px solid #f1c40f;
    border-radius: 8px;
    padding: 0.8rem;
    width: 100%;
    max-width: 500px;
}
.ai-record-section { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.ai-record-btn { font-size: 1rem; padding: 0.5rem 1rem; }
.ai-record-btn.recording { background: #e74c3c; animation: pulse 1s infinite; }
.ai-record-status { font-size: 0.85rem; color: #f1c40f; }
.ai-transcript-section { margin-bottom: 0.5rem; }
.ai-transcript-section label { display: block; font-size: 0.8rem; color: #aaa; margin-bottom: 0.2rem; }
.ai-transcript {
    width: 100%;
    padding: 0.4rem;
    background: #16213e;
    color: #eee;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 0.9rem;
    resize: vertical;
}
.ai-check-btn { margin-top: 0.3rem; font-size: 0.9rem; padding: 0.4rem 1rem; }
.ai-result-section label { display: block; font-size: 0.8rem; color: #aaa; margin-bottom: 0.2rem; }
.ai-result {
    background: #0a0a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    min-height: 3rem;
    white-space: pre-wrap;
}

.add-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.add-form input { flex: 1; min-width: 0; }
.add-form select { width: auto; flex-shrink: 0; max-width: 5.5rem; }
.drag-handle { cursor: grab; color: #555; font-size: 1.1rem; user-select: none; padding: 0 0.3rem; }
.drag-handle:hover { color: #e94560; }
[draggable].dragging { opacity: 0.4; }
[draggable].drag-over { border-top: 2px solid #e94560; }

.game-info { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.game-controls { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }

.audio-playback { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; padding-top: 0.8rem; border-top: 1px solid #333; }
.audio-playback input[type="range"] { width: 100px; }
.playback-status { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid #333; display: flex; flex-direction: column; gap: 0.4rem; }
.playback-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.playback-row input[type="range"] { width: 100px; }
.playback-icon { font-size: 1rem; }
.audio-pick { display: flex; gap: 0.5rem; align-items: center; }
.audio-pick input[type="text"] { flex: 1; }

.contestant-entry { padding: 0.3rem 0; display: flex; align-items: center; gap: 0.4rem; }
.contestant-entry.connected { color: #27ae60; }
.btn-kick { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 0.9rem; padding: 0 0.3rem; opacity: 0.5; }
.btn-kick:hover { opacity: 1; }

.admin-footer { margin-top: 1.5rem; display: flex; gap: 1rem; justify-content: center; }

/* === Standings === */
.standing-points { color: #f1c40f; font-weight: 700; font-variant-numeric: tabular-nums; }
.standing-rank-1 { background: rgba(241, 196, 15, 0.15); }
.standing-rank-2 { background: rgba(192, 192, 192, 0.1); }
.standing-rank-3 { background: rgba(205, 127, 50, 0.1); }
.points-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.points-row input { background: #16213e; color: #eee; border: 1px solid #333; border-radius: 4px; padding: 0.3rem; text-align: center; }
.color-pick { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.color-pick input[type="color"] { width: 40px; height: 32px; border: 1px solid #444; border-radius: 4px; padding: 0; cursor: pointer; background: none; }
.color-pick input[type="range"] { width: 100px; }
.checkbox-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: #aaa; cursor: pointer; }
.checkbox-label input { cursor: pointer; }
.text-bg-preview { margin-top: 0.5rem; padding: 0.8rem 1.5rem; border-radius: 8px; color: #fff; font-size: 1.2rem; text-align: center; }

/* === Video === */
.video-thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid #444; }
.video-thumb:hover { border-color: #e94560; }
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.modal-content { background: #16213e; border-radius: 12px; padding: 1rem; max-width: 80vw; max-height: 80vh; display: flex; flex-direction: column; gap: 0.5rem; }
.modal-content video { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.video-status { font-size: 0.75rem; color: #e67e22; }
.video-status.ready { color: #27ae60; }

/* === QR Codes === */
.qr-container { display: flex; justify-content: center; padding: 1rem 0; }
.qr-container img { border-radius: 8px; }
.qr-container svg { border-radius: 8px; }
.qr-url { font-size: 0.75rem; color: #666; word-break: break-all; text-align: center; }
.qr-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; display: flex; justify-content: center; align-items: center; background: rgba(0,0,0,0.9); }
.qr-overlay-content { background: #fff; padding: 3rem; border-radius: 24px; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.qr-overlay-content svg { width: 50vmin; height: 50vmin; }

/* === Moderator: iPad / tablet responsive === */
@media (max-width: 1024px) {
    .mod-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto auto;
    }
    .mod-left {
        order: 1;
        /* Let notes container expand to fill available space */
        flex: 1;
        min-height: 0;
    }
    .mod-notes-container {
        flex: 3;
    }
    .mod-notes {
        font-size: 1.8rem;
        line-height: 1.7;
    }
    .mod-question-detail .question-text {
        font-size: 1.1rem;
    }
    .mod-center { order: 3; }
    .mod-right { order: 2; }
    .mod-category-tree { max-height: 10vh; }
    /* Betting split: keep side-by-side on tablet, just shrink contestant column */
    .betting-split-right { width: 160px; }
}

/* === Event Mode (Contestant) === */
.event-answer-input {
    width: 80vw;
    max-width: 400px;
    padding: 1rem;
    border: 2px solid #2980b9;
    border-radius: 12px;
    background: #16213e;
    color: #eee;
    font-size: 1.2rem;
    resize: none;
}
.event-timer { font-size: 1.5rem; color: #f1c40f; margin-top: 0.5rem; font-weight: 700; }
.gift-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex; justify-content: center; align-items: center;
    z-index: 200;
}
.gift-card {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    color: #fff;
    max-width: 90vw;
}
.gift-emoji { font-size: 4rem; margin-bottom: 1rem; }
.gift-text { font-size: 2rem; font-weight: 700; margin-bottom: 1.5rem; }
.gift-claimed { margin-top: 1rem; font-size: 1.2rem; color: #f1c40f; font-weight: 700; }

/* === Event Mode: Countdown Overlay === */
.event-countdown-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 300;
    display: flex; justify-content: center; align-items: center;
    animation: countdownBlink 1s infinite;
}
@keyframes countdownBlink {
    0%, 100% { background: rgba(39, 174, 96, 0.9); }
    50% { background: rgba(46, 204, 113, 0.95); }
}
.event-countdown-content {
    text-align: center; color: #fff;
}
.event-countdown-label { font-size: 2rem; margin-bottom: 1rem; }
.event-countdown-time { font-size: 6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.event-countdown-question { font-size: 1.5rem; margin: 1rem 0 2rem; opacity: 0.9; }

/* === Event Mode (Admin) === */
.event-answers-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.event-answers-table th, .event-answers-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #333; text-align: left; }
.event-answers-table th { color: #aaa; font-weight: 600; }
.event-score { font-weight: 700; font-size: 0.9rem; }
.event-score-high { color: #27ae60; }
.event-score-mid { color: #f1c40f; }
.event-score-low { color: #e74c3c; }

/* === Reconnecting overlay === */
body.reconnecting::after, body.disconnected::after {
    content: "Verbindung unterbrochen...";
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 0.5rem;
    background: #e67e22;
    color: #fff;
    text-align: center;
    font-weight: 600;
    z-index: 9999;
}
body.disconnected::after {
    background: #e74c3c;
    content: "Verbindung getrennt!";
}

/* === Color Palette (Login) === */
.color-palette {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; transform: scale(1.2); }

/* === Contestant Color Indicator === */
.contestant-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

/* === Point Sounds Upload === */
.audio-field-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

/* === Point Toast (Projection) === */
.point-toast-container {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    pointer-events: none;
}
.point-toast {
    padding: 0.4rem 1.2rem;
    border-radius: 8px;
    font-size: 1.6rem;
    font-weight: 700;
    white-space: nowrap;
    animation: toastIn 0.3s ease-out, toastOut 0.4s ease-in 2.6s forwards;
}
.point-toast.award  { background: rgba(241,196,15,0.9); color: #1a1a2e; }
.point-toast.remove { background: rgba(233,69,96,0.85); color: #fff; }

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