:root {
  --bg: #0b1020;
  --bg-2: #121a2d;
  --panel: #1a2338;
  --panel-soft: #222e45;
  --primary: #5dd6ff;
  --primary-strong: #1ea7d9;
  --gold: #ffd166;
  --green: #4ec38d;
  --red: #ff6b6b;
  --text: #edf4ff;
  --muted: #9db2d0;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top, rgba(93, 214, 255, 0.20), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 209, 102, 0.12), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

button,
textarea,
select {
  font: inherit;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  font-size: 0.72rem;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 3vw, 3rem);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
}

.panel {
  background: rgba(26, 35, 56, 0.88);
  border: 1px solid rgba(157, 178, 208, 0.18);
  border-radius: 18px;
  box-shadow: 0 18px 40px var(--shadow);
}

.team-panel {
  padding: 20px;
}

.team-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.team-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

textarea,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(157, 178, 208, 0.22);
  background: rgba(10, 16, 27, 0.72);
  color: var(--text);
  padding: 12px 14px;
}

button {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  font-weight: 700;
}

button:hover {
  transform: translateY(-1px);
}

.primary-btn,
.secondary-btn,
.success-btn,
.danger-btn {
  padding: 12px 16px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #04131c;
}

.secondary-btn {
  background: rgba(157, 178, 208, 0.15);
  color: var(--text);
}

.success-btn {
  background: linear-gradient(135deg, #5ae0a2, var(--green));
  color: #061a10;
}

.danger-btn {
  background: linear-gradient(135deg, #ff8a8a, var(--red));
  color: #22090c;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-card {
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(157, 178, 208, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.team-card.active {
  border-color: rgba(93, 214, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(93, 214, 255, 0.5), 0 0 18px rgba(93, 214, 255, 0.18);
  transform: translateX(2px);
  animation: teamPulse 1.25s ease-in-out infinite alternate;
}

.team-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.team-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.token-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.token-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.2), rgba(255, 152, 87, 0.14));
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.22);
  animation: tokenGlow 1.8s ease-in-out infinite alternate;
}

.main-panel {
  padding: 22px;
}

.controls-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.host-status {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(93, 214, 255, 0.22);
  background: rgba(93, 214, 255, 0.08);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}

.challenge-card {
  animation: pulseIn 0.35s ease;
}

.challenge-graphic {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 18px;
}

.challenge-graphic svg {
  width: min(480px, 100%);
  border-radius: 16px;
  border: 1px solid rgba(157, 178, 208, 0.18);
  background: rgba(8, 19, 30, 0.7);
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 18px;
  background: rgba(10, 16, 27, 0.65);
  border-radius: 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(157, 178, 208, 0.16);
}

.label {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.challenge-card {
  position: relative;
  border-radius: 18px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(41, 58, 82, 0.92), rgba(17, 27, 42, 0.94));
  border: 1px solid rgba(157, 178, 208, 0.18);
  min-height: 280px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 18px 40px rgba(4, 12, 20, 0.38);
}

.challenge-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(93, 214, 255, 0.06), transparent 35%, rgba(255, 209, 102, 0.04));
  pointer-events: none;
}

.challenge-card > * {
  position: relative;
  z-index: 1;
}

.challenge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(93, 214, 255, 0.12);
  border: 1px solid rgba(93, 214, 255, 0.24);
  color: var(--primary);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.challenge-card h2 {
  font-size: clamp(1.7rem, 2vw, 2.5rem);
  margin-bottom: 14px;
}

.challenge-card p {
  color: var(--text);
  line-height: 1.65;
}

.challenge-media {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.challenge-media img {
  max-width: min(480px, 100%);
  border-radius: 14px;
  border: 1px solid rgba(157, 178, 208, 0.2);
  background: rgba(10, 16, 27, 0.5);
}

.answer-area,
.reveal-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(157, 178, 208, 0.18);
  background: rgba(12, 18, 31, 0.52);
}

.answer-area label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.answer-actions,
.mark-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.answer-reveal {
  margin-top: 8px;
  line-height: 1.7;
  color: var(--text);
  font-size: 1.05rem;
}

.hidden {
  display: none;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

@keyframes pulseIn {
  0% {
    opacity: 0.5;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes teamPulse {
  0% {
    box-shadow: inset 0 0 0 1px rgba(93, 214, 255, 0.5), 0 0 18px rgba(93, 214, 255, 0.10);
  }
  100% {
    box-shadow: inset 0 0 0 1px rgba(93, 214, 255, 0.8), 0 0 26px rgba(93, 214, 255, 0.25);
  }
}

@keyframes tokenGlow {
  0% {
    transform: scale(1);
    box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.18);
  }
  100% {
    transform: scale(1.05);
    box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.26), 0 0 14px rgba(255, 209, 102, 0.22);
  }
}

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

  .status-bar {
    grid-template-columns: 1fr;
  }
}
