/* City Warfare — dark, high-contrast, readable over a moving battlefield. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  background: #0d1017;
  color: #e8edf6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* Nameplates and crosshair. It sits on top of the WebGL canvas and is the
   pointer-lock target, so it must accept the click that grabs the mouse. */
#overlay { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; z-index: 5; cursor: crosshair; }
html.device-phone #overlay, html.device-tablet #overlay { pointer-events: none; }

.hidden { display: none !important; }

/* ------------------------------------------------------------------ HUD */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > div { position: absolute; }

#top-left { top: 14px; left: 14px; }
#top-right { top: 14px; right: 14px; text-align: right; }
#bottom-left { left: 14px; bottom: 14px; }
#bottom-right { right: 14px; bottom: 14px; text-align: right; }

#hp-wrap {
  position: relative; width: 260px; height: 26px;
  background: rgba(6, 9, 14, 0.72); border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px; overflow: hidden;
}
#hp-bar {
  position: absolute; inset: 0; width: 100%;
  background: linear-gradient(90deg, #37d67a, #7ef0a8);
  transition: width 90ms linear;
}
#hp-wrap.hurt #hp-bar { background: linear-gradient(90deg, #d6a237, #f0d67e); }
#hp-wrap.crit #hp-bar { background: linear-gradient(90deg, #d63f37, #f08a7e); }
#hp-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

#loadout {
  margin-top: 8px; background: rgba(6, 9, 14, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px;
  padding: 6px 9px; font-size: 12px; max-width: 260px;
}
.lo-row { display: flex; gap: 8px; align-items: baseline; }
.lo-row + .lo-row { margin-top: 3px; }
.lo-key { color: #7b88a1; font-size: 10px; letter-spacing: 0.08em; min-width: 40px; }
#gun-name, #melee-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#perk-row { margin-top: 6px; display: flex; gap: 6px; }
.perk {
  background: rgba(120, 80, 200, 0.28); border: 1px solid rgba(170, 130, 255, 0.5);
  color: #d8c8ff; border-radius: 5px; padding: 3px 7px; font-size: 11px; font-weight: 600;
}
.perk.cooling { opacity: 0.4; }

#city-chip, #kp-chip, #spin-chip {
  display: inline-block; background: rgba(6, 9, 14, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px;
  padding: 5px 10px; font-size: 13px; margin-bottom: 6px;
}
#city-name { font-weight: 700; }
#city-arch { color: #7b88a1; margin-left: 7px; font-size: 11px; }
#kp-chip { color: #ffd76e; font-weight: 700; font-variant-numeric: tabular-nums; }
.kp-label { color: #8a8060; font-weight: 400; font-size: 11px; }
#spin-chip { display: block; color: #ffb3f0; border-color: rgba(255, 140, 230, 0.45); background: rgba(70, 20, 60, 0.6); }
#daily-chip {
  display: block; cursor: pointer; color: #9ff0c4; font-weight: 600;
  border: 1px solid rgba(120, 235, 175, 0.45); background: rgba(16, 58, 40, 0.66);
  border-radius: 6px; padding: 5px 10px; font-size: 13px; margin-bottom: 6px;
}

#scores {
  list-style: none; background: rgba(6, 9, 14, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px;
  padding: 6px 9px; font-size: 12px; min-width: 190px; display: none;
}
#scores.show { display: block; }
#scores li { display: flex; justify-content: space-between; gap: 12px; padding: 1px 0; }
#scores li.me { color: #7ef0a8; font-weight: 700; }
#scores li.boss { color: #ff6b7e; font-weight: 700; }
#scores .sc-k { font-variant-numeric: tabular-nums; color: #b9c4d8; }

#boss-banner {
  top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(90, 15, 28, 0.85); border: 1px solid #ff4d5e;
  color: #ffd0d5; padding: 7px 16px; border-radius: 7px;
  font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  box-shadow: 0 0 24px rgba(255, 77, 94, 0.35);
  animation: bosspulse 2.2s ease-in-out infinite;
}
@keyframes bosspulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }

#lock-hint {
  top: 50%; left: 50%; transform: translate(-50%, 60px);
  background: rgba(6, 9, 14, 0.78); border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cdd8ea; padding: 8px 16px; border-radius: 8px; font-size: 13px;
  pointer-events: none;
}

#feed {
  top: 62px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 13px; pointer-events: none;
}
.feed-line {
  background: rgba(6, 9, 14, 0.7); border-radius: 5px; padding: 3px 10px;
  animation: feedin 240ms ease-out;
}
.feed-line .a { color: #7ef0a8; font-weight: 700; }
.feed-line .b { color: #ff9a9a; font-weight: 700; }
.feed-line.boss { border: 1px solid #ff4d5e; }
@keyframes feedin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }

#minimap {
  background: rgba(6, 9, 14, 0.74); border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px; width: 168px; height: 168px;
}

#ammo { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 2px 8px rgba(0,0,0,0.85); }
#ammo-mag, #ammo-sep { font-size: 18px; color: #7b88a1; }
#ammo.empty #ammo-now { color: #ff6b6b; }
#reload-bar { width: 120px; height: 5px; background: rgba(255,255,255,0.16); border-radius: 3px; margin: 6px 0 0 auto; overflow: hidden; }
#reload-fill { height: 100%; width: 0; background: #ffd76e; }
#hint { margin-top: 7px; font-size: 11px; color: #6d7a92; }

/* Touch controls: hidden unless the device gate says this is a touch device. */
.touch-ctrl { display: none; pointer-events: auto; }
html.device-phone .touch-ctrl, html.device-tablet .touch-ctrl { display: flex; }
html.device-phone #hint, html.device-tablet #hint { display: none; }
html.device-phone #minimap, html.device-tablet #minimap { width: 108px; height: 108px; }
html.device-phone #hp-wrap { width: 180px; }
html.device-phone #loadout { max-width: 180px; font-size: 11px; }

#stick-move, #stick-aim {
  position: absolute; bottom: 26px; width: 132px; height: 132px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.14);
  align-items: center; justify-content: center; touch-action: none;
}
#stick-move { left: 22px; }
#stick-aim { right: 22px; }
.knob { width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
#stick-aim .knob { background: rgba(255, 120, 120, 0.32); }
#btn-fire {
  position: absolute; right: 170px; bottom: 34px;
  width: 84px; height: 84px; border-radius: 50%;
  background: rgba(190, 50, 50, 0.55); border: 2px solid rgba(255, 130, 130, 0.7);
  color: #fff; font-size: 15px; font-weight: 800; letter-spacing: 0.06em;
  align-items: center; justify-content: center;
}
#btn-fire:active { background: rgba(230, 70, 70, 0.8); }
#touch-btns { right: 24px; bottom: 176px; flex-direction: column; gap: 9px; }
#touch-btns button {
  width: 54px; height: 54px; border-radius: 50%; font-size: 20px;
  background: rgba(20, 26, 38, 0.85); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e8edf6;
}
html.device-phone #bottom-left { bottom: 172px; }
html.device-tablet #bottom-left { bottom: 178px; }
html.device-phone #bottom-right, html.device-tablet #bottom-right { bottom: 178px; right: 92px; }
html.device-tablet #bottom-right { right: 96px; }

/* -------------------------------------------------------------- overlays */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: radial-gradient(1200px 700px at 50% 0%, rgba(30, 42, 68, 0.9), rgba(8, 10, 15, 0.96));
  display: flex; align-items: center; justify-content: center;
  padding: 3vh 3vw; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.sheet {
  width: 100%; max-width: 620px;
  background: rgba(14, 18, 27, 0.94); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px; padding: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.sheet.wide { max-width: 940px; display: flex; flex-direction: column; max-height: 94vh; }
.sheet.narrow { max-width: 380px; text-align: center; }

/* Credit, tucked into the corner of the menu sheet the way hide-in-plain-sight
   signs its main menu. */
#menu .sheet { position: relative; }
/* Keep the title clear of the signature when the sheet is narrow. */
#menu .sheet h1 { padding-right: 76px; }
.menu-signature {
  position: absolute; top: 14px; right: 18px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.25em;
  text-transform: lowercase; color: #77b6ff; opacity: 0.85;
  text-shadow: 0 0 12px rgba(119, 182, 255, 0.45);
  pointer-events: none;
}

h1 { font-size: clamp(26px, 5vw, 40px); letter-spacing: -0.02em; }
h2 { font-size: 19px; }
.tagline { color: #93a1bb; margin: 4px 0 14px; font-size: 14px; }

.who { font-size: 13px; color: #93a1bb; margin-bottom: 12px; }
.who strong { color: #7ef0a8; }
.who .guest { color: #ffd76e; }

#guest-name-row { margin-bottom: 12px; }
.mini-link { display: inline-block; margin-top: 6px; font-size: 12px; color: #77b6ff; text-decoration: none; }
.mini-link:hover { text-decoration: underline; }

input, select {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e8edf6; border-radius: 8px; padding: 9px 11px; font-size: 14px;
  font-family: inherit; width: 100%;
}
input:focus, select:focus { outline: 2px solid #4d7fd6; outline-offset: 1px; }
select { cursor: pointer; }
select option { background: #141a27; }

.boss-line {
  background: rgba(90, 15, 28, 0.4); border: 1px solid rgba(255, 77, 94, 0.4);
  color: #ffc3c9; border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 16px;
}
.boss-line strong { color: #ff8f9c; }
.boss-line.dead { background: rgba(30, 36, 50, 0.5); border-color: rgba(255,255,255,0.12); color: #93a1bb; }

.map-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.map-head h2 { flex: 1; white-space: nowrap; }
.map-head input { max-width: 220px; padding: 7px 10px; font-size: 13px; }

.city-grid {
  /* position: relative so a tile's offsetTop is measured against the grid —
     that is what the boss reveal scrolls by. */
  position: relative;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 6px; max-height: 40vh; overflow-y: auto; padding: 4px;
  background: rgba(0, 0, 0, 0.22); border-radius: 9px; margin-bottom: 16px;
}
.city {
  background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px; padding: 7px 8px; cursor: pointer; text-align: left;
  color: inherit; font-family: inherit; transition: background 120ms, border-color 120ms;
}
.city:hover { background: rgba(255, 255, 255, 0.1); }
.city.on { border-color: #5b8dd6; background: rgba(91, 141, 214, 0.2); }
.city .cn { display: block; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city .ca { display: block; font-size: 10px; color: #7b88a1; }
.city .cp { display: block; font-size: 10px; color: #7ef0a8; margin-top: 2px; }
/* The one city ETHAN is in. It has to win against 100 other tiles at a
   glance, so it takes the whole tile — name included — not just the border. */
.city.hasboss {
  border-color: #ff4d5e;
  background: rgba(150, 22, 40, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 77, 94, 0.5), 0 0 16px rgba(255, 77, 94, 0.35);
  animation: boss-pulse 1.6s ease-in-out infinite;
}
.city.hasboss:hover { background: rgba(180, 28, 48, 0.55); }
.city.hasboss .cn { color: #ff6b78; }
.city.hasboss .ca { color: #ff8f9c; font-weight: 700; }
.city.hasboss.on { border-color: #ff8f9c; }
@keyframes boss-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 77, 94, 0.5), 0 0 14px rgba(255, 77, 94, 0.28); }
  50%      { box-shadow: 0 0 0 1px rgba(255, 77, 94, 0.8), 0 0 22px rgba(255, 77, 94, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .city.hasboss { animation: none; }
}

.menu-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.big-btn {
  flex: 1; min-width: 130px; padding: 13px 18px; border-radius: 10px;
  border: none; background: linear-gradient(180deg, #4d7fd6, #3a63ad);
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.big-btn:hover { filter: brightness(1.1); }
.big-btn:active { transform: translateY(1px); }
.big-btn.ghost { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); }
.big-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.menu-msg { margin-top: 10px; font-size: 13px; color: #ffb3b3; min-height: 18px; }
.menu-msg.good { color: #7ef0a8; }

.how { margin-top: 16px; font-size: 13px; color: #93a1bb; }
.how summary { cursor: pointer; color: #b9c4d8; }
.how ul { margin: 9px 0 0 18px; display: flex; flex-direction: column; gap: 5px; }
.how strong { color: #e8edf6; }

.back-link { display: inline-block; margin-top: 16px; color: #77b6ff; text-decoration: none; font-size: 14px; }
.back-link:hover { text-decoration: underline; }

/* --------------------------------------------------------------- armory */

.armory-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.armory-head h2 { flex: 1; }
.armory-kp { color: #ffd76e; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.x-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06); color: #e8edf6; cursor: pointer; font-size: 15px;
}

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tab {
  padding: 8px 13px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05); color: #b9c4d8; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
}
.tab.on { background: rgba(91, 141, 214, 0.25); border-color: #5b8dd6; color: #fff; }
.tab-n { color: #7b88a1; font-weight: 400; margin-left: 5px; font-size: 11px; }

.filters { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.filters input { flex: 2; min-width: 140px; }
.filters select { flex: 1; min-width: 130px; }
.owned-toggle { font-size: 12px; color: #93a1bb; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.owned-toggle input { width: auto; }

.item-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding-right: 4px; min-height: 200px; }
.item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
}
.item.equipped { border-color: #37d67a; background: rgba(55, 214, 122, 0.1); }
.item.locked { opacity: 0.62; }
.item .swatch { width: 30px; height: 30px; border-radius: 7px; flex: none; border: 2px solid rgba(255,255,255,0.2); }
.item .info { flex: 1; min-width: 0; }
.item .nm { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .st { font-size: 11px; color: #8593ad; margin-top: 2px; }
.item .st b { color: #b9c4d8; font-weight: 600; }
.item .tier { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,0.1); color: #b9c4d8; margin-left: 6px; }
.item .act { display: flex; gap: 6px; flex: none; }
.item button {
  padding: 7px 12px; border-radius: 7px; border: none; cursor: pointer;
  font-size: 12px; font-weight: 700; font-family: inherit;
  background: linear-gradient(180deg, #4d7fd6, #3a63ad); color: #fff;
}
.item button.own { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18); color: #b9c4d8; }
.item button[disabled] { opacity: 0.4; cursor: not-allowed; }
.item .price { color: #ffd76e; font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item.prize { border-color: rgba(170, 130, 255, 0.5); background: rgba(80, 50, 140, 0.16); }
.item.prize .nm { color: #d8c8ff; }
.item .blurb { font-size: 11px; color: #a99ad0; margin-top: 3px; }
.empty-note { color: #7b88a1; font-size: 13px; padding: 20px; text-align: center; }

/* ---------------------------------------------------------------- daily */

/* Fourteen rungs on one grid: seven across is a week per row, which is the
   whole point of the ladder and saves the tiles having to say so. */
.daily-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; margin-bottom: 12px;
}
.day {
  position: relative; text-align: center; border-radius: 9px; padding: 8px 3px 7px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
}
.day .d-n { font-size: 10px; color: #7b88a1; letter-spacing: 0.04em; }
.day .d-kp { font-size: 15px; font-weight: 800; color: #ffd76e; font-variant-numeric: tabular-nums; }
.day .d-skin {
  width: 15px; height: 15px; border-radius: 4px; margin: 3px auto 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
}
.day .d-mark { font-size: 9px; color: #93a1bb; margin-top: 2px; }
.day.done { background: rgba(55, 214, 122, 0.12); border-color: rgba(55, 214, 122, 0.4); }
.day.done::after {
  content: '✓'; position: absolute; top: 3px; right: 5px;
  font-size: 10px; color: #37d67a; font-weight: 800;
}
.day.next { border-color: #ffd76e; background: rgba(255, 215, 110, 0.12); box-shadow: 0 0 0 1px rgba(255, 215, 110, 0.35); }
.day.next .d-n { color: #ffd76e; }
.day.locked { opacity: 0.5; }
#daily-result { min-height: 0; }
#daily-result:empty { display: none; }

/* ---------------------------------------------------------------- wheel */

#wheel { display: block; margin: 8px auto 12px; max-width: 100%; }
.wheel-result { min-height: 46px; font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.wheel-result .got { color: #ffd76e; font-size: 19px; display: block; }
.wheel-result .blurb { color: #93a1bb; font-weight: 400; font-size: 12px; display: block; margin-top: 4px; }
.odds { margin-top: 12px; font-size: 11px; color: #6d7a92; line-height: 1.5; }

.respawn { font-size: 30px; font-weight: 800; color: #ffd76e; margin-top: 10px; }
#death-by { color: #93a1bb; font-size: 14px; }
#death .sheet { background: rgba(30, 12, 16, 0.9); border-color: rgba(255, 77, 94, 0.3); }

@media (max-width: 560px) {
  .sheet { padding: 16px; }
  .map-head { flex-wrap: wrap; }
  .map-head input { max-width: none; }
  .city-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 34vh; }
  .item .act { flex-direction: column; }
  /* Seven tiles across is unreadable on a phone. Two rows of seven become
     four rows of four; the week boundary stops lining up, which is what the
     "One week" / "Two weeks" labels on those two tiles are there for. */
  .daily-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .day { padding: 6px 2px 5px; }
  .day .d-kp { font-size: 14px; }
}
