:root {
  color-scheme: dark;
  --bg: #05070c;
  --cabinet: #0b0f18;
  --cabinet-light: #192131;
  --screen: #071626;
  --screen-dark: #02060a;
  --grid: #131923;
  --grid-edge: #2c3745;
  --blue: #1097ff;
  --red: #ff352f;
  --gold: #ffc928;
  --ink: #fff7e6;
  --muted: #9db3c9;
  --green: #41d39a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 18% 4%, rgba(16, 151, 255, 0.22), transparent 30%),
    radial-gradient(circle at 82% 4%, rgba(255, 53, 47, 0.2), transparent 30%),
    linear-gradient(180deg, #020306 0%, #05070c 42%, #000 100%);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  min-height: 44px;
  padding: 0 14px;
  color: #211408;
  background: var(--gold);
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}

button:hover {
  filter: brightness(1.06);
}

button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.app {
  width: min(1540px, calc(100vw - 16px));
  margin: 0 auto;
  padding: 10px 0 22px;
}

.marquee {
  position: relative;
  min-height: clamp(160px, 20vw, 300px);
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(16, 151, 255, 0.18), transparent 34%, transparent 66%, rgba(255, 53, 47, 0.18));
  box-shadow:
    0 20px 52px rgba(0, 0, 0, 0.62);
}

.eyebrow,
.label,
label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.logo-wrap {
  min-width: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: visible;
}

.game-logo {
  display: block;
  width: min(1500px, 100vw);
  height: clamp(150px, 20vw, 300px);
  object-fit: contain;
  filter:
    drop-shadow(0 0 24px rgba(16, 151, 255, 0.42))
    drop-shadow(0 0 24px rgba(255, 53, 47, 0.36));
}

.room-box {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(210px, 32vw);
  display: grid;
  gap: 6px;
  opacity: 0.72;
}

input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--ink);
  font-weight: 800;
}

.machine {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 4px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(128px, 170px)) minmax(150px, 200px) minmax(124px, 160px);
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(16, 151, 255, 0.1), rgba(0, 0, 0, 0.72), rgba(255, 53, 47, 0.1)),
    #07090e;
}

.status,
.turn {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border-radius: 6px;
  background: #090706;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status strong,
.turn strong {
  font-size: 19px;
  line-height: 1.15;
}

.players {
  display: contents;
}

#join-one {
  background: var(--blue);
  color: #fff6f0;
}

#join-two {
  background: var(--red);
  color: #fff6f0;
}

#play-computer {
  background: linear-gradient(180deg, #ffe283, #d59513);
  color: #211408;
}

.reset {
  background: var(--green);
}

.screen {
  min-height: 0;
  padding: 10px 0 20px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.08), transparent 42%);
  box-shadow: none;
}

.table-head {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 170px 1fr 170px;
  gap: 10px;
  align-items: stretch;
  margin: 0 auto 10px;
}

.player-card,
.turn-plate {
  min-height: 118px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
  padding: 12px;
}

.player-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  text-align: center;
}

.player-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.player-card strong {
  font-size: 15px;
}

.blue-card {
  box-shadow: inset 0 0 24px rgba(16, 151, 255, 0.26);
}

.red-card {
  box-shadow: inset 0 0 24px rgba(255, 53, 47, 0.25);
}

.turn-plate {
  display: grid;
  place-items: center;
  text-align: center;
}

#turn-label {
  color: var(--gold);
  font-size: clamp(22px, 3.6vw, 46px);
  font-weight: 950;
  font-style: italic;
  text-transform: uppercase;
  text-shadow:
    0 0 16px rgba(255, 201, 40, 0.88),
    0 4px 0 rgba(0, 0, 0, 0.42);
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: clamp(10px, 1.1vw, 18px);
  aspect-ratio: 1.16 / 1;
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: clamp(30px, 3.2vw, 48px) clamp(48px, 5vw, 72px);
  border-radius: 18px;
  border-top: clamp(28px, 3.1vw, 44px) solid #32363c;
  border-bottom: clamp(34px, 3.6vw, 52px) solid #15181d;
  border-left: clamp(34px, 3.5vw, 52px) solid #083f94;
  border-right: clamp(34px, 3.5vw, 52px) solid #96110f;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 4%, transparent 92%, rgba(255, 255, 255, 0.08)),
    radial-gradient(circle at 50% 43%, rgba(255, 255, 255, 0.06), transparent 54%),
    linear-gradient(180deg, #3a3d42 0%, #25282d 38%, #171a1f 100%);
  box-shadow:
    inset 0 0 0 4px #090b0e,
    inset 0 0 0 7px rgba(255, 255, 255, 0.08),
    inset 0 -22px 28px rgba(0, 0, 0, 0.42),
    -14px 0 22px rgba(16, 151, 255, 0.5),
    14px 0 22px rgba(255, 53, 47, 0.44),
    0 30px 54px rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.board::before,
.board::after {
  content: "";
  position: absolute;
  top: -18px;
  bottom: -18px;
  width: clamp(18px, 1.8vw, 28px);
  border-radius: 999px;
  opacity: 0.58;
  transition: opacity 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  pointer-events: none;
}

.board::before {
  left: -22px;
  background: linear-gradient(90deg, #003073, #087cff 42%, #8fdcff 52%, #087cff 62%, #001f57);
  box-shadow: 0 0 18px rgba(16, 151, 255, 0.68);
}

.board::after {
  right: -22px;
  background: linear-gradient(90deg, #5a0705, #ff352f 42%, #ffaaa4 52%, #ff352f 62%, #5a0705);
  box-shadow: 0 0 18px rgba(255, 53, 47, 0.62);
}

.turn-blue .board::before,
.turn-red .board::after {
  opacity: 1;
  filter: brightness(1.35);
  box-shadow: 0 0 12px currentColor, 0 0 34px currentColor, 0 0 58px currentColor;
}

.turn-blue .board::before {
  color: rgba(16, 151, 255, 0.95);
}

.turn-red .board::after {
  color: rgba(255, 53, 47, 0.95);
}

.turn-blue .blue-card,
.turn-red .red-card {
  border-color: rgba(255, 255, 255, 0.36);
  transform: translateY(-2px);
}

.turn-blue .blue-card {
  box-shadow: inset 0 0 24px rgba(16, 151, 255, 0.42), 0 0 22px rgba(16, 151, 255, 0.48);
}

.turn-red .red-card {
  box-shadow: inset 0 0 24px rgba(255, 53, 47, 0.38), 0 0 22px rgba(255, 53, 47, 0.44);
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #050607 0 56%, #12161a 59%, #0a0c0f 64%, transparent 66%),
    radial-gradient(circle at 35% 28%, #2c3036, #090b0e 74%);
  box-shadow:
    inset 0 14px 22px rgba(0, 0, 0, 0.9),
    inset 0 -2px 2px rgba(255, 255, 255, 0.18),
    0 -2px 2px rgba(255, 255, 255, 0.32),
    0 4px 5px rgba(0, 0, 0, 0.74),
    0 0 0 4px #050607,
    0 0 0 7px #5d636d,
    0 0 0 9px #111419;
  transition: filter 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.cell.playable {
  cursor: pointer;
}

.board:has(.cell.playable:hover) .cell.playable:hover,
.cell.playable:hover {
  filter: brightness(1.26);
  box-shadow:
    inset 0 10px 16px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(255, 255, 255, 0.34);
}

.cell.blue {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), transparent 30%),
    radial-gradient(circle at 42% 28%, #4bbcff 0 16%, #086fff 40%, #003da5 70%, #00194d 100%);
  box-shadow:
    inset 0 11px 8px rgba(255, 255, 255, 0.28),
    inset 0 -13px 16px rgba(0, 0, 0, 0.42),
    0 0 0 3px #001940,
    0 0 0 6px #168eff,
    0 0 22px rgba(16, 151, 255, 0.92);
}

.cell.red {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), transparent 30%),
    radial-gradient(circle at 42% 28%, #ff8278 0 15%, #ff352f 40%, #a80d0a 70%, #4a0200 100%);
  box-shadow:
    inset 0 11px 8px rgba(255, 255, 255, 0.24),
    inset 0 -13px 16px rgba(0, 0, 0, 0.42),
    0 0 0 3px #3a0302,
    0 0 0 6px #ff4a42,
    0 0 22px rgba(255, 53, 47, 0.88);
}

.cell.blue::after,
.cell.red::after,
.sample-token {
  color: rgba(4, 8, 18, 0.42);
  font-weight: 950;
  font-style: italic;
  text-shadow:
    -2px -2px 0 rgba(255, 255, 255, 0.26),
    2px 3px 0 rgba(0, 0, 0, 0.78),
    0 0 7px rgba(255, 255, 255, 0.16);
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.18);
}

.cell.blue::after {
  content: "B";
}

.cell.red::after {
  content: "R";
}

.cell::after {
  font-size: clamp(28px, 4.1vw, 58px);
  line-height: 1;
}

.sample-token {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 42px;
  box-shadow:
    inset 0 10px 8px rgba(255, 255, 255, 0.24),
    inset 0 -12px 14px rgba(0, 0, 0, 0.38),
    0 10px 18px rgba(0, 0, 0, 0.36);
}

.blue-token {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), transparent 30%),
    radial-gradient(circle at 42% 28%, #4bbcff 0 16%, #086fff 40%, #003da5 70%, #00194d 100%);
}

.red-token {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), transparent 30%),
    radial-gradient(circle at 42% 28%, #ff8278 0 15%, #ff352f 40%, #a80d0a 70%, #4a0200 100%);
}

.cell.win {
  outline: 5px solid #ffffff;
  outline-offset: -5px;
}

.cell.falling {
  animation: coin-drop 460ms cubic-bezier(0.2, 0.8, 0.22, 1.12);
  z-index: 2;
}

@keyframes coin-drop {
  0% {
    transform: translateY(calc(-1 * var(--drop-rows) * 118%)) scale(0.94);
    filter: brightness(1.45);
  }
  72% {
    transform: translateY(8%) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 880px) {
  .marquee,
  .machine,
  .table-head {
    grid-template-columns: 1fr;
  }

  .marquee {
    display: grid;
  }

  .screen {
    min-height: auto;
    padding: 12px;
  }

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

  .status,
  .turn,
  .reset {
    grid-column: 1 / -1;
  }

  .board {
    gap: 6px;
    padding: 20px 26px;
  }
}
