/* Agency of Empires — HUD styling (Aeonix brand) */

:root {
  --teal: #00D4AA;
  --deep-teal: #00A88A;
  --violet: #8B5CF6;
  --deep-violet: #6D3FD0;
  --ink: #0C0D11;
  --dark: #1A1D26;
  --mid: #5A5D6A;
  --subtle: #9B9DA8;
  --light: #D8DAE0;
  --off-white: #F2F3F5;
  --grad: linear-gradient(135deg, #00D4AA, #8B5CF6);
  --sans: 'Outfit', system-ui, sans-serif;
  --pixel: 'Press Start 2P', monospace;
  --panel-bg: rgba(12, 13, 17, 0.86);
  --panel-border: 1px solid rgba(255, 255, 255, 0.09);
}

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

html, body { height: 100%; overflow: hidden; background: var(--ink); }

#game {
  position: fixed; inset: 0;
  cursor: grab;
  touch-action: none; /* the game owns all gestures — pinch zoom, drag pan */
  -webkit-tap-highlight-color: transparent;
}
#game:active { cursor: grabbing; }
body { overscroll-behavior: none; }

/* ---------- shared panel ---------- */
.panel {
  position: fixed;
  background: var(--panel-bg);
  border: var(--panel-border);
  border-radius: 12px;
  color: var(--off-white);
  font-family: var(--sans);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 10;
}
.panel-title {
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--teal);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ---------- logomark ---------- */
.logomark {
  display: inline-block;
  width: 34px; height: 34px;
  border-radius: 22%;
  background: var(--grad);
  position: relative;
  flex: none;
}
.logomark::after {
  content: 'A';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--sans); font-weight: 900; font-size: 20px;
}
.logomark.small { width: 18px; height: 18px; }
.logomark.small::after { font-size: 11px; }

/* ---------- HQ panel (top-left) ---------- */
#hq-panel { top: 16px; left: 16px; padding: 16px 18px; width: 250px; }
.hq-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.brand {
  font-family: var(--pixel); font-size: 13px; letter-spacing: 2px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tier { font-size: 12px; color: var(--subtle); margin-top: 4px; }
.tier #tier-name { color: var(--off-white); font-weight: 500; }
.mrr { font-family: var(--pixel); font-size: 22px; color: #fff; }
.mrr-sub { font-size: 11px; color: var(--subtle); margin: 4px 0 12px; }
.bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}
.fill {
  height: 100%; width: 0%;
  background: var(--grad);
  border-radius: 999px;
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.upgrade-label { font-size: 11px; color: var(--subtle); margin-top: 6px; }

/* ---------- clients panel (top-right) ---------- */
#clients-panel { top: 16px; right: 16px; padding: 14px 14px 10px; width: 236px; max-height: 60vh; overflow-y: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-head .panel-title { margin-bottom: 10px; }

/* toggle switch */
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; margin-bottom: 10px; }
.switch input { display: none; }
.switch .slider {
  width: 28px; height: 16px; border-radius: 999px; flex: none;
  background: rgba(255, 255, 255, 0.15);
  position: relative; transition: background 200ms;
}
.switch .slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--light); transition: transform 200ms, background 200ms;
}
.switch input:checked + .slider { background: var(--violet); }
.switch input:checked + .slider::after { transform: translateX(12px); background: #fff; }
.switch-label { font-size: 10px; color: var(--subtle); user-select: none; }
.switch input:checked ~ .switch-label { color: var(--violet); }
.client-chip {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 8px; margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent; border-radius: 8px;
  color: var(--off-white); font-family: var(--sans); font-size: 12.5px;
  cursor: pointer; text-align: left;
}
.client-chip:hover { border-color: var(--teal); background: rgba(0, 212, 170, 0.08); }
.client-chip.sim { opacity: 0.65; }
.client-chip.sim .chip-name::after { content: ' ✦'; color: var(--violet); }
.chip-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-val { color: var(--teal); font-weight: 700; font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.big { width: 16px; height: 16px; }
.delivered-row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--subtle);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 4px 4px; margin-top: 6px;
}
.delivered-row b { color: #f8d048; }

/* ---------- journey bar (bottom) ---------- */
#journey {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(680px, calc(100vw - 220px));
  z-index: 10; font-family: var(--sans);
}
.journey-track {
  position: relative; height: 12px; border-radius: 999px;
  background: rgba(12, 13, 17, 0.8);
  border: var(--panel-border);
}
.journey-fill {
  position: absolute; inset: 2px auto 2px 2px; width: 0%;
  background: var(--grad); border-radius: 999px;
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.journey-marker {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  transition: left 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.flag {
  position: absolute; bottom: 14px; transform: translateX(-50%);
  border-left: 2px solid var(--teal); height: 16px;
}
.flag span {
  position: absolute; bottom: 14px; left: -2px;
  font-family: var(--pixel); font-size: 7px; white-space: nowrap;
  color: var(--teal); background: rgba(12, 13, 17, 0.75);
  padding: 3px 5px; border-radius: 4px;
}
.flag.stretch { left: 100%; border-color: var(--violet); }
.flag.stretch span { color: var(--violet); left: auto; right: -2px; }
.journey-label {
  text-align: center; font-size: 11.5px; color: var(--light);
  margin-top: 8px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ---------- card ---------- */
#card { bottom: 78px; left: 16px; padding: 16px; width: 240px; display: none; }
.card-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--subtle);
  font-size: 16px; cursor: pointer;
}
.card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.card-title { font-weight: 700; font-size: 15px; }
.card-sub { font-size: 11px; color: var(--subtle); }
.card-rows div {
  display: flex; justify-content: space-between;
  font-size: 12.5px; padding: 5px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.card-rows span { color: var(--subtle); }

/* ---------- zoom ---------- */
#zoom-controls {
  position: fixed; right: 16px; bottom: 78px; z-index: 10;
  display: flex; flex-direction: column; gap: 6px;
}
#zoom-controls button {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--panel-bg); border: var(--panel-border);
  color: var(--off-white); font-size: 17px; cursor: pointer;
}
#zoom-controls button:hover { border-color: var(--teal); color: var(--teal); }

/* ---------- simulation ---------- */
#sim-toggle {
  position: fixed; right: 16px; bottom: 18px; z-index: 10;
  background: var(--panel-bg); border: var(--panel-border);
  color: var(--subtle); font-family: var(--sans); font-size: 12px;
  padding: 8px 12px; border-radius: 10px; cursor: pointer;
}
#sim-toggle:hover { color: var(--teal); border-color: var(--teal); }
#sim-panel { right: 16px; bottom: 60px; padding: 16px; width: 250px; display: none; }
.sim-note { font-size: 11px; color: var(--subtle); line-height: 1.5; margin-bottom: 12px; }
#sim-slider { width: 100%; accent-color: var(--teal); }
.sim-row {
  display: flex; justify-content: space-between; align-items: center; margin-top: 10px;
}
#sim-value { font-family: var(--pixel); font-size: 12px; color: var(--teal); }
#sim-reset {
  background: none; border: 1px solid var(--violet); color: var(--violet);
  font-family: var(--sans); font-size: 11px; padding: 5px 10px;
  border-radius: 8px; cursor: pointer;
}
#sim-reset:hover { background: rgba(139, 92, 246, 0.15); }
#sim-badge {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  display: none; align-items: center; gap: 8px; z-index: 11;
  background: rgba(139, 92, 246, 0.92); color: #fff;
  font-family: var(--pixel); font-size: 9px; letter-spacing: 1px;
  padding: 8px 14px; border-radius: 999px;
}

/* ---------- footer ---------- */
#footer {
  position: fixed; left: 16px; bottom: 18px; z-index: 9;
  font-family: var(--sans); font-size: 10.5px; color: var(--subtle);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ---------- phones: compact HUD, pinch does the zooming ---------- */
@media (max-width: 760px) {
  #clients-panel { display: none; }
  #journey { width: calc(100vw - 24px); bottom: 10px; }
  .journey-label { font-size: 10.5px; margin-top: 6px; }
  #hq-panel { top: 10px; left: 10px; width: 200px; padding: 10px 12px; }
  .hq-head { margin-bottom: 8px; }
  .brand { font-size: 11px; }
  .logomark { width: 28px; height: 28px; }
  .logomark::after { font-size: 16px; }
  .mrr { font-size: 16px; }
  .mrr-sub { margin: 2px 0 8px; }
  #footer { display: none; }
  #zoom-controls { display: none; }
  #sim-toggle { top: 16px; right: 10px; bottom: auto; }
  #sim-panel { left: 10px; right: 10px; top: 62px; bottom: auto; width: auto; }
  #sim-badge { top: auto; bottom: 68px; }
  #card { left: 10px; right: 10px; bottom: 84px; width: auto; }
  .flag span { font-size: 6px; bottom: 10px; }
  .flag { height: 12px; }
}

#footer a { color: var(--subtle); text-decoration: none; }
#footer a:hover { color: var(--teal); }
#footer b { color: var(--teal); }
