body { font-family: sans-serif; text-align: center; background-color: #2c3e50; margin: 0; color: #ecf0f1; padding: 20px 0; overflow-x: hidden; }
#app { max-width: 800px; margin: 20px auto; padding: 20px; position: relative; z-index: 1; }
#lobby, #waitingRoom, #bracketArea, #gameArea { background: #ecf0f1; padding: 30px; border-radius: 10px; color: #333; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.settings-box { background: white; border: 1px solid #ddd; border-radius: 8px; padding: 15px; margin-bottom: 20px; text-align: left; }
.settings-box label { display: block; font-weight: bold; margin: 10px 0 5px; color: #333; }
.settings-box select, .settings-box input { width: 100%; padding: 10px; font-size: 16px; border-radius: 5px; border: 1px solid #ccc; box-sizing: border-box; }
button { padding: 12px 25px; font-size: 16px; cursor: pointer; background: #e74c3c; color: white; border: none; border-radius: 5px; font-weight: bold; transition: 0.2s; }
button:hover { background: #c0392b; transform: scale(1.05); }

.pulse-btn { background: #f1c40f !important; color: #d35400 !important; width: 100%; margin-bottom: 25px; font-size: 20px; animation: pulsing 1.5s infinite; border: 2px solid #e67e22 !important; }
@keyframes pulsing { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7); } 70% { transform: scale(1.03); box-shadow: 0 0 0 15px rgba(243, 156, 18, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(243, 156, 18, 0); } }

/* CHỐNG TÀNG HÌNH: Ép bóng ma hiển thị nổi bần bật */
[class^="drag-piece"] { z-index: 2147483647 !important; display: block !important; opacity: 1 !important; visibility: visible !important; pointer-events: none !important; }

#roomCode { padding: 12px; font-size: 16px; width: 150px; text-align: center; margin-right: 10px; }
#lobbyMsg { color: #e74c3c; font-weight: bold; margin-top: 15px; }
#playerList { list-style: none; padding: 0; font-size: 18px; font-weight: bold; color: #2980b9; }
#playerList li { padding: 5px 0; border-bottom: 1px dashed #ccc; }

#bracketContent { display: flex; gap: 20px; justify-content: center; overflow-x: auto; padding: 20px 0; align-items: stretch; }
.bracket-round { display: flex; flex-direction: column; gap: 20px; justify-content: space-around; }
.bracket-round h3 { margin: 0 0 10px 0; color: #8e44ad; }
.match-box, .match-bye { border: 2px solid #bdc3c7; padding: 10px; border-radius: 8px; background: white; width: 160px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); position: relative;}
.match-bye { border-style: dashed; opacity: 0.8; background: #f9f9f9; }
.match-player { font-weight: bold; padding: 5px; border-bottom: 1px solid #ecf0f1; }
.match-player:last-child { border-bottom: none; }
.match-vs { font-size: 12px; color: #7f8c8d; margin: 2px 0; }
.winner-text { display: block; font-size: 12px; color: #27ae60; font-weight: bold; margin-top: 5px; text-transform: uppercase; }

.watch-btn { background: #3498db; padding: 5px 10px; font-size: 12px; margin-top: 8px; width: 100%; border-radius: 4px; }
.watch-btn:hover { background: #2980b9; }

#tugOfWar { position: relative; display: flex; align-items: center; justify-content: space-between; margin: 30px 0; padding: 20px; background: white; border-radius: 15px; box-shadow: 0 6px 12px rgba(0,0,0,0.15); }
.rope { position: relative; width: 400px; height: 18px; background: #8B4513; border-radius: 9px; box-shadow: inset 0 3px 5px rgba(0,0,0,0.4); }
.center-mark { position: absolute; left: 50%; top: -10px; width: 4px; height: 38px; background: #222; }
.player { font-size: 20px; font-weight: 900; color: #c0392b; width: 100px;}
#status { font-size: 18px; font-weight: bold; margin-top: 15px; color: #2980b9; }
#marker { position: absolute; left: 50%; top: -35px; transform: translateX(-50%); transition: left 0.3s ease-out; z-index: 10; display: flex; align-items: flex-start; justify-content: center; }
.king-piece { width: 55px; height: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); animation: struggle 0.15s infinite alternate; }
.sweat-drop { font-size: 22px; animation: sweat-drip 0.8s infinite; }
.sweat-drop.left { transform: rotate(15deg); margin-right: -15px; margin-top: -5px; }
.sweat-drop.right { transform: scaleX(-1) rotate(15deg); margin-left: -15px; margin-top: 10px; animation-delay: 0.4s; }

@keyframes struggle { 0% { transform: translateX(-2px) rotate(-8deg); } 100% { transform: translateX(2px) rotate(8deg); } }
@keyframes sweat-drip { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(20px) scale(0.5); } }

#emojiPanel { margin-top: 20px; display: flex; justify-content: center; gap: 15px; }
.emoji-btn { background: #fff; border: 2px solid #bdc3c7; font-size: 28px; padding: 5px 20px; border-radius: 25px; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.1); color: initial; }
.emoji-btn:hover { background: #f1f2f6; transform: scale(1.15) translateY(-5px); border-color: #e74c3c; }
.floating-emoji { position: absolute; font-size: 50px; pointer-events: none; z-index: 100; animation: floatUp 1.5s ease-out forwards; text-shadow: 0 4px 8px rgba(0,0,0,0.3); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(0) scale(0.5); } 20% { opacity: 1; transform: translateY(-20px) scale(1.2); } 80% { opacity: 1; transform: translateY(-60px) scale(1); } 100% { opacity: 0; transform: translateY(-80px) scale(0.8); } }

#victoryModal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); z-index: 9999; flex-direction: column; justify-content: center; align-items: center; }
#victoryText { font-size: 4rem; color: #f1c40f; text-shadow: 0 0 20px #e67e22, 0 0 40px #e67e22; margin-bottom: 40px; text-transform: uppercase; text-align: center; }

.ad-banner { max-width: 800px; margin: 10px auto; padding: 25px; background-color: #34495e; color: #95a5a6; border: 2px dashed #7f8c8d; border-radius: 10px; text-transform: uppercase; font-weight: bold; letter-spacing: 1px; }
.ad-banner-side { position: fixed; top: 50%; transform: translateY(-50%); width: 160px; height: 600px; background-color: #34495e; color: #95a5a6; border: 2px dashed #7f8c8d; border-radius: 10px; display: flex; align-items: center; justify-content: center; text-transform: uppercase; font-weight: bold; z-index: 0; }
#ad-left { left: 20px; }
#ad-right { right: 20px; }
@media (max-width: 1200px) { .ad-banner-side { display: none; } }
footer { margin-top: 50px; padding: 20px; color: #bdc3c7; font-size: 16px; border-top: 1px solid #34495e; max-width: 800px; margin-left: auto; margin-right: auto; }
footer strong { color: #f1c40f; font-size: 18px; text-transform: uppercase; letter-spacing: 1.5px; }

#board { touch-action: none; }
.highlight-square { box-shadow: inset 0 0 0 4px rgba(231, 76, 60, 0.8) !important; background-color: rgba(231, 76, 60, 0.3) !important; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); z-index: 9999; display: flex; justify-content: center; align-items: center; }
.modal-content { background: white; padding: 25px; border-radius: 15px; width: 90%; max-width: 500px; color: #333; }
.modal-content h2 { color: #e67e22; margin-top: 0; }
.lb-tabs { display: flex; justify-content: space-around; margin-bottom: 15px; }
.lb-tab { background: #ecf0f1; color: #333; padding: 10px; width: 30%; border-radius: 5px; cursor: pointer; font-weight: bold; border: none; }
.lb-tab.active { background: #f39c12; color: white; }
.lb-body { max-height: 300px; overflow-y: auto; margin-bottom: 15px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid #ddd; text-align: left; }
th { background: #34495e; color: white; position: sticky; top: 0; }
td:first-child { font-weight: bold; color: #e74c3c; text-align: center; }
#closeLbBtn { background: #95a5a6; width: 100%; }
#closeLbBtn:hover { background: #7f8c8d; }
