:root {
  --bg: #14181c;
  --panel: rgba(28, 34, 40, 0.94);
  --panel-border: #3c4652;
  --text: #e8eef4;
  --muted: #93a1b0;
  --accent: #2f7fd8;
  --accent-2: #1d5fa8;
  --danger: #c62828;
  --field: #245c2a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(1200px 700px at 50% -10%, #22303c 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px 14px;
}

#hud {
  width: min(100%, 1100px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.hud-team {
  font-size: clamp(14px, 2.4vw, 22px);
  font-weight: 700;
  color: #6fc8ff;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-team.hud-opponent { color: #ff8d8d; text-align: right; }

.hud-clock {
  background: #0c0f12;
  border: 3px solid #59636e;
  border-radius: 8px;
  padding: 2px 12px;
  box-shadow: inset 0 0 12px rgba(255, 210, 90, 0.25);
  font-family: "Consolas", monospace;
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 700;
  color: #ffd45a;
  letter-spacing: 2px;
  min-width: 74px;
  text-align: center;
}

#stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: clamp(18px, 3vw, 34px);
  width: min(92vw, 560px);
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.title {
  margin: 0 0 10px;
  font-size: clamp(26px, 5.2vw, 46px);
  letter-spacing: 2px;
  line-height: 0.95;
  color: #eef4fa;
  text-shadow: 0 3px 0 #1b2733, 0 8px 24px rgba(0, 0, 0, 0.55);
}

.title span {
  display: block;
  font-size: 0.42em;
  letter-spacing: 8px;
  color: #9fb4c7;
  margin-top: 6px;
}

h2 { margin: 0 0 12px; font-size: clamp(20px, 3.4vw, 30px); }

.muted { color: var(--muted); font-size: clamp(13px, 2vw, 16px); line-height: 1.45; margin: 0 0 14px; }

.menu-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

.btn {
  appearance: none;
  border: 1px solid #4c5b6b;
  background: linear-gradient(180deg, #3a4756 0%, #2b3541 100%);
  color: var(--text);
  font-size: clamp(15px, 2.2vw, 19px);
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
  user-select: none;
}

.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
  background: linear-gradient(180deg, #4a9bec 0%, var(--accent-2) 100%);
  border-color: #7cbcf5;
}

.rules { text-align: left; margin-top: 16px; border-top: 1px solid var(--panel-border); padding-top: 12px; }
.rules p { margin: 0 0 8px; color: #c6d3df; font-size: 14px; line-height: 1.4; }

.hint { color: var(--muted); font-size: 12.5px; line-height: 1.4; margin: 14px 0 0; }

.spinner {
  width: 42px;
  height: 42px;
  margin: 10px auto 18px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #6fc8ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.board-wrap {
  width: min(100%, 1100px);
  display: flex;
  justify-content: center;
  align-items: center;
}

#field {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 8 / 5;
  height: auto;
  max-height: 72vh;
  display: block;
  border-radius: 10px;
  touch-action: manipulation;
  cursor: pointer;
}

.game-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-controls .btn { padding: 10px 26px; }

#footer { margin-top: 8px; min-height: 18px; }

.status { color: var(--muted); font-size: 13px; }

#result-art { width: 130px; height: auto; margin-bottom: 8px; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.5)); }

@media (max-width: 700px) {
  #app { padding: 6px 6px 10px; }
  #field { max-height: 62vh; }
  .panel { width: 96vw; }
  .hud-clock { font-size: 18px; min-width: 60px; padding: 0 8px; }
}
