﻿@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Nunito:wght@600;700;800&display=swap');

:root {
  --blue-1: #0096df;
  --blue-2: #25b4ff;
  --blue-3: #0074c5;
  --ink: #072744;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  font-family: 'Nunito', sans-serif;
  background:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.2) 0%, transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(255,255,255,0.18) 0%, transparent 30%),
    linear-gradient(140deg, var(--blue-1), var(--blue-2) 45%, var(--blue-3));
}

.hidden { display: none !important; }

.entry-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.entry-card {
  width: min(480px, 92vw);
  background: rgba(0, 34, 66, 0.72);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
}

.entry-card h1 { margin: 0 0 8px; }
.entry-card p { margin: 0 0 12px; }
.entry-card input { width: 100%; margin-bottom: 10px; }
.legal-links {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.legal-links a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.legal-links a:hover {
  filter: brightness(1.08);
}

.legal-links-page {
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 10;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 18px;
  gap: 16px;
}

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

.brand {
  font-family: 'Bangers', cursive;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.85;
  letter-spacing: 1px;
  text-shadow: 0 5px 0 rgba(0,0,0,0.25);
}

.brand span {
  font-size: 0.6em;
  color: #ffe28a;
}

input, button {
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.95rem;
}

input {
  background: rgba(255,255,255,0.95);
  color: #0b2b48;
}

button {
  background: #ffce2f;
  color: #0a2d4a;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 0 #d09e00;
}

.secondary-btn {
  background: #ffffff;
  color: #0a2d4a;
  box-shadow: 0 6px 0 rgba(0,0,0,0.16);
}

button:hover { filter: brightness(1.05); }
button:active { transform: translateY(2px); box-shadow: 0 4px 0 #d09e00; }

.arena {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.35);
  min-height: 62vh;
}

.arena-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(115deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.06) 75%, transparent 75%, transparent);
  background-size: 120px 120px;
  opacity: 0.55;
}

.question-stage {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
  align-content: center;
  justify-items: center;
  height: 100%;
  padding: 20px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.meta-line span {
  background: rgba(0, 36, 70, 0.45);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
}

.question-box {
  width: min(1280px, 100%);
  display: grid;
  justify-items: center;
  text-align: center;
}

.mode-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.question-title {
  margin: 0 0 18px;
  font-size: clamp(1.4rem, 2.5vw, 2.1rem);
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0,0,0,0.24);
}

.question-media {
  width: min(720px, 100%);
  margin: 0 auto 16px;
}

.question-media img,
.question-media video {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 2px solid rgba(255,255,255,0.36);
  border-radius: 8px;
  background: rgba(0, 36, 70, 0.35);
  box-shadow: 0 10px 0 rgba(0,0,0,0.15);
}

.question-media-staged {
  width: min(820px, 100%);
}

.question-media-staged img {
  max-height: 420px;
  border-radius: 18px;
  object-fit: contain;
}

.staged-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: center;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.staged-media-col,
.staged-answers-col {
  min-width: 0;
}

.staged-media-col .question-media {
  width: 100%;
  margin: 0;
}

.staged-answers-col .answers-grid {
  grid-template-columns: 1fr;
}

.lobby-card {
  width: min(760px, 100%);
  display: grid;
  gap: 16px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 24px;
  background: rgba(0, 34, 66, 0.68);
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

.lobby-subtitle {
  margin: -8px 0 0;
  font-weight: 800;
}

.lobby-player-list {
  display: grid;
  gap: 10px;
}

.lobby-player-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  font-weight: 900;
}

.lobby-player-row.ready {
  background: rgba(68, 210, 132, 0.22);
  border-color: rgba(136, 255, 185, 0.45);
}

.lobby-player-row.waiting {
  background: rgba(255,255,255,0.1);
}

.countdown-screen,
.question-intro-screen {
  position: relative;
  overflow: hidden;
  width: min(960px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 0 auto;
  padding: 42px 28px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.22), transparent 38%),
    linear-gradient(160deg, rgba(0,32,72,0.8), rgba(0,117,188,0.78));
  border: 1px solid rgba(255,255,255,0.34);
  box-shadow: 0 24px 50px rgba(0,0,0,0.2);
  animation: introFadeIn 0.35s ease;
}

.countdown-badge {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  font-weight: 900;
}

.countdown-number {
  font-family: 'Bangers', cursive;
  font-size: clamp(5rem, 16vw, 9rem);
  line-height: 0.85;
  color: #ffe14d;
  text-shadow: 0 8px 0 rgba(0,0,0,0.18);
  animation: pulseBounce 0.7s ease infinite alternate;
}

.countdown-text,
.question-intro-subtitle {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.question-intro-title {
  margin: 0;
  font-family: 'Bangers', cursive;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  line-height: 0.92;
  color: #ffe14d;
  text-shadow: 0 6px 0 rgba(0,0,0,0.22);
}

.intro-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.intro-confetti span {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 24px;
  border-radius: 4px;
  opacity: 0.9;
  animation: confettiFall 2.2s linear infinite;
}

@keyframes confettiFall {
  from { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  to { transform: translateY(420px) rotate(260deg); opacity: 0; }
}

@keyframes pulseBounce {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

@keyframes introFadeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.battle-layout {
  display: grid;
  grid-template-columns: 190px minmax(560px, 1fr) 190px;
  gap: 12px;
  align-items: stretch;
  width: 100%;
}

.battle-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  padding: 12px;
  border: 2px solid rgba(255,255,255,0.32);
  border-radius: 8px;
  background: rgba(0, 45, 86, 0.46);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}

.battle-panel h3 {
  margin: 0;
  font-family: 'Bangers', cursive;
  font-size: 1.45rem;
  letter-spacing: 0;
  color: #ffe14d;
  text-shadow: 0 3px 0 rgba(0,0,0,0.2);
}

.battle-hp-list {
  display: grid;
  gap: 8px;
}

.battle-hp-row {
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.92);
  color: #07335b;
  text-align: left;
  box-shadow: 0 5px 0 rgba(0,0,0,0.14);
}

.battle-hp-row.self {
  outline: 3px solid #ffe14d;
}

.battle-hp-row.dead {
  opacity: 0.55;
  filter: grayscale(0.85);
}

.battle-hp-name {
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-hearts {
  color: #e9344e;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.battle-canvas-wrap {
  min-width: 0;
}

.battle-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  background: #1f9fe0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}

.battle-controls-panel {
  align-items: center;
  justify-content: center;
}

.control-keys {
  display: grid;
  grid-template-columns: repeat(3, 38px);
  gap: 6px;
  justify-content: center;
}

.control-combos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.control-layout-btn {
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  color: #ffffff;
  font-weight: 900;
  box-shadow: none;
  cursor: pointer;
}

.control-layout-btn.active {
  background: #ffffff;
  color: #07335b;
  box-shadow: 0 5px 0 rgba(0,0,0,0.18);
}

.control-layout-btn:hover {
  filter: brightness(1.08);
}

.control-keys kbd,
.mouse-control {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 8px;
  background: #ffffff;
  color: #07335b;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(0,0,0,0.18);
}

.mouse-control {
  width: 78px;
  margin-top: 8px;
}

.battle-controls-panel p {
  margin: 0;
  font-weight: 900;
}

.speed-counters {
  display: grid;
  gap: 4px;
  margin-top: 2px;
  margin-bottom: 4px;
  text-align: center;
  font-weight: 900;
}

.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  background: #ffffff;
  color: #08a4df;
  font-size: clamp(1.1rem, 2vw, 1.8rem);
  font-weight: 900;
  border-radius: 18px;
  min-height: 94px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.answer-btn:hover { transform: translateY(-2px); }
.answer-btn.selected { outline: 4px solid #ffe14d; filter: brightness(0.95); }
.answer-btn.locked { opacity: 0.72; }
.answer-btn.correct-answer {
  background: linear-gradient(180deg, #dfffe8, #84f2a8);
  color: #0f6e35;
  box-shadow: 0 10px 0 rgba(13, 111, 55, 0.28);
}
.answer-btn.wrong-answer {
  background: linear-gradient(180deg, #ffe3e3, #ff9c9c);
  color: #8f1f2b;
  box-shadow: 0 10px 0 rgba(128, 22, 36, 0.25);
}

.answer-letter {
  font-family: 'Bangers', cursive;
  font-size: 1.45em;
  color: #005488;
  min-width: 26px;
}

.bottombar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

#status {
  background: rgba(0, 28, 56, 0.42);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
}

#scoreboard {
  margin: 0;
  padding: 10px 14px 10px 28px;
  border-radius: 12px;
  background: rgba(0, 28, 56, 0.42);
  border: 1px solid rgba(255,255,255,0.22);
  max-height: 130px;
  overflow: auto;
}

.remote-cursor {
  position: absolute;
  z-index: 3;
  transform: translate(-2px, -2px);
  pointer-events: none;
}

.remote-cursor::before {
  content: '';
  width: 0;
  height: 0;
  display: block;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 18px solid #ffe14d;
  transform: rotate(-35deg);
}

.remote-label {
  margin-top: 2px;
  font-size: 11px;
  color: #082949;
  background: #ffe14d;
  border-radius: 8px;
  padding: 2px 6px;
  font-weight: 900;
}

.round-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 42, 76, 0.42);
  backdrop-filter: blur(3px);
}

.round-result-card {
  width: min(680px, 92vw);
  padding: 22px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.42);
  background: rgba(0, 111, 178, 0.92);
  box-shadow: 0 18px 0 rgba(0,0,0,0.18);
  text-align: center;
}

.round-result-card h2 {
  margin: 0;
  font-family: 'Bangers', cursive;
  font-size: 2.4rem;
  letter-spacing: 0;
  color: #ffe14d;
  text-shadow: 0 4px 0 rgba(0,0,0,0.24);
}

.personal-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 42, 76, 0.3);
  backdrop-filter: blur(2px);
  animation: introFadeIn 0.18s ease;
}

.personal-result-card {
  width: min(520px, 90vw);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  border-radius: 22px;
  border: 2px solid rgba(255,255,255,0.42);
  box-shadow: 0 18px 36px rgba(0,0,0,0.2);
}

.personal-result-overlay.won .personal-result-card {
  background: linear-gradient(180deg, rgba(23,155,73,0.94), rgba(10,109,51,0.94));
}

.personal-result-overlay.lost .personal-result-card {
  background: linear-gradient(180deg, rgba(216,61,78,0.94), rgba(132,23,38,0.94));
}

.personal-result-card h2 {
  margin: 0;
  font-family: 'Bangers', cursive;
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 0.9;
  color: #ffffff;
  text-shadow: 0 5px 0 rgba(0,0,0,0.22);
}

.final-results-screen {
  width: min(920px, 100%);
  display: grid;
  gap: 16px;
  padding: 30px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.22), transparent 34%),
    linear-gradient(165deg, rgba(0,36,70,0.82), rgba(0,110,176,0.86));
  border: 1px solid rgba(255,255,255,0.32);
  box-shadow: 0 22px 44px rgba(0,0,0,0.18);
}

.final-results-list {
  display: grid;
  gap: 10px;
}

.final-results-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
}

.final-results-row.self {
  outline: 3px solid #ffe14d;
  background: rgba(255,225,77,0.16);
}

.final-results-row.won {
  border-color: rgba(107, 255, 163, 0.42);
}

.final-results-rank {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  color: #ffe14d;
  text-align: center;
}

.final-results-main {
  display: grid;
  gap: 2px;
  text-align: left;
}

.final-results-main strong {
  font-size: 1.1rem;
}

.final-results-main span {
  font-size: 0.95rem;
  font-weight: 800;
  opacity: 0.88;
}

.final-results-score {
  font-weight: 900;
  font-size: 1.1rem;
  white-space: nowrap;
}

.round-result-card > p {
  margin: 6px 0 18px;
  font-weight: 900;
}

.round-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.round-result-list {
  min-height: 140px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.94);
  color: #082949;
}

.round-result-list h3 {
  margin: 0 0 10px;
  font-family: 'Bangers', cursive;
  font-size: 1.7rem;
  letter-spacing: 0;
}

.round-result-list.success h3 { color: #139b49; }
.round-result-list.failed h3 { color: #d83d4e; }

.round-result-player {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #e9f7ff;
  font-weight: 900;
}

.round-result-empty {
  margin: 18px 0 0;
  color: rgba(8, 41, 73, 0.66);
  font-weight: 800;
}

@media (max-width: 980px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .battle-layout { grid-template-columns: 1fr; }
  .staged-layout { grid-template-columns: 1fr; }
  .battle-panel { min-height: auto; }
  .answers-grid { grid-template-columns: 1fr; }
  .bottombar { grid-template-columns: 1fr; }
  .round-result-grid { grid-template-columns: 1fr; }
}
