:root {
  /* Flat neutral charcoal-gray palette (Dark Mode default) */
  --bg: #18191a;
  --surface: #202224;
  --surface-panel: rgba(26, 28, 30, 0.85);
  --surface-2: #26282b;
  --surface-hover: #2c2f33;
  --thead-bg: #232528;
  --border: #35393e;
  --border-strong: #4a4f56;
  --row-divider: #2e3237;

  /* Typography (high-contrast Dark Mode — passes WCAG AA+ on every label) */
  --text: #f1f2f4;
  --text-muted: #c4c8ce;
  --text-dim: #a4a9b1;

  /* Single primary accent: L4D Saferoom Door Red */
  --accent: #b83232;
  --accent-bright: #cf3d3d;
  --accent-soft: #e06a6a;
  --accent-bg: #2e1d1e;
  --accent-border: #8f2d2d;

  /* Tier / Entity 1px Borders (muted, disciplined) */
  --b-gray: #63676d;
  --b-gold: #b08b3e;
  --b-red: #b83232;

  /* Restrained semantic tones for tier/HP readability */
  --gold-text: #dfb963;
  --gold-bg: #2b261b;
  --badge-gray-bg: #27292c;
  --badge-gray-text: #cfd2d6;
  --avatar-bg: #1a1c1e;
  --entity-avatar-bg: #18191a;
  --modal-art-bg: #141517;
  --modal-art-frame-bg: #1a1c1f;
  --risk-text: #e4b6b6;
  --meter-track: #161718;
  --select-optgroup-bg: #1b1d1f;
  --select-option-bg: #232528;
  --table-fade-solid: #202224;
  --table-fade-clear: rgba(32, 34, 36, 0);

  --header-h: 74px;
  --tabs-h: 42px;
  --topbar-h: 116px;
  --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Barlow Condensed', 'Source Sans 3', sans-serif;
  --radius: 3px;
}

/* === LIGHT MODE (Tactical Field Manual — calm paper-gray, high contrast) === */
html[data-theme="light"] {
  --bg: #eceef1;
  --surface: #ffffff;
  --surface-panel: rgba(255, 255, 255, 0.9);
  --surface-2: #f4f5f7;
  --surface-hover: #e9ecf0;
  --thead-bg: #e4e7ec;
  --border: #d0d5dd;
  --border-strong: #b2b8c2;
  --row-divider: #e4e7ec;

  --text: #181a1d;
  --text-muted: #4b5058;
  --text-dim: #686f7a;

  --accent: #b83232;
  --accent-bright: #cf3d3d;
  --accent-soft: #a62424;
  --accent-bg: #fae9e9;
  --accent-border: #d89696;

  --b-gray: #8f96a0;
  --b-gold: #b5892b;
  --b-red: #b83232;

  --gold-text: #855e0d;
  --gold-bg: #fbf3df;
  --badge-gray-bg: #e8ebef;
  --badge-gray-text: #383d45;
  --avatar-bg: #e2e6eb;
  --entity-avatar-bg: #dde1e7;
  --modal-art-bg: #e7eaef;
  --modal-art-frame-bg: #dbe0e7;
  --risk-text: #7d1e1e;
  --meter-track: #dce0e6;
  --select-optgroup-bg: #e8ebef;
  --select-option-bg: #ffffff;
  --table-fade-solid: #ffffff;
  --table-fade-clear: rgba(255, 255, 255, 0);
}

html[data-theme="light"] body::before {
  opacity: 0.1;
  filter: grayscale(1) contrast(1.15) brightness(0.95) blur(0.4px);
  mix-blend-mode: multiply;
}

html[data-theme="light"] body::after {
  background: radial-gradient(ellipse at 50% 45%, rgba(236, 238, 241, 0.12) 0%, rgba(236, 238, 241, 0.82) 86%);
}

html[data-theme="light"] .brand-logo-img {
  filter: invert(1) hue-rotate(180deg) saturate(1.15);
}

html[data-theme="light"] .brand-wordmark {
  color: #181a1d;
}

html[data-theme="light"] mark.hl {
  background: #f8d4d4;
  color: #181a1d;
  border-bottom-color: var(--accent);
}

html[data-theme="light"] .drawer-backdrop {
  background: rgba(15, 18, 22, 0.52);
}

html[data-theme="light"] .spot-photo-caption {
  background: rgba(24, 25, 26, 0.84);
  color: #f0f1f2;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: rgba(184, 50, 50, 0.2);
}

html {
  background-color: var(--bg);
  scrollbar-gutter: stable;
}

html, body {
  overflow-x: clip;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  background-color: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
}

/* Subtle desaturated L4D2 hand backdrop — never overpowers text */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: url("Images/bg-l4d2-hand.jpg");
  background-repeat: no-repeat;
  background-position: center 54%;
  background-size: auto min(94vh, 960px);
  opacity: 0.44;
  filter: saturate(0.28) brightness(0.75) contrast(1.08) blur(0.4px);
  -webkit-mask-image: radial-gradient(ellipse 72% 86% at 50% 52%, #000 38%, rgba(0, 0, 0, 0.5) 72%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 86% at 50% 52%, #000 38%, rgba(0, 0, 0, 0.5) 72%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(24, 25, 26, 0.08) 0%, rgba(24, 25, 26, 0.65) 88%);
}

html.drawer-open,
body.drawer-open,
html.modal-open,
body.modal-open {
  overflow: hidden;
}

body.drawer-open,
body.modal-open {
  padding-right: var(--sb-comp, 0px);
}

.num, .tabular {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* === BORDER COLOR CODING (flat 1px) === */
.b-gray { border-color: var(--b-gray) !important; }
.b-gold { border-color: var(--b-gold) !important; }
.b-red { border-color: var(--b-red) !important; }

/* === TOPBAR === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 10px 24px 10px 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1;
}

.brand-logo-img {
  height: 68px;
  width: auto;
  margin: -8px 0;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 700;
  color: #f0f1f2;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.search-wrap {
  flex: 1 1 200px;
  min-width: 190px;
  max-width: 330px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#global-search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 32px 7px 32px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}

#global-search:focus {
  border-color: var(--accent);
}

#global-search::placeholder {
  color: var(--text-dim);
}

.clear-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.clear-btn:hover {
  color: var(--text);
}

/* Instant Search Dropdown (flat 1px border, no shadow) */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  max-height: 360px;
  overflow-y: auto;
  z-index: 80;
  padding: 4px;
}

.search-group-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 6px 8px 3px;
}

.search-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 7px 8px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 13.5px;
}

.search-item:hover {
  background: var(--surface-hover);
}

.search-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.search-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

mark.hl {
  background: var(--accent-bg);
  color: #ffffff;
  border-bottom: 1px solid var(--accent-bright);
  padding: 0 1px;
}

/* Mode Cluster (Selector + Consolidated Inline Summary) */
.mode-cluster {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.difficulty-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.diff-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.diff-pills {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}

.diff-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 2px;
  cursor: pointer;
}

.diff-pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.diff-pill.active {
  background: var(--accent);
  border-color: var(--accent-bright);
  color: #ffffff;
}

.realism-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.realism-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.realism-box {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  border: 1px solid var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.realism-toggle:hover:not(.disabled) {
  border-color: var(--border-strong);
  color: var(--text);
}

.realism-toggle.checked {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--text);
}

.realism-toggle.checked .realism-box {
  background: var(--accent);
  border-color: var(--accent);
}

.realism-toggle.checked .realism-box::after {
  content: "✓";
  font-size: 10px;
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
}

.realism-toggle.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mode-inline-summary {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.mode-inline-summary strong {
  color: var(--text);
  font-weight: 600;
}

.mode-inline-summary .sum-danger {
  color: var(--accent-soft);
  font-weight: 600;
}

/* Tabs (no count bubbles, flat border) */
.tabs-bar {
  position: sticky;
  top: var(--header-h, 74px);
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tabs-inner {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs-inner::-webkit-scrollbar,
.filter-group-single::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  padding: 9px 13px;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent-bright);
}

.tabs-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.theme-toggle-btn,
.share-tab-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.theme-toggle-btn:hover,
.share-tab-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* === MAIN CONTAINER === */
.container {
  max-width: 1340px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 44px;
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Controls & Chips */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.controls-weapons {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.wrap-controls {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-group-single {
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: center;
  gap: 5px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.chip-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}

.chip-gear {
  border-style: dashed;
}

.chip-gear.active {
  border-style: solid;
}

.hint-text {
  font-size: 12.5px;
  color: var(--text-dim);
}

/* === SPREADSHEET TABLES === */
.table-scroll-shell {
  position: relative;
}

.table-wrap {
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

.stats-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 14px;
}

.stats-table thead th {
  background: var(--thead-bg);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-strong);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#weapons-table thead th {
  position: sticky;
  top: var(--topbar-h, 116px);
  z-index: 25;
}

.stats-table thead th:hover {
  color: var(--text);
}

.stats-table thead th.sorted {
  color: var(--accent-soft);
}

.stats-table tbody tr {
  cursor: pointer;
}

.stats-table tbody td {
  border-bottom: 1px solid var(--row-divider);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table tbody tr:hover {
  background: var(--surface-hover);
}

/* Flat 1px-feel row left accent matching tier rules */
.stats-table tbody tr.row-b-gray td:first-child { border-left: 2px solid var(--b-gray); }
.stats-table tbody tr.row-b-gold td:first-child { border-left: 2px solid var(--b-gold); }
.stats-table tbody tr.row-b-red td:first-child { border-left: 2px solid var(--b-red); }

.stats-table td {
  padding: 8px 11px;
  white-space: nowrap;
  vertical-align: middle;
}

.stats-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.weapon-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weapon-avatar {
  width: 70px;
  height: 38px;
  border-radius: 2px;
  padding: 3px 5px;
  background: var(--avatar-bg);
  border: 1px solid var(--b-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.weapon-avatar img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.weapon-avatar-dual {
  gap: 2px;
  padding: 3px;
}

.weapon-avatar-dual img {
  max-width: 48%;
  max-height: 100%;
}

.weapon-avatar-dual .dual-right {
  transform: scaleX(-1);
}

.weapon-name-cell {
  display: flex;
  flex-direction: column;
}

.weapon-title {
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.weapon-cat {
  font-size: 12px;
  color: var(--text-dim);
}

.melee-tag {
  font-weight: 600;
}

.tag-sharp { color: var(--accent-soft); }
.tag-blunt { color: var(--text-muted); }

.pellet-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
}

.dps-hi {
  color: var(--text);
  font-weight: 400;
}

.mag-hi {
  color: var(--accent-soft);
  font-weight: 700;
}

/* Gear Tables */
.gear-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.gear-sections.solo-mode {
  margin-top: 0;
}

.gear-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gear-block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.gear-block-head h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.section-sub {
  font-size: 12.5px;
  color: var(--text-dim);
}

.gear-table-wrap {
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.gear-table thead th {
  position: static;
  cursor: default;
}

.gear-table td.wrap-cell {
  white-space: normal;
  min-width: 185px;
  max-width: 340px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Flat Badges (sentence/clean labels, 2px radius, 1px border) */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge-t1, .badge-sec, .badge-util, .badge-common {
  background: var(--badge-gray-bg);
  border-color: var(--b-gray);
  color: var(--badge-gray-text);
}

.badge-t2, .badge-special, .badge-uncommon {
  background: var(--gold-bg);
  border-color: var(--b-gold);
  color: var(--gold-text);
}

.badge-t3, .badge-boss, .badge-mode {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-soft);
}

.badge-type {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

/* === CARDS GRID === */
.cards-grid {
  display: grid;
  gap: 14px;
}

.infected-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr));
}

.spots-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 370px), 1fr));
}

.survivors-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
}

.card {
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.card-clickable {
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.card-clickable:hover {
  background: var(--surface-hover);
  border-color: var(--accent) !important;
}

.card-head-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color 0.12s ease, transform 0.12s ease;
}

.card-clickable:hover .card-chevron {
  color: var(--accent-soft);
  transform: translateX(2px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.entity-avatar {
  width: 56px;
  height: 56px;
  border-radius: 2px;
  background: var(--entity-avatar-bg);
  border: 1px solid var(--b-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.entity-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.survivor-avatar {
  width: 60px;
  height: 60px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}

.card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* HP Pill matched to border rule */
.hp-pill {
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
  border: 1px solid var(--b-gray);
}

.hp-pill.hp-gray {
  color: var(--badge-gray-text);
  background: var(--badge-gray-bg);
  border-color: var(--b-gray);
}

.hp-pill.hp-gold {
  color: var(--gold-text);
  background: var(--gold-bg);
  border-color: var(--b-gold);
}

.hp-pill.hp-red {
  color: var(--accent-soft);
  background: var(--accent-bg);
  border-color: var(--accent);
}

.stat-line {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 4px 10px;
  font-size: 13px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
}

.stat-row + .stat-row {
  border-top: 1px solid var(--row-divider);
}

.stat-row-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.stat-mini-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-mini-list li {
  position: relative;
  padding-left: 11px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.38;
  text-align: left;
}

.stat-mini-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-soft);
  font-weight: 700;
}

.stat-k {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.stat-v {
  color: var(--text);
  text-align: right;
  font-weight: 500;
}

.stat-v.danger {
  color: var(--accent-soft);
  font-weight: 700;
}

/* Infected counters: plain bold lead-in + em-dash (no pills) */
.counters-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.counter-item {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.counter-item strong {
  color: var(--text);
  font-weight: 700;
}

.card-note {
  font-size: 12.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* === GOD SPOTS (WITH IN-GAME SCREENSHOTS) === */
.spot-card {
  padding: 0;
  overflow: hidden;
  gap: 0;
}

.spot-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #141516;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.spot-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spot-photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(24, 25, 26, 0.86);
  border-top: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.spot-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.spot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.spot-pos {
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 7px 10px;
  border-radius: 2px;
}

.spot-pos strong {
  color: var(--text);
  margin-right: 4px;
}

.spot-steps {
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spot-risk {
  font-size: 12.5px;
  color: var(--risk-text);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 2px;
  padding: 7px 10px;
  margin-top: auto;
}

.spot-risk strong {
  color: var(--accent-soft);
  margin-right: 4px;
}

/* === SURVIVORS TAB === */
.survivor-section {
  margin-bottom: 24px;
}

.survivor-section:last-child {
  margin-bottom: 0;
}

.survivor-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.survivor-section-head h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.survivor-brief {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.voicelines-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.voicelines-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-soft);
}

.voicelines-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.voiceline-item {
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  padding: 6px 10px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.vl-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.vl-quote {
  color: var(--text);
  font-style: italic;
}

/* === CALCULATOR TAB === */
.calc-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calc-pickers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
}

.calc-picker-card {
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calc-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.calc-select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.calc-select:focus {
  border-color: var(--accent);
}

.calc-select optgroup {
  background: var(--select-optgroup-bg);
  color: var(--accent-soft);
}

.calc-select option {
  background: var(--select-option-bg);
  color: var(--text);
}

.calc-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 38px;
  height: 38px;
  align-self: center;
}

.calc-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px 10px;
}

.calc-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.calc-preview-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}

.calc-preview-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.calc-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.calc-result-card {
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-result-weakspot {
  border-color: var(--accent);
}

.calc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calc-card-head h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}

.calc-hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.calc-metric-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px 12px;
}

.calc-metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.calc-metric-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  color: var(--text);
  line-height: 1.15;
}

.calc-metric-val.accent { color: var(--accent-soft); }
.calc-metric-val.amber { color: var(--text); }
.calc-metric-val.danger { color: var(--accent-soft); }

.calc-metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.calc-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.calc-meter-track {
  height: 6px;
  border-radius: 2px;
  background: var(--meter-track);
  overflow: hidden;
  border: 1px solid var(--border);
}

.calc-meter-fill {
  height: 100%;
  background: var(--accent-bright);
}

.calc-meter-fill.fill-amber {
  background: #9fa3a8;
}

.calc-meter-fill.fill-red {
  background: var(--accent);
}

.calc-detail-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 9px 11px;
  font-size: 13px;
}

.calc-tactics-banner {
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-tactics-banner h4 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.calc-tactics-banner p {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* === ITEM DETAIL MODAL (BIG ART LEFT + STATS RIGHT, ZERO LAYOUT SHIFT) === */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 12, 0.78);
  z-index: 60;
}

.item-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  max-height: min(86dvh, 760px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  z-index: 70;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-art-pane {
  width: 300px;
  flex-shrink: 0;
  background: var(--modal-art-bg);
  border-right: 1px solid var(--border);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-art-stage {
  width: 100%;
  flex: 1;
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-art-frame {
  width: 100%;
  height: 100%;
  min-height: 210px;
  max-height: 270px;
  background: var(--modal-art-frame-bg);
  border: 1px solid var(--b-gray);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-art-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.modal-art-portrait {
  padding: 0;
}

.modal-art-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.modal-art-dual {
  gap: 10px;
  padding: 14px;
}

.modal-art-dual img {
  max-width: 47%;
  max-height: 100%;
}

.modal-art-dual .dual-right {
  transform: scaleX(-1);
}

.modal-art-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-art-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal-art-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.modal-detail-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}

.drawer-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.drawer-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.drawer-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.drawer-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* === FEEDBACK & BUG REPORT MODAL === */
.feedback-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(500px, calc(100vw - 24px));
  max-height: 90dvh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  z-index: 75;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.feedback-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.feedback-form {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-opt {
  font-weight: 400;
  color: var(--text-dim);
}

.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
}

.form-control::placeholder {
  color: var(--text-dim);
}

textarea.form-control {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.btn-secondary,
.btn-primary {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent-bright);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-bright);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.feedback-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
}

.feedback-open-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-bg);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kpi-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px 10px;
}

.kpi-box .k {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.kpi-box .v {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.drawer-section h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-soft);
  margin-bottom: 6px;
}

.stk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.stk-table th, .stk-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--row-divider);
}

.stk-table th {
  background: var(--thead-bg);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.stk-table td.num, .stk-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.notes-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.wiki-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  color: var(--accent-soft);
  text-decoration: none;
  font-weight: 600;
}

.wiki-link:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-dim);
  font-size: 13.5px;
  grid-column: 1 / -1;
}

/* === FOOTER (WITH AUTHOR & VERSION CREDIT) === */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

.footer-inner {
  max-width: 1340px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
}

.footer-author {
  color: var(--text-muted);
}

.footer-author strong {
  color: var(--text);
  font-weight: 600;
}

.footer a {
  color: var(--accent-soft);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.support-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent-bg);
  color: var(--text) !important;
  text-decoration: none !important;
}

.support-btn:hover {
  background: var(--accent);
  color: #ffffff !important;
}

.badge-tip {
  cursor: help;
}

.tier-tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  max-width: 290px;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.4;
  white-space: normal;
}

.tier-tooltip strong {
  color: var(--accent-soft);
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 95;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  max-width: calc(100vw - 28px);
  text-align: center;
}

/* === RESPONSIVE / SMARTPHONE === */
@media (max-width: 1040px) {
  .brand-logo-img {
    height: 54px;
    margin: -4px 0;
  }

  .brand-wordmark {
    font-size: 25px;
  }

  .search-wrap {
    max-width: none;
  }

  .mode-cluster {
    margin-left: 0;
    align-items: flex-start;
    width: 100%;
  }
}

@media (max-width: 780px) {
  .item-modal {
    flex-direction: column;
    width: calc(100vw - 20px);
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-art-pane,
  .modal-detail-pane {
    display: contents;
  }

  .item-modal .drawer-header {
    order: 1;
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .modal-art-stage {
    order: 2;
    min-height: 130px;
    flex: none;
    background: var(--modal-art-bg);
    padding: 12px 14px 0;
  }

  .modal-art-frame {
    min-height: 130px;
    max-height: 165px;
    padding: 12px;
  }

  .modal-art-meta {
    order: 3;
    background: var(--modal-art-bg);
    padding: 10px 14px 12px;
    border-bottom: 1px solid var(--border);
  }

  .item-modal .drawer-body {
    order: 4;
    overflow-y: visible;
    flex: none;
  }

  .modal-art-footer {
    order: 5;
    margin-top: 0;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--surface-2);
  }
}

@media (max-width: 900px) {
  .calc-pickers {
    grid-template-columns: 1fr;
  }
  .calc-vs {
    margin: 0 auto;
  }
  .calc-results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .topbar {
    position: relative;
  }

  .tabs-bar {
    top: 0;
  }

  /* Subtle right-edge fade hinting horizontal swipe on mobile tables */
  .table-scroll-shell::after {
    content: "";
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 34px;
    background: linear-gradient(to left, var(--table-fade-solid) 12%, var(--table-fade-clear) 100%);
    pointer-events: none;
    z-index: 10;
    border-top-right-radius: calc(var(--radius) - 1px);
    border-bottom-right-radius: calc(var(--radius) - 1px);
    transition: opacity 0.15s ease;
  }

  .table-scroll-shell.scrolled-end::after {
    opacity: 0;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #weapons-table thead th {
    position: static;
    top: auto;
  }

  #weapons-table th:first-child,
  #weapons-table td:first-child {
    position: sticky;
    left: 0;
    top: auto;
    z-index: 6;
    background: var(--surface);
    border-right: 1px solid var(--border);
    max-width: 190px;
  }

  #weapons-table thead th:first-child {
    position: sticky;
    left: 0;
    top: auto;
    background: var(--thead-bg);
    z-index: 8;
  }

  #weapons-table .weapon-avatar {
    width: 50px;
    height: 30px;
    padding: 2px 3px;
  }

  #weapons-table .weapon-title {
    white-space: normal;
    line-height: 1.2;
    font-size: 13px;
  }

  #weapons-table td,
  #weapons-table th {
    padding: 8px 9px;
  }
}

@media (max-width: 720px) {
  body::before {
    background-size: cover;
    background-position: center 50%;
    opacity: 0.36;
  }

  .topbar-inner {
    padding: 8px 12px;
    gap: 9px;
  }

  .brand-logo-img {
    height: 44px;
    margin: -2px 0;
  }

  .brand-wordmark {
    font-size: 23px;
  }

  .tabs-inner {
    padding: 0 10px;
  }

  .tab-btn {
    padding: 9px 10px;
    font-size: 15px;
  }

  .container {
    padding: 12px 12px 32px;
  }

  .search-wrap {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
  }

  #global-search,
  .calc-select,
  .form-control {
    font-size: 16px;
  }

  .search-item {
    min-height: 44px;
    padding: 9px 10px;
  }

  .mode-cluster {
    order: 2;
    width: 100%;
  }

  .difficulty-bar {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .diff-label {
    display: none;
  }

  .diff-pills {
    flex: 1;
    justify-content: space-between;
  }

  .diff-pill {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: 12.5px;
  }

  .realism-toggle {
    padding: 6px 9px;
    font-size: 12.5px;
  }

  .chip {
    padding: 6px 10px;
    font-size: 13px;
  }

  .infected-grid, .spots-grid, .survivors-grid {
    grid-template-columns: 1fr;
  }

  .stat-row {
    flex-direction: column;
    gap: 1px;
  }

  .stat-v {
    text-align: left;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .calc-metric-val {
    font-size: 20px;
  }

  .drawer-body {
    padding: 14px 14px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .footer-inner {
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    justify-content: center;
    text-align: center;
  }

  .footer-meta {
    justify-content: center;
  }
}

/* Stacked flat mobile cards for Medical, Ammo Packs & Explosives */
@media (max-width: 680px) {
  .gear-table-wrap {
    overflow: visible;
    background: transparent;
    border: none;
  }

  .gear-table,
  .gear-table tbody,
  .gear-table tr,
  .gear-table td {
    display: block;
    width: 100%;
  }

  .gear-table thead {
    display: none;
  }

  .gear-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .gear-table tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
  }

  .gear-table tbody tr.row-b-gray { border-color: var(--b-gray); }
  .gear-table tbody tr.row-b-gold { border-color: var(--b-gold); }
  .gear-table tbody tr.row-b-red { border-color: var(--b-red); }

  .gear-table tbody tr.row-b-gray td:first-child,
  .gear-table tbody tr.row-b-gold td:first-child,
  .gear-table tbody tr.row-b-red td:first-child {
    border-left: none;
  }

  .gear-table td {
    padding: 5px 0;
    border-bottom: 1px solid var(--row-divider);
    white-space: normal;
    text-align: left !important;
  }

  .gear-table td:first-child {
    padding-top: 0;
    padding-bottom: 8px;
    margin-bottom: 4px;
  }

  .gear-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .gear-table td[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
  }

  .gear-table td[data-label]::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    flex-shrink: 0;
  }

  .gear-table td.wrap-cell[data-label] {
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    max-width: none;
  }
}
