/* Momento v2 — mobile-first. Palette vars set per-moment by app.js */
:root {
  --bg: #141126;
  --accent: #6ee7b7;
  --floor: #241f3d;
  --text: #f4f1ff;
  --muted: #9a93b8;
  --card: #ffffff12;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--bg) 80%, var(--accent) 8%) 0%, var(--bg) 60%);
  color: var(--text);
  overflow: hidden;
  transition: background .6s ease;
  /* pin the app so iOS can't pan the page when the keyboard opens */
  position: fixed; inset: 0; width: 100%;
}
.hidden { display: none !important; }
/* --vvh is kept in sync with window.visualViewport by app.js — this is what
   makes the layout shrink to the visible area (above the keyboard) instead
   of being pushed off-screen when an input focuses on mobile */
.view { height: var(--vvh, 100dvh); display: flex; flex-direction: column; }

/* ---------- create / join ---------- */
#view-create, #view-join { align-items: center; justify-content: center; padding: 24px; }
.create-box { width: 100%; max-width: 430px; text-align: center; }
.create-box h1 { font-size: 46px; letter-spacing: -2px; }
.spark { font-size: 30px; vertical-align: super; }
.tagline { color: var(--muted); margin: 10px 0 22px; line-height: 1.5; }
.join-decor { font-size: 34px; letter-spacing: 6px; margin-bottom: 6px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
textarea, #name-input, #prompt-input, #chat-input {
  width: 100%; border: 2px solid #ffffff22; border-radius: 14px;
  background: #ffffff0d; color: var(--text); font-size: 16px; padding: 14px;
  outline: none; resize: none;
}
textarea:focus, input:focus { border-color: var(--accent); }
button {
  border: 0; border-radius: 14px; padding: 14px 22px; margin-top: 14px;
  background: var(--accent); color: #10101a; font-size: 17px; font-weight: 800;
  cursor: pointer; width: 100%;
  transition: transform .08s ease;
}
button:active { transform: scale(.97); }
button.ghost { background: #ffffff18; color: var(--text); }
.status { min-height: 22px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.examples { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  background: var(--card); border: 1px solid #ffffff20; border-radius: 999px;
  padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.chip:active { background: #ffffff25; }
.brand-link { display: block; margin-top: 18px; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }

/* ---------- room chrome ---------- */
#room-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: #00000038;
}
#room-title { flex: 1; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#round-badge { font-size: 12px; font-weight: 700; color: var(--muted); background: #00000040; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
#room-timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 17px;
  background: #00000055; border-radius: 10px; padding: 4px 10px; color: var(--accent);
}
#room-timer.urgent { color: #ff6b6b; animation: pulse .8s infinite; }
@keyframes pulse { 50% { transform: scale(1.12) } }
#share-btn, #skip-btn, #mic-btn { width: auto; margin: 0; padding: 8px 12px; font-size: 13px; background: #ffffff20; color: var(--text); }
#skip-btn:disabled { opacity: .45; }
#mic-btn.on { background: var(--accent); color: #10101a; animation: micpulse 1.6s infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 12px var(--accent); } }
#audio-unlock {
  position: fixed; bottom: 30dvh; left: 50%; transform: translateX(-50%);
  width: auto; padding: 12px 22px; border-radius: 999px; z-index: 80;
  background: var(--accent); color: #10101a; box-shadow: 0 8px 30px #000c;
}

#brand-bar {
  text-align: center; font-size: 12px; padding: 5px 10px; font-weight: 700;
  background: var(--accent); color: #10101a;
}

#word-bar {
  text-align: center; padding: 8px 12px; font-size: 22px; font-weight: 800;
  letter-spacing: 4px; background: #00000030; min-height: 44px;
  font-variant-numeric: tabular-nums;
}
#word-bar .small { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
#rules-card {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 8px 12px; background: #00000024; border-top: 1px solid #ffffff10;
  border-bottom: 1px solid #ffffff10; font-size: 13px; line-height: 1.35;
  color: #ffffffe6; text-align: center;
}
#rules-card b {
  color: var(--accent); white-space: nowrap; font-size: 12px; text-transform: uppercase;
}
#rules-card span { max-width: 760px; }

.stage { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }

/* ---------- lounge ---------- */
#lounge-canvas { width: 100%; height: 100%; display: block; touch-action: manipulation; }
#start-wrap { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; padding: 0 24px; }
#start-btn { max-width: 340px; box-shadow: 0 8px 30px #00000080; }
.hint { color: #ffffffd0; font-size: 13px; margin-top: 8px; text-shadow: 0 1px 6px #000; }

/* ---------- drawing board ---------- */
#draw { padding: 8px; gap: 8px; }
/* board keeps a FIXED square aspect on every device: same proportions for
   drawer and guessers (no distortion), and portrait-friendly on phones */
#board-wrap {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
#board {
  display: block;
  background: #fdfcf7; border-radius: 16px; touch-action: none;
  box-shadow: 0 6px 26px #00000060;
  /* actual pixel size is set by app.js (largest square that fits the wrap) */
}
#board-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: #10101a; text-align: center; padding: 20px;
  background: #fdfcf7cc; border-radius: 16px;
}
#draw-tools { display: flex; flex-direction: column; gap: 6px; }
#colors { display: flex; gap: 6px; justify-content: center; }
.color-btn {
  width: 34px; height: 34px; border-radius: 50%; margin: 0; padding: 0;
  border: 3px solid transparent; flex: none;
}
.color-btn.sel { border-color: var(--accent); transform: scale(1.12); }
.tool-row { display: flex; gap: 6px; justify-content: center; align-items: center; }
.size-btn {
  width: 44px; height: 38px; margin: 0; padding: 0; background: #ffffff18; color: var(--text);
  font-size: 10px; flex: none; border-radius: 10px;
}
.size-btn.big { font-size: 18px; }
.size-btn.sel { background: var(--accent); color: #10101a; }
.tool-btn { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; background: #ffffff18; color: var(--text); flex: none; }

/* ---------- who / impostor ---------- */
#who, #imp { padding: 14px; overflow-y: auto; }
.who-question {
  text-align: center; font-size: 20px; font-weight: 800; line-height: 1.35;
  padding: 10px 6px 16px;
}
.who-players { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.who-pick {
  display: flex; align-items: center; gap: 8px; width: auto; margin: 0;
  background: var(--card); color: var(--text); border: 2px solid #ffffff20;
  padding: 10px 16px; font-size: 15px; border-radius: 999px;
}
.who-pick.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 25%, transparent); }
.who-pick:disabled { opacity: .55; }
.status.center { text-align: center; }
.who-tally { display: flex; flex-direction: column; gap: 8px; max-width: 360px; margin: 10px auto; }
.tally-row {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border-radius: 12px; padding: 10px 14px; font-weight: 700;
}
.tally-row.elected { border: 2px solid var(--accent); font-size: 17px; }
.tally-row .tname { flex: 1; }
.tally-bar { height: 8px; background: var(--accent); border-radius: 4px; }

.imp-banner {
  text-align: center; font-size: 18px; font-weight: 800; padding: 12px;
  border-radius: 14px; background: var(--card); margin-bottom: 12px;
}
.imp-banner.impostor { background: #e6394633; border: 2px dashed #e63946; }
.imp-hints { display: flex; flex-direction: column; gap: 6px; max-width: 400px; margin: 0 auto 10px; }
.hint-row { background: var(--card); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.hint-row b { margin-right: 6px; }
.imp-hint-form { display: flex; gap: 8px; max-width: 400px; margin: 0 auto; }
.imp-hint-form input {
  flex: 1; border: 2px solid #ffffff22; border-radius: 12px;
  background: #ffffff0d; color: var(--text); font-size: 15px; padding: 10px 14px; outline: none;
}
.imp-hint-form button { width: auto; margin: 0; padding: 10px 16px; font-size: 14px; }

/* ---------- buzzer ---------- */
#buzz-btn {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: auto; padding: 14px 30px; font-size: 18px; border-radius: 999px;
  background: #ffd166; color: #10101a; box-shadow: 0 8px 30px #00000090;
  animation: buzzpulse 1s infinite; z-index: 5;
}
@keyframes buzzpulse { 50% { transform: translateX(-50%) scale(1.07); } }
#buzz-banner {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: #000000cc; color: #ffd166; font-weight: 800; font-size: 15px;
  padding: 10px 18px; border-radius: 999px; z-index: 5; white-space: nowrap;
}

/* ---------- skip poll ---------- */
#skip-poll {
  position: fixed; right: 10px; top: 90px; z-index: 50; width: 150px;
  background: #000000d9; border: 1px solid var(--accent); border-radius: 14px;
  padding: 10px; font-size: 13px; text-align: center;
}
#skip-poll-text { font-weight: 800; margin-bottom: 6px; }
.skip-poll-btns { display: flex; gap: 6px; }
.skip-poll-btns button { flex: 1; margin: 0; padding: 8px 4px; font-size: 12px; }
#skip-no { background: #ffffff20; color: var(--text); }
#skip-poll-count { margin-top: 6px; color: var(--muted); }

/* ---------- podium ---------- */
#podium { align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.podium-title { margin-bottom: 14px; }
#podium-list { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; }
.podium-row {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border-radius: 14px; padding: 12px 14px; font-weight: 700;
}
.podium-row.first { border: 2px solid var(--accent); font-size: 18px; box-shadow: 0 0 30px #ffffff18; }
.podium-row .pos { width: 30px; text-align: center; }
.podium-row .pname { flex: 1; }
.podium-actions { width: 100%; max-width: 360px; }
.brand-cta {
  margin-top: 14px; background: var(--card); border: 1px dashed var(--accent);
  border-radius: 14px; padding: 12px; font-size: 14px; text-align: center; max-width: 360px;
}

/* ---------- emotes ---------- */
#emotes {
  display: flex; gap: 4px; justify-content: center; padding: 4px 8px;
  background: #00000025;
}
.emote {
  font-size: 20px; padding: 4px 8px; cursor: pointer; border-radius: 10px;
  user-select: none; transition: transform .08s;
}
.emote:active { transform: scale(1.35); }
.fly {
  position: fixed; font-size: 30px; pointer-events: none; z-index: 60;
  animation: flyup 1.4s ease-out forwards;
}
@keyframes flyup {
  0% { transform: translateY(0) scale(.7); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-140px) scale(1.5) rotate(12deg); opacity: 0; }
}

/* ---------- players strip ---------- */
#players-strip {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px;
  background: #00000025; scrollbar-width: none;
}
#players-strip::-webkit-scrollbar { display: none; }
.pcard {
  flex: none; display: flex; align-items: center; gap: 5px;
  background: var(--card); border-radius: 999px; padding: 4px 10px 4px 6px; font-size: 12px;
  border: 1px solid transparent;
}
.pcard .pface { font-size: 17px; }
.pcard .pscore { color: var(--accent); font-weight: 800; }
.pcard.guessed { border-color: var(--accent); }
.pcard.drawing { border-color: #ffd166; }
.pcard.drawing::after { content: "✏️"; }
.pcard.host::after { content: "👑"; font-size: 11px; margin-left: -2px; }

/* ---------- chat ---------- */
#chat { background: #00000045; border-top: 1px solid #ffffff12; }
#chat-log {
  height: clamp(64px, 15dvh, 150px); overflow-y: auto; padding: 8px 12px;
  display: flex; flex-direction: column; gap: 4px; font-size: 14px;
}
/* when the keyboard is open (small visual viewport), shrink chat history so
   the game stays visible while typing */
body.kbd-open #chat-log { height: 52px; }
body.kbd-open #emotes, body.kbd-open #players-strip { display: none; }
.msg .who { font-weight: 800; margin-right: 6px; }
.msg.host { color: var(--accent); }
.msg.host .who::before { content: "🎙️ "; }
.msg.correct { color: var(--accent); font-weight: 800; }
.msg.sys { color: #ffd166; }
#chat-form { display: flex; gap: 8px; padding: 8px 12px 12px; }
#chat-input { flex: 1; padding: 10px 14px; border-radius: 999px; }
#chat-form button { width: 48px; margin: 0; border-radius: 999px; font-size: 16px; }

@media (min-width: 700px) {
  .create-box h1 { font-size: 60px; }
  #chat-log { height: 15dvh; }
  #draw { flex-direction: row; }
  #draw-tools { justify-content: center; }
  #colors { flex-direction: column; }
  .tool-row { flex-direction: column; }
}
