:root {
  --bg: #0b0f17;
  --panel: rgba(17, 24, 39, 0.92);
  --border: rgba(148, 163, 184, 0.25);
  --amber: #f59e0b;
  --cyan: #06b6d4;
  --green: #22c55e;
  --red: #ef4444;
  --text: #f8fafc;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body, #app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden { display: none !important; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.1s;
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-lg { padding: 12px 26px; font-size: 16px; }
.btn-amber { background: linear-gradient(180deg, #fbbf24, #d97706); color: #0f172a; }
.btn-green { background: linear-gradient(180deg, #4ade80, #16a34a); color: #052e16; }
.btn-cyan { background: linear-gradient(180deg, #38bdf8, #0284c7); }
.btn-ghost { background: rgba(30, 41, 59, 0.9); border: 1px solid var(--border); }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #090d16 75%);
  z-index: 20;
  overflow-y: auto;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 800;
  color: var(--amber);
}
.brand h1 {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 900;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gold-badge {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
}

/* Карта */
.map-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  min-height: 300px;
}
.map-scroll {
  flex: 1;
  overflow-x: auto;
  display: flex;
  align-items: center;
  background: radial-gradient(circle at 50% 45%, #162238 0%, #090d16 100%);
}
.campaign-map {
  width: 100%;
  min-width: 820px;
  height: 100%;
  max-height: 480px;
  display: block;
}
.map-node { cursor: pointer; }
.map-node.locked { cursor: not-allowed; opacity: 0.5; }
.map-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.96);
  border-top: 1px solid var(--border);
}
.sel-biome { font-size: 12px; font-weight: 800; color: var(--cyan); text-transform: uppercase; }
.sel-title { font-size: 17px; font-weight: 800; }

/* Ангар */
.hangar-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}
.hangar-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hangar-panel h3 { color: var(--amber); font-size: 15px; }
.cards-col { display: flex; flex-direction: column; gap: 10px; }
.up-card {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.up-card.active {
  border-color: var(--green);
  background: rgba(20, 83, 45, 0.25);
}
.up-info h4 { font-size: 14px; margin-bottom: 3px; }
.up-info p { font-size: 12px; color: var(--muted); }

/* Боевой HUD */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  padding: max(10px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}
.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.hud-left, .hud-center, .hud-right { pointer-events: auto; }
.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hp-pill, .stat-pill {
  background: rgba(15, 23, 42, 0.84);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}
.hp-pill { min-width: 130px; }
.hp-bar-bg {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 3px;
}
.hp-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.1s;
}
.gold-pill { color: #fbbf24; }

.hud-center { flex: 1; max-width: 300px; }
.progress-wrap, .boss-bar-wrap {
  background: rgba(15, 23, 42, 0.84);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  text-align: center;
  margin-bottom: 6px;
}
.progress-label { font-size: 11px; font-weight: 800; color: var(--cyan); margin-bottom: 4px; }
.progress-bg {
  width: 100%;
  height: 7px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #06b6d4, #38bdf8); }
.boss-label { font-size: 12px; font-weight: 800; color: #fca5a5; }
.boss-fill { background: linear-gradient(90deg, #ef4444, #f97316); }

.hud-right { display: flex; gap: 8px; }

.ult-btn {
  pointer-events: auto;
  position: absolute;
  right: 18px;
  bottom: max(22px, env(safe-area-inset-bottom));
  padding: 12px 16px;
  border-radius: 999px;
  border: 2px solid #fbbf24;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.9), rgba(180, 83, 9, 0.95));
  color: #0f172a;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}
.ult-btn:disabled { opacity: 0.55; filter: grayscale(0.7); cursor: not-allowed; }

/* Модалка */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 15, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}
.modal-box {
  background: #111827;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  max-width: 390px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-stars { font-size: 32px; letter-spacing: 6px; color: #fbbf24; }
.modal-btns { display: flex; flex-direction: column; gap: 8px; }
