﻿:root {
  --bg: #030914;
  --bg-2: #081226;
  --bg-3: #0f1f3a;
  --line: rgba(154, 186, 255, 0.18);
  --line-strong: rgba(154, 186, 255, 0.38);
  --text: #e8f0ff;
  --muted: #95a8c7;
  --accent: #53a8ff;
  --accent-2: #7fd2ff;
  --ok: #44e3a3;
  --warn: #ff5f6d;
  --gold: #ffd264;
  --panel: rgba(6, 17, 34, 0.72);
  --panel-strong: rgba(6, 17, 34, 0.92);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 15%, #12336b 0%, transparent 32%),
    radial-gradient(circle at 85% 8%, #123b6f 0%, transparent 26%),
    linear-gradient(170deg, var(--bg-3) 0%, var(--bg-2) 42%, var(--bg) 100%);
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(90, 170, 255, 0.15) 0.8px, transparent 0.8px),
    radial-gradient(circle, rgba(90, 170, 255, 0.08) 1.2px, transparent 1.2px);
  background-size: 26px 26px, 55px 55px;
  background-position: 0 0, 12px 14px;
  opacity: 0.38;
  animation: drift-grid 18s linear infinite;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 95vw);
  margin: 22px auto;
  display: grid;
  gap: 14px;
}

.panel,
.topbar,
.system-strip,
.chips-row {
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 37, 69, 0.34), rgba(5, 15, 31, 0.82));
  backdrop-filter: blur(7px);
}

.topbar {
  padding: 16px 18px;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 16px;
}

.kicker {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.ghost-btn,
.primary-btn,
.admin-actions button {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(83, 168, 255, 0.1);
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.ghost-btn {
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.84rem;
}

.corner-logout {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 65;
}

.ghost-btn:hover,
.primary-btn:hover,
.admin-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(160, 210, 255, 0.9);
  box-shadow: 0 8px 20px rgba(35, 109, 189, 0.28);
}

.hidden {
  display: none !important;
}

.chips-row {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.chip {
  padding: 9px 12px;
  border-radius: 12px;
  border: none;
  background: rgba(7, 19, 39, 0.78);
  font-size: clamp(0.78rem, 1.1vw, 0.9rem);
  color: #cee2ff;
}

.chip.win {
  background: linear-gradient(180deg, rgba(255, 210, 100, 0.2), rgba(80, 44, 0, 0.55));
}

.main-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

.app-shell.player-view .main-grid {
  grid-template-columns: 1fr;
}

.app-shell.player-view .buzzer-panel {
  width: min(900px, 100%);
  justify-self: center;
}

.panel {
  padding: 16px;
}

.panel-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.buzzer-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 292px;
}

.buzz-btn {
  width: min(290px, 75vw);
  aspect-ratio: 1;
  border: 2px solid rgba(145, 206, 255, 0.9);
  border-radius: 50%;
  color: #eff8ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(2.2rem, 5vw, 3.3rem);
  font-weight: 700;
  background: radial-gradient(circle at 30% 25%, rgba(125, 214, 255, 0.32), rgba(52, 117, 193, 0.42) 45%, rgba(13, 43, 84, 0.95) 100%);
  box-shadow: 0 10px 35px rgba(60, 142, 230, 0.34), inset 0 0 35px rgba(171, 226, 255, 0.2);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.buzz-btn:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 14px 45px rgba(60, 142, 230, 0.48), inset 0 0 42px rgba(171, 226, 255, 0.24);
}

.buzz-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.buzz-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.3);
  opacity: 0.42;
}

.fine-print {
  font-size: 0.8rem;
  color: #abc0df;
}

.admin-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-actions button {
  border-radius: 10px;
  padding: 10px;
  font-size: 0.88rem;
}

.admin-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.admin-actions button.warn {
  border-color: rgba(255, 100, 120, 0.65);
  background: rgba(255, 74, 96, 0.13);
}

#adminInfo {
  margin-top: 10px;
  min-height: 1.2em;
}

.players-panel {
  display: grid;
  gap: 12px;
}

.players-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.players-head p {
  color: var(--muted);
  font-size: 0.88rem;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.player-card {
  border: none;
  background: linear-gradient(180deg, rgba(14, 32, 58, 0.7), rgba(5, 14, 30, 0.9));
  border-radius: 13px;
  padding: 10px;
  display: grid;
  gap: 8px;
  transition: transform 140ms ease, border-color 140ms ease, opacity 180ms ease;
}

.player-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.player-name {
  font-size: 1rem;
  font-weight: 700;
}

.player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6e809e;
}

.player-dot.online {
  background: #4ef6ac;
  box-shadow: 0 0 12px rgba(78, 246, 172, 0.8);
}

.player-metrics {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #d7e8ff;
  font-size: 0.92rem;
}

.life-row {
  display: flex;
  gap: 5px;
}

.life {
  color: var(--warn);
  opacity: 0.92;
}

.life.off {
  color: #5d728f;
}

.player-status {
  font-size: 0.8rem;
  color: #b2c7e7;
  min-height: 1.2em;
}

.player-card.eliminated {
  opacity: 0.56;
  filter: grayscale(0.65);
}

.player-card.winner {
  box-shadow: 0 0 28px rgba(255, 210, 100, 0.26);
}

.player-card.winner-glow {
  animation: winner-glow 1.8s ease-in-out infinite;
}

.player-card.life-loss {
  animation: life-loss 850ms ease;
}

.player-card.elim-fx {
  animation: elimination-hit 1200ms ease;
}

.system-strip {
  padding: 11px 15px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.86rem;
  color: #d5e6ff;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.login-overlay {
  background: #020816;
}

body.auth-locked .app-shell,
body.auth-locked .corner-logout,
body.auth-locked .bg-layer {
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  width: min(460px, 92vw);
  border: none;
  border-radius: 18px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(16, 38, 69, 0.9), rgba(6, 15, 29, 0.95));
  display: grid;
  gap: 10px;
}

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

#authForm {
  display: grid;
  gap: 7px;
}

#authForm label {
  font-size: 0.86rem;
  color: #c9dcf8;
}

#authForm input {
  border: 1px solid rgba(156, 199, 255, 0.42);
  border-radius: 10px;
  background: rgba(4, 14, 31, 0.86);
  color: var(--text);
  font-family: inherit;
  padding: 10px 12px;
}

#authForm input:focus {
  outline: none;
  border-color: rgba(177, 219, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(83, 168, 255, 0.2);
}

.primary-btn {
  border-radius: 10px;
  padding: 11px;
  margin-top: 6px;
  font-size: 0.95rem;
}

.text-btn {
  justify-self: start;
  border: none;
  background: transparent;
  color: var(--accent-2);
  font-size: 0.9rem;
  padding: 0;
  cursor: pointer;
}

.text-btn:hover {
  text-decoration: underline;
}

.small-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-message {
  border-top: 1px solid rgba(145, 196, 255, 0.2);
  padding-top: 10px;
  min-height: 1.2em;
  font-size: 0.86rem;
}

.buzz-overlay {
  background: rgba(0, 0, 0, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.buzz-overlay.active {
  opacity: 1;
}

.buzz-overlay p {
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: "IBM Plex Mono", monospace;
}

.buzz-overlay h2 {
  font-size: clamp(2rem, 6vw, 4.4rem);
}

.buzz-ring {
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  border: 2px solid rgba(154, 216, 255, 0.8);
  box-shadow: 0 0 50px rgba(115, 204, 255, 0.4), inset 0 0 50px rgba(115, 204, 255, 0.22);
  animation: buzz-ring 820ms ease-out infinite;
}

.victory-overlay {
  background: radial-gradient(circle at 50% 25%, rgba(255, 205, 95, 0.18), transparent 38%),
    linear-gradient(165deg, rgba(30, 20, 5, 0.98) 0%, rgba(5, 8, 16, 0.98) 72%);
  backdrop-filter: blur(8px);
  z-index: 50;
}

.victory-card {
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(95, 63, 12, 0.76), rgba(30, 20, 5, 0.92));
  padding: 22px;
  width: min(500px, 92vw);
  text-align: center;
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.5);
  animation: victory-card-rise 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.victory-card p:first-child {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #ffe2a9;
  font-family: "IBM Plex Mono", monospace;
}

#victoryName {
  margin-top: 8px;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

#victoryReason {
  margin-top: 10px;
  color: #ffedc2;
}

.elimination-overlay {
  background: radial-gradient(circle at 50% 22%, rgba(255, 90, 110, 0.16), transparent 36%),
    linear-gradient(165deg, rgba(35, 8, 15, 0.98) 0%, rgba(6, 8, 16, 0.98) 75%);
  backdrop-filter: blur(8px);
  z-index: 49;
}

.elimination-card {
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(125, 34, 50, 0.76), rgba(38, 10, 19, 0.93));
  padding: 22px;
  width: min(500px, 92vw);
  text-align: center;
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.52);
  animation: elimination-card-rise 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.elimination-card p:first-child {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #ffb7c1;
  font-family: "IBM Plex Mono", monospace;
}

#eliminationName {
  margin-top: 8px;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

#eliminationReason {
  margin-top: 10px;
  color: #ffd3da;
}

@keyframes drift-grid {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(26px);
  }
}

@keyframes buzz-ring {
  0% {
    transform: scale(0.7);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes life-loss {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes elimination-hit {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(0.96);
  }
}

@keyframes winner-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 210, 100, 0.22);
  }
  50% {
    box-shadow: 0 0 36px rgba(255, 210, 100, 0.4);
  }
}

@keyframes victory-card-rise {
  0% {
    transform: translateY(18px) scale(0.97);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes elimination-card-rise {
  0% {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 1000px) {
  .chips-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .players-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .players-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: 96vw;
    margin: 12px auto;
    gap: 10px;
  }

  .topbar {
    padding: 13px 14px;
    flex-direction: column;
  }

  .corner-logout {
    top: 10px;
    right: 10px;
  }

  .chips-row {
    grid-template-columns: 1fr;
  }

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

  .admin-actions {
    grid-template-columns: 1fr;
  }

  .buzz-ring {
    width: 260px;
    height: 260px;
  }
}
