/* SmackTown — mobile-first PWA styling */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0f1220;
  --panel: #1a1f33;
  --panel-2: #232a45;
  --ink: #eef1ff;
  --ink-dim: #9aa3c7;
  --accent: #ffb02e;
  --accent-2: #ff5470;
  --good: #3ddc84;
  --warn: #ffd166;
  --bad: #ff5470;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Pin the app so a stray browser zoom can't leave it scrolled/overflowing */
body { position: fixed; inset: 0; width: 100%; }

/* The game surface must swallow every gesture: 'manipulation' still allows
   pinch-zoom, which two mashing thumbs trigger constantly. */
#screen-game, #touch-layer, #stick-zone, #action-zone, .ability-btn, #game-canvas {
  touch-action: none;
}

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(12px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
  overflow-y: auto;
  background:
    radial-gradient(1200px 500px at 50% -10%, #232a55 0%, transparent 60%),
    var(--bg);
}

.panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid #2c3457;
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  max-height: 100%;
  overflow-y: auto;   /* short viewports (landscape phones): scroll, don't clip */
}
.panel.narrow { max-width: 380px; }
.panel.wide { max-width: 560px; height: 100%; }

.logo {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 2px;
  text-align: center;
  font-style: italic;
  text-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.logo span { color: var(--accent); }
.logo.small { font-size: 26px; }
.tagline { text-align: center; color: var(--ink-dim); font-size: 13px; margin-top: -8px; }

.field-label { font-size: 13px; color: var(--ink-dim); font-weight: 600; }

input[type=text] {
  width: 100%;
  padding: 14px;
  font-size: 18px;
  border-radius: var(--radius);
  border: 2px solid #39406b;
  background: var(--panel-2);
  color: var(--ink);
  outline: none;
}
input[type=text]:focus { border-color: var(--accent); }

.btn {
  border: 0;
  border-radius: var(--radius);
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 800;
  color: #221a06;
  background: var(--accent);
  cursor: pointer;
  transition: transform .06s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn.big { padding: 16px; font-size: 18px; }
.btn.ghost { background: transparent; color: var(--ink-dim); border: 2px solid #39406b; }
.btn.tiny { padding: 6px 10px; font-size: 14px; }
.btn:disabled { filter: grayscale(.8) brightness(.6); cursor: default; }
.btn.ready-on { background: var(--good); }

.error { color: var(--bad); font-size: 13px; font-weight: 600; }

.btn.install { border-color: var(--accent); color: var(--accent); }
.install-hint {
  font-size: 12px;
  color: var(--ink-dim);
  text-align: center;
  line-height: 1.5;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.install-hint b { color: var(--ink); }
.share-glyph { display: inline-block; transform: rotate(180deg); }

/* color picker */
.color-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.color-swatch {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}
.color-swatch.sel { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }

/* fighter card on menu — tap to edit, arrows swap characters */
.menu-char-row { display: flex; align-items: stretch; gap: 8px; }
.menu-char-row .hat-arrow { height: auto; flex: none; }
.fighter-card {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--panel-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
}
.fighter-card:active { border-color: var(--accent); }
.fighter-card canvas { width: 84px; height: 84px; flex: none; }
.fighter-card-info { min-width: 0; }
.fighter-card-edit {
  position: absolute;
  top: 8px; right: 10px;
  font-size: 13px;
  opacity: .55;
}
.fighter-name { font-size: 20px; font-weight: 800; }
.fighter-loadout { font-size: 11px; color: var(--accent); font-weight: 800; min-height: 13px; }
.fighter-build { font-size: 12px; color: var(--ink-dim); line-height: 1.5; }
.hat-arrow:disabled { opacity: .3; cursor: default; }
.hat-arrow:disabled:active { transform: none; border-color: #39406b; }

.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 800; }
.join-row .btn { min-width: 110px; }
.join-hint { font-size: 11px; color: var(--ink-dim); text-align: center; margin-top: -8px; }

/* fighters online (town-square presence) */
.online-box { text-align: left; }
.online-box .section-title { margin: 0 0 8px; }
.online-list { max-height: 190px; overflow-y: auto; }
.online-list li { padding: 8px 10px; }
.online-list .r-name { line-height: 1.2; }
.online-list .r-where { display: block; font-size: 11px; color: var(--ink-dim); font-weight: 400; }
.online-empty { font-size: 12px; color: var(--ink-dim); text-align: center; margin: 0; }

/* ============ builder ============ */
.builder-head { display: flex; align-items: center; justify-content: space-between; }
.builder-head h2 { font-size: 22px; }
.builder-title { min-width: 0; }
.builder-editing {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.credits-pill {
  background: var(--panel-2);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 900;
  font-size: 18px;
  color: var(--accent);
  display: flex; align-items: baseline; gap: 6px;
}
.credits-label { font-size: 11px; color: var(--ink-dim); font-weight: 600; }
.builder-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.builder-foot { display: flex; gap: 10px; }
.builder-foot .btn { flex: 1; }
.section-title { font-size: 15px; margin-top: 10px; }
.section-title .hint { font-size: 11px; color: var(--ink-dim); font-weight: 400; }

/* saved builds (loadouts) */
.loadout-list { display: flex; flex-direction: column; gap: 6px; }
.loadout-empty { font-size: 12px; color: var(--ink-dim); margin: 0; }
.loadout-chip { display: flex; gap: 6px; align-items: stretch; }
.loadout-chip .lo-main {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.loadout-chip .lo-main:active { border-color: var(--accent); }
.loadout-chip.selected .lo-main {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(255, 176, 46, .25);
}
.loadout-chip .r-swatch { width: 20px; height: 20px; border-radius: 6px; flex: none; }
.loadout-chip .lo-fig { position: relative; flex: none; width: 20px; height: 20px; }
.loadout-chip .lo-fig .r-swatch { display: block; }
.loadout-chip .lo-hat {
  position: absolute;
  left: 50%; top: -15px;
  width: 30px; height: 29px;   /* 24x23 grid; face rows overlap the swatch */
  transform: translateX(-50%);
  image-rendering: pixelated;
  pointer-events: none;
}
.loadout-chip .lo-text { min-width: 0; }
.loadout-chip .lo-name { display: block; font-weight: 800; font-size: 14px; }
.loadout-chip .lo-sum {
  display: block; font-size: 11px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.loadout-chip .lo-del {
  width: 40px;
  border: 2px solid #39406b;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-dim);
  font-size: 15px;
  cursor: pointer;
}
.loadout-save-row { display: flex; gap: 8px; }
.loadout-save-row input { flex: 1; padding: 10px 12px; font-size: 15px; }
.loadout-save-row .btn { padding: 10px 14px; font-size: 14px; }

/* fighter preview + hat cycle arrows */
.builder-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px;
}
.builder-preview-fig { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.builder-preview-fig canvas { width: 110px; height: 110px; }
.hat-arrow {
  width: 46px; height: 66px;
  border: 2px solid #39406b;
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  transition: transform .06s;
}
.hat-arrow:active { transform: scale(.94); border-color: var(--accent); }
.hat-cycle-label { font-size: 11px; color: var(--ink-dim); font-weight: 600; min-height: 14px; }

.stat-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.stat-info { flex: 1; }
.stat-name { font-weight: 800; font-size: 14px; }
.stat-desc { font-size: 11px; color: var(--ink-dim); }
.stat-pips { display: flex; gap: 4px; margin-top: 5px; }
.pip { width: 18px; height: 8px; border-radius: 4px; background: #39406b; }
.pip.on { background: var(--accent); }
.stat-btns { display: flex; gap: 6px; }
.stat-btns button {
  width: 38px; height: 38px;
  border-radius: 10px; border: 0;
  font-size: 20px; font-weight: 900;
  background: #39406b; color: var(--ink);
  cursor: pointer;
}
.stat-btns button:disabled { opacity: .3; }
.stat-cost { font-size: 10px; color: var(--ink-dim); text-align: center; margin-top: 2px; }

.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-item {
  background: var(--panel-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  position: relative;
}
.shop-item.owned { border-color: var(--good); }
.shop-item.locked { opacity: .45; }
.shop-item .si-icon { font-size: 22px; }
.shop-item .si-name { font-weight: 800; font-size: 13px; margin-top: 2px; }
.shop-item .si-desc { font-size: 11px; color: var(--ink-dim); line-height: 1.35; margin-top: 2px; }
.shop-item .si-cost {
  position: absolute; top: 8px; right: 10px;
  font-size: 11px; font-weight: 800; color: var(--accent);
}
.shop-item.owned .si-cost { color: var(--good); }

/* ============ hat studio ============ */
#hat-canvas {
  width: 100%;
  height: min(48vh, 400px);
  touch-action: none;
  background:
    radial-gradient(500px 260px at 50% 20%, #232a55 0%, transparent 70%),
    var(--panel-2);
  border-radius: var(--radius);
  border: 1px solid #2c3457;
}
.hat-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.hat-swatch {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 2px solid rgba(255,255,255,.12);
  cursor: pointer;
}
.hat-swatch.sel { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.hat-tools { display: flex; gap: 8px; }
.hat-tools .btn.tool-on { border-color: var(--accent); color: var(--accent); }
.hat-foot { display: flex; gap: 10px; }
.hat-foot .btn { flex: 1; }

/* ============ hat library (modal) ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 14px calc(16px + var(--safe-bottom));
  background: rgba(6, 8, 18, .72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-card {
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border: 1px solid #2c3457;
  border-radius: 20px;
  padding: 18px 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 20px; }
.modal-close {
  width: 34px; height: 34px;
  border: 2px solid #39406b;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 14px;
  cursor: pointer;
}
.hatlib-tabs { display: flex; gap: 8px; }
.hatlib-tab {
  flex: 1;
  padding: 9px 10px;
  border: 2px solid #39406b;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.hatlib-tab.on { border-color: var(--accent); color: var(--accent); }
.hatlib-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 120px;
}
.hatlib-hint { font-size: 11px; color: var(--ink-dim); margin: 0; }
.hatlib-empty { font-size: 12px; color: var(--ink-dim); margin: 6px 0; text-align: center; }
.hatlib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}
.hatlib-card { display: flex; flex-direction: column; gap: 4px; }
.hatlib-art {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 24 / 23;      /* tracks the hat grid */
  padding: 6px;
  background: #10122a;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 10px;
  cursor: pointer;
}
.hatlib-card.worn .hatlib-art {
  border-color: var(--good);
  box-shadow: 0 0 8px rgba(61, 220, 132, .35);
}
.hatlib-art canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.hatlib-worn {
  position: absolute;
  left: 50%; bottom: 3px;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--good);
}
.hatlib-actions { display: flex; gap: 4px; }
.hatlib-btn {
  flex: 1;
  padding: 5px 0;
  border: 2px solid #39406b;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.hatlib-btn:active { border-color: var(--accent); color: var(--accent); }

/* town hats (global lobby) */
.hatlib-town-list { display: flex; flex-direction: column; gap: 12px; }
.town-row {
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.town-owner { display: flex; align-items: center; gap: 8px; }
.town-owner .r-swatch { width: 18px; height: 18px; border-radius: 5px; flex: none; }
.town-name { font-weight: 800; font-size: 13px; }
.town-hats { display: flex; flex-wrap: wrap; gap: 8px; }
.town-hat {
  position: relative;
  width: 64px; height: 62px;
  padding: 5px;
  background: #10122a;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 9px;
}
.town-hat canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.town-copy {
  position: absolute;
  top: -8px; right: -8px;
  width: 24px; height: 24px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #221a06;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

/* ============ lobby ============ */
.room-code { color: var(--accent); letter-spacing: 5px; font-weight: 900; }
.btn.invite { border-color: var(--accent); color: var(--accent); }
.roster { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.roster li {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.presence-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.presence-dot.online { background: var(--good); box-shadow: 0 0 8px var(--good); }
.presence-dot.away { background: var(--warn); }
.presence-dot.gone { background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.roster .r-swatch { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.roster .r-name { font-weight: 800; flex: 1; }
.roster .r-name .r-host { font-size: 10px; color: var(--accent); margin-left: 6px; }
.roster .r-meta { font-size: 11px; color: var(--ink-dim); text-align: right; }
.roster .r-ready { color: var(--good); font-weight: 800; font-size: 12px; }
.roster .r-score { font-weight: 900; font-size: 18px; color: var(--accent); }
.lobby-status { text-align: center; font-size: 13px; color: var(--ink-dim); min-height: 18px; }

/* map vote grid */
.map-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.map-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--panel-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 8px 6px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.map-card.voted { border-color: var(--accent); box-shadow: 0 0 10px rgba(255, 176, 46, .35); }
.map-card .map-name { font-weight: 800; font-size: 12px; }
.map-card .map-votes { font-size: 11px; color: var(--accent); font-weight: 700; min-height: 15px; }
.map-card .map-votes.none { color: var(--ink-dim); font-weight: 400; }
.map-thumb {
  width: 100%; max-width: 84px; height: 44px;
  border-radius: 7px;
  position: relative;
  overflow: hidden;
}
.map-thumb::after {           /* main floor silhouette */
  content: '';
  position: absolute; left: 18%; right: 18%; bottom: 6px; height: 7px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .75);
}
.map-thumb::before {          /* platform hints */
  content: '';
  position: absolute; left: 30%; right: 30%; top: 12px; height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .45);
}
.map-thumb-battlefield { background: linear-gradient(#141a38, #1c1430); }
.map-thumb-flatlands { background: linear-gradient(#2c1a3e, #e8703a); }
.map-thumb-flatlands::after { left: 8%; right: 8%; }
.map-thumb-flatlands::before { display: none; }
.map-thumb-skyline { background: linear-gradient(#04141c, #0a2a30); }
.map-thumb-skyline::after { left: 28%; right: 28%; }
.map-thumb-skyline::before { top: 8px; }

/* Landscape phones: short viewport — compact the chrome and lay the lobby
   out in two columns (room info + roster left, actions right) so nothing
   important sits below the fold. */
@media (orientation: landscape) and (max-height: 560px) {
  .screen { padding: calc(8px + var(--safe-top)) 14px calc(8px + var(--safe-bottom)); }
  .panel { padding: 14px 16px; gap: 10px; }
  .panel.narrow { max-width: 460px; }
  .btn.big { padding: 12px; font-size: 16px; }
  .logo { font-size: 30px; }
  .logo.small { font-size: 22px; }

  .lobby-panel {
    display: grid;
    max-width: 680px;
    height: 100%;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas:
      "head   ready"
      "tag    start"
      "invite edit"
      "roster leave"
      "roster maptitle"
      "roster maps"
      "status status";
    grid-template-rows: auto auto auto auto auto 1fr auto;
    column-gap: 16px;
    row-gap: 8px;
    align-items: start;
  }
  .lobby-panel h2 { grid-area: head; align-self: center; }
  .lobby-panel .tagline { grid-area: tag; margin-top: 0; text-align: left; }
  #lobby-invite { grid-area: invite; }
  #lobby-roster { grid-area: roster; align-self: stretch; min-height: 0; overflow-y: auto; }
  #lobby-status { grid-area: status; min-height: 0; }
  #lobby-ready  { grid-area: ready; }
  #lobby-start  { grid-area: start; }
  #lobby-edit   { grid-area: edit; }
  #lobby-leave  { grid-area: leave; }
  .lobby-panel .section-title { grid-area: maptitle; margin: 0; }
  #lobby-maps { grid-area: maps; align-self: start; }
  .map-thumb { height: 34px; }

  /* hat studio: canvas left, palette & controls right */
  .hat-panel {
    display: grid;
    max-width: 680px;
    height: 100%;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    grid-template-areas:
      "canvas head"
      "canvas tag"
      "canvas palette"
      "canvas tools"
      "canvas foot";
    grid-template-rows: auto auto 1fr auto auto;
    column-gap: 16px;
    row-gap: 8px;
    align-items: start;
  }
  .hat-head { grid-area: head; }
  .hat-tag { grid-area: tag; margin-top: 0; text-align: left; }
  #hat-canvas { grid-area: canvas; height: 100%; min-height: 0; align-self: stretch; }
  .hat-palette { grid-area: palette; align-content: start; }
  .hat-tools { grid-area: tools; }
  .hat-foot { grid-area: foot; align-self: end; }
}

/* ============ game ============ */
#screen-game { padding: 0; background: #000; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

#game-hud {
  position: absolute;
  top: calc(6px + var(--safe-top));
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}
.hud-tile {
  background: rgba(10,12,25,.72);
  border-radius: 12px;
  padding: 5px 10px;
  text-align: center;
  min-width: 74px;
  border-top: 3px solid;
}
.hud-tile .h-name { font-size: 10px; font-weight: 700; color: var(--ink-dim); white-space: nowrap; overflow: hidden; max-width: 90px; }
.hud-tile .h-pct { font-size: 20px; font-weight: 900; font-style: italic; }
.hud-tile .h-pct.h-pct-hit { animation: pct-hit .35s ease-out; }
@keyframes pct-hit {
  0% { transform: scale(1.5); filter: brightness(2.2); }
  100% { transform: scale(1); filter: none; }
}
.hud-tile .h-stocks { font-size: 10px; letter-spacing: 2px; }
.hud-tile.dead { opacity: .4; }

#touch-layer { position: absolute; inset: 0; }
#stick-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 45%; }
#action-zone { position: absolute; right: 0; top: 0; bottom: 0; width: 55%; }

#stick-base {
  position: absolute;
  width: 110px; height: 110px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.06);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
#stick-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  transform: translate(-50%, -50%);
}

.ability-btn {
  position: absolute;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  background: rgba(20,24,48,.75);
  color: var(--ink);
  font-size: 24px;
  z-index: 5;
}
.ability-btn .ab-icon { position: relative; z-index: 2; }
.ability-btn svg { position: absolute; inset: -2px; width: 62px; height: 62px; transform: rotate(-90deg); }
.ability-btn .cd-ring {
  fill: none; stroke: var(--accent); stroke-width: 4;
  stroke-dasharray: 113; stroke-dashoffset: 0;
}
.ability-btn.cooling { opacity: .55; }
#ability-btn-0 { right: 92px; bottom: calc(22px + var(--safe-bottom)); }
#ability-btn-1 { right: 16px; bottom: calc(80px + var(--safe-bottom)); }

#game-quit { position: absolute; top: calc(8px + var(--safe-top)); right: 10px; z-index: 6; }

#game-toast {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 34px;
  font-weight: 900;
  font-style: italic;
  text-shadow: 0 3px 0 rgba(0,0,0,.5);
  pointer-events: none;
  animation: toast-pop .5s;
}
@keyframes toast-pop { 0% { transform: translateX(-50%) scale(.3); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }

#game-help {
  position: absolute; inset: 0;
  background: rgba(5,7,18,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  padding: 20px;
}
.help-card {
  background: var(--panel);
  border-radius: 20px;
  padding: 22px;
  max-width: 400px;
  display: flex; flex-direction: column; gap: 12px;
}
.help-card p { font-size: 14px; color: var(--ink-dim); line-height: 1.5; }
.help-card b { color: var(--ink); }

#net-banner {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: var(--warn);
  color: #221a06;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
#net-banner.bad { background: var(--bad); color: #fff; }
#net-banner.good { background: var(--good); color: #06210f; }
#net-banner.tappable { cursor: pointer; box-shadow: 0 6px 22px rgba(0,0,0,.45); }
