:root { --primary: #d90429; --bg-color: #2b2d42; }
body { margin: 0; padding: 0; background: #1a1a2e; color: white; font-family: sans-serif; overflow: hidden; display: flex; flex-direction: column; height: 100vh; }
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #333; padding: 10px 20px; border-radius: 20px; display: none; z-index: 200; font-size: 14px; }
#toast.show { display: block; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; justify-content: center; align-items: center; }
.modal.active { display: flex; }
.modal-content { background: #2b2d42; padding: 20px; border-radius: 15px; width: 90%; max-width: 350px; text-align: center; position: relative; }
.btn { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-weight: bold; width: 100%; margin-top: 5px; transition: 0.2s; }
.btn:active { transform: scale(0.95); }
.btn-lang { background: #444; border: 1px solid #555; color: white; }
.btn-close { background: #555; }

/* Верхняя панель */
.top-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    background: rgba(0,0,0,0.5);
    font-size: 14px;
    font-weight: bold;
    position: relative;
    height: 7vh;
    box-sizing: border-box;
    z-index: 50;
}

/* Поляна (высота 45vh, чтобы поместились кнопки и чат) */
.table-area {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 45vh;
    padding: 0px 10px;
    box-sizing: border-box;
    background:
        radial-gradient(circle, #ffee58 20%, transparent 60%) 10% 5% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 30% 5% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 50% 5% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 70% 5% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 90% 5% / 20px 20px no-repeat,
        linear-gradient(#5d4037, #3e2723) 10% 12% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 30% 12% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 50% 12% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 70% 12% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 90% 12% / 35px 12px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 10% 95% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 30% 95% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 50% 95% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 70% 95% / 20px 20px no-repeat,
        radial-gradient(circle, #ffee58 20%, transparent 60%) 90% 95% / 20px 20px no-repeat,
        linear-gradient(#5d4037, #3e2723) 10% 88% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 30% 88% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 50% 88% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 70% 88% / 35px 12px no-repeat,
        linear-gradient(#5d4037, #3e2723) 90% 88% / 35px 12px no-repeat,
        radial-gradient(circle at 45% 45%, rgba(255,255,255,0.7) 0%, transparent 20%) center/110px 110px no-repeat,
        radial-gradient(circle, #29b6f6 0%, #0277bd 55%, transparent 56%) center/110px 110px no-repeat,
        radial-gradient(circle, #cfd8dc 0%, #90a4ae 65%, transparent 66%) center/130px 130px no-repeat,
        radial-gradient(circle, #78909c 0%, #455a64 70%, transparent 71%) center/150px 150px no-repeat,
        radial-gradient(circle at center, #689f38 20%, #33691e 90%, #1b5e20 100%);
    border: 4px solid #1b5e20;
    border-radius: 16px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.player-row { display: flex; justify-content: center; gap: 12px; min-height: 80px; }
.player-slot { display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: transform 0.2s; }
.player-slot:hover { transform: scale(1.05); }
.player-name { font-size: 9px; font-weight: bold; color: #ffffff; text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8); margin-bottom: 0px; }
.player-avatar { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.2); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); }

/* Чат (занимает оставшееся пространство) */
#chat-area { flex-grow: 1; background: #ffffff; display: flex; flex-direction: column; padding: 0px 10px 10px 10px; border-top: none; box-sizing: border-box; }
#chat-messages { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; margin-bottom: 0px; }
.msg-bubble { padding: 8px 12px; border-radius: 15px; max-width: 80%; word-wrap: break-word; font-size: 13px; background: #f1f1f1; color: #000000; }
#chat-input-area { display: flex; gap: 10px; align-items: center; order: -1; margin-top: 5px; margin-bottom: 10px; }
#chat-input { flex-grow: 1; padding: 12px 15px; border-radius: 20px; border: 1px solid #ddd; outline: none; background: #fafafa; color: #000000; }
#chat-input-area button { background: var(--primary); color: white; border: none; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; justify-content: center; align-items: center; }

.gift-item { background: #1a1a2e; border: 2px solid #444; border-radius: 15px; padding: 10px; text-align: center; cursor: pointer; transition: 0.2s; }
.gift-item:active { transform: scale(0.9); border-color: var(--primary); }

#spectator-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 5;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
}
#spectator-overlay.active { display: flex; }
#spectator-quote {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    padding: 20px;
    text-shadow: 0 0 30px rgba(255,50,50,0.9);
    animation: pulseQuote 2s infinite;
}
@keyframes pulseQuote {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

#pair-question-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background: rgba(0,0,0,0.7);
}
#pair-question-overlay.active { display: flex; }
.question-card {
    background: #2b2d42;
    padding: 20px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    color: #fff;
}
.question-card h3 { margin-top: 0; }
.question-card .options { display: flex; justify-content: center; gap: 20px; margin: 20px 0; }
.question-card .option { flex: 1; padding: 15px; border: 2px solid #555; border-radius: 15px; cursor: pointer; transition: 0.2s; user-select: none; }
.question-card .option:hover { border-color: var(--primary); transform: scale(1.05); }
.question-card .option img { font-size: 40px; display: block; margin: 0 auto 10px; }
.question-card .option .label { font-size: 14px; font-weight: bold; }
.question-card .timer { font-size: 20px; font-weight: bold; color: #ff5555; margin-bottom: 10px; }

#gift-panel {
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 45vh;
    background: rgba(255,255,255,0.95); 
    backdrop-filter: blur(10px); 
    padding: 15px; 
    box-sizing: border-box;
    border-top: 2px solid #d90429; 
    border-radius: 20px 20px 0 0; 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); 
    grid-auto-rows: max-content;
    gap: 10px; 
    overflow-y: auto; 
    transform: translateY(100%); 
    opacity: 0; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease; 
    pointer-events: none; 
    z-index: 1000;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.15);
}
#gift-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
#gift-tooltip { position: fixed; background: #d90429; color: white; padding: 5px 10px; border-radius: 8px; font-weight: bold; font-size: 12px; pointer-events: none; opacity: 0; transition: opacity 0.2s; z-index: 1001; transform: translate(-50%, -120%); white-space: nowrap; }