@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: #0f0518; --card: #1f1130; --text: #fff; --gold: #ffd700;
    --accent: #b026ff; --green: #00ff66; --danger: #ff4444; --blue: #00d2ff;
    --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; position:relative; 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; }

.question-text { font-family: 'Nunito', Arial, sans-serif !important; font-weight: 800 !important; letter-spacing: 1px !important; font-size: clamp(1.5rem, 4vh, 3rem); color: var(--gold); line-height: 1.2; text-align: center; word-break: break-word; }

.text-gold { color: var(--gold); } .text-accent { color: var(--accent); } .text-muted { color: #aaa; }
.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; min-width: 0; min-height: 0;}
.mb-20 { margin-bottom: 20px; } .bg-red { background: linear-gradient(45deg, #880000, #ff0000) !important; }

/* CORE CONTAINER */
.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, 15px) 30px; font-size: clamp(1rem, 2.5vh, 1.2rem); background: var(--accent); color: white; border: none; border-radius: 50px; cursor: pointer; box-shadow: 0 4px 15px rgba(176, 38, 255, 0.4); margin-top: 10px; transition: transform 0.1s; font-family: var(--font-header); letter-spacing: 1px; touch-action: manipulation; flex-shrink: 0; word-break: break-word; }
.btn-action:active, .btn-host:active { transform: scale(0.95); }
.btn-action:disabled, .btn-host:disabled { opacity: 0.3; cursor: not-allowed; }

.input-box { font-size: clamp(1.2rem, 3vh, 1.3rem); font-weight: bold; padding: clamp(10px, 2vh, 15px); border-radius: 10px; border: 2px solid #444; background: #222; color: white; width: 90%; max-width: 400px; margin-bottom: 1.5vh; font-family: var(--font-body); transition: border 0.3s; flex-shrink: 0; word-break: break-word; }
.input-box:focus { outline: none; border-color: var(--accent); }

.emoji-btn { cursor: pointer; opacity: 0.4; transition: transform 0.2s, opacity 0.2s, border 0.2s; padding-bottom: 5px; user-select: none; }
.emoji-btn.selected { opacity: 1; transform: scale(1.3); border-bottom: 3px solid var(--gold); }

/* IRONCLAD SPLIT LAYOUT FIX FOR TV */
.host-grid-container { display: flex; width: 100vw; height: 100dvh; overflow: hidden; flex-direction: row; }
#panel-left { flex: 0 0 clamp(180px, 20vw, 240px); height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: rgba(0,0,0,0.6); border-right: 2px solid #333; z-index: 20; padding: 2vh 1vw; box-sizing: border-box; gap: 2vh;}
#panel-right { flex: 1; min-width: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; z-index: 10; }

#box-status { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; padding: 2vh 1vw; background: #222; border-radius: 15px; border: 2px solid #333; }
.host-lb-container { flex: 1; overflow: hidden; display: flex; flex-direction: column; background: #222; border-radius: 15px; border: 2px solid #333; padding: 15px; min-height: 0; }
.host-lb-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding-right: 5px; color: white; }

#box-header { flex: 0 0 auto; 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; padding: 0 15px; }
#box-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 2vh 2vw; min-height: 0;}

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

.lb-header { color: var(--gold); font-size: clamp(1rem, 2.5vh, 1.2rem); margin-bottom: 1vh; border-bottom: 1px solid #444; padding-bottom: 5px; font-family: var(--font-header); text-align: center; flex-shrink: 0;}
.lb-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #333; font-size: clamp(0.9rem, 2vh, 1rem); font-weight: bold; flex-shrink:0; }
.lb-score { color: var(--gold); font-weight: bold; }

/* THE REVEAL PODIUM CARDS */
.reveal-card { background: var(--card); padding: clamp(15px, 4vh, 30px); border-radius: 20px; border: 4px solid var(--accent); text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; width: 80%; max-width: 800px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.reveal-rank { font-size: clamp(2rem, 5vh, 2.5rem); color: var(--gold); margin-bottom: 2vh; font-family: var(--font-header); }
.reveal-text { font-size: clamp(1.5rem, 5vmin, 4rem); margin-bottom: 2vh; word-break: break-word; font-family: var(--font-body); font-weight: 900; color: white; }
.reveal-author { font-size: clamp(1.2rem, 4vmin, 2rem); color: var(--accent); font-style: italic; font-weight: bold; margin-bottom: 1.5vh;}
.reveal-likes { font-size: clamp(1rem, 3vmin, 1.5rem); color: var(--red); font-weight: bold; }

.slam-anim { animation: slam 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes slam { 0% { transform: scale(2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.lobby-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 20vw, 200px), 1fr)); gap: 10px; width: 100%; overflow-y: auto; height: 100%; padding-bottom: 20px; align-content: start; }
.lobby-card { background: #333; padding: clamp(8px, 1.5vh, 10px); border-radius: 8px; font-weight: bold; display: flex; justify-content: center; align-items: center; font-size: clamp(0.9rem, 2.5vh, 1rem); word-break: break-word; text-align: center;}

#btn-fullscreen { position: absolute; top: 10px; left: 10px; background: none; border: 1px solid #555; color: #aaa; width: 40px; height: 40px; border-radius: 8px; font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 9999;}

/* PLAYER VOTING & HYBRID UI */
.hand-card-btn { font-family: var(--font-body); font-size: clamp(1rem, 2.5vh, 1.1rem); font-weight: 700; background: #222; color: #fff; border: 2px solid #555; border-radius: 10px; padding: clamp(10px, 2vh, 15px); cursor: pointer; text-align: left; line-height: 1.3; transition: 0.1s; touch-action: manipulation; word-break: break-word; flex-shrink: 0;}
.hand-card-btn:active { background: #444; border-color: var(--accent); transform: scale(0.98); }

.custom-input { width: 100% !important; max-width: none !important; font-size: clamp(0.9rem, 2vh, 1rem) !important; padding: clamp(10px, 2vh, 12px) !important; text-transform: none !important; margin-bottom: 10px !important;}

.voting-list { width: 100%; flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; min-height:0; }
.vote-card { background: #222; padding: clamp(10px, 2vh, 15px); border-radius: 10px; border: 2px solid #444; font-size: clamp(1rem, 2.5vh, 1.1rem); font-weight: bold; cursor: pointer; transition: 0.1s; font-family: var(--font-body); text-align: left; position: relative; word-break: break-word; flex-shrink:0;}
.vote-card.liked { border-color: var(--red); background: #3a1010; }
.vote-card.liked::after { content: '❤️'; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; }

/* STICKER BAR */
.sticker-bar { display: flex; justify-content: space-around; padding: 10px; background: #222; border-radius: 15px; margin-top: auto; width: 100%; max-width: 400px; flex-shrink: 0; }
.sticker-btn { font-size: clamp(1.5rem, 4vh, 2rem); background: none; border: none; cursor: pointer; transition: transform 0.1s; padding: 5px; }
.sticker-btn:active { transform: scale(1.2); }

.sticker { position: absolute; font-size: clamp(2.5rem, 8vh, 4rem); pointer-events: none; animation: floatUp 2s forwards; z-index: 1000; }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0) scale(0.5); } 15% { transform: translateY(-20px) scale(1.2); } 100% { opacity: 0; transform: translateY(-150px) scale(1); } }

.floating-score { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); font-family: var(--font-header); font-size: clamp(3rem, 10vh, 6rem); 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); } }

.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; }
.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: #222; padding: 30px; border-radius: 15px; border: 3px solid var(--danger); text-align: center; box-shadow: 0 0 50px rgba(255,0,0,0.5); width: clamp(280px, 80vw, 500px); }

.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(--gold); font-family: var(--font-header);}
@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; } }
.hidden { display: none !important; } .hidden-ui { display: none; } .show-flex { display: flex !important; }
