:root {
  --bg: #0b0f14;
  --panel: rgba(12, 18, 28, 0.92);
  --line: rgba(120, 180, 255, 0.18);
  --text: #e8f0ff;
  --muted: #8ea0b8;
  --accent: #3ddc97;
  --danger: #ff5c5c;
  --warn: #ffc857;
  --blue: #4cc9f0;
  --gold: #f4d35e;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

.hidden {
  display: none !important;
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(61, 220, 151, 0.12), transparent 45%),
    radial-gradient(ellipse at 70% 80%, rgba(76, 201, 240, 0.1), transparent 40%),
    linear-gradient(160deg, #0b0f14 0%, #121a24 50%, #0a1018 100%);
  z-index: 20;
}

.menu-card {
  width: min(440px, 92vw);
  padding: 36px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  text-align: center;
}

.menu-card.small {
  width: min(320px, 90vw);
  padding: 28px 24px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  border: 1px solid rgba(61, 220, 151, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.badge.lose {
  color: var(--danger);
  border-color: rgba(255, 92, 92, 0.4);
}

h1 {
  font-size: 1.85rem;
  line-height: 1.25;
  margin-bottom: 10px;
  font-weight: 700;
}

h2 {
  font-size: 1.4rem;
  margin-bottom: 18px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 22px;
}

.menu-stats,
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.menu-stats div,
.result-stats div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 8px;
}

.menu-stats span,
.result-stats span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.menu-stats strong,
.result-stats strong {
  font-size: 1rem;
  color: var(--text);
}

.btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(135deg, #3ddc97, #2bb673);
  color: #04140c;
  margin-bottom: 10px;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.controls-hint {
  margin-top: 22px;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.controls-hint h3 {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.controls-hint ul {
  list-style: none;
  display: grid;
  gap: 8px;
}

.controls-hint li {
  font-size: 0.86rem;
  color: #c5d2e6;
}

kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--gold);
  margin-right: 2px;
}

/* HUD */
#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #1a2330;
  cursor: crosshair;
}

#hud.playing {
  cursor: crosshair;
}

#minimap {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 160px;
  height: 160px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 12, 18, 0.75);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 12;
  pointer-events: none;
}

#top-bar {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 12;
  pointer-events: none;
}

.pill {
  background: rgba(8, 12, 18, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

#kill-feed {
  position: absolute;
  top: 70px;
  right: 196px;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 12;
  pointer-events: none;
}

.kill-item {
  background: rgba(8, 12, 18, 0.7);
  border-left: 3px solid var(--danger);
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 0 8px 8px 0;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

#crosshair {
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 26px;
  font-weight: 300;
  line-height: 28px;
  text-align: center;
  pointer-events: none;
  z-index: 15;
  text-shadow: 0 0 4px #000, 0 0 8px rgba(61, 220, 151, 0.6);
  transform: translate(0, 0);
  will-change: left, top;
}

#bottom-hud {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  z-index: 12;
  pointer-events: none;
}

.hp-block {
  width: 220px;
  background: rgba(8, 12, 18, 0.75);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  backdrop-filter: blur(8px);
}

.bar-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.bar-label.armor {
  margin-top: 8px;
}

.bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.15s ease;
}

.fill.hp {
  background: linear-gradient(90deg, #2bb673, #3ddc97);
}

.fill.armor {
  background: linear-gradient(90deg, #3a86ff, #4cc9f0);
}

.weapon-block {
  background: rgba(8, 12, 18, 0.75);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 140px;
  backdrop-filter: blur(8px);
}

#weapon-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
}

#ammo-text {
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 600;
}

#medkit-text {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.slots {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.slot {
  width: 64px;
  height: 56px;
  background: rgba(8, 12, 18, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--muted);
  backdrop-filter: blur(8px);
}

.slot.active {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(61, 220, 151, 0.35);
}

.slot .key {
  font-size: 0.65rem;
  color: var(--gold);
  margin-bottom: 2px;
}

#pickup-hint {
  position: absolute;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  background: rgba(8, 12, 18, 0.85);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 12;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

#zone-warn {
  position: absolute;
  left: 50%;
  top: 70px;
  transform: translateX(-50%);
  background: rgba(120, 20, 20, 0.85);
  border: 1px solid var(--danger);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 12;
  animation: pulse 1s ease infinite;
  pointer-events: none;
}

#move-hint {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  background: rgba(8, 12, 18, 0.8);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  z-index: 12;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#move-hint.fade {
  opacity: 0;
}

#btn-mute {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 25;
  background: rgba(8, 12, 18, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}

#btn-mute:hover {
  color: var(--text);
  border-color: var(--accent);
}

.menu-tips {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.diff-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.diff-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: 0.12s ease;
}

.diff-btn:hover {
  color: var(--text);
  border-color: rgba(61, 220, 151, 0.4);
}

.diff-btn.active {
  color: #04140c;
  background: linear-gradient(135deg, #3ddc97, #2bb673);
  border-color: transparent;
}

.menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.menu-actions .btn {
  margin-bottom: 0;
  padding: 10px 12px;
  font-size: 0.88rem;
}

.best-score {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--gold);
}

.share-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(8, 18, 12, 0.92);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 40;
  font-size: 0.88rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.share-toast.show {
  opacity: 1;
}

@media (max-width: 640px) {
  .menu-card {
    padding: 22px 16px;
  }
  h1 {
    font-size: 1.4rem;
  }
  #minimap {
    width: 110px;
    height: 110px;
    top: 10px;
    right: 10px;
  }
  #top-bar {
    top: 10px;
    scale: 0.9;
  }
  .hp-block {
    width: 150px;
  }
  .slot {
    width: 48px;
    height: 48px;
    font-size: 0.62rem;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

#pause, #result {
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(6px);
}
