:root {
  --ink: #14213d;
  --muted: #637083;
  --soft: #f6f8ff;
  --panel: #ffffff;
  --line: #dde4f2;
  --blue: #2a6df4;
  --teal: #18b9a7;
  --coral: #ff5a6e;
  --amber: #ffb400;
  --violet: #7b5cff;
  --green: #24b36b;
  --danger: #df3151;
  --shadow: 0 18px 48px rgba(22, 34, 66, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(42, 109, 244, 0.08), transparent 30rem),
    linear-gradient(180deg, #ffffff 0%, #f5f7ff 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding: 0.45rem clamp(1rem, 3vw, 1.6rem);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(221, 228, 242, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 12rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--radius);
  background: #fff7d6;
  box-shadow: 0 10px 22px rgba(42, 109, 244, 0.2);
  overflow: hidden;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-title {
  display: block;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.nav-actions,
.row,
.toolbar,
.button-row,
.control-row,
.split-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.nav-actions {
  justify-content: flex-end;
}

.screen {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(0.65rem, 1.8vh, 1.25rem) clamp(1rem, 3vw, 2rem);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 0.9fr);
  align-items: stretch;
  gap: clamp(0.8rem, 2vw, 1.25rem);
  min-height: calc(100svh - 5.6rem);
}

.play-surface,
.panel,
.game-card,
.question-editor,
.history-card,
.team-setup-card,
.result-card,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.play-surface {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.surface-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(0.65rem, 1.4vh, 1rem);
  padding: clamp(1rem, 2.1vw, 1.45rem);
  background:
    linear-gradient(120deg, rgba(42, 109, 244, 0.12), rgba(24, 185, 167, 0.12)),
    #fff;
}

.kicker {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: clamp(0.45rem, 1vh, 0.75rem);
  font-size: clamp(2rem, 4.4vw, 4.1rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-title {
  margin-bottom: clamp(0.35rem, 0.8vh, 0.55rem);
  font-size: clamp(1.55rem, 2.85vw, 2.1rem);
  line-height: 1.08;
}

.hero-title span {
  display: block;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0.7rem;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.55rem;
  font-size: 1.15rem;
  line-height: 1.2;
}

p {
  margin-bottom: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}

.surface-copy {
  max-width: 48rem;
  margin-bottom: clamp(0.65rem, 1.25vh, 0.9rem);
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 650;
}

.surface-banner .stat-grid {
  max-width: 38rem;
}

.flow-strip {
  display: flex;
  gap: clamp(0.45rem, 1.2vw, 0.85rem);
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem clamp(1rem, 2vw, 1.25rem);
}

.flow-chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.8rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: #eef3ff;
  color: #274067;
  font-size: 0.78rem;
  font-weight: 800;
}

.flow-chip {
  flex: 0 1 auto;
  white-space: nowrap;
}

.flow-chip:nth-child(3n + 1) {
  background: rgba(42, 109, 244, 0.1);
}

.flow-chip:nth-child(3n + 2) {
  background: rgba(24, 185, 167, 0.12);
}

.flow-chip:nth-child(3n + 3) {
  background: rgba(255, 180, 0, 0.16);
}

.quick-panel {
  min-height: 0;
  padding: clamp(0.9rem, 2vw, 1.2rem);
  overflow: auto;
}

.quick-stack {
  display: grid;
  gap: 0.85rem;
}

.stat-grid,
.settings-grid,
.meta-grid,
.result-stats {
  display: grid;
  gap: 0.7rem;
}

.stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  min-height: 4.6rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--soft);
  border: 1px solid var(--line);
}

.stat strong {
  display: block;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 3rem;
  min-width: 3rem;
  padding: 0.75rem 1.05rem;
  border: 0;
  border-radius: 999px;
  background: #edf2ff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(20, 33, 61, 0.14);
  outline: none;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn.primary {
  background: var(--blue);
  color: #fff;
}

.btn.success {
  background: var(--green);
  color: #fff;
}

.btn.warning {
  background: var(--amber);
  color: #332300;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn.big {
  min-height: 3.5rem;
  padding-inline: 1.25rem;
  font-size: 1rem;
}

.btn.small {
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
}

.btn.icon {
  width: 3rem;
  padding: 0;
  font-size: 1.2rem;
}

.btn.media-toggle {
  width: 3.2rem;
  min-width: 3.2rem;
  min-height: 3.2rem;
  flex: 0 0 auto;
}

.control-icon {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.media-toggle.is-off {
  color: var(--muted);
  background: #f5f7fb;
}

.control-icon .off-slash {
  stroke: var(--danger);
  stroke-width: 2.8;
}

.btn[disabled],
.answer-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head p {
  margin-bottom: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 16rem;
  padding: 2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border: 2px dashed #cbd5e7;
  border-radius: var(--radius);
}

.game-list,
.question-list,
.history-list {
  display: grid;
  gap: 1rem;
}

.game-card,
.history-card,
.result-card {
  padding: clamp(1rem, 2.5vw, 1.35rem);
}

.game-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.history-card .section-head {
  align-items: center;
}

.history-actions {
  flex-wrap: nowrap;
}

.history-clear-btn .control-icon,
.history-actions .control-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.card-title {
  margin: 0;
  font-size: 1.35rem;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #f1f5ff;
  color: #40516d;
  font-size: 0.78rem;
  font-weight: 850;
}

.panel {
  padding: clamp(1rem, 3vw, 1.35rem);
}

.meta-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label,
.checkline {
  color: #2d3f5f;
  font-size: 0.84rem;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 3.1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #cbd5e7;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.field textarea {
  min-height: 6rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(42, 109, 244, 0.16);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #cbd5e7;
  border-radius: var(--radius);
  background: #fff;
}

.checkline input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--blue);
}

.uploader {
  display: grid;
  gap: 0.8rem;
  align-content: center;
  min-height: 13rem;
  padding: 1.2rem;
  border: 2px dashed #bec9de;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #f6f9ff);
}

.uploader input {
  width: 100%;
}

.helper {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-note {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  background: #fff7d8;
  border: 1px solid #f5df86;
  color: #604700;
  font-weight: 800;
}

.question-editor {
  padding: 1rem;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.question-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(12rem, 0.7fr);
  gap: 0.9rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.choice-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.choice-row input[type="radio"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--green);
}

.team-count-grid,
.team-name-grid,
.music-grid,
.play-again-grid {
  display: grid;
  gap: 1rem;
}

.team-count-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.team-name-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.music-grid {
  grid-template-columns: minmax(18rem, 1.4fr) minmax(15rem, 1fr) minmax(10rem, 0.65fr) minmax(12rem, 0.75fr) auto;
  align-items: end;
}

.music-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.team-setup-card {
  padding: clamp(1rem, 3vw, 1.4rem);
  border-top: 0.5rem solid var(--team-color, var(--blue));
}

.team-color-dot {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: var(--team-color, var(--blue));
}

.battle-screen {
  width: min(1720px, 100%);
  padding: clamp(0.7rem, 2vw, 1.2rem);
}

.battle-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 0.8rem;
  min-height: calc(100vh - 1.4rem);
}

.battle-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: stretch;
}

.timer-card,
.question-card,
.teacher-bar,
.leaderboard-card,
.reveal-summary {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(20, 33, 61, 0.1);
}

.timer-card {
  display: grid;
  place-items: center;
  min-width: 8.2rem;
  padding: 0.8rem;
}

.timer-number {
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 1000;
}

.timer-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.timer-bar {
  width: 100%;
  height: 0.65rem;
  margin-top: 0.55rem;
  border-radius: 999px;
  background: #e7edfb;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--coral));
  transition: width 220ms linear;
}

.question-card {
  padding: clamp(1rem, 2vw, 1.4rem);
  text-align: center;
}

.question-count {
  color: var(--blue);
  font-weight: 950;
  text-transform: uppercase;
  font-size: 0.88rem;
}

.question-text {
  margin: 0.45rem 0 0;
  font-size: clamp(1.65rem, 4vw, 3.7rem);
  line-height: 1.05;
  font-weight: 1000;
}

.teacher-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.65rem;
}

.leaderboard-card {
  min-width: 12rem;
  padding: 0.85rem;
}

.leaderboard-card h3 {
  margin-bottom: 0.55rem;
}

.leader-list {
  display: grid;
  gap: 0.45rem;
}

.leader-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  font-weight: 950;
}

.leader-color {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: var(--team-color);
}

.reveal-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-left: 0.45rem solid var(--green);
  animation: bounceIn 420ms ease;
}

.reveal-summary-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(36, 179, 107, 0.13);
  color: #117344;
  font-weight: 1000;
  text-transform: uppercase;
  white-space: nowrap;
}

.reveal-summary-body {
  min-width: 0;
}

.reveal-summary h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  line-height: 1.15;
}

.reveal-summary p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.35vw, 1.12rem);
  font-weight: 750;
  line-height: 1.35;
}

.reveal-source {
  margin-top: 0.18rem;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 900;
}

.answer-arena {
  display: grid;
  gap: 0.75rem;
  min-height: 0;
}

.answer-arena.teams-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.answer-arena.teams-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.answer-arena.teams-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(16rem, 1fr));
}

.team-zone {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  min-height: 17rem;
  padding: 0.9rem;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82)),
    var(--team-color);
  border: 3px solid color-mix(in srgb, var(--team-color), #ffffff 24%);
  overflow: hidden;
}

.team-zone.locked {
  box-shadow: inset 0 0 0 4px rgba(20, 33, 61, 0.08);
}

.team-zone.correct {
  animation: popGlow 620ms ease;
}

.team-zone.wrong {
  animation: softShake 460ms ease;
}

.team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.team-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.team-title h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1rem;
  font-weight: 1000;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  align-content: stretch;
}

.answer-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.7rem;
  padding: 0.8rem;
  border: 2px solid rgba(20, 33, 61, 0.08);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  line-height: 1.15;
  font-weight: 950;
  cursor: pointer;
  text-align: center;
  transition: transform 160ms ease, border 160ms ease, box-shadow 160ms ease;
}

.answer-button:hover,
.answer-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--team-color);
  box-shadow: 0 14px 30px rgba(20, 33, 61, 0.13);
  outline: none;
}

.answer-button.selected {
  border-color: var(--team-color);
  background: color-mix(in srgb, var(--team-color), white 82%);
}

.answer-button.correct-answer {
  background: rgba(36, 179, 107, 0.16);
  border-color: var(--green);
}

.answer-button.wrong-answer {
  background: rgba(223, 49, 81, 0.12);
  border-color: var(--danger);
}

.locked-banner,
.feedback-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.55rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-weight: 1000;
  text-align: center;
}

.feedback-banner {
  animation: bounceIn 520ms ease;
}

.reveal-panel {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
}

.reveal-panel strong {
  color: var(--green);
}

.team-result-grid,
.review-grid {
  display: grid;
  gap: 0.75rem;
}

.team-result-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.team-result {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0.75rem;
  background: #fff;
}

.team-result strong {
  color: var(--ink);
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 1rem;
  min-height: 22rem;
  margin: 1.2rem 0;
}

.podium-step {
  display: grid;
  align-content: end;
  justify-items: center;
  min-height: var(--podium-height);
  padding: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72)), var(--team-color);
  border: 3px solid color-mix(in srgb, var(--team-color), white 25%);
  animation: riseUp 680ms ease both;
}

.podium-rank {
  font-size: 2.2rem;
  font-weight: 1000;
}

.podium-name {
  max-width: 100%;
  font-size: 1.35rem;
  font-weight: 1000;
  text-align: center;
  overflow-wrap: anywhere;
}

.podium-score {
  color: var(--muted);
  font-weight: 950;
}

.result-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(20, 33, 61, 0.42);
}

.modal-card {
  width: min(44rem, 100%);
  max-height: min(44rem, 90vh);
  overflow: auto;
  padding: 1.2rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  width: min(26rem, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: #14213d;
  color: #fff;
  font-weight: 850;
  box-shadow: var(--shadow);
  animation: toastIn 220ms ease;
}

.confetti {
  position: fixed;
  z-index: 80;
  width: 0.65rem;
  height: 0.9rem;
  border-radius: 0.2rem;
  pointer-events: none;
  animation: confettiFall 950ms ease forwards;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.danger-text {
  color: var(--danger);
}

.success-text {
  color: var(--green);
}

.full-width {
  grid-column: 1 / -1;
}

@keyframes popGlow {
  0%,
  100% {
    transform: scale(1);
    box-shadow: none;
  }
  45% {
    transform: scale(1.012);
    box-shadow: 0 0 0 8px rgba(36, 179, 107, 0.16);
  }
}

@keyframes softShake {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-4px);
  }
  60% {
    transform: translateX(4px);
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.92);
    opacity: 0;
  }
  65% {
    transform: scale(1.03);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes riseUp {
  from {
    transform: translateY(22px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastIn {
  from {
    transform: translateY(0.7rem);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes confettiFall {
  0% {
    transform: translate3d(0, -1rem, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift), 9rem, 0) rotate(280deg);
    opacity: 0;
  }
}

@media (max-width: 1180px) {
  .home-grid,
  .battle-top {
    grid-template-columns: 1fr;
  }

  .leaderboard-card {
    min-width: 0;
  }

  .meta-grid,
  .settings-grid,
  .team-result-grid,
  .result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .team-name-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .music-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .answer-arena.teams-3,
  .answer-arena.teams-4 {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: sticky;
    align-items: stretch;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
  }

  .brand {
    min-width: 0;
    width: 100%;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
  }

  .brand-title {
    font-size: 0.9rem;
  }

  .brand-subtitle {
    font-size: 0.76rem;
  }

  .nav-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    width: 100%;
  }

  .nav-actions .btn {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.55rem 0.5rem;
    font-size: 0.86rem;
    white-space: nowrap;
  }

  .section-head,
  .game-card,
  .surface-banner,
  .question-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-row .btn,
  .split-actions .btn {
    width: 100%;
  }

  .screen {
    padding: 0.8rem;
  }

  .home-grid {
    min-height: auto;
  }

  .game-card {
    gap: 0.85rem;
  }

  .split-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .split-actions .btn:first-child,
  .split-actions .btn:last-child {
    grid-column: 1 / -1;
  }

  .stat-grid,
  .meta-grid,
  .settings-grid,
  .choice-grid,
  .team-count-grid,
  .team-name-grid,
  .music-grid,
  .team-result-grid,
  .result-stats,
  .podium {
    grid-template-columns: 1fr;
  }

  .answer-arena.teams-2,
  .answer-arena.teams-3,
  .answer-arena.teams-4 {
    grid-template-columns: 1fr;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .question-text {
    font-size: 1.7rem;
  }

  .hero-title span {
    white-space: normal;
  }

  .teacher-bar .btn {
    flex: 1 1 9rem;
  }

  .flow-strip {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .music-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .music-actions .btn {
    width: 100%;
  }
}
