:root {
  --bg-1: #071122;
  --bg-2: #040812;
  --panel: rgba(10, 20, 36, 0.84);
  --panel-soft: rgba(16, 28, 48, 0.68);
  --panel-border: rgba(124, 164, 220, 0.24);
  --text: #eef4ff;
  --muted: #9eb2cf;
  --error: #ff7e95;
  --accent-red: #ff4d5f;
  --accent-yellow: #ffcf3a;
  --board-surface: #0f2f75;
  --board-shadow: #07142d;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Bahnschrift", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 0%, #12335f, var(--bg-1) 35%, var(--bg-2) 100%);
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(56, 217, 255, 0.18), transparent 32%),
    radial-gradient(circle at 86% 18%, rgba(255, 186, 64, 0.15), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.16), transparent 42%);
}

.app {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  padding: 12px;
}

.card {
  width: 100%;
  height: 100%;
  background: linear-gradient(140deg, var(--panel), var(--panel-soft));
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 14px;
  box-shadow:
    0 18px 34px rgba(2, 7, 18, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.setupCard {
  max-width: min(640px, 100%);
  margin: 0 auto;
  overflow: auto;
  padding: 20px;
}

.gameCard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(290px, 31vw, 390px);
  gap: 14px;
  overflow: hidden;
}

.boardColumn {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.sidePanel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 10px;
  overflow: auto;
  padding: 2px;
}

.hidden {
  display: none !important;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0.35px;
}

p {
  margin: 0;
}

.eyebrow {
  font-size: 0.76rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8ec9ff;
  margin-bottom: 6px;
}

label {
  display: block;
  margin: 14px 0 7px;
  font-weight: 700;
  color: #d6e6ff;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(150, 184, 230, 0.3);
  background: rgba(6, 14, 27, 0.68);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  border-color: rgba(56, 217, 255, 0.74);
  box-shadow: 0 0 0 3px rgba(56, 217, 255, 0.2);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(143, 175, 223, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(47, 78, 133, 0.86), rgba(25, 45, 80, 0.9));
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(6, 19, 42, 0.55);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button.primary {
  border: 1px solid rgba(124, 219, 255, 0.78);
  color: #021421;
  font-weight: 700;
  background: linear-gradient(180deg, #8df0ff, #36bfff);
}

button i {
  font-size: 0.95rem;
  line-height: 1;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.row > input {
  flex: 1;
}

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

.info {
  min-height: 22px;
  margin-top: 12px;
  color: var(--error);
}

.gameHeader {
  display: grid;
  gap: 5px;
}

.inviteBox {
  background: rgba(8, 16, 30, 0.5);
  border: 1px solid rgba(141, 176, 228, 0.24);
  border-radius: 14px;
  padding: 10px;
}

.inviteLabel {
  color: #9ec5ff;
  font-size: 0.78rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.inviteBox .row {
  margin-top: 8px;
}

.turnBanner {
  border-radius: 16px;
  border: 1px solid rgba(145, 178, 226, 0.3);
  padding: 12px 14px;
  background: linear-gradient(140deg, rgba(13, 28, 48, 0.86), rgba(12, 23, 39, 0.82));
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}

.turnBanner.isWaiting {
  border-color: rgba(140, 166, 199, 0.42);
}

.turnBanner.isEnemyTurn {
  border-color: rgba(243, 196, 71, 0.5);
}

.turnBanner.isYourTurn {
  border-color: rgba(56, 217, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(56, 217, 255, 0.22),
    0 0 24px rgba(56, 217, 255, 0.34);
  animation: yourTurnPulse 1.25s ease-in-out infinite;
}

.turnBanner.isFinished {
  border-color: rgba(141, 162, 193, 0.46);
}

.turnBanner.isError {
  border-color: rgba(255, 115, 140, 0.92);
  box-shadow: 0 0 20px rgba(255, 115, 140, 0.42);
}

.turnText {
  font-size: clamp(1.05rem, 1.9vw, 1.4rem);
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.status {
  margin-top: 4px;
  color: #c8d8ef;
  min-height: 20px;
  font-size: 0.94rem;
}

.playerStrip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.playerBadge {
  border-radius: 14px;
  border: 1px solid rgba(148, 177, 220, 0.3);
  background: rgba(9, 19, 36, 0.58);
  padding: 9px 12px;
  min-height: 68px;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.playerBadge.isRed {
  border-color: rgba(255, 129, 143, 0.52);
}

.playerBadge.isYellow {
  border-color: rgba(255, 213, 105, 0.52);
}

.playerBadge.active {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(4, 11, 22, 0.45);
}

.badgeLabel {
  font-size: 0.74rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #91b9f0;
}

.badgeDetail {
  margin-top: 5px;
  font-size: 0.96rem;
  font-weight: 700;
}

.boardWrap {
  --board-gap: 8px;
  --board-pad: 10px;
  --board-size: min(100%, calc((100vh - 190px) * 1.16));
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(150deg, rgba(11, 31, 67, 0.96), rgba(10, 21, 43, 0.94)),
    radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.1), transparent 55%);
  border: 1px solid rgba(117, 157, 214, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 30px rgba(1, 6, 16, 0.55);
}

.controls {
  width: var(--board-size);
  margin: 0 auto 10px;
  padding: 0 var(--board-pad);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--board-gap);
}

.dropBtn {
  border-radius: 999px;
  border: 1px solid rgba(130, 222, 255, 0.82);
  color: #04172a;
  background: linear-gradient(180deg, #b0f3ff, #49c9ff);
  min-height: 38px;
  padding: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 8px 18px rgba(2, 28, 53, 0.36);
}

.dropBtn i {
  font-size: 1rem;
}

.dropBtn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 12px 22px rgba(2, 28, 53, 0.45);
}

.board {
  flex: 1;
  min-height: 0;
  width: var(--board-size);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--board-gap);
  background: linear-gradient(180deg, var(--board-surface), #0d2861);
  border-radius: 14px;
  padding: var(--board-pad);
  box-shadow: inset 0 7px 16px rgba(3, 12, 28, 0.52);
}

.cell {
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #1d4ca2, var(--board-shadow) 68%);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.08);
  padding: 4px;
}

.disc {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 999px;
  background: radial-gradient(circle at 34% 30%, #0b172d, #050b18 68%);
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.06);
}

.disc.red {
  background: radial-gradient(circle at 32% 28%, #ff93a0, var(--accent-red) 58%, #b51a2c 100%);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.35),
    0 0 18px rgba(255, 77, 95, 0.6);
}

.disc.yellow {
  background: radial-gradient(circle at 32% 28%, #ffe9a7, var(--accent-yellow) 58%, #b58101 100%);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.34),
    0 0 18px rgba(255, 207, 58, 0.5);
}

.disc.dropIn {
  animation: dropIn 0.36s ease;
}

.restartBar {
  display: grid;
  gap: 8px;
}

@keyframes yourTurnPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(56, 217, 255, 0.2),
      0 0 18px rgba(56, 217, 255, 0.24);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(56, 217, 255, 0.28),
      0 0 34px rgba(56, 217, 255, 0.46);
  }
}

@keyframes dropIn {
  0% {
    transform: translateY(-16px) scale(0.86);
    opacity: 0.12;
  }
  78% {
    transform: translateY(2px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .gameCard {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 35vw);
  }

  .inviteBox .row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .app {
    padding: 8px;
  }

  .card {
    border-radius: 16px;
    padding: 10px;
  }

  .setupCard .row {
    flex-direction: column;
    align-items: stretch;
  }

  .gameCard {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 40vw);
    gap: 8px;
  }

  .boardWrap {
    --board-gap: 5px;
    --board-pad: 7px;
  }
}
