/* ============================================
   DRUG WARZ - Clean Theme
   ============================================ */

/* ---- IBM Plex Mono (self-hosted) ---- */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-600-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Display faces (self-hosted, SIL Open Font License) ---- */
@font-face {
  font-family: 'Tilt Neon';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/tilt-neon-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/bebas-neue-latin.woff2) format('woff2');
}

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

:root {
  --accent: #4a9eff;
  --accent-hover: #6bb3ff;
  --green: #34c759;
  --red: #ff453a;
  --yellow: #ffd60a;
  --orange: #ff9f0a;
  --purple: #bf5af2;
  --money: #3ddc84;

  --bg: #0b0c0f;
  --bg-raised: #14161b;
  --bg-card: #181b21;
  --bg-input: #101216;
  --border: #282c34;
  --border-strong: #363b45;
  --text: #eceef1;
  --text-secondary: #a3a8b2;
  --text-muted: #6c727d;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: 'IBM Plex Mono', 'SF Mono', 'Fira Code', monospace;
  --font-mono: 'IBM Plex Mono', 'SF Mono', 'Fira Code', monospace;
  --feed-w: 360px;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  font-size: 1rem;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#backdrop { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; transition: opacity .5s ease, filter .5s ease; }

#app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.screen {
  display: none;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-lg);
  flex: 1;
}
.screen.active { display: flex; flex-direction: column; }

/* ============================================
   TITLE SCREEN
   ============================================ */
.title-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--space-xl);
  min-height: 100vh;
}

.game-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--text);
}
.game-title .warz { color: var(--accent); }

.title-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.title-tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 420px;
}

.title-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 320px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (hover: hover) {
  .btn:hover { background: var(--bg-raised); border-color: var(--accent); }
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none !important; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(255,59,48,0.1); }
.btn-success { border-color: var(--green); color: var(--green); }
.btn-success:hover { background: rgba(52,199,89,0.1); }
.btn-warning { border-color: var(--yellow); color: var(--yellow); }
.btn-warning:hover { background: rgba(255,214,10,0.1); }

.btn-small { font-size: 0.85rem; padding: 6px 12px; min-height: 36px; }
.btn-full { width: 100%; }

/* Quantity +/- buttons */
.qty-btn {
  font-size: 1.1rem !important;
  font-weight: 700;
  width: 44px;
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* MAX buy button */
.btn-max {
  border-color: var(--orange);
  color: var(--orange);
  font-weight: 800;
  letter-spacing: 0.05em;
}
.btn-max:hover { background: rgba(255,149,0,0.1); }

/* Preset quantity buttons (25%, 50%, MAX) */
.qty-presets {
  display: inline-flex;
  gap: 2px;
}
.btn-preset {
  font-size: 0.65rem;
  padding: 2px 6px;
  min-width: 32px;
  min-height: 28px;
  border-color: var(--orange);
  color: var(--orange);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn-preset:hover { background: rgba(255,149,0,0.1); }

/* ============================================
   HUD
   ============================================ */
.game-hud {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17,17,17,0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 8px var(--space-lg) 6px;
  padding-top: max(8px, env(safe-area-inset-top));
}
.hud { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.hud-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: center; }
.hud-stat { display: flex; flex-direction: column; min-width: 0; }
.hud-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
}
.hud-value { font-weight: 700; font-family: var(--font-mono); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.hud-value.cash { color: var(--green); }
.hud-value.bank { color: var(--accent); }
.hud-value.debt { color: var(--red); }
.hud-value.paid { color: var(--text-muted); }
.hud-status { grid-template-columns: auto auto 1fr 1fr; font-size: 0.8rem; }
.hud-chip { white-space: nowrap; color: var(--text-secondary); font-weight: 600; }
.hud-chip.location { color: var(--purple); }
.hud-chip.urgent { color: var(--red); }
.hud-meter { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-meter-label { white-space: nowrap; font-weight: 700; font-family: var(--font-mono); font-size: 0.8rem; }
.hud-meter .health { color: var(--yellow); }
.hud-meter .heat { color: var(--orange); }
.hud-meter > div { flex: 1; margin-top: 0; }

.health-bar-container { width: 100%; height: 5px; background: var(--bg-input); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.health-bar { height: 100%; background: var(--green); transition: width 0.4s ease, background 0.4s ease; border-radius: 3px; }
.health-bar.warning { background: var(--yellow); }
.health-bar.danger { background: var(--red); }

.heat-bar-container { width: 100%; height: 5px; background: var(--bg-input); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.heat-bar { height: 100%; background: var(--orange); transition: width 0.4s ease; border-radius: 3px; }
.heat-bar.critical { background: var(--red); }

/* ============================================
   GAME NAV
   ============================================ */
.game-screen { padding-top: 0; }

.game-nav {
  display: flex;
  gap: 6px;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  align-items: center;
}

.nav-btn {
  position: relative;
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 6px 12px;
  min-height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74,158,255,0.06);
}
@media (hover: hover) {
  .nav-btn:hover { border-color: var(--accent); color: var(--accent); }
}
.nav-icon { font-size: 1rem; line-height: 1; }
.nav-badge {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px var(--bg);
}

.nav-home-link {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-decoration: none;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  padding: 8px 0;
  white-space: nowrap;
}
.nav-home-link:hover { color: var(--accent-hover); }

.territory-badge {
  color: var(--purple);
  font-weight: 700;
  font-size: 0.8rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   MARKET TABLE
   ============================================ */
.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.market-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.market-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.market-table th.sortable:hover {
  color: var(--accent);
}
.market-table th.sorted {
  color: var(--accent);
}
.market-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(51,51,51,0.5);
  vertical-align: middle;
}
.market-table tr { transition: background 0.15s; }
.market-table tr:hover { background: rgba(255,255,255,0.02); }

.drug-name {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
}
.drug-emoji { font-size: 1.25em; }
.drug-label { display: flex; flex-direction: column; }
.drug-category { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }

.price { font-weight: 700; font-family: var(--font-mono); font-size: 1rem; }
.price-up { color: var(--green); }
.price-down { color: var(--red); }
.price-stable { color: var(--text-secondary); }

.drug-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.qty-input {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  width: 56px;
  height: 44px;
  min-height: 44px;
  padding: 4px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
  border-radius: var(--radius);
}
.qty-input:focus { outline: none; border-color: var(--accent); }
/* Hide native number spinners */
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input { -moz-appearance: textfield; }

.drug-extreme td { border-color: rgba(255,59,48,0.2); }

/* Bloomberg Market Styles */
.market-table.bloomberg th { font-size: 0.7rem; }

.bloomberg-price-cell { display: flex; flex-direction: column; gap: 2px; }
.bloomberg-change { font-size: 0.75rem; font-family: var(--font-mono); font-weight: 600; }
.change-up { color: var(--green); }
.change-down { color: var(--red); }
.change-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 400; }
.mobile-pnl { display: none; font-size: 0.75rem; font-family: var(--font-mono); font-weight: 700; }

.bloomberg-trend { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.bloomberg-range { font-size: 0.7rem; font-family: var(--font-mono); color: var(--text-muted); white-space: nowrap; }
.range-label { color: var(--text-muted); font-weight: 600; margin-right: 2px; }

.bloomberg-position { display: flex; flex-direction: column; gap: 1px; font-size: 0.8rem; font-family: var(--font-mono); }
.pos-qty { font-weight: 700; color: var(--accent); }
.pos-avg { font-size: 0.7rem; color: var(--text-muted); }
.pos-pnl { font-size: 0.75rem; font-weight: 700; }
.pnl-profit { color: var(--green); }
.pnl-loss { color: var(--red); }
.pos-empty { color: var(--text-muted); }

.drug-purity { color: var(--purple); font-size: 0.7rem; margin-left: 4px; }

.trade-preview { font-size: 0.7rem; font-family: var(--font-mono); color: var(--text-secondary); margin-top: 4px; min-height: 1em; }

.ticker-flash-up { animation: tickerUp 0.6s ease-out; }
.ticker-flash-down { animation: tickerDown 0.6s ease-out; }
@keyframes tickerUp { 0% { background: rgba(52,199,89,0.25); } 100% { background: transparent; } }
@keyframes tickerDown { 0% { background: rgba(255,59,48,0.25); } 100% { background: transparent; } }

/* Message Log */
.msg-log {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: var(--space-md);
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.85rem;
}
.msg-log-item {
  padding: 3px 0;
  border-bottom: 1px solid rgba(51,51,51,0.3);
  color: var(--text-secondary);
}
.msg-log-item:last-child { border-bottom: none; }
.msg-log-day {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-right: 6px;
}

/* Market bar (carrying + stay the night) */
.market-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.sparkline { display: inline-block; vertical-align: middle; }
.sparkline svg { width: 60px; height: 22px; }
.sparkline path { fill: none; stroke: var(--accent); stroke-width: 1.5; }

/* ============================================
   LOCATIONS
   ============================================ */
.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.location-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border-top: 3px solid var(--card-color, var(--accent));
}
.location-card:hover {
  border-color: var(--card-color, var(--accent));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.location-card.current { opacity: 0.5; cursor: default; transform: none; }
.location-card.current::after {
  content: 'HERE';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.1em;
  z-index: 2;
}

.location-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 2px; }
.location-desc { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }
.location-danger { margin-top: var(--space-sm); font-size: 0.75rem; color: var(--text-secondary); }
.danger-dots { color: var(--red); }

/* ============================================
   EVENT OVERLAY & MODAL
   ============================================ */
.event-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.event-overlay.active { opacity: 1; pointer-events: all; }

.event-modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: var(--space-xl);
  max-width: 480px;
  width: 92%;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.event-overlay.active .event-modal { transform: scale(1); }
.event-modal.government-strike { border-color: var(--red); box-shadow: 0 0 30px rgba(255,59,48,0.2); }

.event-title { font-size: 1.4rem; font-weight: 800; margin-bottom: var(--space-md); }
.event-title.danger { color: var(--red); }
.event-title.warning { color: var(--yellow); }
.event-title.success { color: var(--green); }
.event-title.info { color: var(--accent); }

.event-message { font-size: 1rem; color: var(--text-secondary); margin-bottom: var(--space-lg); line-height: 1.6; }
.event-details { font-size: 0.9rem; color: var(--yellow); margin-bottom: var(--space-lg); }

/* Event choice buttons */
.event-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.event-choice-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.95rem;
  text-align: left;
  border: 1px solid var(--accent);
  background: rgba(74,158,255,0.05);
  transition: background 0.15s, border-color 0.15s;
}
.event-choice-btn:hover {
  background: rgba(74,158,255,0.15);
  border-color: var(--accent);
}

/* ============================================
   INVENTORY / PORTFOLIO
   ============================================ */
.portfolio-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.portfolio-stat { text-align: center; }
.portfolio-label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.portfolio-value { font-size: 1.1rem; font-weight: 800; font-family: var(--font-mono); }

.portfolio-capacity { margin-bottom: var(--space-sm); }
.cap-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 3px; }
.cap-bar-container { width: 100%; height: 6px; background: var(--bg-input); border-radius: 3px; }
.cap-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.cap-bar.cap-high { background: var(--orange); }
.cap-bar.cap-full { background: var(--red); }

.portfolio-breakdown { margin-top: var(--space-sm); }
.breakdown-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.breakdown-segment { min-width: 4px; transition: width 0.3s; }
.breakdown-legend { display: flex; gap: var(--space-md); flex-wrap: wrap; font-size: 0.75rem; color: var(--text-secondary); }
.breakdown-legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.inv-equip-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.inv-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-sm);
}
.inventory-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-color, var(--accent));
  border-radius: var(--radius);
  padding: 12px 14px;
}
.inv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.inv-card-data {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px 8px;
}
.inv-stat { display: flex; flex-direction: column; }
.inv-stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.inv-stat-value { font-size: 0.85rem; font-weight: 600; font-family: var(--font-mono); }

.inventory-stats { font-size: 0.9rem; color: var(--text-secondary); }
.inventory-empty { text-align: center; padding: var(--space-xl); color: var(--text-muted); }

/* ============================================
   SHOP
   ============================================ */
.shop-section {
  margin-bottom: var(--space-xl);
}
.shop-section h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.shop-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  gap: var(--space-md);
}
.shop-item-info {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
}
.shop-item-name { font-weight: 700; font-size: 0.95rem; }
.shop-item-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.shop-item-stats { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; font-family: var(--font-mono); }

/* Cook Lab progress bar */
.cook-progress-bar {
  width: 100%; height: 6px; background: var(--bg-input); border-radius: 3px; margin-top: 4px;
  overflow: hidden;
}
.cook-progress-fill {
  height: 100%; background: var(--accent); border-radius: 3px;
  transition: width 0.4s ease;
}

/* ============================================
   FINANCE
   ============================================ */
.finance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.finance-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-lg); }
.finance-card h3 { font-size: 1.1rem; margin-bottom: var(--space-md); }
.finance-amount { font-size: 1.6rem; font-weight: 800; font-family: var(--font-mono); margin-bottom: var(--space-md); }
.finance-input-group { display: flex; gap: var(--space-xs); margin-top: var(--space-sm); }
.finance-input {
  font-family: var(--font-mono); font-size: 0.95rem; padding: 6px 10px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); flex: 1; min-width: 0;
}
.finance-input:focus { outline: none; border-color: var(--accent); }

/* ============================================
   HELP PAGE
   ============================================ */
.help-section {
  margin-bottom: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
}
.help-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}
.help-content {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================
   GAME OVER
   ============================================ */
.gameover-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--space-lg);
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-md);
  box-sizing: border-box;
}
.gameover-title { font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 900; color: var(--red); }
.gameover-reason { font-size: 1rem; color: var(--text-secondary); }

.gameover-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--space-md);
  width: 100%;
  max-width: 600px;
}
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-md); min-width: 0; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: clamp(1rem, 4vw, 1.4rem); font-weight: 800; font-family: var(--font-mono); color: var(--accent); overflow-wrap: anywhere; }
.chart-empty { color: var(--text-muted); font-size: 0.85rem; padding: var(--space-md) 0; }

.highscore-input { display: flex; gap: var(--space-sm); max-width: 300px; margin: 0 auto; }
.highscore-input input {
  font-family: var(--font); font-size: 1rem; padding: var(--space-sm);
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  text-align: center; border-radius: var(--radius); flex: 1;
}
.highscore-input input:focus { outline: none; border-color: var(--accent); }

.highscore-table { width: 100%; max-width: 500px; border-collapse: collapse; font-size: 0.95rem; margin: 0 auto; }
.highscore-table th { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.highscore-table td { padding: 6px 10px; border-bottom: 1px solid rgba(51,51,51,0.5); }
.highscore-table tr:first-child td { color: var(--yellow); font-weight: 700; }

/* ============================================
   MODE SELECT
   ============================================ */
.mode-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--space-xl);
  min-height: 100vh;
}
.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  width: 100%;
  max-width: 580px;
}
.mode-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: var(--space-xl); cursor: pointer; transition: all 0.2s ease; text-align: center;
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.mode-icon { font-size: 2.5rem; margin-bottom: var(--space-sm); }
.mode-title { font-size: 1.3rem; font-weight: 800; color: var(--accent); margin-bottom: var(--space-xs); }
.mode-desc { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }

/* ============================================
   TECH STACK (compact)
   ============================================ */
.tech-section {
  margin-top: var(--space-xl);
  padding: var(--space-lg) var(--space-md);
  border-top: 1px solid var(--border);
}
.tech-title { font-size: 1rem; color: var(--text-muted); text-align: center; margin-bottom: var(--space-md); }
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
  max-width: 960px;
  margin: 0 auto;
}
.tech-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md); transition: border-color 0.2s;
}
.tech-card:hover { border-color: var(--accent); }
.tech-icon { font-size: 1rem; display: inline; margin-right: 4px; }
.tech-name { font-size: 0.8rem; font-weight: 700; display: inline; }
.tech-desc { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
  position: fixed; bottom: var(--space-lg); right: var(--space-lg); z-index: 2000;
  display: flex; flex-direction: column; gap: var(--space-sm); pointer-events: none;
}
.toast {
  font-family: var(--font); font-size: 0.9rem; padding: 8px 14px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); pointer-events: all; transform: translateX(120%);
  transition: transform 0.25s ease; max-width: 320px;
}
.toast.show { transform: translateX(0); }
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
.toast.warning { border-color: var(--yellow); }

/* ============================================
   TRAVEL MODAL
   ============================================ */
.travel-route {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
}
.travel-map {
  position: relative;
  width: 100%;
  height: 200px;
  background: #0a0e17 url('../assets/map-world.webp') 0 0 / 100% 100% no-repeat;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.travel-path-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.travel-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.travel-dot-from { background: var(--text-secondary); }
.travel-dot-to { background: var(--green); box-shadow: 0 0 8px rgba(52,199,89,0.5); }
.travel-plane {
  position: absolute;
  font-size: 1.5rem;
  z-index: 3;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 4px rgba(74,158,255,0.6));
}
.travel-label {
  position: absolute;
  font-size: 0.65rem;
  color: var(--text-muted);
  transform: translateX(-50%);
  z-index: 2;
  white-space: nowrap;
}
.travel-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  transition: color 0.3s;
}

/* ============================================
   COMBAT LOG
   ============================================ */
.combat-log div {
  padding: 2px 0;
  border-bottom: 1px solid rgba(51,51,51,0.3);
}
.combat-log div:last-child { border-bottom: none; }

/* ============================================
   STATS TAB
   ============================================ */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  text-align: center;
}
.stats-card-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stats-card-value {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
}

.stats-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.stats-chart-container canvas {
  width: 100%;
  border-radius: var(--radius);
}

.stats-full-log {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  max-height: 500px;
  overflow-y: auto;
  font-size: 0.85rem;
}

/* ============================================
   COLUMN PINNING
   ============================================ */
.market-table-wrapper { width: 100%; }
.market-bar-actions { display: flex; gap: var(--space-xs); align-items: center; }

/* ============================================
   v0.6 — MARKET ROWS, TRADE SHEET, PLUGS, EMPIRE
   ============================================ */
.market-table tbody tr { cursor: pointer; }
.market-table tbody tr.held { background: rgba(74,158,255,0.04); }
.market-table .col-trade { text-align: right; width: 1%; white-space: nowrap; }
.market-table .col-trend { width: 70px; }
.drug-actions { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
.drug-actions .btn { min-width: 58px; }
.bloomberg-change.change-new { display: none; }
.pos-purity { font-size: 0.7rem; font-weight: 600; }
.price { font-variant-numeric: tabular-nums; }

.deal-chip {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: 2px;
  margin-left: 4px;
  border: 1px solid currentColor;
}
.deal-chip.cheap { color: var(--green); background: rgba(52,199,89,0.12); }
.deal-chip.low { color: var(--green); opacity: 0.75; }
.deal-chip.high { color: var(--yellow); opacity: 0.8; }
.deal-chip.pricey { color: var(--yellow); background: rgba(255,214,10,0.12); }

.market-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: var(--space-md); line-height: 1.5; }
.market-hint .deal-chip { margin: 0 2px; }

details.msg-log { cursor: pointer; }
details.msg-log summary { color: var(--text-secondary); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; list-style: none; }
details.msg-log summary::-webkit-details-marker { display: none; }
details.msg-log summary::before { content: '▸ '; color: var(--text-muted); }
details.msg-log[open] summary::before { content: '▾ '; }
details.msg-log[open] { max-height: 200px; }

.tab-intro { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: var(--space-md); }

/* Trade sheet */
.event-modal.trade-sheet { text-align: left; padding: var(--space-lg); max-width: 440px; }
.ts-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ts-drug { font-size: 1.15rem; }
.ts-price { font-family: var(--font-mono); font-weight: 800; font-size: 1.2rem; }
.ts-sub { font-size: 0.75rem; color: var(--text-muted); margin: 2px 0 var(--space-md); }
.ts-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--space-md); }
.ts-tab { font-family: var(--font); font-weight: 700; font-size: 0.95rem; min-height: 44px; background: var(--bg-input); color: var(--text-secondary); border: 0; cursor: pointer; }
.ts-tab:disabled { opacity: 0.35; cursor: not-allowed; }
.ts-tab.active.buy { background: rgba(52,199,89,0.16); color: var(--green); }
.ts-tab.active.sell { background: rgba(255,59,48,0.16); color: var(--red); }
.ts-qty { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; margin-bottom: 10px; }
.ts-qty .qty-btn { width: 100%; height: 48px; }
.ts-input { width: 100%; height: 48px; font-size: 1.3rem; font-weight: 700; }
.ts-slider { width: 100%; accent-color: var(--accent); height: 28px; margin-bottom: 8px; }
.ts-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); gap: 6px; margin-bottom: var(--space-md); }
.ts-presets .btn-preset { font-size: 0.8rem; min-height: 36px; }
.ts-preview { background: var(--bg-input); border-radius: var(--radius); padding: 8px 12px; margin-bottom: var(--space-md); font-size: 0.85rem; min-height: 64px; }
.ts-line { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.ts-line span { color: var(--text-muted); }
.ts-line b { font-family: var(--font-mono); text-align: right; }
.ts-actions, .modal-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.ts-confirm { font-size: 1.05rem; min-height: 50px; }
.ts-confirm.btn-success:not(:disabled) { background: var(--green); color: #04220d; }
.ts-confirm.btn-danger:not(:disabled) { background: var(--red); color: #fff; }

/* Locations */
.loc-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.loc-badge { font-size: 0.65rem; padding: 2px 6px; border-radius: 10px; background: var(--bg-input); color: var(--text-secondary); white-space: nowrap; }
.loc-badge.yours { color: var(--purple); background: rgba(175,82,222,0.12); }
.loc-badge.ally { color: var(--green); background: rgba(52,199,89,0.1); }
.loc-badge.hostile { color: var(--red); background: rgba(255,59,48,0.1); }
.loc-badge.seen { color: var(--text-muted); }

/* Plugs */
.plug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-sm); }
.plug-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.plug-card.here { box-shadow: 0 0 0 1px rgba(74,158,255,0.35); }
.plug-card.status-allied { border-left-color: var(--green); }
.plug-card.status-hostile { border-left-color: var(--red); }
.plug-head { display: flex; align-items: center; gap: 10px; }
.plug-emoji { font-size: 1.6rem; line-height: 1; }
.plug-id { flex: 1; min-width: 0; }
.plug-name { font-weight: 800; }
.plug-city { font-size: 0.72rem; color: var(--text-muted); }
.status-pill { font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 10px; background: var(--bg-input); color: var(--text-secondary); }
.status-pill.allied { color: var(--green); background: rgba(52,199,89,0.12); }
.status-pill.hostile { color: var(--red); background: rgba(255,59,48,0.12); }
.status-pill.defeated { color: var(--purple); background: rgba(175,82,222,0.14); }
.plug-blurb { font-size: 0.8rem; color: var(--text-secondary); font-style: italic; }
.plug-terms { font-size: 0.75rem; color: var(--text-secondary); font-family: var(--font-mono); }
.plug-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.trust { display: flex; flex-direction: column; gap: 3px; }
.trust-bar { position: relative; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: visible; }
.trust-bar > div { height: 100%; background: linear-gradient(90deg, var(--green), var(--accent)); border-radius: 3px; transition: width 0.4s; }
.trust-mark { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--yellow); }
.trust-label { font-size: 0.7rem; color: var(--text-muted); }
.front-due { font-size: 0.78rem; background: var(--bg-input); border-radius: 4px; padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--text-secondary); }
.front-due.soon { color: var(--orange); }
.front-due.urgent { color: var(--red); }

.empire-card {
  background: linear-gradient(135deg, rgba(175,82,222,0.10), rgba(74,158,255,0.05));
  border: 1px solid rgba(175,82,222,0.35);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: var(--space-lg);
}
.empire-card.kingpin { border-color: var(--yellow); box-shadow: 0 0 24px rgba(255,214,10,0.12); }
.empire-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.empire-title { font-weight: 900; font-size: 1.05rem; color: var(--purple); }
.empire-card.kingpin .empire-title { color: var(--yellow); }
.empire-sub { font-size: 0.75rem; color: var(--text-secondary); }
.empire-progress { flex: 0 0 120px; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.empire-progress > div { height: 100%; background: var(--purple); }
.empire-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "city btn" "stats btn"; gap: 2px 10px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.06); align-items: center; }
.empire-city { grid-area: city; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.empire-level { font-size: 0.7rem; color: var(--purple); font-weight: 700; }
.empire-stats { grid-area: stats; font-size: 0.72rem; color: var(--text-secondary); font-family: var(--font-mono); }
.empire-row .btn, .empire-max { grid-area: btn; }
.empire-max { font-size: 0.7rem; font-weight: 800; color: var(--yellow); }
.empire-empty { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }

/* Crew */
.flight-risk { font-size: 0.72rem; margin-top: 3px; }
.flight-risk.low { color: var(--text-muted); }
.flight-risk.medium { color: var(--orange); }
.flight-risk.high { color: var(--red); font-weight: 700; }

/* Finance */
.pressure-card, .retire-card { margin-top: var(--space-md); }
.pressure-bar { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.pressure-bar > div { height: 100%; background: linear-gradient(90deg, var(--yellow), var(--red)); }

/* Combat */
.combat-you { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 10px; }
.combat-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.combat-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 10px; }

.event-modal.milestone { border-color: var(--yellow); box-shadow: 0 0 40px rgba(255,214,10,0.18); }

/* Keyboard focus */
.btn:focus-visible, .nav-btn:focus-visible, .location-card:focus-visible, .ts-tab:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* Phones and tablets: thumb-reach tab bar at the bottom, toasts up top */
@media (max-width: 900px) {
  /* Bottom tab bar */
  body.in-game { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .game-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    margin: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: rgba(17,17,17,0.97);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); border-bottom: 0;
    flex-wrap: nowrap; gap: 0; overflow-x: auto; scrollbar-width: none;
  }
  .game-nav::-webkit-scrollbar { display: none; }
  .nav-home-link { display: none; }
  .nav-btn {
    flex: 1 0 44px; max-width: 96px; flex-direction: column; gap: 1px;
    min-height: 52px; padding: 4px 2px;
    border: 0; border-radius: 8px; font-size: 0.62rem;
  }
  .nav-btn.active { background: rgba(74,158,255,0.12); }
  .nav-icon { font-size: 1.2rem; }
  .nav-badge { top: 4px; right: calc(50% - 16px); }
  .game-nav { justify-content: center; }
  .toast-container { left: var(--space-sm); right: var(--space-sm); top: calc(72px + env(safe-area-inset-top)); bottom: auto; align-items: center; }
  .toast { max-width: 520px; width: 100%; }
}

@media (max-width: 700px) {
  .screen { padding: var(--space-md); }
  .game-hud { padding: 6px 12px 5px; }
  .hud-value { font-size: 0.92rem; }
  .hud-status { grid-template-columns: auto auto 1fr 1fr; gap: 8px; font-size: 0.75rem; }


  /* Market rows become two-line cards */
  .market-table thead { display: none; }
  .market-table, .market-table tbody { display: block; }
  .market-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "drug price" "pos pos";
    gap: 2px 10px;
    padding: 9px 4px;
    border-bottom: 1px solid rgba(51,51,51,0.6);
  }
  .market-table td { padding: 0; border: 0; display: block; }
  .market-table .col-drug { grid-area: drug; min-width: 0; }
  .market-table .col-price { grid-area: price; text-align: right; }
  .market-table .col-trend { display: none; }
  .market-table .col-position { grid-area: pos; align-self: center; padding-left: 34px; }
  .market-table .col-trade { display: none; }
  .market-table .col-position:has(.pos-empty) { display: none; }
  .bloomberg-price-cell { align-items: flex-end; }
  .bloomberg-position { flex-direction: row; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .pos-empty { display: none; }
  .drug-actions .btn { min-width: 54px; min-height: 36px; padding: 4px 10px; }

  /* Sheets slide up from the bottom on phones */
  .event-overlay { align-items: flex-end; }
  .event-modal { width: 100%; max-width: none; border-radius: 16px 16px 0 0; padding: var(--space-lg) var(--space-md) calc(var(--space-lg) + env(safe-area-inset-bottom)); max-height: 88vh; }
  .event-modal.trade-sheet { max-width: none; }

  .finance-grid { grid-template-columns: 1fr; }
  .location-grid { grid-template-columns: 1fr 1fr; }
  .mode-cards { grid-template-columns: 1fr; }
  .portfolio-summary { grid-template-columns: 1fr; gap: var(--space-xs); }
  .inv-card-grid { grid-template-columns: 1fr; }
  .plug-grid { grid-template-columns: 1fr; }
  .shop-item { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .location-grid { grid-template-columns: 1fr; }
  .market-table { font-size: 0.88rem; }
  .gameover-stats { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: var(--space-sm); }
  .stat-value { font-size: 1.1rem; }
}

@media (max-width: 360px) {
  .hud-label { font-size: 0.55rem; }
  .hud-value { font-size: 0.82rem; }
  .btn-small { font-size: 0.75rem; }
}

@media (min-width: 1200px) {
  .screen { max-width: 1060px; }
  .hud-grid { max-width: 1060px; }
}

/* Never let a card push the page wider than the phone */
#game-content { min-width: 0; }
.finance-grid > *, .plug-grid > *, .inv-card-grid > *, .location-grid > * { min-width: 0; }
.finance-input-group { flex-wrap: wrap; }
.finance-input-group .finance-input { flex: 1 1 120px; }

/* ============================================
   v0.7 — FEED, STORY CARDS, FIGHTS, LENDERS
   ============================================ */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }

/* Subtle grain so flat black reads as a surface, not a void */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.035;
  background-image: radial-gradient(rgba(255,255,255,0.8) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

/* ---- Title & mode ---- */
.game-title > span { display: inline-block; }
.game-title .warz { color: var(--accent); text-shadow: 0 0 28px rgba(74,158,255,0.35); }
.mode-heading { font-size: 1.6rem; font-weight: 800; }
.mode-card { font-family: var(--font); color: var(--text); }
.mode-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pace-picker { width: 100%; max-width: 580px; }
.mode-step { width: 100%; max-width: 580px; margin-bottom: -1.2rem; }
.pace-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 8px; }
.pace-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pace-option {
  font-family: var(--font); color: var(--text-secondary); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; text-align: center; min-height: 64px; transition: border-color .15s, background .15s, color .15s;
}
.pace-option.active { border-color: var(--accent); color: var(--text); background: rgba(74,158,255,0.08); }
.pace-name { font-weight: 800; font-size: 0.95rem; }
.pace-blurb { font-size: 0.68rem; color: var(--text-muted); line-height: 1.3; }

/* ---- HUD additions ---- */
.hud-status { display: flex; align-items: center; gap: 10px; }
.hud-status .hud-meter { flex: 1; }
.hud-feed {
  position: relative; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border-strong); cursor: pointer;
}
.hud-feed:hover { border-color: var(--accent); color: var(--accent); }
.hud-feed-badge {
  position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 0.62rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--bg);
}
.hud-loan {
  flex: 0 0 auto; font-family: var(--font); font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  padding: 3px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
}
.hud-loan.soon { color: var(--orange); border-color: rgba(255,159,10,0.5); }
.hud-loan.late { color: #fff; background: var(--red); border-color: var(--red); animation: loanPulse 1.6s ease-in-out infinite; }
@keyframes loanPulse { 50% { box-shadow: 0 0 0 4px rgba(255,69,58,0.25); } }
.hud-value.tick-up { animation: tickGlowUp 0.9s ease-out; }
.hud-value.tick-down { animation: tickGlowDown 0.9s ease-out; }
@keyframes tickGlowUp { 0% { text-shadow: 0 0 14px rgba(61,220,132,0.9); } 100% { text-shadow: none; } }
@keyframes tickGlowDown { 0% { text-shadow: 0 0 14px rgba(255,69,58,0.9); color: var(--red); } 100% { text-shadow: none; } }
body.feed-docked .hud-feed { display: none; }

.nav-icon { display: inline-flex; font-size: 1.05rem; }

/* ---- Feed peek on the market ---- */
.feed-peek {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; font-family: var(--font);
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--text-muted);
  border-radius: var(--radius); color: var(--text-secondary); padding: 9px 12px; margin-bottom: var(--space-md);
  font-size: 0.8rem; cursor: pointer; min-height: 44px;
}
.feed-peek .icon { font-size: 1rem; color: var(--text-muted); }
.feed-peek-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-peek-more { flex: 0 0 auto; font-size: 0.68rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.feed-peek.tone-good { border-left-color: var(--green); }
.feed-peek.tone-bad { border-left-color: var(--red); }
.feed-peek.tone-warn { border-left-color: var(--orange); }
body.feed-docked .feed-peek { display: none; }

/* ---- Event cards ---- */
.event-overlay { background: rgba(4,5,8,0.78); }
.event-modal.ev-card, .event-modal.combat-modal, .event-modal.travel-card {
  text-align: left; padding: 20px 20px 18px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #1a1d24 0%, var(--bg-raised) 60%);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); max-width: 500px;
  position: relative; overflow-x: hidden;
}
.ev-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--accent); opacity: 0.85;
}
.ev-card.tone-good::before { background: var(--green); }
.ev-card.tone-bad::before { background: var(--red); }
.ev-card.tone-warn::before { background: var(--orange); }
.ev-card.milestone::before { background: linear-gradient(90deg, var(--yellow), var(--orange)); height: 4px; }
.ev-card.government-strike { border-color: var(--red); }
.ev-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.ev-kicker {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ev-kicker .icon { font-size: 0.95rem; color: var(--text-secondary); }
.ev-count { flex: 0 0 auto; font-size: 0.66rem; font-weight: 800; color: var(--text-secondary); background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; padding: 2px 8px; }
.ev-icon { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.ev-title { font-size: 1.35rem; font-weight: 800; line-height: 1.25; margin-bottom: 8px; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.ev-message { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px; white-space: pre-line; }
.ev-details { list-style: none; margin: -6px 0 16px; padding: 8px 12px; background: var(--bg-input); border-radius: var(--radius); font-size: 0.85rem; color: var(--yellow); }
.ev-details li + li { margin-top: 4px; }
.ev-choices { display: flex; flex-direction: column; gap: 8px; }
.ev-choice {
  font-family: var(--font); text-align: left; cursor: pointer; width: 100%; min-height: 52px;
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 10px 16px;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius); transition: background .15s, border-color .15s, transform .1s;
}
.ev-choice:active { transform: scale(0.985); }
@media (hover: hover) { .ev-choice:hover:not(:disabled) { background: #20242c; border-color: var(--text-muted); } }
.ev-choice:disabled { opacity: 0.38; cursor: not-allowed; }
.ev-choice.tone-safe { border-left-color: var(--green); }
.ev-choice.tone-risky { border-left-color: var(--orange); }
.ev-choice.tone-bold { border-left-color: var(--red); }
.ev-choice-label { font-weight: 700; font-size: 0.95rem; }
.ev-choice-hint { font-size: 0.72rem; color: var(--text-muted); }
.ev-continue { width: 100%; min-height: 48px; font-size: 1rem; }
.ev-skip {
  width: 100%; margin-top: 10px; background: none; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--text-secondary); font-family: var(--font); font-size: 0.78rem; padding: 9px 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.ev-skip:hover { color: var(--text); border-color: var(--text-muted); }
.ev-chose { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.ev-result { font-size: 1.02rem; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.chip { font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 12px; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.chip.pos { color: var(--money); border-color: rgba(61,220,132,0.35); background: rgba(61,220,132,0.08); }
.chip.neg { color: var(--red); border-color: rgba(255,69,58,0.35); background: rgba(255,69,58,0.08); }
.feed-item .chips { margin: 4px 0 0; }
.feed-item .chip { font-size: 0.65rem; padding: 1px 7px; }

/* Morning report */
.ev-digest .ev-title { font-size: 1.15rem; }
.digest-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; }
.digest-item { display: flex; gap: 10px; padding: 9px 10px; background: var(--bg-input); border-radius: var(--radius); border-left: 3px solid var(--border-strong); }
.digest-item.tone-good { border-left-color: var(--green); }
.digest-item.tone-bad { border-left-color: var(--red); }
.digest-item.tone-warn { border-left-color: var(--orange); }
.digest-ico { color: var(--text-muted); font-size: 1rem; padding-top: 2px; }
.digest-title { font-weight: 700; font-size: 0.85rem; }
.digest-text { font-size: 0.78rem; color: var(--text-secondary); }
.digest-text b { color: var(--yellow); font-weight: 600; }

/* ---- Fights ---- */
.event-modal.combat-modal { max-width: 540px; }
.cb-versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; margin-bottom: 12px; }
.cb-side { position: relative; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; text-align: center; min-width: 0; transition: background .2s; }
.cb-side.hit { background: rgba(255,69,58,0.18); border-color: rgba(255,69,58,0.6); }
.cb-avatar { font-size: 2.1rem; line-height: 1.1; }
.cb-name { font-weight: 800; font-size: 0.85rem; margin: 2px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-bar { height: 8px; background: #0a0b0d; border-radius: 4px; overflow: hidden; }
.cb-fill { height: 100%; background: var(--green); border-radius: 4px; }
.cb-fill.warning { background: var(--yellow); }
.cb-fill.danger { background: var(--red); }
.cb-fill.foe { background: linear-gradient(90deg, #ff6b4a, var(--red)); }
.cb-num { font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 4px; }
.cb-num small { color: var(--text-muted); font-weight: 500; }
.cb-meta { font-size: 0.66rem; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.cb-vs { align-self: center; font-weight: 900; font-size: 0.8rem; color: var(--text-muted); letter-spacing: 0.1em; }
.cb-odds { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 10px; }
.cb-odds-bar { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.cb-odds-bar > div { height: 100%; background: var(--yellow); border-radius: 3px; }
.cb-odds.good .cb-odds-bar > div { background: var(--green); } .cb-odds.good b { color: var(--green); }
.cb-odds.bad .cb-odds-bar > div { background: var(--red); } .cb-odds.bad b { color: var(--red); }
.cb-odds.even b { color: var(--yellow); }
.cb-log { background: var(--bg-input); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; font-size: 0.8rem; height: 96px; overflow-y: auto; color: var(--text-muted); }
.cb-log div { padding: 2px 0; }
.cb-log div.new { color: var(--text); font-weight: 600; }
.cb-log.final { height: auto; max-height: 220px; color: var(--text-secondary); }
.cb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cb-act { display: flex; gap: 8px; min-height: 50px; font-size: 0.9rem; }
.cb-act .icon { font-size: 1.1rem; }
.cb-wide { grid-column: 1 / -1; min-height: 44px; color: var(--text-secondary); }
.float-text { position: absolute; left: 76%; top: 40px; transform: translateX(-50%); font-weight: 900; font-size: 1.3rem; pointer-events: none; text-shadow: 0 2px 8px rgba(0,0,0,0.8); z-index: 3; }
.float-text.dmg-out { color: var(--yellow); }
.float-text.dmg-in { color: var(--red); }
.float-text.miss { color: var(--text-muted); font-size: 0.9rem; }
.cb-stinger {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5;
  font-size: 2.4rem; font-weight: 900; letter-spacing: 0.1em; pointer-events: none;
  background: radial-gradient(circle, rgba(0,0,0,0.75) 30%, rgba(0,0,0,0.25) 80%);
}
.cb-stinger.good { color: var(--green); } .cb-stinger.bad { color: var(--red); } .cb-stinger.info { color: var(--accent); }
.odds-good { color: var(--green); } .odds-even { color: var(--yellow); } .odds-bad { color: var(--red); }

/* ---- Travel ---- */
.travel-card .travel-route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.05rem; margin-bottom: 12px; color: var(--text); }
.travel-arrow { color: var(--text-muted); }
.travel-to { color: var(--accent); }
.travel-path-ghost { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 1.5; stroke-dasharray: 3 4; }
.travel-path { fill: none; stroke: var(--accent); stroke-width: 2.5; filter: drop-shadow(0 0 4px rgba(74,158,255,0.8)); }
.travel-card .travel-plane { left: 0; top: 0; width: 28px; height: 28px; margin: -14px 0 0 -14px; transform: none; display: flex; align-items: center; justify-content: center; }
.travel-card .travel-plane > span { display: block; transform: rotate(45deg); font-size: 1.35rem; }
.travel-status.arrived { color: var(--green); }
.travel-skip { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- Feed panel ---- */
.feed-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
.feed-backdrop.open { opacity: 1; pointer-events: auto; }
.feed-panel {
  position: fixed; z-index: 950; top: 0; right: 0; bottom: 0; width: min(var(--feed-w), 92vw);
  display: none; flex-direction: column; background: #101217; border-left: 1px solid var(--border-strong);
  box-shadow: -20px 0 50px rgba(0,0,0,0.5);
}
.feed-panel.open { display: flex; }
.feed-grip { display: none; }
.feed-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; padding-top: max(14px, env(safe-area-inset-top)); touch-action: none; }
.feed-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1rem; }
.feed-sub { font-weight: 500; font-size: 0.7rem; color: var(--text-muted); }
.feed-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; cursor: pointer; }
.feed-filters { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.feed-filter { font-family: var(--font); font-size: 0.75rem; font-weight: 700; padding: 6px 12px; min-height: 32px; border-radius: 16px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.feed-filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.feed-list { list-style: none; flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 0 calc(16px + env(safe-area-inset-bottom)); }
.feed-day {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 14px 6px; font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); background: rgba(16,18,23,0.95); backdrop-filter: blur(6px);
}
.feed-item { position: relative; display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.feed-ico { flex: 0 0 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-card); color: var(--text-secondary); font-size: 0.85rem; }
.feed-item.tone-good .feed-ico { color: var(--green); background: rgba(52,199,89,0.12); }
.feed-item.tone-bad .feed-ico { color: var(--red); background: rgba(255,69,58,0.12); }
.feed-item.tone-warn .feed-ico { color: var(--orange); background: rgba(255,159,10,0.12); }
.feed-body { min-width: 0; flex: 1; }
.feed-body p { font-size: 0.8rem; line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere; }
.feed-item.unread .feed-body p { color: var(--text); }
.feed-item.unread::after { content: ''; position: absolute; left: 5px; top: 18px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.feed-empty { padding: 40px 16px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Wide screens: the feed lives beside the game */
@media (min-width: 1400px) {
  body.feed-docked #app { padding-right: var(--feed-w); }
  body.feed-docked .feed-panel { display: flex; transform: none !important; z-index: 90; box-shadow: none; }
  body.feed-docked .feed-close { display: none; }
}

/* ---- Lenders & security ---- */
.finance-note { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.5; }
.finance-note.warn { color: var(--orange); }
.finance-amount.debt { color: var(--red); margin-bottom: 4px; }
.btn-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
.loan-current { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.loan-current.soon { border-color: rgba(255,159,10,0.5); }
.loan-current.late, .loan-current.hunted { border-color: var(--red); box-shadow: 0 0 0 1px rgba(255,69,58,0.25) inset; }
.loan-terms { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 6px; }
.loan-current.late .loan-terms b, .loan-current.hunted .loan-terms b { color: var(--red); }
.loan-collectors { font-size: 0.72rem; color: var(--text-muted); font-style: italic; margin-bottom: 8px; }
.lender-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.lender-emoji { font-size: 1.5rem; width: 34px; text-align: center; flex: 0 0 34px; color: var(--text-muted); }
.lender-name { font-weight: 800; font-size: 0.9rem; }
.lender-name .rep { color: var(--yellow); font-size: 0.7rem; }
.lender-title { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }
.lender-terms { font-size: 0.7rem; color: var(--text-secondary); font-family: var(--font-mono); margin-top: 2px; }
.lender-ladder { display: flex; flex-direction: column; margin-top: 10px; border-top: 1px solid var(--border); }
.lender-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.lender-row .lender-info { flex: 1; min-width: 0; }
.lender-row.locked { opacity: 0.5; }
.lender-row.current .lender-name { color: var(--accent); }
.lender-row.hostile .lender-name { color: var(--red); }
.borrow-box { background: rgba(255,214,10,0.05); border: 1px solid rgba(255,214,10,0.25); border-radius: var(--radius); padding: 10px; }
.borrow-label { font-size: 0.8rem; margin-bottom: 4px; }
.borrow-label span { color: var(--orange); font-size: 0.72rem; }
.security-card { margin-top: var(--space-md); }
.security-card h3 { display: flex; align-items: center; gap: 8px; }
.security-next { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--bg-input); border-radius: var(--radius); padding: 10px 12px; }
.security-next .finance-note { display: block; margin: 2px 0 0; }

/* ---- Phones ---- */
@media (max-width: 900px) {
  .feed-panel { top: auto; left: 0; right: 0; width: auto; height: 86vh; height: 86dvh; border-left: 0; border-top: 1px solid var(--border-strong); border-radius: 18px 18px 0 0; box-shadow: 0 -20px 50px rgba(0,0,0,0.5); }
  .feed-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 8px auto 0; touch-action: none; }
  .feed-head { padding-top: 6px; }
}
@media (max-width: 700px) {
  .event-modal.ev-card, .event-modal.combat-modal, .event-modal.travel-card {
    max-width: none; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  }
  .ev-card::before { border-radius: 18px 18px 0 0; }
  .ev-title { font-size: 1.2rem; }
  .ev-icon { font-size: 2rem; }
  .cb-versus { gap: 6px; }
  .cb-avatar { font-size: 1.7rem; }
  .cb-side { padding: 8px 6px; }
  .hud-status { gap: 8px; }
  .hud-feed { width: 34px; height: 34px; font-size: 1.05rem; }
  .pace-options { grid-template-columns: 1fr; }
  .pace-option { flex-direction: row; justify-content: space-between; align-items: center; text-align: left; min-height: 48px; padding: 8px 12px; }
  .security-next { flex-direction: column; align-items: stretch; }
}
@media (max-width: 380px) {
  .hud-status .hud-chip.location { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .hud-loan { padding: 3px 6px; }
}

/* Toasts are animated by anime.js; a CSS transform transition would lag every frame */
.toast { transform: none; transition: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }

/* Translated labels run longer: let grid buttons wrap instead of overflowing */
.cb-actions > .btn, .btn-row > .btn, .modal-actions > .btn, .ts-actions > .btn, .ts-tabs > button, .finance-input-group > .btn {
  white-space: normal; min-width: 0; line-height: 1.2; text-align: center;
}
.cb-act { padding-left: 8px; padding-right: 8px; }


/* ============================================
   v0.8 — PICTURES, STORYLINES
   ============================================ */

/* ---- The city behind the menus ---- */
body.in-game #backdrop { display: none; }
body:not([data-screen="title"]) #backdrop { opacity: 0.32; filter: blur(3px); }
#fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 10000; pointer-events: none; }

/* ---- Title: a neon sign over the skyline ---- */
.title-screen { justify-content: flex-start; padding-top: clamp(48px, 13vh, 150px); gap: clamp(20px, 5vh, 44px); }
.title-sign { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.game-title {
  font-family: 'Tilt Neon', var(--font); font-weight: 400; line-height: 0.95; letter-spacing: 0.03em;
  font-size: clamp(3.3rem, 14.5vw, 8.6rem); color: #fff5fa; white-space: nowrap;
  text-shadow: 0 0 5px #fff, 0 0 16px #ff3d8b, 0 0 40px #ff3d8b, 0 0 90px rgba(255, 61, 139, 0.55);
}
.game-title .warz {
  color: #effdff;
  text-shadow: 0 0 5px #fff, 0 0 16px #3de2ff, 0 0 40px #3de2ff, 0 0 90px rgba(61, 226, 255, 0.55);
  animation: neonBuzz 7s linear infinite;
}
@keyframes neonBuzz {
  0%, 41%, 43%, 45%, 78%, 79.5%, 100% { opacity: 1; }
  42%, 44% { opacity: 0.35; }
  79% { opacity: 0.6; }
}
.title-subtitle { font-size: clamp(0.72rem, 2.6vw, 1rem); letter-spacing: 0.34em; color: #ffd9a0; text-shadow: 0 0 14px rgba(255, 180, 94, 0.6), 0 1px 2px #000; }
.title-buttons {
  padding: 14px; border-radius: 18px; background: rgba(8, 9, 22, 0.58); border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.title-buttons .btn { background: rgba(24, 27, 40, 0.75); }
.title-buttons .btn-primary { background: linear-gradient(180deg, #ff5c9d, #e0307a); border-color: #ff7ab0; color: #fff; box-shadow: 0 0 22px rgba(255, 61, 139, 0.45); }
@media (hover: hover) { .title-buttons .btn-primary:hover { background: linear-gradient(180deg, #ff74ac, #ee3f88); } }
.title-tagline { color: rgba(255, 255, 255, 0.5); font-size: 0.7rem; line-height: 1.5; max-width: none; margin-top: 6px; }
.mode-screen, #screen-scores, #screen-help, .gameover-screen { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
#tech-container { position: relative; z-index: 1; }

/* ---- City banner on the market ---- */
.city-banner {
  position: relative; height: 132px; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-md);
  border: 1px solid var(--border-strong); background: #0b0c14;
}
.city-banner canvas, .ev-scene canvas, .travel-arrival canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.city-banner::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 6, 12, 0.78) 0%, rgba(5, 6, 12, 0.3) 42%, transparent 68%), linear-gradient(0deg, rgba(5, 6, 12, 0.5), transparent 55%);
}
.city-banner-text { position: absolute; left: 16px; bottom: 11px; z-index: 1; min-width: 0; max-width: 72%; }
.city-name {
  font-family: 'Bebas Neue', var(--font); font-size: 2.9rem; line-height: 0.92; letter-spacing: 0.04em; color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.85), 0 0 34px var(--city, transparent);
}
.city-sub { font-size: 0.76rem; color: rgba(255, 255, 255, 0.78); font-style: italic; text-shadow: 0 1px 4px #000; }
.city-banner-tags { position: absolute; right: 10px; top: 10px; z-index: 1; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.city-tag {
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 10px;
  background: rgba(5, 6, 12, 0.72); border: 1px solid rgba(255, 255, 255, 0.16); color: var(--text-secondary);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.city-tag.yours { color: var(--green); border-color: rgba(52, 199, 89, 0.5); }
.city-tag.warm { color: var(--orange); border-color: rgba(255, 159, 10, 0.5); }
.city-tag.hot { color: #fff; background: rgba(255, 69, 58, 0.88); border-color: var(--red); animation: loanPulse 1.6s ease-in-out infinite; }

/* ---- Pictures on cards ---- */
.ev-scene {
  position: relative; height: 172px; margin: -20px -20px 14px; overflow: hidden; background: #07080f;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ev-scene::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(0deg, #1a1d24 0%, rgba(26, 29, 36, 0) 36%); }
.ev-scene-slim { height: 86px; }
.ev-badge {
  position: absolute; left: 16px; bottom: 8px; z-index: 1; width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; line-height: 1;
  background: rgba(10, 11, 18, 0.78); border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.ev-scene.has-arc .ev-badge { border-color: var(--arc); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 0 20px var(--arc); }
.ev-arc {
  position: absolute; right: 12px; bottom: 14px; z-index: 1; display: flex; align-items: center; gap: 8px; max-width: 62%;
  padding: 4px 10px; border-radius: 12px; background: rgba(10, 11, 18, 0.74); border: 1px solid var(--arc);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-size: 0.68rem; font-weight: 700; color: #fff;
}
.ev-arc-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-pips, .arc-pips { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.ev-pips i, .arc-pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.ev-pips i.on, .arc-pips i.on { background: var(--arc); box-shadow: 0 0 6px var(--arc); }
.ev-card.is-arc .ev-kicker { color: var(--text-secondary); }
.ev-ending {
  margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--bg-input);
  display: flex; flex-direction: column; gap: 3px;
}
.ev-ending-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.ev-ending b { font-family: 'Bebas Neue', var(--font); font-weight: 400; font-size: 1.9rem; letter-spacing: 0.04em; line-height: 1; color: var(--yellow); }
.ev-ending.tone-good b { color: var(--green); }
.ev-ending.tone-bad b { color: var(--red); }
.ev-ending-perk { font-size: 0.78rem; color: var(--text-secondary); }

/* ---- Travel: pictures of where you could go, and where you just landed ---- */
.location-card { overflow: hidden; }
.location-thumb {
  position: relative; height: 62px; margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) 10px;
  background: #0b0c14 center bottom / cover no-repeat;
}
.location-thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg-card) 0%, transparent 55%); }
.location-card.current::after { background: rgba(5, 6, 12, 0.7); padding: 2px 7px; border-radius: 8px; }
.travel-arrival { position: absolute; inset: 0; z-index: 5; display: none; opacity: 0; background: #07080f; }
.travel-arrival.show { display: block; }
.travel-arrival::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(5, 6, 12, 0.75), transparent 60%); }
.travel-arrival-text { position: absolute; left: 14px; bottom: 10px; z-index: 1; text-align: left; }
.travel-arrival-city { font-family: 'Bebas Neue', var(--font); font-size: 2.6rem; line-height: 0.95; letter-spacing: 0.05em; color: #fff; text-shadow: 0 2px 16px #000; }
.travel-arrival-blurb { font-size: 0.76rem; font-style: italic; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 4px #000; }

/* ---- Story tab ---- */
.story-head { margin-bottom: var(--space-md); }
.story-title { font-family: 'Bebas Neue', var(--font); font-weight: 400; font-size: 2.4rem; letter-spacing: 0.05em; line-height: 1; }
.story-sub { color: var(--text-muted); font-size: 0.85rem; }
.story-perks { background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: var(--radius); padding: 12px 14px; margin-bottom: var(--space-md); }
.story-perks h3 { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 6px; }
.story-perks ul { list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; color: var(--text); }
.arc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--space-md); align-items: start; }
.arc-card {
  --arc: var(--accent);
  background: var(--bg-card); border: 1px solid var(--border); border-top: 3px solid var(--arc); border-radius: var(--radius); padding: 14px;
  background-image: radial-gradient(120% 90px at 0 0, color-mix(in srgb, var(--arc) 16%, transparent), transparent);
}
.arc-card.locked { border-top-color: var(--border-strong); background-image: none; }
.arc-card.locked .arc-ico { color: var(--text-muted); border-color: var(--border); }
.arc-card.done { border-top-style: double; }
.arc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.arc-ico {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.35rem;
  background: var(--bg-input); border: 1px solid var(--arc); box-shadow: 0 0 14px color-mix(in srgb, var(--arc) 35%, transparent);
}
.arc-card.locked .arc-ico { box-shadow: none; font-size: 1rem; }
.arc-head > div { min-width: 0; flex: 1; }
.arc-title { font-size: 1rem; font-weight: 800; line-height: 1.2; }
.arc-role { font-size: 0.7rem; color: var(--text-muted); }
.arc-next { font-size: 0.85rem; color: var(--text); padding: 8px 10px; margin-bottom: 10px; border-left: 2px solid var(--arc); background: var(--bg-input); border-radius: 0 var(--radius) var(--radius) 0; }
.arc-tease { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }
.arc-ending { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.arc-ending span { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.arc-ending b { font-family: 'Bebas Neue', var(--font); font-weight: 400; font-size: 1.5rem; letter-spacing: 0.04em; line-height: 1; color: var(--yellow); }
.arc-card.tone-good .arc-ending b { color: var(--green); }
.arc-card.tone-bad .arc-ending b { color: var(--red); }
.arc-perk { font-size: 0.8rem; color: var(--green); margin-bottom: 10px; }
.arc-log { list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; color: var(--text-secondary); border-top: 1px solid var(--border); padding-top: 9px; }
.arc-log li { display: flex; gap: 8px; }
.arc-day { flex: 0 0 auto; width: 46px; color: var(--text-muted); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }

/* ---- Game over: where everyone ended up ---- */
.recap { width: 100%; max-width: 620px; text-align: left; }
.recap-title { font-family: 'Bebas Neue', var(--font); font-weight: 400; font-size: 1.7rem; letter-spacing: 0.05em; margin-bottom: 8px; text-align: center; }
.recap-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.recap-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: rgba(20, 22, 30, 0.82); border: 1px solid var(--border); border-left: 3px solid var(--arc); }
.recap-item.open { border-left-style: dashed; opacity: 0.8; }
.recap-ico { font-size: 1.4rem; line-height: 1.2; }
.recap-who { font-weight: 800; font-size: 0.9rem; }
.recap-ending { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-left: 6px; }
.recap-item.tone-good .recap-ending { color: var(--green); }
.recap-item.tone-bad .recap-ending { color: var(--red); }
.recap-item p { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.5; }

/* ---- Help, folded under Stats ---- */
.help-fold { margin-top: var(--space-lg); border-top: 1px solid var(--border); padding-top: var(--space-md); }
.help-fold > summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.help-fold > summary::-webkit-details-marker { display: none; }
.help-fold[open] > summary { margin-bottom: var(--space-md); }

/* ---- The edges of the screen react to trouble ---- */
body.in-game::before { content: ''; position: fixed; inset: 0; z-index: 80; pointer-events: none; opacity: 0; transition: opacity 0.6s ease; }
body.heat-hot::before { opacity: 1; animation: sirens 1.2s steps(1, end) infinite; }
body.hp-low::before { opacity: 1; box-shadow: inset 0 0 110px rgba(255, 30, 30, 0.4); animation: heartbeat 1.1s ease-in-out infinite; }
@keyframes sirens {
  0% { box-shadow: inset 0 0 64px rgba(255, 69, 58, 0.2); }
  50% { box-shadow: inset 0 0 64px rgba(74, 158, 255, 0.2); }
}
@keyframes heartbeat { 0%, 100% { opacity: 0.45; } 12% { opacity: 1; } 24% { opacity: 0.6; } 36% { opacity: 0.95; } }

@media (max-width: 700px) {
  .city-banner { height: 104px; border-radius: var(--radius); }
  .city-name { font-size: 2.2rem; }
  .ev-scene { height: 148px; margin: -18px -16px 12px; border-radius: 18px 18px 0 0; }
  .ev-scene-slim { height: 76px; }
  .ev-badge { left: 12px; width: 42px; height: 42px; font-size: 1.35rem; }
  .arc-grid { grid-template-columns: 1fr; }
  .location-thumb { height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .game-title .warz, body.heat-hot::before, body.hp-low::before, .city-tag.hot { animation: none; }
  body.heat-hot::before { box-shadow: inset 0 0 80px rgba(255, 69, 58, 0.22); }
}
