:root {
    --bg-dark: #0a0a0f;
    --bg-panel: #12121a;
    --bg-card: #1a1a24;
    --neon-yellow: #ccff00;
    --neon-yellow-dim: #99cc00;
    --neon-pink: #ff0066;
    --neon-cyan: #00ffff;
    --neon-purple: #bf00ff;
    --text-primary: #ffffff;
    --text-secondary: #8b8b9a;
    --text-muted: #4a4a5a;
    --border-color: #2a2a3a;
    --danger: #ff3333;
    --success: #00ff88;
    --warning: #ffaa00;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    --gold: #ffd700;
    --camera-bg: #0d0d12;
    
    --font-display: 'Teko', sans-serif;
    --font-ui: 'Rajdhani', sans-serif;
}

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

body {
    font-family: var(--font-ui);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Фоновые эффекты */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(204, 255, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(204, 255, 0, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(204, 255, 0, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

/* ===== ШАПКА (всегда видна) ===== */
.main-header {
    padding: 20px 40px 0;
    position: relative;
    z-index: 10;
}

.header-banner {
    background: var(--neon-yellow);
    padding: 20px 40px;
    position: relative;
    max-width: 1800px;
    margin: 0 auto;
    transform: skewX(-5deg);
    box-shadow: 0 0 30px rgba(204, 255, 0, 0.3);
}

.banner-cutout {
    position: absolute;
    width: 30px;
    height: 30px;
    background: var(--bg-dark);
    transform: rotate(45deg);
}

.banner-cutout.left {
    left: -15px;
    top: 50%;
    margin-top: -15px;
}

.banner-cutout.right {
    right: -15px;
    top: 50%;
    margin-top: -15px;
}

.glitch-text {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    color: var(--bg-dark);
    text-align: center;
    letter-spacing: 4px;
    transform: skewX(5deg);
    position: relative;
    line-height: 1;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    animation: glitch-1 2s infinite linear alternate-reverse;
    color: var(--neon-pink);
    z-index: -1;
}

.glitch-text::after {
    animation: glitch-2 3s infinite linear alternate-reverse;
    color: var(--neon-cyan);
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(20% 0 30% 0); transform: translate(-2px, 2px); }
    40% { clip-path: inset(50% 0 20% 0); transform: translate(2px, -2px); }
    60% { clip-path: inset(10% 0 60% 0); transform: translate(-2px, 0); }
    80% { clip-path: inset(80% 0 5% 0); transform: translate(2px, 2px); }
}

@keyframes glitch-2 {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -2px); }
    40% { clip-path: inset(30% 0 40% 0); transform: translate(-2px, 2px); }
    60% { clip-path: inset(10% 0 70% 0); transform: translate(2px, 0); }
    80% { clip-path: inset(40% 0 30% 0); transform: translate(-2px, -2px); }
}

.subtitle {
    text-align: center;
    color: var(--bg-dark);
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 8px;
    transform: skewX(5deg);
    margin-top: 5px;
    opacity: 0.7;
}

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
.app-container {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 30px;
    padding: 30px 40px 40px;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* ===== ЛЕВАЯ КОЛОНКА ===== */
.left-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: calc(100vh - 200px); /* Фиксируем высоту */
    position: sticky;
    top: 20px;
}
.sidebar-panel.leaderboard-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
    flex: 1; /* Занимает всё доступное пространство */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Важно для flex-контейнера */
    max-height: none; /* Убираем ограничение */
}
/* Лидерборд */
.sidebar-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-title-bar {
    background: var(--bg-card);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.title-icon {
    font-size: 1.5rem;
}

.panel-title-bar h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    letter-spacing: 2px;
    flex: 1;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse-live 1.5s infinite;
    box-shadow: 0 0 10px var(--danger);
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.panel-body {
    padding: 15px;
    flex: 1;
    overflow-y: auto; /* Скролл внутри */
    min-height: 0; /* Важно для flex-контейнера */
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leader-item {
    background: var(--bg-card);
    border-left: 3px solid var(--border-color);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
}

.leader-item.new-player {
    animation: slide-in 0.3s ease;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-score {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--neon-yellow); }
}

.leader-item.top-1 {
    border-left-color: var(--gold);
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, var(--bg-card) 100%);
}

.leader-item.top-2 {
    border-left-color: var(--silver);
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, var(--bg-card) 100%);
}

.leader-item.top-3 {
    border-left-color: var(--bronze);
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, var(--bg-card) 100%);
}

.leader-rank {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    width: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.leader-item.top-1 .leader-rank { 
    color: var(--gold); 
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    font-size: 2rem;
}
.leader-item.top-2 .leader-rank { 
    color: var(--silver);
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}
.leader-item.top-3 .leader-rank { 
    color: var(--bronze);
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
}

.leader-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leader-score {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--neon-yellow);
    font-weight: 700;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 1.1rem;
}

/* Камера стримера */
.streamer-camera {
    width: 100%;
    height: 253px;
    flex-shrink: 0;
    flex-grow: 0;
}

.camera-frame-large {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(13, 13, 18, 0.5);
    border: 3px dashed var(--neon-yellow);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 0 30px rgba(204, 255, 0, 0.2),
        inset 0 0 60px rgba(204, 255, 0, 0.05);
    animation: camera-pulse 3s ease-in-out infinite;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}

@keyframes camera-pulse {
    0%, 100% { 
        border-color: var(--neon-yellow);
        box-shadow: 0 0 30px rgba(204, 255, 0, 0.2), inset 0 0 60px rgba(204, 255, 0, 0.05);
    }
    50% { 
        border-color: var(--neon-yellow-dim);
        box-shadow: 0 0 50px rgba(204, 255, 0, 0.3), inset 0 0 80px rgba(204, 255, 0, 0.1);
    }
}

.camera-frame-large .corner {
    position: absolute;
    width: 25px;
    height: 25px;
    border: 4px solid var(--neon-yellow);
    animation: corner-blink 2s ease-in-out infinite;
}

.camera-frame-large .corner.top-left {
    top: -4px;
    left: -4px;
    border-right: none;
    border-bottom: none;
}

.camera-frame-large .corner.top-right {
    top: -4px;
    right: -4px;
    border-left: none;
    border-bottom: none;
    animation-delay: 0.5s;
}

.camera-frame-large .corner.bottom-left {
    bottom: -4px;
    left: -4px;
    border-right: none;
    border-top: none;
    animation-delay: 1s;
}

.camera-frame-large .corner.bottom-right {
    bottom: -4px;
    right: -4px;
    border-left: none;
    border-top: none;
    animation-delay: 1.5s;
}

@keyframes corner-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.camera-label-overlay {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--neon-yellow);
    color: var(--bg-dark);
    padding: 5px 20px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 10px) 100%, 0 100%, 0 5px);
}

.camera-instruction {
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.7;
}

/* ===== ПРАВАЯ КОЛОНКА - ОСНОВНОЙ КОНТЕНТ ===== */
.main-content {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.content-screen {
    display: none;
    flex: 1;
    height: 100%;
}

.content-screen.active {
    display: flex;
    flex-direction: column;
}

/* ===== ЭКРАН НАСТРОЕК ===== */
.setup-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 30px 100%, 0 calc(100% - 30px));
}

.setup-panel .panel-header {
    background: linear-gradient(90deg, var(--bg-card) 0%, transparent 100%);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}

.header-accent {
    width: 4px;
    height: 30px;
    background: var(--neon-yellow);
    transform: skewX(-10deg);
}

.setup-panel .panel-header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    letter-spacing: 2px;
    flex: 1;
}

.setup-panel .panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 30px;
    padding: 40px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.input-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-label {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--neon-yellow);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    padding: 15px 20px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 2rem;
    outline: none;
    transition: all 0.3s;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.input-wrapper input:focus {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 20px rgba(204, 255, 0, 0.2);
}

.input-decoration {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    background: var(--neon-yellow);
    color: var(--bg-dark);
    padding: 0 20px;
    display: flex;
    align-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%);
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 4px;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.twitch-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: 25px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}

.twitch-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(191, 0, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.twitch-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(191, 0, 255, 0.5));
}

.twitch-info {
    flex: 1;
}

.twitch-status {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--danger);
    letter-spacing: 2px;
}

.twitch-status.connected {
    color: var(--success);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.twitch-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 3px;
}

.action-btn {
    background: var(--bg-dark);
    border: 2px solid var(--neon-purple);
    color: var(--neon-purple);
    padding: 12px 30px;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.action-btn:hover {
    background: var(--neon-purple);
    color: var(--bg-dark);
    box-shadow: 0 0 30px rgba(191, 0, 255, 0.5);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--text-muted);
    color: var(--text-muted);
}

.launch-btn {
    width: 100%;
    margin-top: 10px;
    padding: 0;
    background: transparent;
    border: none;
    position: relative;
    cursor: pointer;
    height: 80px;
}

.launch-btn.small {
    height: 60px;
    max-width: 300px;
    margin: 20px auto 0;
}

.btn-bg {
    position: absolute;
    inset: 0;
    background: var(--neon-yellow);
    clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 20px 100%, 0 50%);
    transition: all 0.3s;
}

.launch-btn:hover .btn-bg {
    background: var(--text-primary);
    box-shadow: 0 0 40px rgba(204, 255, 0, 0.6);
}

.btn-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--bg-dark);
}

.btn-icon {
    font-size: 1.5rem;
}

.btn-text-main {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 3px;
}

.btn-sub {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    opacity: 0.7;
    letter-spacing: 2px;
    border-left: 2px solid rgba(0,0,0,0.2);
    padding-left: 15px;
    margin-left: 5px;
}

.btn-borders {
    position: absolute;
    inset: -2px;
    pointer-events: none;
}

.btn-borders span {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--neon-yellow);
}

.btn-borders span:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; }
.btn-borders span:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; }
.btn-borders span:nth-child(3) { bottom: 0; right: 0; border-left: none; border-top: none; }
.btn-borders span:nth-child(4) { bottom: 0; left: 0; border-right: none; border-top: none; }

/* ===== ЭКРАН ИГРЫ ===== */
.game-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
    clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 30px 100%, 0 calc(100% - 30px));
}

.timer-container {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: 20px;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
    flex-shrink: 0;
}

.timer-frame {
    position: relative;
}

.timer-bar-bg {
    height: 30px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-yellow) 0%, var(--warning) 50%, var(--danger) 100%);
    width: 100%;
    transition: width 1s linear;
    position: relative;
}

.timer-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(0,0,0,0.1) 10px,
        rgba(0,0,0,0.1) 20px
    );
}

.timer-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 10% 100%;
    pointer-events: none;
}

.timer-display {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.timer-number {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(204, 255, 0, 0.5);
}

.timer-unit {
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.question-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
}

.card-header {
    background: var(--bg-dark);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.question-counter {
    font-family: var(--font-display);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-counter .current {
    color: var(--neon-yellow);
    font-size: 2rem;
}

.question-counter .separator {
    color: var(--text-muted);
}

.question-counter .total {
    color: var(--text-secondary);
}

.question-type {
    background: var(--neon-yellow);
    color: var(--bg-dark);
    padding: 5px 15px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 2px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 10px) 100%, 0 100%, 0 5px);
}

.question-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
}

.question-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 40px;
    color: var(--text-primary);
    text-transform: uppercase;
    text-align: center;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 0px;
}

.answer-btn {
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    padding: 30px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 15px;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}

.answer-btn::before {
    content: attr(data-letter);
    width: 45px;
    height: 45px;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    transition: all 0.3s;
    clip-path: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%);
}

.answer-btn:hover {
    border-color: var(--neon-yellow);
    background: rgba(204, 255, 0, 0.05);
    transform: translateX(5px);
}

.answer-btn:hover::before {
    background: var(--neon-yellow);
    color: var(--bg-dark);
}

.answer-btn.correct {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--success);
    animation: correct-pulse 0.5s ease;
}

.answer-btn.correct::before {
    background: var(--success);
    color: var(--bg-dark);
}

.answer-btn.wrong {
    opacity: 0.5;
    border-color: var(--danger);
}

.answer-btn.wrong::before {
    background: var(--danger);
}

@keyframes correct-pulse {
    0%, 100% { transform: translateX(0) scale(1); }
    50% { transform: translateX(5px) scale(1.02); }
}

.text-mode {
    background: var(--bg-dark);
    border: 2px solid var(--neon-cyan);
    padding: 50px;
    text-align: center;
    margin-top: auto;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
}

.text-mode-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.text-mode-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--neon-cyan);
    margin-bottom: 15px;
    letter-spacing: 3px;
}

.text-mode-format {
    background: rgba(0, 255, 255, 0.1);
    color: var(--neon-cyan);
    padding: 15px 30px;
    font-family: monospace;
    font-size: 1.3rem;
    display: inline-block;
    margin-bottom: 20px;
    border: 1px dashed var(--neon-cyan);
}

.text-mode-examples {
    display: flex;
    gap: 30px;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1rem;
}

.answer-reveal {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1) 0%, rgba(0, 255, 136, 0.05) 100%);
    border: 2px solid var(--success);
    padding: 5px;
    margin: 0px;
    text-align: center;
    animation: slide-up 0.5s ease;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
}

.reveal-header {
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--success);
    letter-spacing: 4px;
    margin-bottom: 10px;
}

.correct-answer-text {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--text-primary);
}

/* ===== ЭКРАН РЕЗУЛЬТАТОВ ===== */
.results-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    gap: 20px;
    overflow-y: auto;
    clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 30px 100%, 0 calc(100% - 30px));
}

.results-header-compact {
    text-align: center;
    margin-bottom: 10px;
}

.results-header-compact h2 {
    font-family: var(--font-display);
    font-size: 3.5rem;
    color: var(--neon-yellow);
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(204, 255, 0, 0.5);
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 20px;
    margin-bottom: 20px;
}

.podium-container.equal .podium-place {
    width: 220px;
    min-height: 300px;
    height: auto;
}

.podium-place {
    position: relative;
    display: flex;
    flex-direction: column;
    clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 40px, 100% 100%, 0 100%, 0 40px);
}

.podium-place.winner {
    z-index: 2;
    transform: scale(1.05);
}

.place-bg {
    position: absolute;
    inset: 0;
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
}

.second-bg {
    background: linear-gradient(180deg, rgba(192, 192, 192, 0.1) 0%, var(--bg-panel) 100%);
    border-color: var(--silver);
}

.winner-bg {
    background: linear-gradient(180deg, rgba(204, 255, 0, 0.2) 0%, var(--bg-panel) 100%);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 50px rgba(204, 255, 0, 0.3);
}

.third-bg {
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.1) 0%, var(--bg-panel) 100%);
    border-color: var(--bronze);
}

.place-content {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 15px;
    text-align: center;
}

.place-badge {
    width: 45px;
    height: 45px;
    background: var(--bg-dark);
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    clip-path: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%);
}

.second-badge {
    border-color: var(--silver);
    color: var(--silver);
}

.winner-badge {
    background: var(--neon-yellow);
    color: var(--bg-dark);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 20px rgba(204, 255, 0, 0.5);
    width: 55px;
    height: 55px;
    font-size: 2.2rem;
}

.third-badge {
    border-color: var(--bronze);
    color: var(--bronze);
}

.crown {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 20px rgba(204, 255, 0, 0.8));
    animation: float 3s ease-in-out infinite;
}

.place-trophy {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.place-name {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.2;
}

.place-score {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--neon-yellow);
    font-weight: 700;
    margin-bottom: 10px;
}

.place-label {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    letter-spacing: 2px;
    padding: 6px 15px;
    border: 1px solid;
    margin-top: auto;
}

.place-label.silver {
    color: var(--silver);
    border-color: var(--silver);
    background: rgba(192, 192, 192, 0.1);
}

.place-label.gold {
    background: var(--neon-yellow);
    color: var(--bg-dark);
    border-color: var(--neon-yellow);
    font-weight: 700;
    box-shadow: 0 0 20px rgba(204, 255, 0, 0.4);
}

.place-label.bronze {
    color: var(--bronze);
    border-color: var(--bronze);
    background: rgba(205, 127, 50, 0.1);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.final-stats {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
}

.stats-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px;
    gap: 20px;
    padding: 15px 25px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

.final-list {
    max-height: 200px;
    overflow-y: auto;
}

.final-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px;
    gap: 20px;
    padding: 12px 25px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: all 0.3s;
}

.final-item:hover {
    background: rgba(204, 255, 0, 0.05);
}

.final-rank {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.final-item.top-3 .final-rank {
    color: var(--neon-yellow);
}

.final-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.final-score {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--neon-yellow);
}

.final-accuracy {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== УТИЛИТЫ ===== */
.hidden {
    display: none !important;
}

.screen {
    display: none;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-yellow);
}

/* Адаптивность */
@media (max-width: 1400px) {
    .app-container {
        grid-template-columns: 380px 1fr;
        padding: 20px 30px 30px;
    }
    
    .question-title {
        font-size: 3rem;
    }
}

@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .left-sidebar {
        flex-direction: row;
        height: auto;
        min-height: auto;
        max-height: 300px; /* Ограничение в строку */
        position: relative;
        top: 0;
    }
    
    .sidebar-panel {
        flex: 1;
    }
    
    .streamer-camera {
        width: 400px;
        height: 225px; /* 400 / 16 * 9 */
        flex-shrink: 0;
    }
    .sidebar-panel.leaderboard-panel {
    flex: 1;
    min-height: 0; /* Ключевое свойство для flex-контейнера */
    overflow-y: auto;
}
    .answers-grid {
        grid-template-columns: 1fr;
    }
    
    .podium-container.equal .podium-place {
        width: 180px;
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 15px;
    }
    
    .glitch-text {
        font-size: 2.5rem;
    }
    
    .app-container {
        padding: 15px;
    }
    
    .left-sidebar {
        flex-direction: column;
        max-height: none;
    }
    
    .streamer-camera {
        width: 100%;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .answers-grid {
        grid-template-columns: 1fr;
    }
    
    .question-title {
        font-size: 2rem;
    }
    
    .podium-container.equal {
        flex-direction: column;
        align-items: center;
    }
    
    .podium-container.equal .podium-place {
        width: 100%;
        max-width: 300px;
        min-height: 200px;
    }
    
    .podium-place.winner {
        transform: scale(1);
        order: -1;
    }
}
.question-types-section {
    margin-top: 10px;
}

.question-types-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.type-toggle {
    cursor: pointer;
    display: block;
}

.type-toggle input {
    display: none;
}

.toggle-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}

.type-toggle:hover .toggle-card {
    border-color: var(--neon-yellow);
    background: rgba(204, 255, 0, 0.05);
}

.type-toggle input:checked + .toggle-card {
    border-color: var(--neon-yellow);
    background: rgba(204, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(204, 255, 0, 0.2);
}

.toggle-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border-radius: 10px;
    flex-shrink: 0;
}

.toggle-info {
    flex: 1;
}

.toggle-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.toggle-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.toggle-switch {
    flex-shrink: 0;
}

.switch-track {
    width: 50px;
    height: 26px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 13px;
    position: relative;
    transition: all 0.3s;
}

.type-toggle input:checked + .toggle-card .switch-track {
    background: var(--neon-yellow);
    border-color: var(--neon-yellow);
}

.switch-thumb {
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
}

.type-toggle input:checked + .toggle-card .switch-thumb {
    left: 26px;
    background: var(--bg-dark);
}

.type-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 51, 51, 0.1);
    border: 2px solid var(--danger);
    color: var(--danger);
    font-family: var(--font-ui);
    font-weight: 700;
    letter-spacing: 1px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.type-warning.hidden {
    display: none;
}

.warning-icon {
    font-size: 1.2rem;
}
.leaderboard-list::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 2px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: var(--neon-yellow);
    border-radius: 2px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: var(--neon-yellow-dim);
}

/* Фикс для Firefox */
.leaderboard-list {
    scrollbar-width: thin;
    scrollbar-color: var(--neon-yellow) var(--bg-dark);
}