@font-face { font-family: 'Luckiest Guy'; src: url('assets/luckiest-guy-v25-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('assets/nunito-v32-latin-regular.woff2') format('woff2'); font-display: swap; }

:root {
    --bg: #1a0505; --card: #2d1010; --text: #fff;
    --gold: #ffd700; --red: #ff4444; --green: #00ff66; --blue: #4488ff;
    --font-header: 'Luckiest Guy', cursive; --font-body: 'Nunito', sans-serif;
}

/* 1. ABSOLUTE VIEWPORT CONTAINMENT */
html, body { margin: 0; padding: 0; width: 100vw; height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font-body); overflow: hidden; text-align: center; overscroll-behavior: none; }
audio { display: none; }
h1, h2, h3, .btn-action, .btn-host, .status-label, .round-label { font-family: var(--font-header); letter-spacing: 1px; }

.text-gold { color: var(--gold); } .text-red { color: var(--red); } .w-full { width: 100%; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-col-center { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height:100%; min-width:0; min-height:0; }
.mb-20 { margin-bottom: 20px; } .bg-red { background: linear-gradient(45deg, #880000, #ff0000) !important; }
.hidden { display: none !important; } .hidden-ui { display: none; }

.container { height: 100dvh; width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2dvh 4vw; padding-bottom: max(2dvh, env(safe-area-inset-bottom, 2dvh)); box-sizing: border-box; min-width:0; min-height:0; }

.btn-action, .btn-host { padding: clamp(10px, 2vh, 16px) 20px; font-size: clamp(0.9rem, 2.5vh, 1.1rem); font-family: var(--font-header); letter-spacing: 1px; background: linear-gradient(45deg, #880000, #ff4444); color: white; border: none; border-radius: 50px; cursor: pointer; box-shadow: 0 4px 15px rgba(255,68,68,0.4); margin-top: 10px; transition: transform 0.1s, opacity 0.2s; white-space: normal; word-break: break-word; width: 100%; box-sizing: border-box; display: block; text-align: center; touch-action: manipulation; flex-shrink:0; }
.btn-action:active, .btn-host:active { transform: scale(0.95); }

/* PHONE GRID & BUTTONS */
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.5vh, 15px); width: 100%; flex: 1 1 auto; min-height:0; margin-bottom:1.5vh; }
.p-btn { font-family: var(--font-body); font-size: clamp(1rem, 2.5vh, 1.4rem); font-weight: 800; background: linear-gradient(135deg, #1a0505, #2d1010); color: #fff; border: 2px solid rgba(255,68,68,0.4); border-radius: 14px; padding: clamp(10px, 2vh, 15px); height: 100%; cursor: pointer; display:flex; flex-direction:column; align-items:center; justify-content:center; touch-action: manipulation; transition: 0.2s; word-break: break-word; }
.p-btn.dimmed { opacity: 0.2; pointer-events: none; }
.p-btn.locked-in { background: linear-gradient(135deg, #2d1010, #4a0a0a) !important; border-color: var(--green) !important; opacity: 1 !important; transform: scale(0.98); }

.input-box { font-size: clamp(1.2rem, 3vh, 1.8rem); font-weight: 700; letter-spacing: 2px; padding: clamp(10px, 2vh, 15px); border-radius: 12px; border: 3px solid transparent; text-align: center; width: 85%; max-width: 400px; margin-bottom: 2vh; background: #333; color: white; font-family: var(--font-body); transition: border 0.3s; text-transform: uppercase; flex-shrink: 0; word-break: break-word; }
.input-box:focus { outline: none; border-color: var(--red); }
.emoji-btn { cursor: pointer; opacity: 0.4; transition: transform 0.2s; padding-bottom: 5px; user-select: none; }
.emoji-btn.selected { opacity: 1; transform: scale(1.3); border-bottom: 3px solid var(--gold); }

/* IRONCLAD HOST LAYOUT */
.host-grid-container { display: flex; width: 100vw; height: 100dvh; overflow: hidden; flex-direction: row; }
#panel-left { flex: 0 0 clamp(180px, 20vw, 250px); height: 100dvh; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; background: rgba(0,0,0,0.6); border-right: 2px solid #3a1010; z-index: 20; padding: 2vh 1vw; box-sizing: border-box; justify-content: center; align-items: center; }
#panel-right { flex: 1; min-width: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; z-index: 10; }

#box-status { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; min-height: 0; width: 100%; gap: 2vh; }
#box-header { height: clamp(60px, 12vh, 100px); display: flex; align-items: center; justify-content: center; border-bottom: 2px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.4); overflow: hidden; flex-shrink: 0; padding: 0 15px; }
#box-stage { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 2vh 2vw; min-width:0; min-height:0; }

#game-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height:0; }

.squircle-timer { font-size: clamp(2rem, 5vh, 4rem); color: var(--red); border: clamp(2px, 0.5vh, 4px) solid var(--red); border-radius: 20%; width: clamp(60px, 15vh, 100px); height: clamp(60px, 15vh, 100px); display: flex; align-items: center; justify-content: center; background: #000; font-family: var(--font-header); flex-shrink: 0; }
.status-label { font-size: clamp(1rem, 2.5vh, 1.5rem); color: #aaa; flex-shrink:0;}
.player-count { font-size: clamp(0.9rem, 2vh, 1.2rem); color: var(--green); font-weight: bold; flex-shrink:0; margin: 1vh 0;}

/* SHARED QUESTION TEXT (TV AND PHONE) */
.host-q-text, .question-text { font-size: clamp(1.2rem, 4vh, 2.5rem); font-family: var(--font-body); font-weight: 900; color: var(--gold); margin-bottom: 2vh; text-align: center; width: 100%; text-shadow: 2px 2px 5px black; flex-shrink: 0; word-break: break-word; }
.host-q-text.long-text, .question-text.long-text { font-size: clamp(1rem, 3vh, 2rem); margin-bottom: 1vh; }

/* 2x2 GRID FOR TV OPTIONS */
.host-options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.5vh, 15px); width: 100%; max-width: 1000px; justify-content: center; flex: 1 1 auto; min-height: 0; margin-bottom: 2vh; }
.host-opt-box { background: rgba(255,68,68,0.1); border: clamp(2px, 0.5vh, 4px) solid var(--red); border-radius: 12px; padding: clamp(10px, 2vh, 15px); font-size: clamp(1rem, 3.5vmin, 1.8rem); font-weight: bold; color:white; transition: background 0.3s; display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; word-break: break-word; }
.host-opt-box.correct-answer { background: var(--green); color: black; border-color: white; transform: scale(1.05); box-shadow: 0 0 20px rgba(0,255,100,0.5); }

/* TOP 3 PODIUM LEADERBOARD */
.top3-container { display: flex; gap: 20px; align-items: center; justify-content: center; width: 100%; flex-wrap:wrap; }
.top3-pill { background: rgba(0,0,0,0.6); padding: 8px 20px; border-radius: 50px; border: 2px solid var(--gold); font-weight: bold; font-size: clamp(1rem, 2.5vh, 1.4rem); display: flex; gap: 10px; align-items: center; color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.top3-rank { color: var(--gold); font-family: var(--font-header); font-size: clamp(1.2rem, 3vh, 1.8rem); }
.top3-score { color: var(--green); font-family: var(--font-header); margin-left: 10px; }
.lb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 10ch; flex-shrink: 1; }

.lobby-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 15vw, 150px), 1fr)); gap: clamp(5px, 1.5vh, 15px); width: 100%; overflow-y: auto; height: 100%; padding-right: 10px; align-content: start;}
.lobby-card { background: #2d1010; padding: clamp(8px, 1.5vh, 15px); border-radius: 8px; font-weight: bold; font-size: clamp(0.9rem, 2.5vh, 1.3rem); display: flex; justify-content: center; align-items: center; border: 1px solid #5a2020; word-break: break-word; text-align: center; }
.lobby-card.eliminated { opacity: 0.3; text-decoration: line-through; }

#btn-fullscreen { position: fixed; top: 12px; left: 12px; z-index: 99999; background: rgba(0,0,0,0.5); border: 1px solid #555; color: #aaa; width: 40px; height: 40px; border-radius: 8px; font-size: 1.4rem; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: background 0.2s, color 0.2s; }

/* THE PREMIUM THANOS SNAP CSS */
#purge-overlay { background: linear-gradient(to bottom, #110000, #000000); overflow: hidden; position: fixed; inset: 0; z-index: 1000; display:flex; flex-direction: column; align-items:center; }
.purge-title { color: var(--red); font-size: clamp(3rem, 10vmin, 6rem); animation: strobe 0.5s infinite alternate; margin-top: 10vh; margin-bottom: 2vh; }
.victims-container { position: absolute; bottom: 20%; display: flex; gap: 40px; align-items: flex-end; justify-content: center; width: 100%; z-index: 5; flex-wrap: wrap; padding: 0 5vw;}

.victim-snap { font-family: var(--font-header); font-size: clamp(1.2rem, 4vmin, 2rem); color: #fff; text-align:center; animation: snapDust 2.5s ease-in forwards; word-break: break-word; }
.victim-snap span { font-size: clamp(3rem, 8vmin, 5rem); display: block; margin-bottom: 10px; }

@keyframes snapDust {
    0% { filter: blur(0px) grayscale(0%); transform: translateY(0) scale(1); opacity: 1; }
    40% { filter: blur(4px) grayscale(50%); transform: translateY(-10px) scale(1.05); opacity: 0.8; }
    100% { filter: blur(15px) grayscale(100%); transform: translateY(-100px) scale(1.2); opacity: 0; }
}
@keyframes strobe { 0% { text-shadow: 0 0 10px red; transform: scale(1); } 100% { text-shadow: 0 0 40px red; transform: scale(1.1); } }

.winner-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding:20px; }
.winner-title { font-size: clamp(3rem, 10vmin, 8rem); color: var(--gold); margin: 0; font-family: var(--font-header); text-align:center;}
.winner-name { font-size: clamp(2rem, 8vmin, 6rem); color: white; margin-top: 20px; font-family: var(--font-header); word-break: break-word; text-align:center;}
.restart-warning-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.88); z-index: 8000; display: flex; align-items: center; justify-content: center; }
.warning-box { background: #2d1010; padding: 30px; border-radius: 15px; border: 3px solid var(--red); text-align: center; box-shadow: 0 0 50px rgba(255,0,0,0.5); width: clamp(280px, 80vw, 500px); }

.spectator-mode .p-grid button { pointer-events: none; opacity: 0.3; border-color: #555; }

.floating-score { position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%); font-family: var(--font-header); font-weight: 800; font-size: clamp(3rem, 10vh, 6rem); color: var(--green); text-shadow: 0 5px 15px rgba(0,0,0,0.8); pointer-events: none; z-index: 9999; animation: floatUpText 2s forwards; }
@keyframes floatUpText { 0% { opacity: 0; transform: translate(-50%, -20%) scale(0.5); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); } 80% { opacity: 1; transform: translate(-50%, -70%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -100%) scale(1); } }

.orientation-warning { position: fixed; inset: 0; background: var(--bg); z-index: 99999; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.orientation-warning h1 { font-size: 5rem; margin: 0 0 20px 0; } .orientation-warning h2 { font-size: 2rem; color: var(--red); }
@media (orientation: portrait) { body.host-client #landscape-warning { display: flex !important; } body.host-client .host-ui-wrap, body.host-client .host-grid-container { display: none !important; } }
