:root {
    /* Цвета из сайта розыгрыша */
    --apple-bg: #000000;
    --apple-surface: #1c1c1e;
    --apple-surface-light: #2c2c2e;
    --apple-border: rgba(255, 255, 255, 0.1);
    --apple-text: #f5f5f7;
    --apple-text-secondary: rgba(255, 255, 255, 0.7);
    --apple-text-tertiary: rgba(255, 255, 255, 0.5);
    --apple-blue: #ff3b3b;
    --apple-blue-dark: #ff6b6b;
    --apple-green: #30d158;
    --apple-red: #ff453a;
    --apple-orange: #ff9f0a;
    --apple-purple: #ff6b6b;
    --apple-gold: #ffd60a;
    
    /* Переменные викторины с цветами розыгрыша */
    --bg-dark: #000000;
    --bg-panel: #1c1c1e;
    --bg-card: #2c2c2e;
    --neon-yellow: #ff3b3b;
    --neon-yellow-dim: #ff6b6b;
    --neon-pink: #ff0066;
    --neon-cyan: #00ffff;
    --neon-purple: #bf00ff;
    --text-primary: #f5f5f7;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --danger: #ff453a;
    --success: #30d158;
    --warning: #ff9f0a;
    --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: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    background: #000000;
    color: var(--apple-text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Static Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: -1;
}

/* ===== ШАПКА ===== */
.app-header {
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.header-gradient {
    background: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1) 33%, rgba(20, 20, 20, 1) 66%, rgba(20, 20, 20, 1));
    border: 1px solid var(--apple-border);
    border-radius: 8px;
    padding: 14px 24px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #ff3b3b, #ff6b6b);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--apple-text);
    margin: 0;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1) 33%, rgba(20, 20, 20, 1) 66%, rgba(20, 20, 20, 1));
    border: 1px solid var(--apple-border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.header-link:hover {
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-link-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.header-link-icon svg {
    width: 22px;
    height: 22px;
}

.header-link-icon {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.3), rgba(255, 107, 0, 0.3));
    border: 1px solid rgba(255, 159, 10, 0.4);
    color: rgb(255, 159, 10);
}

.header-link-icon i {
    font-size: 18px;
}

.header-link-icon.telegram {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.3));
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: rgb(59, 130, 246);
}

.header-link-icon.twitch {
    background: linear-gradient(135deg, rgba(145, 70, 255, 0.3), rgba(126, 58, 242, 0.3));
    border: 1px solid rgba(145, 70, 255, 0.4);
    color: rgb(145, 70, 255);
}

.header-link-icon.twitch i {
    font-size: 18px;
}

.header-link-icon.support {
    background: linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.3),
        rgba(255, 127, 0, 0.3),
        rgba(255, 255, 0, 0.3),
        rgba(0, 255, 0, 0.3),
        rgba(0, 0, 255, 0.3),
        rgba(75, 0, 130, 0.3),
        rgba(148, 0, 211, 0.3),
        rgba(255, 0, 0, 0.3)
    );
    background-size: 200% 100%;
    border: 1px solid rgba(255, 0, 255, 0.4);
    animation: rainbow-border 3s linear infinite;
}

.header-link-icon.support i {
    font-size: 18px;
    background: linear-gradient(
        90deg,
        #ff0000,
        #ff7f00,
        #ffff00,
        #00ff00,
        #0000ff,
        #4b0082,
        #9400d3,
        #ff0000
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow-text 3s linear infinite;
}

.header-link-support:hover .header-link-icon.support {
    animation: rainbow-border 1.5s linear infinite;
}

.header-link-support:hover .header-link-icon.support i {
    animation: rainbow-text 1.5s linear infinite, heartbeat 1s ease-in-out infinite;
}

@keyframes rainbow-border {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

@keyframes rainbow-text {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.header-link:hover i,
.header-link:hover .header-link-icon {
    transform: scale(1.05);
}

.header-link-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-link-label {
    font-size: 0.65rem;
    color: var(--apple-text-tertiary);
    font-weight: 500;
}

.header-link-name {
    font-size: 0.8rem;
    color: var(--apple-text);
    font-weight: 600;
}

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    max-width: 100%;
    margin: 0;
    overflow: hidden;
}

.main-header {
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Grid для контента */
.app-content-grid {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 16px;
    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: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1) 33%, rgba(20, 20, 20, 1) 66%, rgba(20, 20, 20, 1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: none;
}

.sidebar-panel {
    background: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1) 33%, rgba(20, 20, 20, 1) 66%, rgba(20, 20, 20, 1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-title-bar {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
}

.title-icon {
    font-size: 1.5rem;
}

.panel-title-bar h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    letter-spacing: 2px;
    flex: 1;
}

.panel-body {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leader-item {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--border-color);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    border-radius: 8px;
}

.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);
    }
}

.leader-item.top-1 {
    border-left-color: var(--gold);
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.leader-item.top-2 {
    border-left-color: var(--silver);
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.leader-item.top-3 {
    border-left-color: var(--bronze);
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, rgba(255, 255, 255, 0.05) 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(255, 59, 59, 0.2),
        inset 0 0 60px rgba(255, 59, 59, 0.05);
    animation: camera-pulse 3s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes camera-pulse {
    0%, 100% { 
        border-color: var(--neon-yellow);
        box-shadow: 0 0 30px rgba(255, 59, 59, 0.2), inset 0 0 60px rgba(255, 59, 59, 0.05);
    }
    50% { 
        border-color: var(--neon-yellow-dim);
        box-shadow: 0 0 50px rgba(255, 59, 59, 0.3), inset 0 0 80px rgba(255, 59, 59, 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: white;
    padding: 5px 20px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    border-radius: 4px;
}

.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: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1) 33%, rgba(20, 20, 20, 1) 66%, rgba(20, 20, 20, 1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.setup-panel .panel-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
}

.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 {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 15px;
    padding: 15px 30px;
    overflow-y: auto;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.input-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-label {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    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: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 1.6rem;
    outline: none;
    transition: all 0.3s;
    border-radius: 8px;
}

.input-wrapper input:focus {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 20px rgba(255, 59, 59, 0.2);
}

.input-decoration {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    background: var(--neon-yellow);
    color: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    border-radius: 0 8px 8px 0;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 3px;
    margin: 8px 0 8px;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* Question Types */
.question-types-section {
    margin-top: 0px;
}

.question-source-section {
    margin-top: 0px;
}

.question-source-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.source-toggle {
    cursor: pointer;
}

.source-toggle input[type="radio"] {
    display: none;
}

.source-toggle input[type="radio"]:checked + .toggle-card {
    background: rgba(255, 59, 59, 0.1);
    border-color: var(--neon-yellow);
}

.source-toggle input[type="radio"]:checked + .toggle-card .radio-indicator {
    background: var(--neon-yellow);
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.5);
}

.radio-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s;
    flex-shrink: 0;
}

/* Custom Question Form */
.custom-question-form {
    width: 100%;
    height: 253px;
    flex-shrink: 0;
    flex-grow: 0;
}

.custom-question-form.hidden {
    display: none;
}

.custom-form-panel {
    width: 100%;
    height: 100%;
    background: rgba(13, 13, 18, 0.5);
    border: 3px dashed var(--neon-yellow);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 0 30px rgba(255, 59, 59, 0.2),
        inset 0 0 60px rgba(255, 59, 59, 0.05);
    animation: form-pulse 3s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes form-pulse {
    0%, 100% { 
        border-color: var(--neon-yellow);
        box-shadow: 0 0 30px rgba(255, 59, 59, 0.2), inset 0 0 60px rgba(255, 59, 59, 0.05);
    }
    50% { 
        border-color: var(--neon-yellow-dim);
        box-shadow: 0 0 50px rgba(255, 59, 59, 0.3), inset 0 0 80px rgba(255, 59, 59, 0.1);
    }
}

.custom-form-panel .corner {
    position: absolute;
    width: 25px;
    height: 25px;
    border: 4px solid var(--neon-yellow);
    animation: corner-blink 2s ease-in-out infinite;
}

.custom-form-panel .corner.top-left {
    top: -4px;
    left: -4px;
    border-right: none;
    border-bottom: none;
}

.custom-form-panel .corner.top-right {
    top: -4px;
    right: -4px;
    border-left: none;
    border-bottom: none;
    animation-delay: 0.5s;
}

.custom-form-panel .corner.bottom-left {
    bottom: -4px;
    left: -4px;
    border-right: none;
    border-top: none;
    animation-delay: 1s;
}

.custom-form-panel .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; }
}

.custom-form-panel .panel-title-bar {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--neon-yellow);
    color: white;
    padding: 4px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    z-index: 10;
}

.custom-form-panel .panel-title-bar h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 2px;
    font-weight: 700;
    margin: 0;
}

.custom-form-panel .panel-body {
    padding: 15px 15px 12px 15px;
    overflow-y: auto;
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0px;
    margin: 0;
}

.form-group.full-width {
    margin-bottom: 8px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group .input-label {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.text-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    height: 40px;
    line-height: 1.4;
}

.text-input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 0 3px rgba(255, 59, 59, 0.1);
}

.text-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
}

/* Answer Type Toggles */
.answer-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.answer-type-toggle {
    cursor: pointer;
    width: 100%;
}

.answer-type-toggle input[type="radio"] {
    display: none;
}

.toggle-card-small {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s;
    position: relative;
    height: 40px;
    width: 100%;
}

.answer-type-toggle input[type="radio"]:checked + .toggle-card-small {
    background: rgba(255, 59, 59, 0.1);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 0 3px rgba(255, 59, 59, 0.1);
}

.toggle-card-small:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

.toggle-title-small {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.toggle-card-small .radio-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    transition: all 0.3s;
    flex-shrink: 0;
}

.answer-type-toggle input[type="radio"]:checked + .toggle-card-small .radio-indicator {
    border-color: var(--neon-yellow);
    background: var(--neon-yellow);
    box-shadow: 0 0 8px rgba(255, 59, 59, 0.6);
}

.answer-type-toggle input[type="radio"]:checked + .toggle-card-small .radio-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.question-types-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.type-toggle {
    cursor: pointer;
}

.type-toggle input[type="checkbox"] {
    display: none;
}

.toggle-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    position: relative;
}

.type-toggle input[type="checkbox"]:checked + .toggle-card {
    background: rgba(48, 209, 88, 0.1);
    border-color: rgba(48, 209, 88, 0.4);
}

.toggle-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.toggle-icon {
    font-size: 1.8rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    flex-shrink: 0;
}

.toggle-info {
    flex: 1;
}

.toggle-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toggle-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.toggle-switch {
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch-track {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    position: relative;
    transition: all 0.3s;
}

.type-toggle input[type="checkbox"]:checked + .toggle-card .switch-track {
    background: var(--success);
}

.switch-thumb {
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
}

.type-toggle input[type="checkbox"]:checked + .toggle-card .switch-thumb {
    left: 25px;
}

.type-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.3);
    border-radius: 8px;
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 15px;
}

.type-warning.hidden {
    display: none;
}

.warning-icon {
    font-size: 1.5rem;
}

/* Twitch Section */
.twitch-section {
    margin-top: 0px;
}

.twitch-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 18px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.twitch-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(145, 70, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.twitch-icon {
    font-size: 2.5rem;
    color: #9146FF;
    filter: drop-shadow(0 0 10px rgba(145, 70, 255, 0.5));
}

.twitch-info {
    flex: 1;
}

.twitch-status {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--danger);
    letter-spacing: 2px;
}

.twitch-status.connected {
    color: var(--success);
    text-shadow: 0 0 10px rgba(48, 209, 88, 0.5);
}

.twitch-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 3px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px 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;
    border-radius: 8px;
}

.action-btn:hover {
    background: var(--neon-purple);
    color: white;
    box-shadow: 0 0 30px rgba(145, 70, 255, 0.5);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--text-muted);
    color: var(--text-muted);
}

.action-btn.connecting {
    pointer-events: none;
    opacity: 0.7;
}

.action-btn.connecting::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Launch Button */
.launch-btn {
    width: 100%;
    margin-top: 0px;
    padding: 0;
    background: transparent;
    border: none;
    position: relative;
    cursor: pointer;
    height: 65px;
}

.launch-btn.small {
    height: 60px;
    max-width: 300px;
    margin: 20px auto 0;
}

.launch-btn.small .btn-text-main {
    font-size: 1.4rem;
}

.launch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #ff3b3b, #ff6b6b);
    border-radius: 8px;
    transition: all 0.3s;
}

.launch-btn:hover:not(:disabled) .btn-bg {
    background: linear-gradient(135deg, #ff6b6b, #ff3b3b);
    box-shadow: 0 0 40px rgba(255, 59, 59, 0.6);
}

.btn-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: white;
}

.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(255,255,255,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 rgba(255, 255, 255, 0.3);
}

.btn-borders span:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.btn-borders span:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 8px 0 0; }
.btn-borders span:nth-child(3) { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 8px 0; }
.btn-borders span:nth-child(4) { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 8px; }

/* ===== ЭКРАН ИГРЫ ===== */
.game-panel {
    background: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1) 33%, rgba(20, 20, 20, 1) 66%, rgba(20, 20, 20, 1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
}

.timer-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    flex-shrink: 0;
}

.timer-frame {
    position: relative;
}

.timer-bar-bg {
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 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(255, 59, 59, 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: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.card-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
}

.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: white;
    padding: 5px 15px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 2px;
    border-radius: 4px;
}

.question-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 25px 40px;
}

.question-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 25px;
    color: var(--text-primary);
    text-transform: uppercase;
    text-align: center;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 0px;
}

.answer-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 20px;
    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;
    border-radius: 8px;
}

.answer-btn::before {
    content: attr(data-letter);
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    transition: all 0.3s;
    border-radius: 6px;
    flex-shrink: 0;
}

.answer-btn:hover {
    border-color: var(--neon-yellow);
    background: rgba(255, 59, 59, 0.05);
    transform: translateX(5px);
}

.answer-btn:hover::before {
    background: var(--neon-yellow);
    color: white;
}

.answer-btn.correct {
    background: rgba(48, 209, 88, 0.1);
    border-color: var(--success);
    animation: correct-pulse 0.5s ease;
}

.answer-btn.correct::before {
    background: var(--success);
    color: white;
}

.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: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--neon-cyan);
    padding: 50px;
    text-align: center;
    margin-top: auto;
    border-radius: 8px;
}

.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.hidden {
    display: none;
}

.answer-reveal {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.1) 0%, rgba(48, 209, 88, 0.05) 100%);
    border: 1px solid var(--success);
    padding: 15px;
    margin: 15px 20px 20px 20px;
    text-align: center;
    animation: slide-up 0.5s ease;
    border-radius: 8px;
}

.answer-reveal.hidden {
    display: none;
}

.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);
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ЭКРАН РЕЗУЛЬТАТОВ ===== */
.results-panel {
    background: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1) 33%, rgba(20, 20, 20, 1) 66%, rgba(20, 20, 20, 1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    gap: 20px;
    overflow-y: auto;
}

.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(255, 59, 59, 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;
    border-radius: 8px;
    overflow: hidden;
}

.podium-place.winner {
    z-index: 2;
    transform: scale(1.05);
}

.place-bg {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.second-bg {
    background: linear-gradient(180deg, rgba(192, 192, 192, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: var(--silver);
}

.winner-bg {
    background: linear-gradient(180deg, rgba(255, 59, 59, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 50px rgba(255, 59, 59, 0.3);
}

.third-bg {
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.1) 0%, rgba(255, 255, 255, 0.05) 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: rgba(255, 255, 255, 0.1);
    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;
    border-radius: 50%;
}

.second-badge {
    border-color: var(--silver);
    color: var(--silver);
}

.winner-badge {
    background: var(--neon-yellow);
    color: white;
    border-color: var(--neon-yellow);
    box-shadow: 0 0 20px rgba(255, 59, 59, 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(255, 59, 59, 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;
    border-radius: 4px;
}

.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: white;
    border-color: var(--neon-yellow);
    font-weight: 700;
    box-shadow: 0 0 20px rgba(255, 59, 59, 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: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.stats-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px;
    gap: 20px;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.05);
    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(255, 59, 59, 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;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-yellow);
}

/* Responsive */
@media (max-width: 1400px) {
    .app-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .left-sidebar {
        height: auto;
        position: relative;
        flex-direction: row;
        gap: 20px;
    }
    
    .sidebar-panel.leaderboard-panel {
        flex: 1;
        max-height: 400px;
    }
    
    .streamer-camera {
        width: 450px;
        height: auto;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .question-types-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 15px 20px 0;
    }
    
    .header-banner {
        padding: 15px 20px;
    }
    
    .glitch-text {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
        letter-spacing: 4px;
    }
    
    .app-container {
        padding: 20px;
    }
    
    .left-sidebar {
        flex-direction: column;
    }
    
    .streamer-camera {
        width: 100%;
    }
    
    .question-title {
        font-size: 2rem;
    }
    
    .answers-grid {
        grid-template-columns: 1fr;
    }
    
    .podium-container {
        flex-direction: column;
        align-items: center;
    }
    
    .podium-container.equal .podium-place {
        width: 100%;
        max-width: 300px;
    }
}


/* Модальное окно результата раунда */
.round-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.round-modal.hidden {
    display: none !important;
}

.round-modal-content {
    background: linear-gradient(to right, rgba(25, 25, 25, 1), rgba(22, 22, 22, 1));
    border: 2px solid var(--neon-yellow);
    border-radius: 16px;
    padding: 2rem;
    max-width: 900px;
    width: 85%;
    aspect-ratio: 16 / 9;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.round-modal-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.round-modal-header h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--neon-yellow);
    letter-spacing: 3px;
    text-shadow: none;
}

.round-modal-body {
    margin-bottom: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.round-result-word {
    text-align: center;
    margin-bottom: 2rem;
}

.result-label {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.result-word {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.round-winner-section {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.round-winner-section .result-label {
    margin-top: 1rem;
}

.round-winner-section .result-label:first-child {
    margin-top: 0;
}

.result-winner {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--neon-yellow);
    margin-bottom: 1rem;
}

.result-points {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--success);
    text-shadow: 0 0 20px rgba(48, 209, 88, 0.5);
}

.round-no-winner-section {
    text-align: center;
    padding: 2rem;
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.round-no-winner-section .result-label {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.modal-continue-btn {
    width: 100%;
    background: var(--neon-yellow);
    border: 2px solid var(--neon-yellow);
    border-radius: 12px;
    padding: 1.2rem 2rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.modal-continue-btn:hover {
    background: var(--neon-yellow-dim);
    box-shadow: none;
    transform: translateY(-2px);
}
