:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1a2022;
  --panel-2: #252a33;
  --text: #f4f0e8;
  --muted: #aeb8c4;
  --line: #3d4652;
  --red: #df4d45;
  --gold: #f0bf4f;
  --sea: #38c1aa;
  --violet: #8c6ff0;
  --ink: #0b0e13;
  --board: #225f9b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(56, 193, 170, 0.1), transparent 30rem),
    linear-gradient(315deg, rgba(223, 77, 69, 0.09), transparent 28rem),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 5rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: 1rem 1rem 1.5rem;
}

.topbar,
.status-strip,
.momentum-panel,
.join-row,
.players {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  padding: 0.25rem 0 0.75rem;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

h1 {
  margin: 0.1rem 0 0;
  font-size: 2.25rem;
  line-height: 1;
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.icon-button,
button {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sea);
  color: #06110f;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, filter 140ms ease;
}

button:active {
  transform: translateY(1px) scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35) brightness(0.72);
}

.icon-button {
  flex: 0 0 auto;
  width: 2.75rem;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.3rem;
}

.join-panel,
.status-strip,
.momentum-panel,
.players,
.message,
.activity {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(26, 32, 34, 0.94);
  padding: 0.75rem;
  box-shadow: 0 0.85rem 2.2rem rgba(0, 0, 0, 0.16);
}

.join-panel label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-weight: 700;
}

.join-row input {
  min-width: 0;
  flex: 1;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1115;
  color: var(--text);
  padding: 0 0.75rem;
}

.join-row button {
  width: 6rem;
}

.status-strip {
  justify-content: space-between;
  margin: 0.75rem 0;
}

.status-strip > div,
.momentum-panel > div {
  min-width: 0;
}

.status-strip strong,
.momentum-panel strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.momentum-panel {
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.momentum-panel strong:first-letter {
  text-transform: uppercase;
}

.arena {
  position: relative;
}

.column-controls {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.38rem;
  margin-bottom: 0.38rem;
}

.column-button {
  min-width: 0;
  min-height: 2.25rem;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.16);
  background: #151a20;
  color: var(--text);
}

.column-button.hot {
  border-color: var(--sea);
  background: color-mix(in srgb, var(--sea) 22%, #151a20);
}

.column-button.winning {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 26%, #151a20);
  box-shadow: 0 0 0 2px rgba(240, 191, 79, 0.18);
  animation: column-pulse 900ms ease-in-out infinite;
}

.column-button.blocker {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 20%, #151a20);
}

.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.38rem;
  aspect-ratio: 7 / 6;
  padding: 0.5rem;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 28%),
    var(--board);
  box-shadow:
    inset 0 -0.5rem 0 rgba(0, 0, 0, 0.18),
    0 1rem 2.5rem rgba(0, 0, 0, 0.24);
}

.cell {
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: inset 0 0.22rem 0 rgba(0, 0, 0, 0.28);
  transition: outline-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.cell.red {
  background: var(--red);
  box-shadow: inset 0 0.18rem 0 rgba(255, 255, 255, 0.18), inset 0 -0.25rem 0 rgba(0, 0, 0, 0.18);
}

.cell.gold {
  background: var(--gold);
  box-shadow: inset 0 0.18rem 0 rgba(255, 255, 255, 0.28), inset 0 -0.25rem 0 rgba(0, 0, 0, 0.18);
}

.cell.fresh {
  animation: drop-in 380ms cubic-bezier(0.2, 0.9, 0.28, 1.2);
}

.cell.pop {
  animation: pop 900ms ease-in-out infinite;
}

.cell.playable:hover {
  outline: 3px solid rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.board.my-turn {
  outline: 2px solid color-mix(in srgb, var(--sea) 72%, transparent);
  outline-offset: 0.25rem;
}

.board.finished {
  outline: 2px solid color-mix(in srgb, var(--gold) 72%, transparent);
  outline-offset: 0.25rem;
}

.board.rumble {
  animation: board-rumble 420ms ease-in-out;
}

.board.rumble .cell {
  animation: nervous 420ms ease-in-out;
}

.board.rumble .cell:nth-child(2n) {
  animation-delay: 40ms;
}

.board.rumble .cell:nth-child(3n) {
  animation-delay: 80ms;
}

.players {
  justify-content: space-between;
  margin-top: 0.75rem;
}

.player {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  min-width: 0;
  max-width: calc(50% - 0.4rem);
  color: var(--muted);
}

.player.active {
  color: var(--text);
}

.player strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--line);
}

.chip.red {
  background: var(--red);
}

.chip.gold {
  background: var(--gold);
}

.message {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.message.urgent {
  border-color: color-mix(in srgb, var(--sea) 70%, var(--line));
  color: var(--text);
}

.activity {
  margin-top: 0.75rem;
}

.activity-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.activity ol {
  display: grid;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.activity li:first-child {
  color: var(--text);
}

.celebration {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.surprise {
  pointer-events: none;
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  top: 48%;
  z-index: 2;
  min-height: 2.8rem;
  display: grid;
  place-items: center;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(11, 14, 19, 0.88);
  color: var(--text);
  font-weight: 900;
  text-align: center;
  opacity: 0;
  transform: translateY(-0.6rem) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35);
}

.surprise.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.surprise.trick {
  border-color: color-mix(in srgb, var(--violet) 70%, white);
}

.surprise.danger {
  border-color: var(--red);
}

.surprise.payoff {
  border-color: var(--gold);
}

.confetti {
  position: absolute;
  top: -0.5rem;
  width: 0.48rem;
  height: 0.85rem;
  border-radius: 2px;
  background: var(--sea);
  animation: confetti-fall 1100ms ease-out forwards;
}

.confetti:nth-child(3n) {
  background: var(--gold);
}

.confetti:nth-child(3n + 1) {
  background: var(--red);
}

.shake {
  animation: shake 180ms ease-in-out;
}

@keyframes drop-in {
  0% {
    opacity: 0.4;
    transform: translateY(-130%) scale(0.74);
  }
  72% {
    transform: translateY(5%) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pop {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes column-pulse {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes board-rumble {
  0%, 100% {
    transform: translateX(0) rotate(0deg);
  }
  20% {
    transform: translateX(-0.18rem) rotate(-0.4deg);
  }
  45% {
    transform: translateX(0.18rem) rotate(0.4deg);
  }
  70% {
    transform: translateX(-0.1rem) rotate(-0.2deg);
  }
}

@keyframes nervous {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.25);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(110%) rotate(260deg);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-0.35rem);
  }
  70% {
    transform: translateX(0.35rem);
  }
}

@media (max-width: 380px) {
  .shell {
    padding-inline: 0.75rem;
  }

  h1 {
    font-size: 1.9rem;
  }

  .tagline,
  .message,
  .activity {
    font-size: 0.92rem;
  }
}
