/* ============================================================
   Emoji Movie Showdown — 2000s Bollywood title-card glam
   ============================================================ */

:root {
  --ink: #fff6e0;
  --ink-dim: #f3d9ff;
  --night: #14001c;
  --plum: #3a0441;
  --maroon: #6d0838;
  --magenta: #ff2e93;
  --hot: #ff4fd8;
  --gold: #ffd23f;
  --gold-deep: #e89b00;
  --saffron: #ff8a00;
  --teal: #00e0c6;
  --leaf: #2fa84f;
  --danger: #ff3b3b;
  --panel-bg: linear-gradient(160deg, rgba(120, 6, 72, .88), rgba(44, 2, 62, .92));
  --display: "Yatra One", "Rockwell Extra Bold", "Impact", serif;
  --body: "Baloo 2", "Trebuchet MS", "Segoe UI", sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }

/* ---------------- Background ---------------- */
.bg-rays {
  position: fixed;
  inset: -60vmax;
  background: repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(255, 46, 147, .16) 0deg 9deg,
    rgba(255, 210, 63, .05) 9deg 18deg);
  animation: spin 90s linear infinite;
  z-index: 0;
}
.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 79, 216, .35), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(255, 138, 0, .35), transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(10, 0, 16, .85) 100%);
  z-index: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sparkles { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.sparkle {
  position: absolute;
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px 2px rgba(255, 230, 140, .9);
  animation: twinkle 2.6s ease-in-out infinite;
  opacity: 0;
}
.sparkle::before, .sparkle::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  background: rgba(255, 245, 200, .9);
  transform: translate(-50%, -50%);
}
.sparkle::before { width: 22px; height: 2px; }
.sparkle::after { width: 2px; height: 22px; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(45deg); }
}

/* Marigold & mango-leaf toran across the top */
.toran {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 34px;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(circle at 14px 9px, #ffc300 8px, #e8a100 9px, transparent 10px) 0 0 / 56px 34px repeat-x,
    radial-gradient(circle at 42px 9px, #ff7b00 8px, #d85f00 9px, transparent 10px) 0 0 / 56px 34px repeat-x,
    radial-gradient(ellipse 5px 10px at 28px 22px, var(--leaf) 85%, transparent 100%) 0 0 / 56px 34px repeat-x,
    linear-gradient(#7a0b3c, #7a0b3c) 0 0 / 100% 4px no-repeat;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .45));
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ---------------- Screens ---------------- */
.screen {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: none;
  flex-direction: column;
  padding: 40px 28px 16px;
}
.screen.active { display: flex; animation: screen-in .45s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes screen-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---------------- Panels ---------------- */
.panel {
  background: var(--panel-bg);
  border: 3px solid var(--gold);
  border-radius: 26px;
  box-shadow:
    0 0 0 4px rgba(255, 46, 147, .45),
    0 0 34px rgba(255, 210, 63, .28),
    inset 0 0 30px rgba(255, 79, 216, .18);
  padding: 18px 22px;
  position: relative;
}
.panel-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  margin: 0 0 12px;
  color: var(--gold);
  text-shadow: 0 3px 0 #7a0b3c, 0 0 14px rgba(255, 210, 63, .5);
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-title .count {
  font-family: var(--body);
  font-size: 18px;
  font-weight: 800;
  color: var(--night);
  background: var(--teal);
  border-radius: 999px;
  padding: 0 12px;
  text-shadow: none;
  margin-left: auto;
}

/* ---------------- Buttons ---------------- */
.btn {
  --b1: #fff07a; --b2: #ffb000; --b3: #a34a00; --bt: #4a0026;
  border: 3px solid rgba(255, 255, 255, .85);
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--bt);
  background: linear-gradient(180deg, var(--b1) 0%, var(--b2) 60%, var(--b2) 100%);
  box-shadow: 0 5px 0 var(--b3), 0 9px 18px rgba(0, 0, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .7);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1.15;
}
.btn::after { /* glossy shine sweep */
  content: "";
  position: absolute;
  top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: rotate(20deg);
  transition: left .5s ease;
}
.btn:hover:not(:disabled)::after { left: 130%; }
.btn:hover:not(:disabled) { filter: brightness(1.08) saturate(1.1); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--b3), 0 3px 8px rgba(0, 0, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .7); }
.btn:disabled { filter: grayscale(.85) brightness(.6); opacity: .55; }
.btn small { font-size: .62em; font-weight: 700; opacity: .85; }

.btn-gold { --b1: #fff38a; --b2: #ffc300; --b3: #a85a00; --bt: #5a0030; }
.btn-pink { --b1: #ff8fd0; --b2: #ff2e93; --b3: #8a0045; --bt: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.btn-teal { --b1: #8cffef; --b2: #00cdb5; --b3: #006e62; --bt: #10233a; }
.btn-ghost { --b1: #6b2a85; --b2: #48135f; --b3: #210530; --bt: #fff; border-color: rgba(255, 210, 63, .8); }
.btn-sm { font-size: 17px; padding: 7px 16px; }
.btn-lg { font-size: 26px; padding: 12px 30px; }
.btn-xl { font-size: 34px; padding: 14px 44px; font-family: var(--display); font-weight: 400; }

.link-btn {
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 16px;
  font-weight: 700;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
  padding: 4px 6px;
  opacity: .85;
}
.link-btn:hover { opacity: 1; color: var(--gold); }

/* ---------------- Setup screen ---------------- */
.hero { text-align: center; margin-bottom: 10px; }
.hero-badge {
  display: inline-block;
  font-family: var(--display);
  font-size: 18px;
  color: var(--night);
  background: linear-gradient(90deg, var(--gold), #fff3b0, var(--gold));
  padding: 2px 18px;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(255, 210, 63, .6);
  letter-spacing: 1px;
}
.logo {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(44px, 5.6vw, 76px);
  line-height: 1.02;
  margin: 6px 0 2px;
  background: linear-gradient(180deg, #fffbe0 0%, #ffe066 35%, #ffb300 55%, #fff1a8 70%, #e88a00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #8a0045) drop-shadow(0 8px 0 #3d0026) drop-shadow(0 0 22px rgba(255, 79, 216, .65));
  animation: logo-shine 4s ease-in-out infinite;
  background-size: 100% 200%;
}
.logo-emoji { -webkit-text-fill-color: initial; color: initial; font-family: var(--emoji); filter: none; }
.logo-pop {
  display: inline-block;
  transform: rotate(-3deg);
  background: linear-gradient(180deg, #fff0fa 0%, #ff9be0 35%, #ff2e93 60%, #ffc2ea 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 .08em;
}
@keyframes logo-shine { 0%, 100% { background-position: 0 0; } 50% { background-position: 0 100%; } }
.tagline {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  text-shadow: 0 2px 0 #7a0b3c;
  font-style: italic;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 26px;
  flex: 1;
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
#cast-panel { display: flex; flex-direction: column; min-height: 0; }
.add-row { display: flex; gap: 10px; margin-bottom: 12px; }
input[type="text"] {
  flex: 1;
  min-width: 0;
  font-family: var(--body);
  font-size: 22px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  border: 3px solid var(--gold);
  background: rgba(20, 0, 28, .75);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .5);
}
input[type="text"]:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0, 224, 198, .3), inset 0 2px 8px rgba(0, 0, 0, .5); }
input::placeholder { color: rgba(255, 246, 224, .45); }

.chips {
  list-style: none;
  margin: 0;
  padding: 2px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 9px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.chip {
  --c: var(--magenta);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 85%, #fff), var(--c));
  color: #1b0020;
  font-size: 20px;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, .8);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
  animation: pop-in .3s cubic-bezier(.2, .9, .3, 1.5);
}
.chip-x {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(30, 0, 40, .75);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.chip-x:hover { background: var(--danger); }
.chips .empty { color: var(--ink-dim); font-size: 18px; opacity: .75; padding: 6px 4px; font-style: italic; }
@keyframes pop-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#settings-panel { display: flex; flex-direction: column; gap: 7px; padding-top: 14px; padding-bottom: 14px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setting-label { font-size: 22px; font-weight: 800; }
.seg {
  display: inline-flex;
  background: rgba(20, 0, 28, .7);
  border: 2px solid rgba(255, 210, 63, .7);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 19px;
  font-weight: 800;
  padding: 5px 18px;
  border-radius: 999px;
  min-width: 72px;
  transition: background .15s, color .15s, transform .1s;
}
.seg button:hover { background: rgba(255, 255, 255, .1); }
.seg button.on {
  background: linear-gradient(180deg, #fff38a, var(--gold));
  color: #5a0030;
  box-shadow: 0 2px 0 #a85a00;
}
.toggle {
  width: 104px; height: 40px;
  border-radius: 999px;
  border: 2px solid rgba(255, 210, 63, .8);
  background: rgba(20, 0, 28, .7);
  position: relative;
  color: var(--ink);
  font-weight: 800;
  font-size: 17px;
  padding: 0;
}
.toggle .knob {
  position: absolute;
  top: 4px; left: 4px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #888;
  transition: left .2s, background .2s;
}
.toggle .toggle-text { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.toggle[aria-pressed="true"] { background: linear-gradient(180deg, #2bd47a, #13994f); }
.toggle[aria-pressed="true"] .knob { left: 68px; background: #fff; }
.toggle[aria-pressed="true"] .toggle-text { right: auto; left: 16px; }
.setting-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }

.start-wrap { text-align: center; padding-top: 14px; position: relative; z-index: 1; }
.start-hint { margin: 6px 0 0; color: var(--ink-dim); font-size: 16px; min-height: 22px; }
#start-btn:not(:disabled) { animation: pulse-glow 1.8s ease-in-out infinite; }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 5px 0 var(--b3), 0 9px 18px rgba(0, 0, 0, .45), 0 0 0 rgba(255, 210, 63, 0); }
  50% { box-shadow: 0 5px 0 var(--b3), 0 9px 18px rgba(0, 0, 0, .45), 0 0 36px rgba(255, 210, 63, .85); }
}

/* ---------------- Game screen ---------------- */
#screen-game { padding: 38px 18px 24px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}
.round-pill {
  font-family: var(--display);
  font-size: 30px;
  color: var(--night);
  background: linear-gradient(180deg, #fff38a, var(--gold));
  border: 3px solid #fff;
  padding: 0 24px;
  border-radius: 999px;
  box-shadow: 0 4px 0 #a85a00, 0 0 22px rgba(255, 210, 63, .55);
}
.mini-logo {
  font-family: var(--display);
  font-size: 30px;
  color: var(--gold);
  text-shadow: 0 3px 0 #7a0b3c, 0 0 16px rgba(255, 79, 216, .6);
}
.mini-logo span { color: var(--hot); }

.game-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 18px;
}
.stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 12px 20px 14px;
}
.stage-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}
.stage-heading {
  text-align: center;
  font-family: var(--display);
  font-size: 30px;
  color: var(--ink);
  text-shadow: 0 3px 0 #7a0b3c;
}
.timer {
  position: relative;
  width: 92px; height: 92px;
  border: none;
  background: radial-gradient(circle, rgba(20, 0, 28, .95) 58%, transparent 60%);
  border-radius: 50%;
  padding: 0;
  --tc: #2bd47a;
}
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: rgba(255, 255, 255, .14); stroke-width: 11; }
.timer-ring {
  fill: none;
  stroke: var(--tc);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 6px var(--tc));
  transition: stroke .3s;
}
.timer-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 800;
  color: #fff;
}
.timer.warn { --tc: var(--gold); }
.timer.danger { --tc: var(--danger); animation: throb .5s ease-in-out infinite alternate; }
.timer.paused .timer-num { font-size: 30px; }
.timer.done { --tc: #777; }
@keyframes throb { to { transform: scale(1.1); } }

.worth {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(20, 0, 28, .75);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 4px 14px;
  min-width: 112px;
}
.worth-stars { font-family: var(--emoji); font-size: 22px; letter-spacing: 1px; }
.worth-text { font-size: 22px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.worth.drop { animation: shake .4s; }

.emoji-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.emoji-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  font-family: var(--emoji);
  line-height: 1.12;
  /* white rim keeps dark emojis (⬛ 🕴️ 🔫) visible on the dark stage */
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, .85)) drop-shadow(0 0 10px rgba(255, 230, 160, .35)) drop-shadow(0 6px 10px rgba(0, 0, 0, .55));
}
.emoji-row .em {
  display: inline-block;
  padding: 0 .04em;
  animation: em-in .5s cubic-bezier(.2, .9, .3, 1.6) both;
}
.emoji-row.custom-text { font-family: var(--body); font-weight: 800; }
@keyframes em-in {
  from { transform: scale(0) rotate(-25deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.stage.revealed .emoji-wrap { flex: 0 0 auto; }
.stage.revealed .emoji-row { font-size: 64px !important; max-width: none !important; }
.stage.revealed .emoji-row .em { animation: none; }

.answer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: answer-in .6s cubic-bezier(.2, .9, .3, 1.4);
}
.answer-kicker {
  font-family: var(--display);
  font-size: 30px;
  color: var(--teal);
  text-shadow: 0 3px 0 #003d36, 0 0 18px rgba(0, 224, 198, .6);
}
.answer-title {
  font-family: var(--display);
  font-size: clamp(40px, 5.2vw, 76px);
  line-height: 1.05;
  margin: 4px 0;
  padding: 6px 28px 10px;
  background: linear-gradient(180deg, #fffbe0 0%, #ffe066 40%, #ffb300 60%, #fff1a8 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #8a0045) drop-shadow(0 0 22px rgba(255, 79, 216, .7));
}
.answer-meta { font-size: 22px; font-weight: 700; color: var(--ink-dim); }
.answer.sad .answer-kicker { color: #ff8a8a; text-shadow: 0 3px 0 #4a0000; }
@keyframes answer-in {
  0% { transform: scale(.3) rotate(-6deg); opacity: 0; }
  70% { transform: scale(1.06) rotate(1deg); opacity: 1; }
  100% { transform: none; }
}

.hints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 12px;
}
.stage.revealed .hints { display: none; }
.hint-card {
  border-radius: 18px;
  padding: 8px 14px 10px;
  background: rgba(20, 0, 28, .72);
  border: 2px dashed rgba(255, 210, 63, .5);
  min-height: 96px;
  position: relative;
}
.hint-card.unlocked {
  border: 2px solid var(--teal);
  background: linear-gradient(160deg, rgba(0, 120, 110, .45), rgba(20, 0, 28, .85));
  box-shadow: 0 0 18px rgba(0, 224, 198, .35);
  animation: flip-in .5s cubic-bezier(.2, .9, .3, 1.3);
}
@keyframes flip-in {
  from { transform: perspective(600px) rotateX(-90deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.hint-tag {
  position: absolute;
  top: -12px; left: 14px;
  font-size: 15px;
  font-weight: 800;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--night);
}
.hint-card.unlocked .hint-tag { background: var(--teal); }
.hint-body { font-size: 21px; font-weight: 700; line-height: 1.25; margin-top: 6px; }
.hint-card.locked .hint-body { color: rgba(255, 246, 224, .5); font-style: italic; font-size: 19px; display: flex; align-items: center; height: 100%; }
.hint-line + .hint-line { margin-top: 3px; }
.hint-clue { color: var(--gold); }
.blanks { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 28px; font-weight: 800; letter-spacing: 3px; }
.blanks .bw { white-space: nowrap; }
.blanks b { color: var(--gold); }
.blanks i { font-style: normal; color: #fff; opacity: .85; }
.blanks em { font-style: normal; color: var(--ink-dim); }

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Scoreboard */
.scoreboard { display: flex; flex-direction: column; min-height: 0; padding: 12px 14px; }
.sb-title { font-size: 28px; margin-bottom: 0; justify-content: center; }
.sb-sub { margin: 0 0 8px; text-align: center; font-size: 15px; color: var(--ink-dim); }
.players {
  --n: 4;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 4px;
}
.pl {
  --c: var(--magenta);
  flex: 1 1 0;
  min-height: 34px;
  max-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .8);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 80%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 75%, #000) 100%);
  color: #1b0020;
  font-size: clamp(16px, calc(48vh / var(--n)), 27px);
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .45);
  transition: transform .1s ease, filter .15s;
  text-align: left;
  min-width: 0;
}
/* 9+ players: wider board, two columns so all 15 names fit without scrolling */
.game-grid.many { grid-template-columns: 1fr 400px; }
.game-grid.many .players {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 6px 8px;
}
.game-grid.many .pl { min-height: 0; max-height: none; font-size: clamp(15px, calc(80vh / var(--n)), 22px); padding: 0 5px 0 10px; }
.pl:hover { filter: brightness(1.12); transform: translateX(-3px); }
.pl:active { transform: scale(.97); }
.pl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pl-score {
  flex-shrink: 0;
  min-width: 1.9em;
  padding: .2em .4em;
  line-height: 1;
  text-align: center;
  border-radius: 999px;
  background: rgba(20, 0, 28, .85);
  color: var(--gold);
  font-size: 1.05em;
}
.pl.winner { outline: 4px solid #fff; outline-offset: 2px; filter: brightness(1.15); }
.pl.bump .pl-score { animation: bump .6s cubic-bezier(.2, .9, .3, 1.8); }
.pl.minus .pl-score { animation: shake .4s; }
.board-locked .pl:not(.winner) { filter: saturate(.55) brightness(.75); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.6); background: var(--gold); color: var(--night); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

.float-points {
  position: fixed;
  z-index: 60;
  font-family: var(--display);
  font-size: 44px;
  color: var(--gold);
  text-shadow: 0 3px 0 #8a0045, 0 0 18px rgba(255, 210, 63, .8);
  pointer-events: none;
  animation: float-up 1.1s ease-out forwards;
}
@keyframes float-up { from { transform: translateY(0) scale(.6); opacity: 1; } to { transform: translateY(-90px) scale(1.2); opacity: 0; } }

.legend {
  position: fixed;
  left: 18px;
  bottom: 3px;
  z-index: 3;
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: rgba(255, 246, 224, .6);
}
kbd {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
}

/* ---------------- Final screen ---------------- */
#screen-final { align-items: center; padding-top: 44px; }
.final-head { text-align: center; }
.final-logo { font-size: clamp(40px, 5vw, 66px); }
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  margin: 10px 0 8px;
  flex: 1;
  min-height: 0;
  max-height: 340px;
  width: 100%;
}
.pod {
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  animation: rise .8s cubic-bezier(.2, .9, .3, 1.2) both;
}
.pod-medal { font-family: var(--emoji); font-size: 48px; line-height: 1; }
.pod-name {
  font-size: 30px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 3px 0 #7a0b3c;
}
.pod-score { font-size: 20px; font-weight: 700; color: var(--ink-dim); margin-bottom: 6px; }
.pod-block {
  width: 100%;
  border-radius: 18px 18px 6px 6px;
  border: 3px solid #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 64px;
  color: rgba(40, 0, 30, .75);
  box-shadow: 0 0 28px rgba(255, 210, 63, .45), inset 0 -10px 20px rgba(0, 0, 0, .25);
}
.pod.p1 .pod-block { height: 62%; background: linear-gradient(180deg, #fff38a, #ffc300 60%, #d48a00); }
.pod.p2 .pod-block { height: 44%; background: linear-gradient(180deg, #ffffff, #c9d3e0 60%, #8d99ab); }
.pod.p3 .pod-block { height: 30%; background: linear-gradient(180deg, #ffc69a, #d9792f 60%, #9a4c14); }
.pod.p1 .pod-name { font-size: 38px; color: var(--gold); }
.pod.p1 { animation-delay: .9s; }
.pod.p2 { animation-delay: .5s; }
.pod.p3 { animation-delay: .1s; }
@keyframes rise { from { transform: translateY(120%); opacity: 0; } to { transform: none; opacity: 1; } }

.ranks {
  list-style: none;
  margin: 6px 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  max-width: 1100px;
}
.ranks li {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 19px;
  font-weight: 800;
  padding: 3px 14px 3px 4px;
  border-radius: 999px;
  background: rgba(20, 0, 28, .75);
  border: 2px solid rgba(255, 210, 63, .55);
}
.ranks .rk {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--magenta);
  color: #fff;
  font-size: 15px;
}
.ranks .rs { color: var(--gold); }
.final-actions { display: flex; gap: 18px; justify-content: center; }

/* ---------------- Custom puzzle dialog ---------------- */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--ink);
  max-width: 720px;
  width: calc(100% - 40px);
}
.modal::backdrop { background: rgba(10, 0, 16, .75); backdrop-filter: blur(3px); }
.modal-inner {
  background: var(--panel-bg), var(--night);
  border: 3px solid var(--gold);
  border-radius: 26px;
  box-shadow: 0 0 0 4px rgba(255, 46, 147, .45), 0 0 40px rgba(255, 210, 63, .35);
  padding: 22px 26px;
  position: relative;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}
.modal-x {
  position: absolute;
  top: 12px; right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(20, 0, 28, .8);
  color: #fff;
  font-size: 26px;
  line-height: 1;
}
.modal-x:hover { background: var(--danger); }
.modal-sub { margin: -6px 0 12px; color: var(--ink-dim); }
.custom-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: end; }
.custom-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 17px; }
.custom-form label:nth-child(3) { grid-column: 1 / -1; }
.custom-form input { font-size: 19px; }
.custom-form .btn { grid-column: 1 / -1; justify-self: center; }
.opt { font-weight: 500; color: var(--ink-dim); font-size: 14px; }
.custom-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
}
.custom-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(20, 0, 28, .7);
  border: 2px solid rgba(255, 210, 63, .45);
  border-radius: 16px;
  padding: 6px 8px 6px 14px;
}
.custom-list .ce { font-family: var(--emoji); font-size: 28px; }
.custom-list .ct { flex: 1; min-width: 0; }
.custom-list .ct b { display: block; font-size: 18px; }
.custom-list .ct span { font-size: 14px; color: var(--ink-dim); }
.custom-list .empty { justify-content: center; color: var(--ink-dim); font-style: italic; border-style: dashed; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 30px);
  z-index: 70;
  background: linear-gradient(180deg, #ff8fd0, var(--magenta));
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  padding: 8px 24px;
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Edition chooser (Bollywood / Hollywood) */
.seg-mode { display: flex; width: 100%; margin-bottom: 4px; }
.seg-mode button { flex: 1; font-size: 20px; padding: 7px 10px; }
.seg-mode button.on { background: linear-gradient(180deg, #ff9be0, var(--magenta)); color: #fff; box-shadow: 0 2px 0 #8a0045; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }

/* ---------------- Short laptop screens ---------------- */
@media (max-height: 700px) {
  .screen { padding-top: 36px; }
  .logo { font-size: 52px; }
  .tagline { font-size: 18px; }
  .hint-card { min-height: 80px; }
  .hint-body { font-size: 18px; }
  .blanks { font-size: 23px; }
  .btn { font-size: 19px; padding: 8px 18px; }
  .btn-xl { font-size: 28px; }
  .timer { width: 78px; height: 78px; }
  .timer-num { font-size: 32px; }
  .round-pill, .mini-logo { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-rays, .logo, .sparkle { animation: none; }
}

/* ============================================================
   Phones (portrait) and small landscape screens
   Everything stacks, the page scrolls, and text stays big.
   ============================================================ */
@media (max-width: 1000px), (max-height: 500px) {
  html, body { overflow-x: hidden; overflow-y: auto; height: auto; }
  .screen { height: auto; min-height: 100vh; min-height: 100dvh; padding: 42px 14px 22px; }
  .bg-rays { position: fixed; }

  /* Setup */
  .hero { margin-bottom: 12px; }
  .hero-badge { font-size: 15px; }
  .logo { font-size: clamp(36px, 11vw, 56px); }
  .logo-emoji { display: block; font-size: .8em; }
  .tagline { font-size: 17px; }
  .setup-grid { grid-template-columns: 1fr; gap: 18px; flex: none; }
  .panel { padding: 16px 14px; border-radius: 22px; }
  .panel-title { font-size: 24px; }
  #cast-panel .chips { max-height: 40vh; }
  input[type="text"] { font-size: 18px; padding: 10px 16px; }
  .chip { font-size: 18px; }
  .chip-x { width: 32px; height: 32px; }
  .setting { flex-wrap: wrap; gap: 6px; }
  .setting-label { font-size: 19px; }
  .seg button { min-width: 64px; padding: 8px 12px; font-size: 18px; }
  .seg-mode button { font-size: 17px; padding: 9px 6px; white-space: normal; }
  .setting-links { flex-direction: column; align-items: stretch; text-align: center; margin-top: 8px; }
  .btn { font-size: 18px; padding: 10px 18px; }
  .btn-xl { font-size: 24px; padding: 14px 22px; white-space: normal; width: 100%; }
  .btn-lg { font-size: 20px; white-space: normal; }
  .start-wrap { padding-top: 18px; }

  /* Game */
  #screen-game { padding: 40px 10px 18px; }
  .topbar { margin-bottom: 8px; }
  .mini-logo { display: none; }
  .round-pill { font-size: 20px; padding: 2px 16px; }
  .game-grid, .game-grid.many { grid-template-columns: 1fr; gap: 14px; flex: none; }
  .stage { padding: 12px 12px 14px; }
  .stage-top { gap: 8px; }
  .stage-heading { font-size: 19px; line-height: 1.15; }
  .timer { width: 66px; height: 66px; }
  .timer-num { font-size: 28px; }
  .timer.paused .timer-num { font-size: 22px; }
  .worth { min-width: 70px; padding: 2px 8px; border-radius: 14px; }
  .worth-stars { font-size: 15px; }
  .worth-text { font-size: 17px; }
  .emoji-wrap { flex: none; height: 30vh; min-height: 150px; }
  .stage.revealed .emoji-wrap { height: auto; min-height: 0; margin: 6px 0; }
  .stage.revealed .emoji-row { font-size: 46px !important; }
  .answer { flex: none; padding: 6px 0 12px; }
  .answer-kicker { font-size: 22px; }
  .answer-title { font-size: clamp(30px, 9vw, 46px); padding: 4px 8px 8px; }
  .answer-meta { font-size: 16px; }
  .hints { grid-template-columns: 1fr; gap: 16px; margin: 14px 0; }
  .hint-card { min-height: 0; padding: 12px 12px 10px; }
  .hint-body { font-size: 18px; }
  .hint-card.locked .hint-body { font-size: 16px; }
  .blanks { font-size: 24px; gap: 4px 16px; letter-spacing: 2px; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .controls .btn { width: 100%; white-space: normal; padding: 12px 8px; font-size: 18px; }
  #reveal-btn { grid-column: 1 / -1; font-size: 21px; }
  #hint-btn { grid-column: 1 / -1; }
  #undo-btn { grid-column: 1 / -1; }
  .scoreboard { padding: 12px 10px; }
  .players, .game-grid.many .players {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: 52px;
    gap: 8px;
    overflow: visible;
  }
  .pl, .game-grid.many .pl { max-height: none; min-height: 0; font-size: 18px; padding: 0 6px 0 12px; }
  .legend { display: none; }

  /* Final */
  #screen-final { padding-top: 44px; }
  .final-logo { font-size: clamp(30px, 8.5vw, 46px); }
  .podium { flex: none; height: 270px; gap: 8px; }
  .pod { width: 31%; }
  .pod-medal { font-size: 34px; }
  .pod-name, .pod.p1 .pod-name { font-size: 19px; }
  .pod-score { font-size: 15px; }
  .pod-block { font-size: 40px; }
  .ranks li { font-size: 17px; }
  .final-actions { flex-direction: column; width: 100%; gap: 12px; }

  /* Custom puzzle dialog */
  .modal { width: calc(100% - 20px); }
  .modal-inner { padding: 18px 14px; }
  .custom-form { grid-template-columns: 1fr; }
  .custom-list li { flex-wrap: wrap; }

  .toast { font-size: 17px; bottom: 16px; }
}

/* Phones held sideways: keep the scoreboard beside the puzzle */
@media (max-height: 500px) and (min-width: 640px) {
  .game-grid, .game-grid.many { grid-template-columns: 1fr 260px; }
  .emoji-wrap { height: 42vh; }
  .hints { grid-template-columns: 1fr 1fr; }
  .setup-grid { grid-template-columns: 1fr 1fr; }
}
