:root {
  --bg-0: #0f172f;
  --bg-1: #1f2d5f;
  --bg-2: #2a4f92;
  --panel: rgba(9, 16, 42, 0.8);
  --card: rgba(16, 26, 58, 0.88);
  --line: rgba(148, 181, 255, 0.28);
  --ink: #edf3ff;
  --ink-soft: #b6c6ef;
  --hot: #ff9b2f;
  --hot-2: #ff4f52;
  --cool: #31d6c8;
  --cool-2: #78b5ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 0%, #4f7de5 0%, transparent 34%),
    radial-gradient(circle at 90% 100%, #2f6ad1 0%, transparent 30%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 54%, var(--bg-2));
}

.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.08) 0%,
    transparent 38%,
    rgba(72, 221, 255, 0.1) 56%,
    transparent 78%
  );
  animation: drift 14s linear infinite;
}

.fx-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 30;
}

.winner-banner {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  z-index: 40;
  width: min(92vw, 640px);
  border: 1px solid rgba(255, 210, 122, 0.5);
  background: linear-gradient(90deg, rgba(255, 139, 58, 0.95), rgba(255, 83, 86, 0.95));
  color: #fff8ee;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  text-align: center;
  font-family: "Archivo Black", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}

.winner-banner.show {
  animation: banner-show 1800ms ease;
}

.app-shell {
  width: min(1160px, 94vw);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.header {
  animation: rise 600ms ease;
}

.chip {
  display: inline-block;
  margin: 0;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(163, 215, 255, 0.45);
  background: rgba(35, 65, 130, 0.55);
}

h1,
h2 {
  margin: 0;
  font-family: "Archivo Black", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

h1 {
  margin-top: 0.45rem;
  font-size: clamp(2.3rem, 7vw, 5.2rem);
  line-height: 1;
  text-shadow: 0 0 20px rgba(120, 181, 255, 0.55);
}

h2 {
  font-size: clamp(1rem, 2.2vw, 1.3rem);
}

.lead {
  max-width: 72ch;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(1rem, 2vw, 1.3rem);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(4, 8, 27, 0.45);
  backdrop-filter: blur(8px);
}

.stacked-form {
  display: grid;
  gap: 0.55rem;
  max-width: 440px;
}

.compact {
  max-width: none;
}

label,
.metric,
.status {
  font-weight: 600;
  color: var(--ink-soft);
}

.status {
  margin-bottom: 0.7rem;
}

input {
  width: 100%;
  border-radius: 11px;
  border: 1px solid var(--line);
  padding: 0.72rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: rgba(12, 21, 52, 0.95);
}

input::placeholder {
  color: #8ea6df;
}

input:focus {
  outline: 2px solid rgba(49, 214, 200, 0.25);
  border-color: var(--cool);
}

.btn {
  border: 1px solid rgba(127, 175, 255, 0.4);
  border-radius: 999px;
  background: linear-gradient(160deg, #2d3a70, #1f2d5a);
  color: #eff5ff;
  font: inherit;
  font-weight: 700;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(12, 19, 41, 0.5);
}

.btn-primary {
  border-color: rgba(255, 188, 109, 0.5);
  color: #fff8ef;
  background: linear-gradient(120deg, var(--hot), var(--hot-2));
  box-shadow: 0 12px 26px rgba(255, 79, 82, 0.34);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-grid {
  margin-top: 0.35rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.9rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 0.95rem;
  animation: rise 500ms ease;
}

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

.badge {
  background: rgba(255, 196, 109, 0.16);
  border: 1px solid rgba(255, 196, 109, 0.5);
  color: #ffd089;
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 700;
}

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

.round-box {
  border: 1px solid rgba(120, 181, 255, 0.45);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.8rem;
  background: rgba(8, 18, 44, 0.55);
}

.clue-text {
  margin: 0.3rem 0 0.65rem;
  font-weight: 700;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.clue-pop {
  animation: clue-pop 520ms ease;
}

.clue-flash {
  animation: clue-flash 560ms ease;
}

.timer {
  display: inline-block;
  min-width: 1.7rem;
  text-align: center;
}

.timer.danger {
  color: #ffd07f;
  animation: timer-blink 700ms steps(1) infinite;
}

.assigned-word {
  margin: 0.3rem 0 0.75rem;
  border: 1px solid rgba(49, 214, 200, 0.5);
  background: rgba(29, 89, 96, 0.35);
  color: #8ee9e1;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font-weight: 700;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
}

.inline-form .btn {
  white-space: nowrap;
}

.side-card {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.pills,
.scoreboard,
.log-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.player-pill,
.score-row,
.log-list li {
  border: 1px solid rgba(120, 181, 255, 0.26);
  border-radius: 10px;
  background: rgba(16, 29, 63, 0.9);
  padding: 0.5rem 0.65rem;
}

.score-row {
  display: flex;
  justify-content: space-between;
}

.score-shake {
  animation: score-shake 420ms ease;
}

.log-card {
  grid-column: 1;
}

.confetti {
  position: absolute;
  top: -20px;
  left: var(--x);
  width: 10px;
  height: 16px;
  border-radius: 2px;
  background: hsl(var(--hue), 95%, 60%);
  transform: translateX(0);
  animation: confetti-fall 1500ms cubic-bezier(0.2, 0.8, 0.25, 1) var(--delay) forwards;
}

.hidden {
  display: none;
}

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

@keyframes drift {
  0% {
    transform: translateX(-7%);
  }
  100% {
    transform: translateX(7%);
  }
}

@keyframes clue-pop {
  0% {
    transform: translateY(5px) scale(0.98);
    opacity: 0;
  }
  60% {
    transform: translateY(0) scale(1.03);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes clue-flash {
  0% {
    box-shadow: 0 0 0 rgba(120, 181, 255, 0);
  }
  45% {
    box-shadow: 0 0 30px rgba(120, 181, 255, 0.45);
  }
  100% {
    box-shadow: 0 0 0 rgba(120, 181, 255, 0);
  }
}

@keyframes timer-blink {
  0% {
    text-shadow: 0 0 0 transparent;
  }
  50% {
    text-shadow: 0 0 10px rgba(255, 208, 127, 0.8);
  }
  100% {
    text-shadow: 0 0 0 transparent;
  }
}

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

@keyframes banner-show {
  0% {
    transform: translateX(-50%) translateY(-140%);
    opacity: 0;
  }
  15% {
    transform: translateX(-50%) translateY(0%);
    opacity: 1;
  }
  82% {
    transform: translateX(-50%) translateY(0%);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(-140%);
    opacity: 0;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateX(var(--drift)) translateY(110vh) rotate(460deg);
    opacity: 0.2;
  }
}

@media (max-width: 940px) {
  .game-grid {
    grid-template-columns: 1fr;
  }

  .side-card {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 600px) {
  .inline-form {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
