:root {
  --marigold: #ffb526;
  --rose: #ed4a78;
  --cream: #fff5e3;
  --ink: #291433;
  --panel: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.3);
  --dim: rgba(255, 255, 255, 0.65);
  --serif: ui-serif, "New York", Georgia, "Times New Roman", serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  background: linear-gradient(#1a0f33, #401247) fixed #1a0f33;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }

#app { min-height: 100%; display: flex; flex-direction: column; }

.splash {
  margin: auto; padding: 24px; text-align: center;
  font: 800 34px var(--serif); color: var(--marigold);
}
.splash small { display: block; margin-top: 12px; font: 400 17px system-ui, sans-serif; color: var(--dim); }
.splash .btn { margin-top: 20px; }

/* Screens: a scrolling body over a bar of buttons pinned to the bottom. */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100dvh; }
.body {
  flex: 1; width: 100%; max-width: 1000px; margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 24px;
}
.body.narrow { max-width: 680px; }
.bar {
  position: sticky; bottom: 0; z-index: 2;
  background: rgba(40, 14, 62, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.bar-inner {
  display: flex; gap: 12px; width: 100%; max-width: 1000px; margin: 0 auto;
  padding: 12px max(20px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.narrow + .bar .bar-inner, .bar.narrow .bar-inner { max-width: 680px; }

h1 { margin: 0; font: 800 40px/1.1 var(--serif); color: var(--marigold); }
.lead { margin: 6px 0 0; color: rgba(255, 255, 255, 0.75); }
.label {
  margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--dim);
}
.header { display: flex; align-items: flex-start; gap: 12px; }
.header > div { flex: 1; }

.btn {
  flex: 1; min-height: 56px; padding: 0 16px; border-radius: 16px;
  font-size: 20px; font-weight: 700; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn.primary { background: var(--marigold); color: var(--ink); }
.btn.secondary { background: var(--panel); border: 1px solid var(--line); font-weight: 600; }
.btn:active:not(:disabled) { opacity: 0.7; }
.btn:disabled { opacity: 0.4; }
.btn.small { flex: none; min-height: 40px; font-size: 15px; border-radius: 20px; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li {
  counter-increment: step; position: relative; padding: 12px 14px 12px 54px; border-radius: 14px;
  background: var(--panel); color: rgba(255, 255, 255, 0.8);
}
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--marigold); color: var(--ink); font-weight: 700; font-size: 15px;
}
.steps b { color: #fff; }

/* Category tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  text-align: left; padding: 14px; border-radius: 14px; background: var(--panel);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.tile[aria-pressed="true"] { background: var(--marigold); color: var(--ink); }
.tile:disabled { opacity: 0.45; }
.tile-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; height: 28px; }
.tile-top .emoji { font-size: 22px; }
.tile-top .status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.tile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Segmented choices (teams, clip length) */
.segments { display: flex; padding: 3px; border-radius: 12px; background: var(--panel); }
.segments button { flex: 1; min-height: 38px; border-radius: 9px; font-size: 15px; font-weight: 600; }
.segments button[aria-pressed="true"] { background: var(--marigold); color: var(--ink); }
.fields { display: grid; gap: 12px; margin-top: 12px; }
.fields input {
  width: 100%; padding: 12px; border: 0; border-radius: 12px; background: var(--panel);
}
.fields input::placeholder { color: rgba(255, 255, 255, 0.4); }

/* Scores */
.scores { display: flex; gap: 8px; }
.score {
  flex: 1; min-width: 0; padding: 10px 6px; border-radius: 12px; background: var(--panel); text-align: center;
}
.score b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.score span { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Playing */
.topbar {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 1000px; margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 8px max(20px, env(safe-area-inset-left));
}
.round-button {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--panel);
  display: grid; place-items: center; font-size: 18px;
}
.topbar .where { flex: 1; min-width: 0; }
.topbar .where b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .where span { font-size: 12px; color: var(--dim); }
.topbar .scores { gap: 6px; }
.topbar .score { flex: none; min-width: 44px; max-width: 72px; padding: 4px 6px; border-radius: 10px; }
.topbar .score b { font-size: 17px; }
.topbar .score span { font-size: 11px; }

.screen.playing .body { padding-top: 12px; gap: 16px; }

.card { padding: 24px; border-radius: 24px; background: var(--cream); color: var(--ink); }
.card .kicker { margin: 0 0 14px; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--rose); }
.card .lyric { margin: 0 0 14px; font: 500 28px/1.25 var(--serif); }
.fresh { animation: drop 0.25s ease-out; }
.card .more { margin: 0; font-size: 13px; font-weight: 600; opacity: 0.5; }
.card .note { margin: 0; font: 500 20px/1.3 var(--serif); }
.hint {
  padding: 18px; border-radius: 16px; background: var(--panel); color: var(--marigold);
  font: 600 26px var(--serif);
}
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* The answer */
.answer { display: flex; flex-direction: column; gap: 18px; }
.answer .details { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.clip-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000;
}
.clip-frame iframe, .clip-frame > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.clip-fallback {
  aspect-ratio: 16 / 9; border-radius: 16px; background: var(--panel); padding: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; font-weight: 600; text-decoration: none;
}
.clip-fallback .play { font-size: 44px; }
.open-link { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--dim); }
.answer h2 { margin: 0; font: 800 30px/1.15 var(--serif); color: var(--marigold); }
.answer .effort { margin: 6px 0 0; font-size: 14px; color: var(--dim); }
.answer .hindi { margin: 0; font-size: 20px; white-space: pre-line; }
.answer .english { margin: 0; font: italic 16px/1.4 var(--serif); color: rgba(255, 255, 255, 0.6); white-space: pre-line; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  min-height: 48px; padding: 0 8px; border-radius: 12px; background: var(--panel); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.choice[aria-pressed="true"] { background: var(--marigold); color: var(--ink); }

/* Wide screens (a laptop, a TV, a phone on its side): clip beside the answer. */
@media (min-width: 820px) {
  .answer { flex-direction: row; align-items: flex-start; gap: 24px; }
  .answer > * { flex: 1; }
}
@media (max-height: 480px) {
  .bar-inner { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .btn { min-height: 46px; }
}

/* Final scores */
.standing {
  display: flex; justify-content: space-between; align-items: center; padding: 16px;
  border-radius: 14px; background: var(--panel); font-size: 20px; font-weight: 600;
}
.standing b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 10px; }
.played a {
  display: flex; justify-content: space-between; gap: 12px; padding: 6px 0;
  font-weight: 600; text-decoration: none;
}
.played a span:last-child { color: var(--marigold); align-self: center; }
.played small { display: block; font-size: 13px; font-weight: 400; color: var(--dim); }
.stats { flex-wrap: wrap; }
.stats .score { flex: 1 1 40%; }
.stats .score span { white-space: normal; }
.tip { margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--panel); color: rgba(255, 255, 255, 0.8); }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 5; padding: 10px 16px; border-radius: 20px; background: var(--cream); color: var(--ink);
  font-size: 15px; font-weight: 600; white-space: nowrap;
}
