*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #06080f;
  --panel: #0f1419;
  --card: #161b22;
  --border: #21262d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent2: #a855f7;
  --success: #3fb950;
  --danger: #f85149;
  --glow: 0 0 20px rgba(88, 166, 255, 0.15);
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(88,166,255,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(168,85,247,0.05) 0%, transparent 50%);
}

.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

.hidden { display: none !important; }

/* Entry */
#entryScreen { align-items: center; justify-content: center; position: relative; }

.entry-tutorial-btn {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 5;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(88, 166, 255, 0.45);
  background: rgba(15, 20, 25, 0.92);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.entry-tutorial-btn:hover {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--accent);
}

.hero {
  text-align: center;
  max-width: 480px;
  padding: 32px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.subtitle { color: var(--muted); margin: 8px 0 16px; font-size: 14px; }

.conn-panel {
  margin-bottom: 16px;
  text-align: center;
}

.conn-panel .conn-status {
  display: inline-block;
}

.help-text {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 6px;
}

.help-text code {
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
  font-size: 10px;
}

.help-text a { color: var(--accent); }

.conn-status {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
}

.conn-status.ok { color: var(--success); }
.conn-status.err { color: var(--danger); }

.panel-guide {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 4px;
}

.team-pick-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 14px 0 10px;
  letter-spacing: 0.02em;
}

.team-pick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed var(--border);
}

.team-pick-btn {
  --team-color: #3b82f6;
  flex: 1 1 calc(50% - 10px);
  min-width: 128px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--team-color);
  background: color-mix(in srgb, var(--team-color) 14%, var(--panel));
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.team-pick-name {
  line-height: 1.2;
}

.team-pick-meta {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.82;
  line-height: 1.2;
}

.team-pick-btn.selected .team-pick-meta {
  opacity: 0.95;
}

.team-pick-btn:hover:not(:disabled):not(.selected) {
  background: color-mix(in srgb, var(--team-color) 28%, var(--panel));
  transform: translateY(-1px);
}

.team-pick-btn.selected {
  background: var(--team-color);
  border-color: var(--team-color);
  color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--team-color) 35%, transparent),
    0 8px 24px color-mix(in srgb, var(--team-color) 45%, transparent);
  transform: translateY(-1px);
}

.team-pick-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.lobby-server-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  word-break: break-all;
}

.entry-btns { display: flex; gap: 12px; justify-content: center; margin-bottom: 20px; }

.auth-panel {
  width: min(360px, 92vw);
  margin: 0 auto 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--glow);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.auth-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.auth-tab.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(56, 189, 248, 0.12);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}

.auth-logged-in {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-user-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.auth-stats {
  font-size: 13px;
  color: var(--muted);
}

.auth-stats strong {
  color: var(--accent);
  font-size: 15px;
}

.match-btn {
  display: block;
  width: min(360px, 92vw);
  margin: 0 auto 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #111;
  font-weight: 700;
}

.match-btn.is-searching {
  opacity: 0.85;
  animation: pulse-match 1.2s ease-in-out infinite;
}

@keyframes pulse-match {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.match-status {
  text-align: center;
  font-size: 13px;
  color: var(--accent);
  margin: 0 0 12px;
}

.guest-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--glow);
}

.panel input[type="text"], .panel input[type="number"] {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.panel input:focus { border-color: var(--accent); }

.file-label {
  display: block;
  padding: 10px;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}

.file-label:hover { border-color: var(--accent); color: var(--text); }

.file-name { font-size: 12px; color: var(--accent); }

.link { display: inline-block; margin-top: 20px; color: var(--muted); font-size: 13px; text-decoration: none; }
.link:hover { color: var(--accent); }

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover { border-color: var(--accent); }

.btn.primary { background: var(--accent); color: #0d1117; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }

.btn.secondary { background: var(--panel); }

.btn.danger { border-color: var(--danger); color: var(--danger); }

.btn.full { width: 100%; }

.btn.small { padding: 6px 12px; font-size: 12px; }

.btn.fire { background: linear-gradient(135deg, #f59e0b, #ef4444); border: none; color: #fff; font-weight: 600; margin-top: 8px; }
.btn.fire:disabled { cursor: not-allowed; filter: saturate(0.85); }

.fire-btn-wrap {
  position: relative;
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.fire-btn-wrap .btn.fire { margin-top: 0; width: 100%; }

.fire-cd-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0%;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  border-radius: 0 8px 8px 0;
  transition: width 0.08s linear;
}

.fire-key-hint { font-weight: 400; opacity: 0.85; font-size: 0.9em; }

.btn.ready, .btn[data-ready="true"] { background: var(--success); color: #0d1117; border-color: var(--success); }

/* Lobby */
#lobbyScreen { align-items: center; justify-content: center; }

.lobby-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  min-width: 360px;
  max-width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: var(--glow);
}

.lobby-box h2 { margin-bottom: 16px; font-size: 18px; }

.room-code-display {
  text-align: center;
  padding: 16px;
  background: var(--panel);
  border-radius: 12px;
  margin-bottom: 20px;
}

.room-code-display span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.room-code-display strong {
  font-size: 2rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.player-list {
  list-style: none;
  margin-bottom: 12px;
  max-height: 200px;
  min-height: 48px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
}

.player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.player-list li + li { border-top: 1px solid var(--border); }

.player-list .player-list-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.player-list .btn-kick {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 11px;
}

.lobby-room-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.lobby-slot-guide { margin-bottom: 8px; font-size: 12px; }
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.lobby-slot-section { margin-bottom: 16px; }

.lobby-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.lobby-slot-btn {
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.lobby-slot-btn.selected {
  border-color: var(--accent);
  background: #1f3a5f44;
  color: var(--accent);
}

.lobby-slot-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lobby-slot-observer {
  grid-column: 1 / -1;
}

.lobby-map-section {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--panel);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.lobby-map-status {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.lobby-map-status.loaded {
  color: var(--accent);
}

.lobby-map-load {
  margin-top: 4px;
}

.ready-tag { color: var(--success); font-size: 12px; }

/* Game layout */
#gameScreen { flex-direction: column; }

.game-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.game-top-bar {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  flex-shrink: 0;
  overflow-x: auto;
}

.top-bar-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.top-bar-section.top-bar-beacons {
  flex: 1;
  min-width: 0;
}

.top-bar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  flex-shrink: 0;
}

.status-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-beacons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player-status-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 120px;
}

.player-status-card.is-local {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.2);
}

.player-status-card.is-dead {
  opacity: 0.55;
}

.player-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.player-status-dot.offline { background: var(--muted); }
.player-status-dot.disconnected { background: var(--danger); }

.player-status-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.player-status-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-status-name {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.player-status-meta {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 6px;
}

.player-hp-bar {
  width: 56px;
  height: 4px;
  background: #21262d;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.player-hp-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.2s;
}

.beacon-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
}

.beacon-status-chip .beacon-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.beacon-status-chip.neutral .beacon-dot { background: var(--muted); }
.beacon-status-chip.captured { border-color: rgba(255,255,255,0.15); }

.beacon-status-empty {
  font-size: 11px;
  color: var(--muted);
}

.game-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.game-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
}

.sidebar-block { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.sidebar-block h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.sidebar-build .btn-grid { gap: 4px; }
.unit-action-btns { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sidebar-unit .info-panel { margin-top: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(15, 20, 25, 0.5); }
.sidebar-unit .info-panel-body { font-size: 12px; line-height: 1.5; }

.aim-dial-stack {
  position: absolute;
  right: 14px;
  bottom: 16px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.aim-fine-tune {
  position: relative;
  right: auto;
  bottom: auto;
  width: 148px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 6;
  pointer-events: auto;
}

.aim-nudge-btn {
  min-width: 44px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(15, 20, 25, 0.92);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.aim-nudge-btn:active {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-grid { display: flex; flex-direction: column; gap: 6px; }

.band-btn, .build-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  min-height: 52px;
}

.band-btn.active, .build-btn.active { border-color: var(--accent); background: #1f3a5f44; color: var(--accent); }

.band-btn.disabled,
.band-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.band-btn .cost, .build-btn .cost { color: var(--muted); font-size: 10px; line-height: 1.2; }

.slider-row { margin-top: 8px; }
.slider-row label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  touch-action: none;
  min-height: 28px;
  cursor: pointer;
}

#visibleSlider input[type="range"] {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 32px;
  background: transparent;
  accent-color: #22c55e;
}

.visible-slider-wrap {
  position: relative;
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
}

.visible-slider-rail {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.visible-slider-fill {
  position: absolute;
  left: 0;
  height: 6px;
  width: 44%;
  border-radius: 3px;
  background: #22c55e;
  pointer-events: none;
  transition: width 0.06s linear, background 0.12s ease;
}

/* 手机端可见光能量条 — 固定在画布底部、触控按钮上方 */
.mobile-visible-bar {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 18;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(13, 17, 23, 0.96);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.mobile-visible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mobile-visible-title {
  font-size: 12px;
  color: var(--muted);
}

.mobile-visible-header strong {
  font-size: 14px;
  font-weight: 700;
}

.mobile-visible-track {
  position: relative;
  height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.mobile-visible-rail {
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
}

.mobile-visible-fill {
  position: absolute;
  left: 0;
  height: 10px;
  width: 44%;
  border-radius: 5px;
  background: #22c55e;
  pointer-events: none;
  transition: width 0.06s linear, background 0.12s ease;
}

.mobile-visible-thumb {
  position: absolute;
  top: 50%;
  left: 44%;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  margin-left: -14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #22c55e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: left 0.06s linear, border-color 0.12s ease;
}

.mobile-visible-steps {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.mobile-visible-step {
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.mobile-visible-step.active {
  color: #fff;
  background: rgba(88, 166, 255, 0.25);
  border-color: var(--accent);
}

@media (max-width: 768px) {
  #visibleSlider input[type="range"] {
    min-height: 40px;
  }
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  #visibleSlider {
    display: none !important;
  }

  .mobile-visible-bar {
    display: none;
  }

  .mobile-visible-bar.is-visible {
    display: flex;
  }

  #radioPanel {
    display: none !important;
  }

  .mobile-radio-bar {
    display: none;
  }

  .mobile-radio-bar.is-visible {
    display: flex;
  }

  .game-hud .radio-radar {
    display: none !important;
  }

  .mobile-radio-radar:not(.hidden) {
    display: flex;
  }
}

.radio-opt { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 6px 0; }
#radioPanel input[type="text"], #radioPanel input[type="number"],
.mobile-radio-bar input[type="text"], .mobile-radio-bar input[type="number"] {
  width: 100%; background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; color: var(--text); font-size: 12px; margin-bottom: 6px;
}

/* 手机端无线电输入 — 与可见光条同位置 */
.mobile-radio-bar {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 18;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(13, 17, 23, 0.96);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.mobile-radio-header {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
}

.mobile-radio-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.mobile-radio-bar input[type="text"],
.mobile-radio-bar input[type="number"] {
  font-size: 16px;
  min-height: 40px;
  padding: 8px 10px;
}

.mobile-radio-radar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 19;
  max-width: min(280px, calc(100% - 148px));
  margin-left: 0;
  pointer-events: none;
}

@media (min-width: 769px) {
  .mobile-radio-radar {
    display: none !important;
  }
}

.hint { font-size: 11px; color: var(--muted); line-height: 1.4; margin-top: 6px; }

.info-panel {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
}

.info-panel-title {
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 4px;
}

.info-panel-body { color: var(--text); }

#btnRelocateMain.active {
  border-color: var(--accent);
  background: #1f3a5f44;
  color: var(--accent);
}

/* 瞄准圆盘 */
.aim-dial-stack .aim-dial {
  position: relative;
  right: auto;
  bottom: auto;
}

.aim-dial {
  position: absolute;
  right: 14px;
  bottom: 88px;
  width: 148px;
  height: 148px;
  --dial-inset: 22px;
  /* 按钮中心落在圆环外缘（勿写 var(calc(...)) + 2px，部分浏览器会整段 transform 失效） */
  --snap-outer: calc(50% - var(--dial-inset) + 2px);
  z-index: 22;
  touch-action: none;
  user-select: none;
  pointer-events: none;
}

.aim-dial-ring,
.aim-dial-arrows .aim-snap-btn {
  pointer-events: auto;
}

.aim-dial-ring {
  position: absolute;
  inset: var(--dial-inset, 22px);
  z-index: 1;
  border-radius: 50%;
  border: 2px solid rgba(88, 166, 255, 0.45);
  background: rgba(13, 17, 23, 0.88);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  touch-action: none;
}

.aim-dial.is-aiming .aim-dial-ring {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

.aim-dial-hint {
  position: absolute;
  left: 50%;
  bottom: 14%;
  top: auto;
  transform: translateX(-50%);
  width: 88%;
  text-align: center;
  font-size: 9px;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
}

.aim-dial.is-aiming .aim-dial-hint { opacity: 0; }

.aim-dial-indicator {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  pointer-events: none;
}

.aim-dial-indicator span {
  position: absolute;
  left: 50%;
  top: 2px;
  margin-left: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid var(--accent);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.aim-dial-arrows {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.aim-dial-arrows .aim-snap-btn {
  position: absolute;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(15, 20, 25, 0.92);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  z-index: 5;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.aim-dial-arrows .aim-snap-btn span {
  display: inline-block;
  line-height: 22px;
  text-align: center;
  transform: rotate(calc((var(--game-deg, 0) + 90) * 1deg));
}

.aim-dial-arrows .aim-snap-btn.active,
.aim-dial-arrows .aim-snap-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(88, 166, 255, 0.2);
}

.mirror-build-dial.is-aiming .aim-dial-ring {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.mirror-build-dial .aim-dial-indicator span {
  border-bottom-color: #f59e0b;
}

/* 新手教程 */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.tutorial-spotlight {
  position: fixed;
  border-radius: 10px;
  border: 2px solid rgba(88, 166, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.22), 0 0 18px rgba(88, 166, 255, 0.35);
  background: transparent;
  pointer-events: none;
  z-index: 121;
  transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.tutorial-spotlight.hidden {
  display: none;
}

.tutorial-card {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 122;
  pointer-events: auto;
}

.tutorial-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tutorial-step-label {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tutorial-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.tutorial-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.tutorial-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 16px;
}

.tutorial-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.tutorial-actions .btn.disabled,
.tutorial-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-height: 0; }

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}

.radio-radar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.92);
  max-width: min(320px, 42vw);
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-left: auto;
}

.radio-radar-icon {
  font-size: 20px;
  line-height: 1;
}

.radio-radar-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.radio-radar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.radio-radar-text {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-radar.is-ping {
  border-color: #22d3ee;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.55), inset 0 0 12px rgba(34, 211, 238, 0.12);
  animation: radioRadarFlash 0.45s ease-out 2;
}

.radio-radar.is-sent.is-ping {
  border-color: #34d399;
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.5), inset 0 0 12px rgba(52, 211, 153, 0.12);
}

@keyframes radioRadarFlash {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.04); filter: brightness(1.35); }
  100% { transform: scale(1); filter: brightness(1); }
}

.hud-left { display: flex; gap: 20px; }
.hud-item { color: var(--muted); }
.hud-item strong { color: var(--text); }
.physics-mode-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e0f2fe, #f0fdf4);
  color: #0369a1;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #bae6fd;
  letter-spacing: 0.02em;
}

/* ── 仿真光学版浅色调主题 ── */
body.physics-simulation {
  --sim-bg: #f8fafc;
  --sim-panel: #ffffff;
  --sim-border: #e2e8f0;
  --sim-text: #0f172a;
  --sim-muted: #64748b;
  --sim-accent: #0284c7;
  --sim-accent-soft: #e0f2fe;
}

body.physics-simulation .game-sidebar {
  background: var(--sim-panel);
  border-color: var(--sim-border);
  color: var(--sim-text);
}

body.physics-simulation .game-sidebar h3 {
  color: #334155;
  border-bottom-color: var(--sim-border);
}

body.physics-simulation .game-sidebar .hint,
body.physics-simulation .sim-panel-note {
  color: var(--sim-muted);
}

body.physics-simulation .canvas-wrap {
  background: var(--sim-bg);
}

body.physics-simulation .game-hud {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: var(--sim-border);
}

body.physics-simulation .hud-item {
  color: var(--sim-muted);
}

body.physics-simulation .hud-item strong {
  color: var(--sim-text);
}

body.physics-simulation .build-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

body.physics-simulation .build-btn.active {
  background: var(--sim-accent-soft);
  border-color: #38bdf8;
  color: #0369a1;
}

body.physics-simulation .btn.secondary {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

body.physics-simulation .info-panel {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.physics-simulation .sim-panel {
  background: linear-gradient(180deg, #f0f9ff 0%, #f8fafc 100%);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}

body.physics-simulation .sim-panel-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
}

body.physics-simulation .sim-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #0369a1;
  flex: 1;
}

body.physics-simulation .sim-panel-head strong {
  font-size: 18px;
  color: #0c4a6e;
}

body.physics-simulation .sim-unit {
  font-size: 12px;
  color: #64748b;
}

body.physics-simulation .sim-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #475569;
  margin-right: 12px;
  margin-top: 6px;
}

body.physics-simulation .sim-build-hint {
  margin-top: 8px;
  font-size: 11px;
}

body.physics-simulation .sim-spread-label {
  display: block;
  font-size: 12px;
  color: #475569;
  margin: 8px 0 4px;
}

body.physics-simulation #beamSpread {
  width: 100%;
  accent-color: #0284c7;
}

body.physics-simulation .game-sidebar > .sidebar-block:first-child {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}

body.physics-simulation .band-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

body.physics-simulation .band-btn.active {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
}

body.physics-simulation .band-btn .cost {
  color: #64748b;
}

body.physics-simulation .visible-slider-rail {
  background: #e2e8f0;
}

body.physics-simulation .visible-slider-fill {
  background: linear-gradient(90deg, #fbbf24, #f97316);
}

body.physics-simulation .btn.fire {
  background: linear-gradient(135deg, #fb923c, #f97316);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

body.physics-simulation #radioPanel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
}

body.physics-simulation .radio-opt {
  color: #475569;
}

body.physics-simulation #radioPanel input[type="text"],
body.physics-simulation #radioPanel input[type="number"] {
  background: #fff;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.physics-simulation .aim-dial.beam-dial-mode .aim-dial-arrows .aim-snap-btn {
  background: rgba(255, 255, 255, 0.96);
  border-color: #94a3b8;
  color: #475569;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.12);
}

body.physics-simulation .aim-dial.beam-dial-mode .aim-dial-arrows .aim-snap-btn.active,
body.physics-simulation .aim-dial.beam-dial-mode .aim-dial-arrows .aim-snap-btn:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
}

/* 仿真双针瞄准圆盘 → 单针 + 滑条张角 */
.aim-dial.beam-dial-mode .aim-dial-indicator-center {
  display: block;
}

.aim-dial.beam-dial-mode .aim-dial-indicator-upper,
.aim-dial.beam-dial-mode .aim-dial-indicator-lower,
.aim-dial.beam-dial-mode .beam-dial-wedge {
  display: none !important;
}

.aim-dial:not(.beam-dial-mode) .aim-dial-indicator-upper,
.aim-dial:not(.beam-dial-mode) .aim-dial-indicator-lower,
.aim-dial:not(.beam-dial-mode) .beam-dial-wedge {
  display: none;
}

body.physics-simulation .aim-dial.beam-dial-mode .aim-dial-ring {
  border-color: #93c5fd;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(255,255,255,0.8);
}

body.physics-simulation .aim-dial.beam-dial-mode.is-aiming .aim-dial-ring {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
}

/* γ 射线：仿真内使用经典单针圆盘，样式与张角圆盘一致 */
body.physics-simulation .aim-dial:not(.beam-dial-mode) .aim-dial-ring {
  border-color: #93c5fd;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(255,255,255,0.8);
}

body.physics-simulation .aim-dial:not(.beam-dial-mode).is-aiming .aim-dial-ring {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
}

body.physics-simulation .aim-dial:not(.beam-dial-mode) .aim-dial-arrows .aim-snap-btn {
  background: rgba(255, 255, 255, 0.96);
  border-color: #94a3b8;
  color: #475569;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.12);
}

body.physics-simulation .aim-dial:not(.beam-dial-mode) .aim-dial-arrows .aim-snap-btn.active,
body.physics-simulation .aim-dial:not(.beam-dial-mode) .aim-dial-arrows .aim-snap-btn:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
}

.beam-dial-wedge {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: conic-gradient(
    from var(--beam-upper, -15deg),
    rgba(14, 165, 233, 0.18) 0deg,
    rgba(14, 165, 233, 0.18) calc(var(--beam-spread, 15deg)),
    transparent calc(var(--beam-spread, 15deg))
  );
  pointer-events: none;
  opacity: 0.9;
}

.aim-dial-indicator-upper,
.aim-dial-indicator-lower {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 46%;
  margin-left: -1px;
  margin-top: -46%;
  transform-origin: 50% 100%;
  pointer-events: none;
  z-index: 3;
}

.aim-dial-indicator-upper span,
.aim-dial-indicator-lower span {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translate(-50%, -100%);
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
}

.aim-dial-indicator-upper {
  color: #ea580c;
}

.aim-dial-indicator-upper span {
  text-shadow: 0 0 4px #fff;
}

.aim-dial-indicator-lower {
  color: #0284c7;
}

.aim-dial-indicator-lower span {
  text-shadow: 0 0 4px #fff;
}

.aim-dial-indicator-upper::after,
.aim-dial-indicator-lower::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 3px;
  height: 55%;
  margin-left: -1.5px;
  border-radius: 2px;
  background: currentColor;
}

body.physics-simulation .aim-dial-hint {
  color: #64748b;
  font-size: 9px;
}

.hud-right { display: flex; gap: 8px; }

.canvas-wrap {
  flex: 1;
  overflow: hidden;
  background: #000;
  position: relative;
  touch-action: manipulation;
  user-select: none;
  min-height: 0;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  /* 尺寸由 .canvas-wrap 决定；backing store 在 JS 中按 DPR 设置 */
}

.mobile-controls {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  gap: 8px;
  justify-content: center;
  align-items: center;
  z-index: 20;
  touch-action: manipulation;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

.mobile-fire-wrap {
  position: relative;
  flex: 1;
  max-width: 120px;
  border-radius: 12px;
  overflow: hidden;
}

.mobile-controls .touch-btn {
  min-width: 48px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 20, 25, 0.92);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}

.mobile-controls .touch-btn:active {
  background: rgba(88, 166, 255, 0.25);
  border-color: var(--accent);
}

.mobile-fire-wrap .touch-fire,
.mobile-controls .touch-fire {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  max-width: none;
  flex: 1;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(239, 68, 68, 0.95));
  border: none;
  color: #fff;
  font-size: 16px;
}

.mobile-controls .touch-fire:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 48px;
  text-align: center;
  box-shadow: var(--glow);
}

.overlay-box h2 { margin-bottom: 16px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); color: var(--danger); }

.tower-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.tower-list-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.tower-list-btn:hover { border-color: var(--accent); }
.tower-list-btn.active { border-color: var(--accent); background: #1f3a5f44; color: var(--accent); }
.tower-list-btn .coords { font-size: 10px; color: var(--muted); }

.tower-list-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 0;
}

/* ── 手机端适配 ── */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .hero { padding: 20px 16px; max-width: 100%; }
  .hero h1 { font-size: 1.5rem; }
  .entry-btns { flex-direction: column; }
  .panel { padding: 12px; }

  .game-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 10px;
    max-height: 28vh;
    overflow-y: auto;
  }

  .top-bar-section.top-bar-beacons { width: 100%; }

  .player-status-card { min-width: 100px; padding: 4px 8px; }
  .player-status-name { max-width: 72px; font-size: 11px; }
  .player-hp-bar { width: 40px; }

  .game-body {
    flex-direction: column;
  }

  .game-main {
    order: 1;
    min-height: 42vh;
    flex: 1;
  }

  .game-sidebar {
    order: 2;
    width: 100%;
    min-width: 0;
    max-height: 38vh;
    border-right: none;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  .sidebar-block .slider-row {
    touch-action: none;
  }

  .sidebar-block .slider-row input[type="range"] {
    min-height: 36px;
  }

  .sidebar-build .build-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: min(100%, 280px);
  }

  .sidebar-build .build-btn {
    min-height: 44px;
    padding: 8px 6px;
    font-size: 11px;
  }

  .sidebar-block {
    flex: 0 0 auto;
    min-width: min(220px, 78vw);
    margin-bottom: 0;
    padding-bottom: 8px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding-right: 10px;
    margin-right: 10px;
  }

  .sidebar-block:last-child { border-right: none; margin-right: 0; }

  .fire-key-hint { display: none; }

  .game-hud {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .hud-left { gap: 10px; flex-wrap: wrap; }

  .band-btn, .build-btn, .tower-list-btn, .btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-controls {
    display: flex;
  }

  .aim-dial-stack {
    top: 52px;
    bottom: auto;
    right: 8px;
    left: auto;
  }

  .aim-dial-stack .aim-dial {
    width: 132px;
    height: 132px;
    --dial-inset: 18px;
    --snap-outer: calc(50% - var(--dial-inset) + 2px);
  }

  .mirror-build-dial {
    top: 52px;
    bottom: auto;
    width: 132px;
    height: 132px;
    --dial-inset: 18px;
    --snap-outer: calc(50% - var(--dial-inset) + 2px);
    right: 8px;
    left: auto;
  }

  .aim-dial-stack .aim-fine-tune {
    width: 132px;
  }

  .aim-dial-ring { inset: var(--dial-inset, 18px); }

  .aim-dial-arrows .aim-snap-btn {
    width: 36px;
    height: 36px;
    font-size: 12px;
    z-index: 6;
  }

  .aim-dial-arrows .aim-snap-btn span {
    line-height: 36px;
  }

  .hint { font-size: 10px; }

  .lobby-box { margin: 16px; padding: 20px; max-width: calc(100% - 32px); }

  .toast {
    bottom: max(24px, env(safe-area-inset-bottom));
    max-width: 90vw;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .status-beacons { gap: 4px; }
  .beacon-status-chip { font-size: 10px; padding: 3px 6px; }
  .band-btn, .build-btn { padding: 10px; min-height: 44px; }
  .btn { min-height: 44px; }
}
