:root {
  --accent-primary: #9aa3ad;
  --bg: #0b0d10;
  --surface: #121519;
  --surface-strong: #1b2027;
  --border: #2b3138;
  --text: #e6e9ee;
  --text-dim: #9aa3ad;
  --text-muted: #7a838c;
  --success: #9fc9b8;
  --warning: #d7b36a;
  --danger: #d68c8c;
  --glow: rgba(154, 163, 173, 0.2);
  --hud-height: 120px;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: radial-gradient(circle at top, #141821, var(--bg) 55%);
  color: var(--text);
  font-family: "Inter", "SF Pro Text", system-ui, sans-serif;
  overflow: hidden;
  touch-action: none;
}

body.reduced-motion * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.hud {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr 1fr;
  gap: 16px;
  padding: 18px 24px 8px;
  background: linear-gradient(180deg, rgba(9, 12, 16, 0.95), rgba(9, 12, 16, 0.6));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hud-back {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hud-back:hover {
  color: var(--text);
}

.hud-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-title h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hud-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.hud-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 56px;
  justify-content: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

.hud-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.action-row {
  display: flex;
  gap: 10px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.btn:hover {
  border-color: var(--accent-primary);
  background: var(--surface-strong);
}

.btn.primary {
  background: rgba(154, 163, 173, 0.18);
  border-color: var(--accent-primary);
}

.btn.ghost {
  background: transparent;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.pill.active {
  border-color: var(--accent-primary);
  color: var(--text);
  background: rgba(154, 163, 173, 0.16);
}

.mode-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 15, 19, 0.8);
  backdrop-filter: blur(12px);
}

.mode-row .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.arena {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
  background: radial-gradient(circle at center, rgba(154, 163, 173, 0.1), rgba(8, 10, 12, 0.95));
}

.center-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 24px;
  border-radius: var(--radius);
  background: rgba(11, 14, 18, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 10;
  max-width: min(90%, 420px);
}

.center-message.hidden {
  opacity: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(154, 163, 173, 0.4);
  background: radial-gradient(circle at 30% 30%, rgba(200, 210, 220, 0.4), rgba(20, 24, 30, 0.8) 60%, rgba(0, 0, 0, 0.8));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45), 0 0 24px rgba(154, 163, 173, 0.2);
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.orb.hit {
  transform: scale(1.2);
  opacity: 0;
}

.orb.miss {
  opacity: 0;
}

.settings-panel {
  position: absolute;
  right: 24px;
  top: 160px;
  width: min(360px, 90vw);
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(12, 15, 19, 0.98);
  display: none;
  flex-direction: column;
  gap: 14px;
  z-index: 20;
}

.settings-panel.open {
  display: flex;
}

.settings-panel h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting label {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

.setting input[type="range"] {
  width: 100%;
}

.toggle-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle {
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.toggle.active {
  border-color: var(--accent-primary);
  color: var(--text);
  background: rgba(154, 163, 173, 0.16);
}

.toggle input {
  display: none;
}

.settings-note {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  body {
    overflow-y: auto;
    touch-action: auto;
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .hud-actions {
    align-items: flex-start;
  }

  .hud-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-panel {
    position: static;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
  }
}

@media (max-width: 640px) {
  .hud {
    padding: 16px;
  }

  .mode-row {
    padding: 12px 16px;
  }

  .stat {
    min-height: 50px;
  }

  .arena {
    min-height: 45vh;
  }
}
