:root {
  color-scheme: dark;
  --bg: #0b1216;
  --surface: rgba(16, 25, 31, 0.90);
  --surface-strong: rgba(18, 28, 35, 0.97);
  --surface-solid: #121c23;
  --surface-elevated: #1b2933;
  --surface-hover: #243542;
  --border: rgba(212, 232, 238, 0.12);
  --border-strong: rgba(212, 232, 238, 0.22);
  --ink: #f2f7f5;
  --ink-soft: #b6c8c5;
  --muted: #7e9494;
  --emerald: #16c784;
  --emerald-deep: #0ea46b;
  --emerald-soft: rgba(22, 199, 132, 0.16);
  --amber: #f0ad3e;
  --amber-deep: #d38d1d;
  --amber-soft: rgba(240, 173, 62, 0.16);
  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, 0.16);
  --coral: #e56b55;
  --coral-soft: rgba(229, 107, 85, 0.16);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.50);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.36);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font: 14px/1.45 'Inter', 'SF Pro Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overscroll-behavior: none;
}
body.app-body { overflow: hidden; height: 100dvh; width: 100vw; position: fixed; inset: 0; }
body.manual-body { min-height: 100dvh; overflow-y: auto; background: radial-gradient(circle at 18% 0%, #16262e 0%, #0b1216 68%); }
.tabular { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Base interactive controls */
button {
  min-height: 44px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface-elevated); color: var(--ink); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: 0.01em; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}
button:hover { background: var(--surface-hover); border-color: rgba(212, 232, 238, 0.34); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.42; cursor: not-allowed; transform: none; box-shadow: none; }
button.primary { background: linear-gradient(180deg, #1bd48e 0%, var(--emerald-deep) 100%); border-color: rgba(255,255,255,0.16); color: #061b12; box-shadow: 0 8px 20px rgba(22, 199, 132, 0.28); }
button.primary:hover { filter: brightness(1.06); }
button.amber { background: linear-gradient(180deg, #f6ba50 0%, var(--amber-deep) 100%); border-color: rgba(255,255,255,0.18); color: #1b1204; box-shadow: 0 8px 20px rgba(240, 173, 62, 0.28); }
button.amber:hover { filter: brightness(1.06); }
button.coral { background: linear-gradient(180deg, #ee7a65 0%, #c9523d 100%); border-color: rgba(255,255,255,0.18); color: #fff; box-shadow: 0 8px 20px rgba(229, 107, 85, 0.28); }
button.sky { background: linear-gradient(180deg, #56ccff 0%, #0284c7 100%); border-color: rgba(255,255,255,0.18); color: #051b2a; }
button.ghost { background: transparent; border-color: var(--border); color: var(--ink-soft); }
button.ghost:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
button.danger-ghost { background: var(--coral-soft); border-color: rgba(229, 107, 85, 0.32); color: #ff9c8a; }
button.danger-ghost:hover { background: rgba(229, 107, 85, 0.26); border-color: var(--coral); }
button.icon-btn { width: 44px; padding: 0; border-radius: 12px; }
button.compact { min-height: 36px; padding: 6px 12px; font-size: 12px; border-radius: 10px; white-space: nowrap; flex: 0 0 auto; }
input {
  width: 100%; min-height: 46px; color: var(--ink); background: #0e171d;
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 13px;
  font: inherit; font-size: 14px; transition: border-color 0.16s, box-shadow 0.16s;
}
input::placeholder { color: var(--muted); }
input:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }
.field-label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.pill-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; flex: 0 0 auto; }
.pill-tag.emerald { background: var(--emerald-soft); color: var(--emerald); border: 1px solid rgba(22, 199, 132, 0.35); }
.pill-tag.sky { background: var(--sky-soft); color: var(--sky); border: 1px solid rgba(56, 189, 248, 0.38); }
.pill-tag.amber { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(240, 173, 62, 0.38); }
.pill-tag.coral { background: var(--coral-soft); color: #ff9c8a; border: 1px solid rgba(229, 107, 85, 0.38); }

/* Full-bleed live map viewport */
.map-stage { position: fixed; inset: 0; z-index: 1; background: var(--bg); }
.map-gl { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--bg); z-index: 1; }
.map-gl .maplibregl-canvas { outline: none; }
.map-gl .maplibregl-ctrl-logo, .map-gl .maplibregl-ctrl-attrib { display: none; }
canvas#map { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; height: 100%; background: var(--bg); touch-action: none; cursor: grab; }
canvas#map.gl-overlay { background: transparent; pointer-events: none; cursor: default; }
.map-empty {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center;
  gap: 10px; padding: 24px; text-align: center; pointer-events: none;
}
.map-empty-card {
  max-width: 300px; padding: 20px 22px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border-strong);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow-lg);
}
.map-pin { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 14px; background: var(--emerald-soft); border: 1px solid rgba(22, 199, 132, 0.35); color: var(--emerald); display: grid; place-items: center; }
.map-empty strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 6px; }
.map-empty span { display: block; font-size: 13px; color: var(--ink-soft); line-height: 1.45; }

/* Floating Top HUD */
.hud-top {
  position: fixed; z-index: 20; top: calc(10px + var(--safe-top)); left: 12px; right: 12px;
  display: flex; justify-content: center; pointer-events: none;
}
.hud-pill {
  pointer-events: auto; width: 100%; max-width: 580px; min-height: 54px; padding: 7px 10px 7px 12px;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--border-strong);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.hud-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-emblem { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); display: grid; place-items: center; }
.hud-session { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hud-session-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.where { font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { font-size: 11px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ws-status { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--muted); }
.ws-status.connected { background: var(--emerald); box-shadow: 0 0 0 3px rgba(22, 199, 132, 0.24); }
.ws-status.disconnected { background: var(--coral); }
.hud-right { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.credits-pill {
  min-height: 36px; padding: 5px 12px; border-radius: 999px;
  background: linear-gradient(180deg, #f6ba50 0%, #d38d1d 100%); border: 1px solid rgba(255,255,255,0.22);
  color: #1b1204; font-size: 12px; font-weight: 900; letter-spacing: 0.03em; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(240, 173, 62, 0.26);
}
.credits-pill:hover { filter: brightness(1.07); background: linear-gradient(180deg, #f6ba50 0%, #d38d1d 100%); }
.avatar-btn {
  width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%;
  background: var(--amber-soft); border: 2px solid var(--amber);
  color: var(--ink); font-size: 13px; font-weight: 800;
}
.avatar-btn.guest-out { background: var(--surface-elevated); border-color: var(--border-strong); color: var(--ink-soft); }

/* Floating Toast Banner */
.toast {
  position: fixed; z-index: 38; top: calc(72px + var(--safe-top)); left: 50%; transform: translateX(-50%) translateY(-8px);
  max-width: min(370px, calc(100vw - 124px)); padding: 8px 13px; border-radius: 999px;
  background: var(--surface-strong); border: 1px solid var(--border-strong); color: var(--ink);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow-md);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--amber); }
.toast.ok .toast-dot { background: var(--emerald); }
.toast.bad .toast-dot { background: var(--coral); }
#toast-text { overflow: hidden; text-overflow: ellipsis; }

/* Right-Edge Thumb Rail Map Controls */
.map-tools {
  position: fixed; z-index: 18; right: 12px; top: calc(76px + var(--safe-top));
  display: flex; flex-direction: column; gap: 7px; align-items: center;
}
.map-tools button {
  width: 44px; padding: 0; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow-md);
  font-size: 18px;
}
.map-tools button.active { background: rgba(11, 29, 24, 0.92); border-color: rgba(22, 199, 132, 0.72); color: var(--emerald); }
.map-tools button.active-amber { background: rgba(28, 22, 11, 0.92); border-color: rgba(240, 173, 62, 0.78); color: var(--amber); }
#btn-map-3d { font-size: 12px; font-weight: 900; letter-spacing: 0.04em; }
.map-zoom-group { display: flex; flex-direction: column; gap: 2px; border-radius: 13px; overflow: hidden; box-shadow: var(--shadow-md); }
.map-zoom-group button { border-radius: 0; box-shadow: none; }
.map-zoom-group button:first-child { border-radius: 13px 13px 0 0; }
.map-zoom-group button:last-child { border-radius: 0 0 13px 13px; }

/* Bottom Conquest Stack & Framed Target Card */
.bottom-stack {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
}
.target-card {
  pointer-events: auto; width: calc(100% - 24px); max-width: 540px; margin-bottom: 8px;
  padding: 12px 14px; border-radius: 18px; background: var(--surface-strong);
  border: 1.5px solid rgba(229, 107, 85, 0.5); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: relative; overflow: hidden;
}
.target-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--emerald), var(--amber)); }
.target-card.frame-gold { border-color: rgba(245, 158, 11, 0.78); box-shadow: 0 10px 30px rgba(245, 158, 11, 0.22); }
.target-card.frame-gold::before { background: linear-gradient(90deg, #f59e0b, #fef08a, #d97706); height: 4px; }
.target-card.frame-frost { border-color: rgba(125, 211, 252, 0.78); box-shadow: 0 10px 30px rgba(56, 189, 248, 0.22); }
.target-card.frame-frost::before { background: linear-gradient(90deg, #38bdf8, #e0f2fe, #0284c7); height: 4px; }
.target-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.target-badge { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 900; border: 2px solid var(--amber); background: var(--surface-elevated); color: var(--ink); }
.target-info { min-width: 0; }
.target-title { font-size: 14px; font-weight: 800; letter-spacing: 0.02em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-subrow { display: flex; align-items: center; gap: 7px; margin-top: 3px; flex-wrap: wrap; }
.target-meta { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.map-foot {
  pointer-events: auto; width: calc(100% - 28px); max-width: 540px; margin-bottom: 6px; padding: 4px 10px;
  border-radius: 999px; background: rgba(11, 18, 22, 0.72); border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10px; color: var(--ink-soft); white-space: nowrap; overflow: hidden;
}
.map-foot a { color: var(--ink-soft); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.map-foot a:hover { text-decoration: underline; }
.conquest-dock {
  pointer-events: auto; width: calc(100% - 24px); max-width: 540px; margin-bottom: 10px;
  padding: 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border-strong);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 10px;
}
.run-stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.step-pill {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--muted); background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.step-pill.done { background: var(--emerald-soft); color: var(--emerald); border-color: rgba(22, 199, 132, 0.36); }
.step-pill.active { background: var(--amber-soft); color: var(--amber); border-color: rgba(240, 173, 62, 0.42); }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action-grid button { min-width: 0; width: 100%; }
.action-grid .wide { grid-column: 1 / -1; }
.dock-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.dock-hero-btn { font-size: 14px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.dock-discard-btn { padding: 0 12px; font-size: 12px; white-space: nowrap; }
.secondary-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.secondary-actions button { flex: 1; }

/* Persistent 5-Tab Bottom Nav Bar */
.bottom-nav {
  position: fixed; z-index: 28; left: 0; right: 0; bottom: 0; width: 100%; background: var(--surface-strong);
  border-top: 1px solid var(--border-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: 6px 6px calc(6px + var(--safe-bottom)); display: flex; justify-content: center;
}
.bottom-nav-inner { width: 100%; max-width: 580px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.nav-btn {
  position: relative; min-height: 48px; padding: 5px 2px; border: none; border-radius: 12px; background: transparent;
  color: var(--muted); flex-direction: column; gap: 3px; font-size: 10.5px; font-weight: 700;
}
.nav-btn:hover { background: rgba(255,255,255,0.04); color: var(--ink-soft); }
.nav-btn.active { color: var(--amber); background: rgba(240, 173, 62, 0.10); }
.nav-btn svg { width: 19px; height: 19px; }
.nav-dot { position: absolute; top: 6px; right: calc(50% - 14px); width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 2px var(--surface-solid); }

/* Slide-Up Bottom Sheets (Mobile) / Floating Side Drawer (Desktop) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 22; background: rgba(6, 11, 14, 0.48);
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet-drawer {
  position: fixed; z-index: 26; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bottom));
  max-height: min(74dvh, 660px); margin: 0 auto; max-width: 580px;
  background: var(--surface-strong); border: 1px solid var(--border-strong); border-bottom: none;
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(100%); visibility: hidden; pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.28s;
}
.sheet-drawer.open { transform: translateY(0); visibility: visible; pointer-events: auto; }
.sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: rgba(212, 232, 238, 0.26); margin: 10px auto 4px; flex: 0 0 auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 18px 12px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.sheet-head-left { display: flex; align-items: center; gap: 10px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: 0.03em; text-transform: uppercase; }
.sheet-head-right { display: flex; align-items: center; gap: 8px; }
.sheet-body { padding: 14px 18px 22px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* Segmented Controls */
.seg-control { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: #0c1419; border: 1px solid var(--border); margin-bottom: 14px; }
.seg-control.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-control.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg-btn { min-height: 36px; padding: 6px 8px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; }
.seg-btn.active { background: var(--surface-elevated); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,0.28); }

/* Shop & Style Sheet */
.style-preview-box { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--border-strong); background: #0b1318; margin-bottom: 12px; }
.style-preview-canvas { display: block; width: 100%; height: 124px; }
.style-preview-bar { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px; background: rgba(11, 18, 22, 0.86); border: 1px solid var(--border-strong); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.seasonal-drop-card { padding: 14px; border-radius: 16px; background: linear-gradient(155deg, rgba(56, 189, 248, 0.22) 0%, rgba(18, 30, 40, 0.96) 72%); border: 1px solid rgba(125, 211, 252, 0.36); margin-bottom: 14px; }
.seasonal-drop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.seasonal-drop-head strong { font-size: 14px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; color: #e0f2fe; }
.seasonal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.swatch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.swatch-card { padding: 8px; border-radius: 13px; background: var(--surface-elevated); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; cursor: pointer; text-align: left; min-height: 0; align-items: stretch; justify-content: flex-start; }
.swatch-card:hover { border-color: rgba(212, 232, 238, 0.38); }
.swatch-card.equipped { border-color: var(--emerald); box-shadow: 0 0 0 1px var(--emerald); }
.swatch-preview { height: 42px; border-radius: 8px; position: relative; overflow: hidden; border: 1.5px solid rgba(255,255,255,0.18); }
.swatch-badge { position: absolute; top: 4px; right: 4px; padding: 2px 6px; border-radius: 6px; background: rgba(11, 18, 22, 0.82); font-size: 9px; font-weight: 800; color: var(--ink); }
.swatch-name { font-size: 11.5px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch-price { font-size: 11px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.swatch-price.owned { color: var(--emerald); }
.swatch-price.locked { color: var(--muted); }
.cosmetic-row-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.cosmetic-tile { padding: 10px 12px; border-radius: 13px; background: var(--surface-elevated); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; text-align: left; align-items: flex-start; }
.cosmetic-tile.equipped { border-color: var(--emerald); background: rgba(22, 199, 132, 0.08); }
.icon-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.icon-card { padding: 11px; border-radius: 14px; background: var(--surface-elevated); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 5px; text-align: left; align-items: flex-start; }
.icon-card.equipped { border-color: var(--amber); background: rgba(240, 173, 62, 0.10); }
.icon-card.locked { opacity: 0.62; }

/* Expedition Quests Sheet */
.starter-path-card { padding: 14px; border-radius: 16px; background: linear-gradient(180deg, rgba(240, 173, 62, 0.12) 0%, rgba(18, 28, 35, 0.96) 100%); border: 1px solid rgba(240, 173, 62, 0.38); margin-bottom: 14px; }
.starter-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.starter-step { padding: 9px 8px; border-radius: 12px; background: rgba(11, 18, 22, 0.65); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.starter-step.done { border-color: rgba(22, 199, 132, 0.45); }
.starter-step.ready { border-color: var(--amber); background: rgba(240, 173, 62, 0.12); }
.quest-card { padding: 12px 14px; border-radius: 15px; background: var(--surface-elevated); border: 1px solid var(--border); margin-bottom: 9px; display: flex; flex-direction: column; gap: 8px; }
.quest-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.quest-title { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.quest-desc { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.quest-bar-row { display: flex; align-items: center; gap: 10px; }
.quest-bar-track { flex: 1; height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.quest-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--emerald), var(--amber)); transition: width 0.25s ease; }
.quest-count { font-size: 11px; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.streak-badge { padding: 5px 10px; border-radius: 12px; background: linear-gradient(180deg, rgba(240, 173, 62, 0.24), rgba(211, 141, 29, 0.12)); border: 1px solid rgba(240, 173, 62, 0.48); color: var(--amber); font-size: 11px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }

/* Private Matches & Co-op Squad Sheet */
.active-match-card { padding: 14px; border-radius: 16px; background: linear-gradient(160deg, rgba(22, 199, 132, 0.14) 0%, #121d25 75%); border: 1px solid rgba(22, 199, 132, 0.36); margin-bottom: 14px; }
.active-match-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.active-match-title { font-size: 18px; font-weight: 900; letter-spacing: 0.02em; color: var(--ink); margin-top: 2px; }
.invite-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 11px; background: rgba(11, 18, 22, 0.6); border: 1px solid var(--border); }
.coop-member-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.coop-member-row:last-child { border-bottom: none; }
.host-box { padding: 14px; border-radius: 16px; background: #0e171d; border: 1px solid var(--border); margin-top: 12px; }
.host-box h3 { margin: 0 0 10px; font-size: 13px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.radius-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.radius-pill, .dur-pill { min-height: 36px; padding: 6px 4px; font-size: 11.5px; border-radius: 10px; }
.radius-pill.active, .dur-pill.active { background: var(--emerald-soft); border-color: rgba(22, 199, 132, 0.5); color: var(--emerald); }
.dur-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.lobby-browser, .admin-panel { font-size: 13px; padding: 12px; border-radius: 14px; background: #0e171d; border: 1px solid var(--border); margin-top: 12px; }
.lobby-browser h3, .admin-panel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 800; }
.lobby-browser .lobby-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.lobby-browser .lobby-item:last-child { border-bottom: none; }
.lobby-browser .lobby-info { flex: 1; min-width: 0; }
.lobby-browser .lobby-code { font-size: 14px; font-weight: 800; letter-spacing: 0.08em; color: var(--amber); }
.lobby-browser .lobby-meta { color: var(--muted); font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.admin-panel table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-panel th, .admin-panel td { padding: 7px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-panel th { font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em; }
.admin-panel .admin-actions { display: flex; gap: 6px; }

/* Standings Podium & Ranked List */
.podium-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.podium-card { padding: 10px; border-radius: 14px; background: var(--surface-elevated); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.podium-card.r1 { border-color: rgba(240, 173, 62, 0.45); background: linear-gradient(180deg, rgba(240, 173, 62, 0.14), var(--surface-elevated)); }
.podium-card.r2 { border-color: rgba(186, 204, 212, 0.35); }
.podium-card.r3 { border-color: rgba(205, 138, 92, 0.35); }
.rank-medal { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.r1 .rank-medal { background: var(--amber); color: #1d1203; }
.r2 .rank-medal { background: #b8c7d0; color: #101920; }
.r3 .rank-medal { background: #cd8a5c; color: #1d0e05; }
.podium-name { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-pts { font-size: 12px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.board { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.board:empty { display: none; }
.board-row { padding: 11px 12px; border-radius: 14px; background: var(--surface-elevated); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.board-row.me { border-color: rgba(240, 173, 62, 0.48); background: rgba(240, 173, 62, 0.08); }
.board-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.board-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.board-rank { width: 22px; font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.board-name { font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-stats { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.board-zones { font-size: 11px; font-weight: 600; color: var(--muted); }
.board-score { font-size: 14px; font-weight: 800; color: var(--ink); }
.board-bar-track { height: 5px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.board-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--emerald), var(--amber)); }
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.rule-tile { padding: 11px 12px; border-radius: 13px; background: var(--surface-elevated); border: 1px solid var(--border); }
.rule-k { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.rule-v { margin-top: 4px; font-size: 15px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Profile, Stats & Telemetry */
.profile-card { padding: 14px; border-radius: 16px; background: var(--surface-elevated); border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.profile-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.profile-avatar { width: 44px; height: 44px; border-radius: 14px; background: var(--amber-soft); border: 2px solid var(--amber); color: var(--ink); display: grid; place-items: center; font-size: 17px; font-weight: 800; flex: 0 0 44px; }
.profile-name { font-size: 16px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-sub { font-size: 12px; color: var(--muted); }
.stat-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat-tile { padding: 10px; border-radius: 13px; background: #0e171d; border: 1px solid var(--border); text-align: center; }
.stat-tile strong { display: block; font-size: 16px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.upgrade-card { padding: 12px; border-radius: 14px; background: rgba(22, 199, 132, 0.07); border: 1px solid rgba(22, 199, 132, 0.30); display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.upgrade-card-title { font-size: 12.5px; font-weight: 800; letter-spacing: 0.03em; color: var(--emerald); text-transform: uppercase; }
.upgrade-card-desc { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--ink-soft); }
.panel-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.panel { padding: 10px 12px; border-radius: 12px; background: #0a1115; color: #b7d7cb; border: 1px solid var(--border); max-height: 130px; overflow-y: auto; white-space: pre-wrap; font: 11px/1.55 ui-monospace, 'Cascadia Mono', monospace; }
.about-link-card { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: var(--surface-elevated); border: 1px solid var(--border); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px; }
.about-link-card:hover { background: var(--surface-hover); }
.about-link-card span { color: var(--amber); }

/* Modals: Auth & Starter Color Picker */
.auth-overlay {
  position: fixed; inset: 0; z-index: 40; padding: calc(18px + var(--safe-top)) 16px calc(18px + var(--safe-bottom));
  background: rgba(7, 13, 17, 0.76); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: grid; place-items: center; overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 396px; padding: 26px 22px 22px; border-radius: 24px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  position: relative;
}
.auth-close { position: absolute; top: 14px; right: 14px; width: 36px; min-height: 36px; height: 36px; padding: 0; border-radius: 10px; }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand svg { width: 52px; height: 52px; margin-bottom: 8px; }
.auth-brand h1 { margin: 0; font-size: 23px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
.auth-brand p { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.guest-privacy-note { margin: 8px 0 0; font-size: 11px; line-height: 1.4; color: var(--muted); text-align: center; }
.guest-privacy-note a { color: var(--amber); font-weight: 700; text-decoration: underline; }
.location-notice-box { padding: 10px 12px; border-radius: 12px; background: rgba(22, 199, 132, 0.08); border: 1px solid rgba(22, 199, 132, 0.28); display: flex; flex-direction: column; gap: 7px; }
.location-notice-title { font-size: 11.5px; font-weight: 800; letter-spacing: 0.03em; color: var(--emerald); }
.location-notice-text { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--ink-soft); }
.consent-check-row { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 11.5px; line-height: 1.4; color: var(--ink); font-weight: 600; }
.consent-check-row input[type="checkbox"] { width: 17px; height: 17px; min-height: 17px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--emerald); cursor: pointer; }
.consent-check-row a { color: var(--amber); text-decoration: underline; }
.auth-error { padding: 9px 12px; border-radius: 10px; background: var(--coral-soft); border: 1px solid rgba(229, 107, 85, 0.4); color: #ffb3a6; font-size: 12px; font-weight: 600; }
.auth-foot { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.auth-foot a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.auth-foot a:hover { color: var(--ink); }
.starter-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 16px; }
.starter-choice { padding: 14px 8px; border-radius: 16px; flex-direction: column; gap: 8px; background: var(--surface-elevated); border: 2px solid var(--border); }
.starter-choice:hover { border-color: rgba(255,255,255,0.45); }
.starter-dot { width: 38px; height: 38px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.28); }

/* Field Manual (/about) */
.manual-top { position: sticky; top: 0; z-index: 10; background: var(--surface-strong); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px); }
.manual-top-inner { max-width: 920px; margin: 0 auto; padding: calc(12px + var(--safe-top)) 18px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.manual-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.manual-brand h1 { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.manual-brand span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.manual-back { padding: 8px 14px; border-radius: 10px; background: var(--surface-elevated); border: 1px solid var(--border-strong); color: var(--amber); font-size: 13px; font-weight: 700; text-decoration: none; }
.guide-grid { max-width: 920px; margin: 0 auto; padding: 24px 18px calc(44px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.guide-card { padding: 20px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); }
.guide-step { display: inline-block; margin-bottom: 10px; padding: 4px 10px; border-radius: 999px; background: var(--emerald-soft); color: var(--emerald); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.guide-card h2 { margin: 0 0 8px; font-size: 17px; font-weight: 800; color: var(--ink); }
.guide-card p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }

/* Credits & Optional Top-Up Modal */
.auth-inline-link { background: transparent; border: 0; color: var(--muted); font-size: 12px; font-weight: 600; min-height: 32px; padding: 4px 8px; text-decoration: underline; }
.auth-inline-link:hover { color: var(--ink); }
.credits-dormant-note { padding: 12px; border-radius: 12px; background: rgba(22, 199, 132, 0.09); border: 1px solid rgba(22, 199, 132, 0.25); font-size: 12.5px; color: var(--ink); line-height: 1.45; }
.pack-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pack-card { position: relative; padding: 12px 10px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.pack-card.featured { border-color: rgba(240, 173, 62, 0.5); }
.pack-badge { position: absolute; top: -8px; right: 10px; padding: 2px 7px; border-radius: 999px; background: var(--amber); color: #191205; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.pack-credits { font-size: 16px; font-weight: 800; color: var(--amber); font-family: var(--mono); }
.pack-name { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.pack-bonus { font-size: 11px; color: var(--emerald); font-weight: 700; }
.ledger-list { display: flex; flex-direction: column; gap: 5px; max-height: 150px; overflow-y: auto; }
.ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--border); font-size: 12px; }
.ledger-delta { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.ledger-delta.pos { color: var(--emerald); }
.ledger-delta.neg { color: var(--coral); }

/* Desktop adaptation (>=900px): floating side drawer over full-bleed map */
@media (min-width: 900px) {
  .sheet-backdrop { background: transparent; pointer-events: none; }
  .bottom-stack.drawer-open { padding-right: 422px; transition: padding-right 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
  .sheet-drawer {
    left: auto; right: 16px; top: calc(76px + var(--safe-top)); bottom: calc(82px + var(--safe-bottom));
    width: 406px; max-height: none; border-radius: 22px; border-bottom: 1px solid var(--border-strong);
    transform: translateX(446px);
  }
  .sheet-drawer.open { transform: translateX(0); }
  .sheet-handle { display: none; }
  .map-tools { right: auto; left: 16px; top: calc(76px + var(--safe-top)); }
}

/* Narrow mobile thumb sizing */
@media (max-width: 760px) {
  button { min-height: 48px; } .map-tools button { width: 48px; min-height: 48px; }
  .action-grid { row-gap: 10px; }
  .secondary-actions { margin-top: 4px; }
  .avatar-btn { width: 38px; height: 38px; min-height: 38px; }
  .credits-pill { min-height: 36px; padding: 5px 10px; }
  .auth-close { width: 40px; height: 40px; min-height: 40px; }
  .seg-btn { min-height: 38px; }
  .radius-pill, .dur-pill, button.compact { min-height: 38px; }
  .swatch-card { min-height: 0; }
}
