:root {
    --color-bg: #1a1a2e;
    --color-panel: #16213e;
    --color-accent: #e94560;
    --color-text: #ffffff;
    --color-secondary: #0f3460;
    --font-main: 'Nunito', sans-serif;
    --font-display: 'Luckiest Guy', cursive;
}

@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;}

* { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }
body { margin: 0; padding: 0; background: var(--color-bg); color: var(--color-text); font-family: var(--font-main); width: 100vw; height: 100dvh; overflow: hidden; overscroll-behavior: none;}

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }
.text-center { text-align: center; }
.font-display { font-family: var(--font-display); letter-spacing: 1px; }

.btn { background: var(--color-accent); border: none; padding: 15px 30px; color: white; font-family: var(--font-display); font-size: 1.5rem; border-radius: 50px; cursor: pointer; box-shadow: 0 4px 0 #902e3e; transition: transform 0.1s; flex-shrink:0; touch-action: manipulation;}
.btn:active { transform: translateY(4px); box-shadow: none; }
.btn:disabled { background: #555; box-shadow: none; cursor: not-allowed; }

.w-100 { width: 100%; } .h-100 { height: 100%; }
.hidden { display: none !important; }

/* HOST LAYOUT */
body.host-mode { display: grid; grid-template-columns: 25% 75%; grid-template-rows: 100%; height: 100dvh; }

.host-sidebar { background: var(--color-panel); border-right: 4px solid var(--color-secondary); padding: 20px; display: flex; flex-direction: column; align-items: center; z-index: 10; }
.host-main { background: var(--color-bg); padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; }

.player-list { flex: 1; overflow-y: auto; margin-top: 20px; width: 100%; }
.player-card { background: rgba(255,255,255,0.05); padding: 15px; margin-bottom: 10px; border-radius: 8px; display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: bold; border: 2px solid transparent; word-break: break-word;}
.player-card.done { border-color: #4caf50; color: #4caf50; }

.timer-box { position: absolute; top: 20px; right: 30px; font-size: 5rem; font-family: var(--font-display); color: var(--color-accent); text-shadow: 0 0 20px rgba(233, 69, 96, 0.5); }

/* REVEAL CHAIN - HORIZONTAL SCROLL */
.chain-container { display: flex; flex-direction: row; gap: 20px; overflow-x: auto; width: 100%; height: 70%; align-items: center; padding: 20px 50px; justify-content: flex-start; scroll-behavior: smooth; }
.chain-container::-webkit-scrollbar { height: 15px; } .chain-container::-webkit-scrollbar-track { background: #111; border-radius: 10px; } .chain-container::-webkit-scrollbar-thumb { background: var(--color-accent); border-radius: 10px; }

.chain-card { background: white; color: black; border-radius: 15px; padding: 20px; min-width: 400px; max-width: 400px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; box-shadow: 0 10px 30px rgba(0,0,0,0.8); flex-shrink: 0; min-height: 400px; }
.chain-img { width: 100%; border: 4px solid var(--color-secondary); border-radius: 10px; }
.chain-text { font-size: 2.5rem; text-align: center; margin: auto 0; font-family: var(--font-display); line-height: 1.2; color: var(--color-accent); word-break: break-word;}
.chain-author { font-size: 1.2rem; color: #666; margin-top: 15px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; width: 100%; text-align: right; }

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

/* MODALS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-content { background: var(--color-panel); border: 4px solid var(--color-accent); padding: 30px; border-radius: 20px; width: 80%; max-height: 80%; overflow-y: auto; text-align: center; }
.rule-item { margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }

input[type="text"], input[type="password"] { padding: 15px; font-size: 1.2rem; border-radius: 10px; border: 2px solid #444; background: #222; color: white; width: 100%; text-align: center; margin-bottom: 20px; font-weight: bold; }
input[type="text"]:focus { outline: none; border-color: var(--color-accent); }

/* PLAYER LAYOUT */
body.player-mode { display: flex; flex-direction: column; height: 100dvh; }
.mobile-header { flex: 0 0 60px; background: var(--color-panel); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 1.5rem; color: var(--color-accent); border-bottom: 2px solid var(--color-secondary); }
.mobile-body { flex: 1; padding: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow-y: auto; width: 100%; min-height: 0;}

/* CANVAS */
#draw-canvas { background: white; border-radius: 10px; touch-action: none; cursor: crosshair; box-shadow: 0 0 20px rgba(0,0,0,0.5); flex-shrink: 0; width: 100%; max-width: 400px; max-height: 400px; aspect-ratio: 1;}
.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 15px; width: 100%; max-width: 300px; flex-shrink: 0;}
.color-btn { width: 40px; height: 40px; border-radius: 50%; border: 3px solid white; cursor: pointer; box-shadow: 0 4px 0 #333; transition: transform 0.1s; }
.color-black { background: black; } .color-yellow { background: #ffd700; } .color-brown { background: #8b4513; } .color-eraser { background: white; font-size: 1.2rem; }

.fs-btn { position: fixed; bottom: 10px; right: 10px; background: rgba(0,0,0,0.5); color: white; border: 1px solid white; padding: 5px 10px; font-size: 0.8rem; cursor: pointer; z-index: 999; }
.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(--color-accent); }
