/* Drug Wars: Chicago -- 16-bit skin, travel overlay and event scenes.
 *
 * Loaded after the existing stylesheets so it can override the Bootstrap-era
 * look without editing the old files. Colours are the same 36 the art uses.
 */

:root {
  --ink: #0a0a12;   --night: #141624; --slate1: #1e2235; --slate2: #2a3048;
  --slate3: #39415e; --slate4: #4b5575; --slate5: #616c8d; --slate6: #7d88a6;
  --mist: #9da7bf;  --fog: #c2c9d9;   --bone: #e8ecf4;
  --tan2: #965c2e;  --amber1: #c07d3a; --amber2: #e3a451; --amber3: #f5c977; --cream: #fde6ae;
  --blood: #5c101a; --red: #c0252c;   --flame: #e8453c;
  --teal2: #1c778f; --aqua: #5fd9d2;  --green: #367a3f; --moss: #1d3f24;
  --blue1: #2437b4; --blue2: #3d63e8;

  --disp: 'Press Start 2P', 'Courier New', monospace;
  --body: 'VT323', 'Courier New', monospace;
}

/* Pixel art must never be smoothed. */
img[src*="/art/"], img[src*="/avatars/"], .pixel-stage canvas, .event-art canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------- travel overlay ---------- */

.pixel-overlay {
  position: fixed;
  inset: 0;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: dw-fade-in 140ms ease-out;
}

.pixel-stage {
  line-height: 0;
  box-shadow: 0 0 0 2px var(--slate2);
}

.pixel-overlay::after {
  content: 'click or press any key to skip';
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--body);
  font-size: 17px;
  letter-spacing: 1px;
  color: var(--slate4);
  pointer-events: none;
}

@keyframes dw-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- event scenes ---------- */

.event-scene {
  position: fixed;
  inset: 0;
  z-index: 4500;
  background: rgba(10, 10, 18, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  animation: dw-fade-in 150ms ease-out;
}
.event-scene.closing { animation: dw-fade-out 140ms ease-in forwards; }
@keyframes dw-fade-out { to { opacity: 0; } }

.event-panel {
  width: min(660px, 100%);
  background: var(--ink);
  border: 3px solid var(--red);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px rgba(0, 0, 0, 0.5);
  animation: dw-pop 170ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes dw-pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.event-art {
  position: relative;
  border-bottom: 3px solid var(--red);
  line-height: 0;
  background: var(--ink);
}
.event-art canvas { width: 100%; height: auto; display: block; }

.event-tag {
  position: absolute;
  left: 0;
  top: 14px;
  padding: 6px 16px 6px 12px;
  font-family: var(--disp);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--cream);
}

.event-body { padding: 18px 20px; font-family: var(--body); }

.event-text {
  margin: 0;
  color: var(--bone);
  font-size: 26px;
  line-height: 1.5;
  text-wrap: pretty;
  white-space: pre-line; /* outcome text uses \n for its roll line */
}

.event-stats { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.event-stat {
  flex: 1 1 140px;
  background: var(--night);
  border: 2px solid var(--slate2);
  padding: 7px 10px;
}
.event-stat .k { color: var(--slate5); font-size: 19px; letter-spacing: 1px; }
.event-stat .v { color: var(--bone); font-size: 24px; }

.event-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.event-choice {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--slate1);
  border: 2px solid var(--slate4);
  border-left: 6px solid var(--red);
  border-radius: 0;
  padding: 12px 14px;
  cursor: pointer;
  font-family: var(--body);
  transition: background 90ms linear, border-color 90ms linear;
  min-height: 44px;
}
.event-choice:hover, .event-choice:focus-visible {
  background: var(--slate2);
  border-color: var(--amber1);
  outline: none;
}
.event-choice .lab {
  display: block;
  font-family: var(--disp);
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--bone);
}
.event-choice .det { display: block; color: var(--mist); font-size: 23px; margin-top: 7px; }
.event-choice .hint { display: block; color: var(--amber2); font-size: 21px; margin-top: 4px; }

/* ---------- travel picker ---------- */

.dw-line-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  vertical-align: middle;
  border: 2px solid rgba(0, 0, 0, 0.45);
}

@media (max-width: 560px) {
  .event-text { font-size: 22px; }
  .event-panel { border-width: 2px; }
  .event-stat { flex-basis: 100%; }
}

/* Someone who has asked for less motion still gets the scene, just still. */
@media (prefers-reduced-motion: reduce) {
  .event-scene, .event-panel, .pixel-overlay { animation: none; }
}

/* ---------- intro / title screen ----------
 * The backdrop is generated art; the lettering is real type over the top.
 * Asking an image model for the title produced garbled glyphs every time.
 */

#intro-screen {
  position: relative;
  background:
    linear-gradient(180deg, rgba(10,10,18,0.55) 0%, rgba(10,10,18,0.82) 55%, var(--ink) 100%),
    url('../art/title_hero.png') center 32% / cover no-repeat;
  image-rendering: pixelated;
}

.dw-title { text-align: center; margin-bottom: 4px; }

#intro-screen .dw-title h1 {
  font-family: var(--disp);
  font-size: clamp(24px, 6vw, 46px);
  letter-spacing: 2px;
  color: var(--amber3);
  text-shadow: 4px 4px 0 var(--blood), 8px 8px 0 rgba(0, 0, 0, 0.55);
  margin: 0;
  animation: none; /* the old infinite pulse fought the backdrop */
}

.dw-title-sub {
  font-family: var(--disp);
  font-size: clamp(11px, 2.4vw, 17px);
  letter-spacing: clamp(6px, 2.2vw, 14px);
  color: var(--blue2);
  margin-top: 12px;
  text-shadow: 2px 2px 0 var(--ink);
}

.dw-title-tag {
  font-family: var(--body);
  font-size: 19px;
  letter-spacing: 2px;
  color: var(--slate6);
  margin-top: 14px;
}

#avatar-selection img {
  image-rendering: pixelated;
  border: 2px solid var(--slate2);
  background: var(--ink);
  transition: border-color 90ms linear, transform 90ms ease-out;
}
#avatar-selection img:hover { border-color: var(--slate5); transform: translateY(-2px); }
#avatar-selection img.selected-avatar { border-color: var(--amber3); }

/* ---------- buttons ---------- */

.dw-btn {
  font-family: var(--disp);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--fog);
  background: var(--slate1);
  border: 2px solid var(--slate4);
  border-radius: 0;
  padding: 13px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: background 90ms linear, border-color 90ms linear, color 90ms linear;
}
.dw-btn:hover, .dw-btn:focus-visible {
  background: var(--slate2); border-color: var(--slate6); color: var(--bone); outline: none;
}
.dw-btn-primary {
  background: var(--slate1); border-color: var(--amber3); color: var(--amber3);
}
.dw-btn-primary:hover, .dw-btn-primary:focus-visible {
  background: var(--tan2); border-color: var(--cream); color: var(--cream);
}

.dw-footer-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- modal shell ---------- */

.dw-modal-scrim {
  position: fixed; inset: 0; z-index: 4300;
  background: rgba(10, 10, 18, 0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
  animation: dw-fade-in 130ms ease-out;
}

.dw-modal {
  width: min(560px, 100%);
  background: var(--ink);
  border: 3px solid var(--slate4);
  box-shadow: 0 0 0 3px var(--ink), 0 14px 40px rgba(0, 0, 0, 0.6);
  animation: dw-pop 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
}
.dw-modal.wide { width: min(880px, 100%); }

.dw-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 14px;
  background: var(--night);
  border-bottom: 3px solid var(--slate4);
  flex: none;
}
.dw-modal-title {
  font-family: var(--disp); font-size: 15px; letter-spacing: 2px; color: var(--amber3);
}
.dw-modal-x {
  background: none; border: none; color: var(--slate5);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.dw-modal-x:hover { color: var(--flame); }

.dw-modal-art { height: 132px; overflow: hidden; position: relative; flex: none; border-bottom: 2px solid var(--slate2); }
.dw-modal-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dw-modal-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,18,0.1) 0%, rgba(10,10,18,0.85) 100%);
}

.dw-modal-body { padding: 20px; font-family: var(--body); font-size: 25px; color: var(--fog); overflow-y: auto; line-height: 1.45; }
.dw-modal-blurb { margin: 0 0 16px; color: var(--mist); font-size: 24px; text-wrap: pretty; }

/* Adopted panels arrive with Bootstrap classes; neutralise the worst of it. */
.dw-adopted .card,
.dw-adopted .card-body { background: transparent !important; border: none !important; box-shadow: none !important; }
.dw-adopted .btn { border-radius: 0 !important; min-height: 40px; }
.dw-adopted h6, .dw-adopted h5 {
  font-family: var(--disp); font-size: 11px; letter-spacing: 1px; color: var(--slate6);
}

/* ---------- the L map ---------- */

.dw-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  min-height: 380px;
  background:
    radial-gradient(circle at 78% 78%, rgba(28, 119, 143, 0.20) 0%, transparent 42%),
    var(--night);
  border: 2px solid var(--slate2);
}
.dw-map-lines { position: absolute; inset: 0; width: 100%; height: 100%; }

.dw-stn {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--slate1);
  border: 2px solid var(--slate3);
  border-radius: 0;
  padding: 6px 9px;
  text-align: left;
  cursor: pointer;
  font-family: var(--body);
  min-width: 128px;
  min-height: 44px;
  transition: border-color 90ms linear, background 90ms linear, transform 90ms ease-out;
}
/* Hover must not re-centre a station that was deliberately edge-anchored, so
   it lifts and brightens rather than scaling from a changed origin. */
.dw-stn:hover:not(:disabled), .dw-stn:focus-visible:not(:disabled) {
  border-color: var(--amber3);
  background: var(--slate2);
  outline: none;
  z-index: 3;
  box-shadow: 0 0 0 2px var(--ink), 0 0 12px rgba(245, 201, 119, 0.35);
}
.dw-stn.here {
  border-color: var(--amber1);
  background: var(--slate2);
  cursor: default;
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--tan2);
}
.dw-stn-row { display: flex; align-items: center; gap: 7px; }
.dw-stn-dot { width: 10px; height: 10px; flex: none; border: 1px solid rgba(0,0,0,0.5); }
.dw-stn-nm { font-size: 18px; color: var(--bone); letter-spacing: 1px; }
.dw-stn.here .dw-stn-nm { color: var(--amber3); }
.dw-stn-sub { display: block; font-size: 15px; color: var(--slate5); margin-top: 2px; }
.dw-stn-sub.here { color: var(--amber1); }
.dw-stn-sub .risk { color: var(--flame); }
.dw-stn-sub .calm { color: var(--green); }

.dw-map-legend {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; font-family: var(--body); font-size: 17px; color: var(--mist);
}
.dw-legend-item { display: flex; align-items: center; gap: 6px; }
.dw-legend-sw { width: 16px; height: 6px; display: inline-block; }
.dw-legend-note { color: var(--slate5); margin-left: auto; }

/* ---------- field notes ---------- */

.dw-panel { background: var(--night); border: 2px solid var(--slate3); height: 100%; }
.dw-panel-head {
  font-family: var(--disp); font-size: 11px; letter-spacing: 2px;
  color: var(--slate6); padding: 10px 12px;
  background: var(--slate1); border-bottom: 2px solid var(--slate3);
}
.dw-notes-list {
  list-style: none; margin: 0; padding: 12px;
  font-family: var(--body); font-size: 18px; color: var(--mist);
}
.dw-notes-list li {
  padding: 7px 0 7px 14px; border-bottom: 1px solid var(--slate1);
  position: relative; text-wrap: pretty;
}
.dw-notes-list li:last-child { border-bottom: none; }
.dw-notes-list li::before {
  content: ''; position: absolute; left: 0; top: 14px;
  width: 6px; height: 6px; background: var(--amber1);
}

@media (max-width: 720px) {
  .dw-map { aspect-ratio: 3 / 4; min-height: 460px; }
  .dw-stn { min-width: 104px; padding: 5px 7px; }
  .dw-stn-nm { font-size: 16px; }
  .dw-stn-sub { font-size: 13px; }
  .dw-legend-note { margin-left: 0; width: 100%; }
}

/* ---------- header / HUD ---------- */

.dw-header {
  background: var(--night) !important;
  border-bottom: 2px solid var(--slate3) !important;
  padding: 0 !important;
}

.dw-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate1);
}
.dw-brand {
  font-family: var(--disp); font-size: 13px; letter-spacing: 1px;
  color: var(--amber3); margin: 0;
}
.dw-brand span { color: var(--red); }
.dw-titlebar-right { display: flex; gap: 10px; align-items: center; }

.dw-chip {
  font-family: var(--body); font-size: 17px; letter-spacing: 1px;
  background: var(--slate1); border: 2px solid var(--slate3);
  color: var(--bone); padding: 3px 10px;
}
.dw-chip-heat { color: var(--green); border-color: var(--moss); background: #101a12; }
.dw-chip-heat[data-level="medium"] { color: var(--amber2); border-color: var(--tan2); background: #1a130a; }
.dw-chip-heat[data-level="high"]   { color: var(--coral); border-color: var(--red);  background: var(--blood); }

.dw-hud { display: flex; gap: 12px; padding: 11px 14px; align-items: flex-start; }
.dw-hud-avatar {
  width: 64px; height: 64px; flex: none;
  border: 2px solid var(--slate4); background: var(--ink);
  image-rendering: pixelated; object-fit: cover;
}
.dw-hud-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 20px; flex-grow: 1; min-width: 0;
}

.dw-stat {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--slate1); padding-bottom: 2px; min-width: 0;
}
.dw-stat-k {
  font-family: var(--body); font-size: 16px; letter-spacing: 1px;
  color: var(--slate6); flex: none;
}
.dw-stat-v {
  font-family: var(--disp); font-size: 12px; color: var(--bone);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dw-cash { color: var(--amber3) !important; }

.dw-meter { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dw-meter .dw-stat-k { width: 56px; }
.dw-bar {
  flex-grow: 1; height: 12px; min-width: 40px;
  background: var(--slate1); border: 1px solid var(--slate2);
}
.dw-bar-fill { height: 100%; transition: width 0.25s linear; }
.dw-bar-fill.hp  { background: var(--green); }
.dw-bar-fill.rep { background: var(--amber1); }
.dw-meter-n {
  font-family: var(--body); font-size: 17px; color: var(--bone);
  width: 56px; text-align: right; flex: none;
}

/* ---------- location strip ---------- */

.dw-locstrip {
  position: relative; min-height: 92px;
  background-size: cover; background-position: center 60%;
  image-rendering: pixelated;
  border-top: 2px solid var(--slate3);
}
.dw-locstrip-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--ink) 0%, rgba(10,10,18,0.72) 46%, rgba(10,10,18,0.25) 100%);
}
.dw-locstrip-body {
  position: relative; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.dw-locstrip-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.dw-locstrip-name {
  font-family: var(--disp); font-size: 15px; letter-spacing: 1px; color: var(--bone);
}
.dw-locstrip-line { font-family: var(--body); font-size: 17px; color: var(--slate6); }
.dw-locstrip-blurb {
  font-family: var(--body); font-size: 18px; color: var(--mist);
  max-width: 60ch; text-wrap: pretty;
}

/* ---------- cards, lists, market rows ---------- */

#game-ui .card {
  background: var(--night) !important;
  border: 2px solid var(--slate3) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
#game-ui .card-title {
  font-family: var(--disp) !important; font-size: 11px !important;
  letter-spacing: 2px !important; color: var(--slate6) !important;
  border-bottom: 2px solid var(--slate2); padding-bottom: 9px; margin-bottom: 12px !important;
}
#game-ui .card-subtitle {
  font-family: var(--disp) !important; font-size: 10px !important;
  letter-spacing: 1px !important; color: var(--slate5) !important;
}

#game-ui .list-group-item {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--slate1) !important;
  border-radius: 0 !important;
  color: var(--fog) !important;
  font-family: var(--body); font-size: 19px;
  padding: 9px 4px !important;
}
#game-ui .list-group-item:last-child { border-bottom: none !important; }

.dw-drug-labels { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
#game-ui .drug-name {
  font-family: var(--body); font-size: 20px; color: var(--bone); letter-spacing: 1px;
}
#game-ui .badge {
  font-family: var(--disp) !important; font-size: 11px !important;
  background: transparent !important; color: var(--amber3) !important;
  padding: 0 !important; text-shadow: none !important;
}

#game-ui .trade-buttons { display: flex; gap: 6px; flex: none; }
#game-ui .trade-buttons .btn,
#game-ui .btn-sm {
  font-family: var(--body); font-size: 17px; letter-spacing: 1px;
  border-radius: 0 !important; min-height: 40px; padding: 6px 14px;
}
#game-ui .btn-success {
  background: var(--moss) !important; border: 2px solid var(--green) !important; color: var(--bone) !important;
}
#game-ui .btn-danger {
  background: var(--blood) !important; border: 2px solid var(--red) !important; color: var(--bone) !important;
}
#game-ui .btn-success:hover { background: var(--green) !important; }
#game-ui .btn-danger:hover  { background: var(--red) !important; }

#game-ui .form-select {
  background: var(--ink) !important; border: 2px solid var(--slate3) !important;
  border-radius: 0 !important; color: var(--fog) !important;
  font-family: var(--body); font-size: 18px;
}

/* ---------- tier / empire status ---------- */

#tier-display .tier-rank {
  font-family: var(--disp); font-size: 12px; letter-spacing: 1px; color: var(--amber3);
}
#tier-display .tier-description { font-family: var(--body); font-size: 18px; color: var(--mist); margin-top: 4px; }
#tier-display .tier-limits,
#tier-display .tier-progress { font-family: var(--body); font-size: 18px; color: var(--slate6); margin-top: 3px; }
#tier-display .tier-progress { color: var(--aqua); }

.footer { background: var(--night) !important; border-top: 2px solid var(--slate3) !important; }

@media (max-width: 720px) {
  .dw-hud-grid { grid-template-columns: 1fr; }
  .dw-hud-avatar { width: 48px; height: 48px; }
  .dw-brand { font-size: 11px; }
  .dw-locstrip-name { font-size: 13px; }
  .dw-footer-actions .dw-btn { flex: 1 1 auto; font-size: 9px; padding: 12px 8px; }
}

/* ---------- item icons through the rest of the UI ---------- */

.dw-modal-head { gap: 10px; }
.dw-modal-title { flex-grow: 1; }

.dw-weapon-head { display: flex; align-items: center; gap: 2px; }
.dw-weapon-head h5 {
  font-family: var(--disp); font-size: 11px; letter-spacing: 1px;
  color: var(--bone); margin: 0 0 5px;
}
.dw-weapon-head .weapon-stats { font-family: var(--body); font-size: 17px; color: var(--mist); }

.dw-inv-row { display: flex !important; align-items: center; }
.dw-inv-body { display: flex; flex-direction: column; min-width: 0; }
.dw-inv-name { font-family: var(--body); font-size: 19px; color: var(--bone); letter-spacing: 1px; }
.dw-inv-meta { font-family: var(--body); font-size: 16px; color: var(--slate6); }
.dw-inv-meta .text-success { color: var(--green) !important; }
.dw-inv-meta .text-danger  { color: var(--flame) !important; }

.dw-equipped { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.dw-equipped-name {
  font-family: var(--disp); font-size: 11px; letter-spacing: 1px; color: var(--amber3);
}

#game-ui .weapon-card {
  background: var(--ink) !important;
  border: 2px solid var(--slate2) !important;
  border-radius: 0 !important;
  padding: 10px !important;
  margin-bottom: 8px;
}

/* Panels that now live behind footer buttons. They must stay in the DOM -- the
   modal adopts the live nodes and restores them here on close -- so they are
   hidden rather than removed. The modal re-parents them out of this card, which
   is why the adopted content is still visible when opened. */
.dw-offstage { display: none !important; }


/* ==================== rebuilt game screen: normal flow ==================== */

body {
  background: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Hidden until the game starts; game.js flips display to flex. */
#game-ui {
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
}

.dw-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px;
}

.dw-market, .dw-side { background: var(--night); border: 2px solid var(--slate3); }
.dw-side { display: flex; flex-direction: column; }

.dw-sect-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-family: var(--disp); font-size: 11px; letter-spacing: 2px; color: var(--slate6);
  padding: 10px 12px; background: var(--slate1); border-bottom: 2px solid var(--slate3);
}

.dw-list { list-style: none; margin: 0; padding: 0; }
.dw-empty,
.dw-list .list-group-item {
  display: block;
  font-family: var(--body); font-size: 18px; color: var(--slate5);
  padding: 10px 12px; background: transparent;
  border: none; border-bottom: 1px solid var(--slate1);
}

/* ---------- market rows ---------- */

.dw-mkt-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--slate1);
}
.dw-mkt-row:last-child { border-bottom: none; }
.dw-mkt-info { display: flex; align-items: center; flex-grow: 1; min-width: 0; }
.dw-drug-labels { display: flex; flex-direction: column; min-width: 0; }
.dw-mkt-name { font-family: var(--body); font-size: 20px; color: var(--bone); letter-spacing: 1px; }
.dw-mkt-sub { display: flex; gap: 10px; font-family: var(--body); font-size: 15px; }
.dw-trend.up { color: var(--green); }
.dw-trend.down { color: var(--flame); }
.dw-trend.flat { color: var(--slate4); }
.dw-limit-note { color: var(--amber2); }

.dw-mkt-price {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  flex: none; font-family: var(--disp); font-size: 12px; color: var(--amber3);
}
.dw-rep-note { font-family: var(--body); font-size: 14px; color: var(--aqua); letter-spacing: 1px; }

.trade-buttons { display: flex; gap: 6px; flex: none; }
.dw-btn-buy, .dw-btn-sell {
  font-family: var(--body); font-size: 17px; letter-spacing: 1px;
  border-radius: 0; min-height: 42px; min-width: 58px; padding: 5px 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dw-btn-buy  { background: var(--moss);  border: 2px solid var(--green); color: var(--bone); }
.dw-btn-sell { background: var(--blood); border: 2px solid var(--red);   color: var(--bone); }
.dw-btn-buy:hover  { background: var(--green); }
.dw-btn-sell:hover:not(:disabled) { background: var(--red); }
.dw-btn-sell:disabled {
  opacity: 0.4; cursor: not-allowed; pointer-events: none;
  background: var(--slate1); border-color: var(--slate3); color: var(--slate5);
}

.dw-market-note { font-family: var(--body); font-size: 16px; letter-spacing: 1px; color: var(--green); }
.dw-market-note.down { color: var(--flame); }

/* ---------- side column ---------- */

.dw-arsenal { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.dw-select {
  width: 100%; background: var(--ink); border: 2px solid var(--slate3);
  color: var(--fog); font-family: var(--body); font-size: 18px;
  padding: 7px 8px; border-radius: 0;
}
.dw-tier { padding: 10px 12px; }

/* ---------- compact header ---------- */

.dw-hud { padding: 8px 14px; }
.dw-hud-avatar { width: 52px; height: 52px; }
.dw-locstrip { min-height: 62px; }
.dw-locstrip-body { padding: 8px 14px; gap: 3px; }
.dw-locstrip-name { font-size: 13px; }
.dw-locstrip-blurb {
  font-size: 16px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- sticky footer: reserves its own space, covers nothing ---------- */

.dw-footer {
  position: sticky; bottom: 0; z-index: 60;
  margin-top: auto;
  background: var(--night); border-top: 2px solid var(--slate3);
}
.dw-footer-inner {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 9px 14px 5px;
}
.dw-footer-gap { flex-grow: 1; }
.dw-footer-links {
  display: flex; gap: 16px; justify-content: center; align-items: baseline;
  padding: 0 14px 7px; font-family: var(--body); font-size: 15px; letter-spacing: 1px;
}
.dw-footer-links a { color: var(--slate5); text-decoration: none; }
.dw-footer-links a:hover { color: var(--amber2); }
.dw-footer-links span { color: var(--slate3); }

/* ================= legacy dialogs on the same palette ================= */

/* The amount dialogs (bank, stash picker) open ON TOP of a panel modal, so
   they must clear .dw-modal-scrim's 4300. */
.retro-popup-backdrop { z-index: 4600 !important; }
.trade-modal-backdrop { z-index: 4600 !important; }
#drug-selection-modal { z-index: 4600 !important; }
#police-modal { z-index: 4600 !important; }

.retro-popup, .trade-modal {
  background: var(--ink) !important;
  border: 3px solid var(--amber1) !important;
  border-radius: 0 !important;
  box-shadow: 0 0 0 3px var(--ink), 0 14px 40px rgba(0, 0, 0, 0.6) !important;
  font-family: var(--body) !important;
}
.retro-popup-header, .trade-modal-header {
  background: var(--night) !important;
  border-bottom: 2px solid var(--amber1) !important;
  border-radius: 0 !important;
}
.retro-popup-title, .trade-modal-title {
  font-family: var(--disp) !important; font-size: 12px !important;
  letter-spacing: 2px !important; color: var(--amber3) !important;
  text-shadow: none !important;
}
.retro-popup-body, .trade-modal-body,
.trade-modal-description, .trade-modal-label, .trade-modal-value {
  font-family: var(--body) !important; color: var(--fog) !important;
}
.retro-popup-btn, .trade-modal button {
  font-family: var(--body) !important; font-size: 17px !important;
  letter-spacing: 1px !important; border-radius: 0 !important;
  min-height: 42px;
}

#police-modal .police-modal-content {
  background: var(--ink) !important;
  border: 3px solid var(--red) !important;
  border-radius: 0 !important;
  font-family: var(--body) !important;
  color: var(--fog) !important;
}
#police-modal h2 {
  font-family: var(--disp) !important; font-size: 14px !important;
  letter-spacing: 2px !important; color: var(--flame) !important;
}
#police-modal .btn { border-radius: 0 !important; min-height: 44px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .dw-main { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .dw-footer-inner .dw-btn { flex: 1 1 auto; font-size: 9px; padding: 12px 6px; }
  .dw-mkt-name { font-size: 18px; }
  .dw-mkt-price { font-size: 11px; }
}

/* Attract-mode leaderboard: palette + scrollable table on narrow screens. */
#high-score-screen { padding: 16px; }
#high-score-screen .high-score-table-container {
  overflow-x: auto;
  max-width: 100%;
  border: 2px solid var(--slate3);
  background: var(--night);
}
#high-score-screen .high-score-table {
  font-family: var(--body);
  color: var(--fog);
}

/* Ultra-narrow screens: market rows wrap their buttons to a second line and
   the HUD meters give up their fixed number widths. */
@media (max-width: 380px) {
  .dw-mkt-row { flex-wrap: wrap; }
  .dw-mkt-row .trade-buttons { width: 100%; justify-content: flex-end; }
  .dw-mkt-price { margin-left: auto; }
  .dw-meter .dw-stat-k { width: 44px; font-size: 14px; }
  .dw-meter-n { width: auto; min-width: 38px; font-size: 15px; }
  .dw-hud-grid { gap: 5px 10px; }
}

/* Intro screen buttons on the palette (markup is Bootstrap; skin only). */
#intro-screen .btn {
  font-family: var(--disp);
  font-size: 11px;
  letter-spacing: 1px;
  border-radius: 0;
  min-height: 44px;
  border-width: 2px;
}
#intro-screen .btn-primary, #intro-screen .btn-success {
  background: var(--moss); border-color: var(--green); color: var(--bone);
}
#intro-screen .btn-primary:hover, #intro-screen .btn-success:hover {
  background: var(--green); border-color: var(--aqua);
}
#intro-screen .btn-warning {
  background: var(--slate1); border-color: var(--slate4); color: var(--fog);
}
#intro-screen .btn-warning:hover {
  background: var(--slate2); border-color: var(--amber2); color: var(--amber3);
}
#intro-screen input.form-control {
  background: var(--ink); border: 2px solid var(--slate4); border-radius: 0;
  color: var(--bone); font-family: var(--body); font-size: 20px;
}
#intro-screen input.form-control:focus {
  border-color: var(--amber3); box-shadow: none; background: var(--ink); color: var(--bone);
}

/* Bio modal on the palette too. */
#bio-modal .bio-modal-content, #bio-modal .modal-content {
  background: var(--ink); border: 3px solid var(--amber1); border-radius: 0;
}

/* style.css targets #btn-start by id, which outranks class selectors; match it. */
#intro-screen #btn-start,
#intro-screen #btn-options,
#intro-screen #btn-highscores,
#intro-screen #player-name {
  border-radius: 0;
  animation: none;
}
#intro-screen #btn-start {
  background: var(--moss); border: 2px solid var(--green); color: var(--bone);
  font-family: var(--disp); font-size: 12px; letter-spacing: 2px; min-height: 48px;
}
#intro-screen #btn-start:hover {
  background: var(--green); border-color: var(--aqua); transform: none; box-shadow: none;
}
#intro-screen #player-name {
  background: var(--ink); border: 2px solid var(--slate4);
  color: var(--bone); font-family: var(--body); font-size: 20px;
}

/* ============ the neighbourhood fills the page, not just a bar ============ */

body {
  background-color: var(--ink);
  /* Scrim over the neighbourhood art so panels and text keep their contrast. */
  background-image:
    linear-gradient(180deg, rgba(10, 10, 18, 0.60) 0%, rgba(10, 10, 18, 0.84) 55%, rgba(10, 10, 18, 0.94) 100%),
    var(--dw-city-art, none);
  background-size: cover, cover;
  background-position: center, center 30%;
  background-attachment: fixed, fixed;
  background-repeat: no-repeat, no-repeat;
  image-rendering: pixelated;
}

/* The strip becomes a caption floating over the page art. */
.dw-locstrip { background: transparent !important; border-top: none; min-height: 84px; }
.dw-locstrip-scrim {
  background: linear-gradient(90deg, rgba(10, 10, 18, 0.75) 0%, rgba(10, 10, 18, 0.35) 55%, transparent 100%);
}
.dw-locstrip-name, .dw-locstrip-line, .dw-locstrip-blurb { text-shadow: 2px 2px 0 var(--ink); }

/* Header goes slightly translucent so the city reads behind it. */
.dw-header { background: rgba(20, 22, 36, 0.92) !important; }

/* Old tier-info gradient clashes with the art; flatten it onto the palette. */
#tier-display .tier-info {
  background: var(--ink) !important;
  border: 1px solid var(--slate2) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 10px 12px !important;
}

/* ============== big-icon pass (ui-ux-pro-max: scale 12/14/16/18/24/32, ============
   ============== 44px+ targets, icons framed as game item slots) ============== */

/* Item slots: every icon sits in a bordered tile like a game inventory slot.
   This is the ONLY .dw-item-icon definition -- two smaller ones used to sit
   further up the file and were silently overridden. */
.dw-item-icon {
  width: 76px; height: 76px;
  padding: 5px;
  background: var(--ink);
  border: 2px solid var(--slate3);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6);
  margin-right: 16px;
  flex: none;
  image-rendering: pixelated;
}
.dw-item-icon.sm { width: 58px; height: 58px; padding: 4px; margin-right: 12px; }
.dw-item-icon.lg { width: 92px; height: 92px; padding: 6px; margin-right: 16px; }
.dw-modal-head .dw-item-icon { width: 44px; height: 44px; padding: 3px; }

/* Market rows: taller, clearer hierarchy — name 22, price up a step. */
.dw-mkt-row { padding: 12px; gap: 12px; }
.dw-mkt-row:hover { background: rgba(30, 34, 53, 0.5); }
.dw-mkt-name { font-size: 22px; }
.dw-mkt-sub { font-size: 16px; margin-top: 2px; }
.dw-mkt-price { font-size: 14px; gap: 3px; }
.dw-btn-buy, .dw-btn-sell { min-height: 48px; min-width: 64px; font-size: 18px; }

/* Inventory rows breathe with the bigger slots. */
.dw-inv-row { padding: 10px 12px !important; }
.dw-inv-name { font-size: 20px; }
.dw-inv-meta { font-size: 17px; }

/* HUD: the portrait earns its place against the full-page art. */
.dw-hud-avatar { width: 64px; height: 64px; border-width: 3px; }

/* Empire tier block: kill the last old-theme remnants. */
#tier-display .tier-rank { font-size: 13px; }
#tier-display .tier-progress-bar,
#tier-display .progress {
  height: 12px !important;
  background: var(--slate1) !important;
  border: 1px solid var(--slate2) !important;
  border-radius: 0 !important;
  overflow: hidden;
  margin-top: 8px;
}
#tier-display .tier-progress-fill,
#tier-display .progress-bar {
  background: var(--amber1) !important;
  border-radius: 0 !important;
}
#tier-display .tier-next,
#tier-display small {
  font-family: var(--body) !important;
  font-size: 16px !important;
  color: var(--slate6) !important;
  letter-spacing: 1px;
}

/* Weapon shop cards: slot + text side by side, room to breathe. */
#game-ui .weapon-card, .dw-adopted .weapon-card { padding: 12px !important; }
.dw-weapon-head { gap: 10px; }
.dw-weapon-head h5 { font-size: 12px; }

@media (max-width: 560px) {
  .dw-item-icon { width: 58px; height: 58px; margin-right: 12px; }
  .dw-item-icon.sm { width: 46px; height: 46px; }
  .dw-mkt-name { font-size: 19px; }
}

.dw-equipped-badge {
  font-family: var(--disp); font-size: 8px; letter-spacing: 1px;
  color: var(--aqua); border: 1px solid var(--teal2);
  padding: 2px 6px; margin-left: 8px; vertical-align: middle;
}
/* Market note: shrink politely instead of wrapping the section header. */
.dw-market-note { text-align: right; flex-shrink: 1; min-width: 0; }

/* ============ adopted panels: Bootstrap's small type is unreadable here ============ */

.dw-adopted, .dw-adopted div, .dw-adopted span, .dw-adopted p, .dw-adopted label {
  font-family: var(--body);
  font-size: 23px;
  color: var(--fog);
}
.dw-adopted .small, .dw-adopted small {
  font-size: 21px !important;
  color: var(--mist) !important;
}
.dw-adopted h5, .dw-adopted h6 {
  font-family: var(--disp) !important;
  font-size: 13px !important;
  letter-spacing: 1px;
  color: var(--slate6) !important;
  margin-bottom: 10px !important;
}
.dw-adopted .btn {
  font-family: var(--body) !important;
  font-size: 21px !important;
  letter-spacing: 1px;
  border-radius: 0 !important;
  min-height: 48px;
  padding: 10px 16px !important;
}
.dw-adopted .weapon-stats { font-size: 21px !important; }
.dw-adopted .dw-weapon-head h5 { font-size: 14px !important; }
.dw-adopted select, .dw-adopted input {
  font-family: var(--body) !important;
  font-size: 22px !important;
  border-radius: 0 !important;
  background: var(--ink) !important;
  border: 2px solid var(--slate3) !important;
  color: var(--bone) !important;
  min-height: 46px;
}

/* Legacy amount dialogs (bank deposit/withdraw, stash picker, trade) */
.retro-popup-body, .retro-popup-body div, .retro-popup-body span,
.trade-modal-body, .trade-modal-description {
  font-size: 23px !important;
  font-family: var(--body) !important;
}
.trade-modal-label, .trade-modal-value { font-size: 22px !important; }
.retro-popup-title, .trade-modal-title { font-size: 15px !important; }
.retro-popup-btn, .trade-modal button {
  font-size: 21px !important;
  min-height: 48px;
  padding: 10px 18px !important;
}
.retro-popup input, .trade-modal input[type="number"], .trade-modal input[type="text"] {
  font-family: var(--body) !important;
  font-size: 24px !important;
  background: var(--ink) !important;
  border: 2px solid var(--slate4) !important;
  color: var(--bone) !important;
  border-radius: 0 !important;
  min-height: 46px;
}

/* ---------- loan shark ---------- */

.dw-btn-debt { border-color: var(--crimson); color: var(--coral); }
.dw-btn-debt:hover, .dw-btn-debt:focus-visible {
  background: var(--blood); border-color: var(--flame); color: var(--cream);
}
/* Owing money is the default state, so the button nags only when it should. */
.dw-btn-debt.overdue {
  background: var(--blood); border-color: var(--flame); color: var(--cream);
  animation: dw-nag 1.6s steps(2, end) infinite;
}
@keyframes dw-nag { 50% { border-color: var(--coral); } }

.dw-loan-warn {
  font-family: var(--body); font-size: 21px; letter-spacing: 1px;
  color: var(--amber2); margin: 4px 0 12px;
}
.dw-loan-warn.clear { color: var(--green); }
.dw-loan-warn.danger { color: var(--flame); }

/* Debt line in the HUD, so it is never a surprise. */
.dw-debt { color: var(--coral) !important; }

@media (prefers-reduced-motion: reduce) {
  .dw-btn-debt.overdue { animation: none; }
}

/* ---------- the game shell is hidden until a run starts ----------
   The header and footer are siblings of #game-ui, so hiding only #game-ui left
   the HUD over the intro screen -- including an <img src=""> avatar, which
   browsers draw as a broken-image icon. */

.dw-header, .dw-footer { display: none; }
body.dw-playing .dw-header { display: block; }
body.dw-playing .dw-footer { display: block; }

/* Belt and braces: an avatar with no source never renders as a broken icon. */
.dw-hud-avatar:not([src]), .dw-hud-avatar[src=""] { visibility: hidden; }

/* ---------- TOP DEALERS leaderboard ---------- */

#high-score-screen {
  padding: 20px;
  background: linear-gradient(rgba(10, 10, 18, 0.93), rgba(10, 10, 18, 0.97)) !important;
}
#high-score-screen h1 {
  font-family: var(--disp);
  font-size: clamp(16px, 3vw, 26px) !important;
  letter-spacing: 3px;
  color: var(--amber3) !important;
  text-shadow: 4px 4px 0 var(--blood) !important;
  animation: none !important;          /* the infinite pulse was distracting */
  margin-bottom: 20px;
}

#high-score-screen .high-score-table-container {
  width: auto;
  max-width: min(760px, 100%);
  margin: 0 auto 20px !important;      /* centred regardless of parent display */
  background: var(--night) !important;
  border: 2px solid var(--slate3) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow-x: auto;
  max-height: 62vh;
}

.high-score-table { width: 100%; margin: 0 auto; }

/* Tighter fields, bigger type: the old cells were 15px of padding around 0.8rem
   text, which read as a lot of box and very little information. */
#high-score-screen .high-score-table th {
  font-family: var(--disp) !important;
  font-size: 10px !important;
  letter-spacing: 1px;
  padding: 10px 8px !important;
  background: var(--slate1) !important;
  color: var(--slate6) !important;
  border-bottom: 2px solid var(--slate3) !important;
  text-align: center;
  white-space: nowrap;
}
#high-score-screen .high-score-table td {
  font-family: var(--body) !important;
  font-size: 22px !important;
  padding: 6px 8px !important;
  color: var(--fog) !important;
  border-bottom: 1px solid var(--slate1) !important;
  text-align: center;
  white-space: nowrap;
}
#high-score-screen .high-score-table .top-score td {
  color: var(--amber3) !important;
  background: var(--slate1) !important;
}
#high-score-screen .avatar-thumbnail {
  width: 40px; height: 40px;
  image-rendering: pixelated;
  border: 2px solid var(--slate3);
  background: var(--ink);
  vertical-align: middle;
}
#high-score-screen .high-score-table tbody tr:nth-child(even) { background: transparent !important; }
#high-score-screen .high-score-table tr:hover td { background: var(--slate1) !important; }

/* ---------- button text alignment ----------
   Press Start 2P sits high in its line box, so padding alone left the label
   visibly off-centre. Flex centring puts it where it belongs, in every button
   that carries the display face. */

#intro-screen .btn,
#high-score-screen button,
.dw-btn,
.dw-btn-buy,
.dw-btn-sell,
.event-choice .lab,
.dw-modal-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
}
.event-choice .lab { display: block; text-align: left; }   /* choices read left */

#intro-screen .intro-buttons .btn,
#intro-screen #btn-start {
  min-height: 48px;
  padding: 12px 20px;
}
/* One vocabulary for the intro buttons; the stock Bootstrap purple and teal
   belonged to a different game. */
#intro-screen .btn-warning,
#intro-screen .btn-info,
#intro-screen .btn-secondary {
  background: var(--slate1) !important;
  border: 2px solid var(--slate4) !important;
  color: var(--fog) !important;
}
#intro-screen .btn-warning:hover,
#intro-screen .btn-info:hover,
#intro-screen .btn-secondary:hover {
  background: var(--slate2) !important;
  border-color: var(--amber2) !important;
  color: var(--amber3) !important;
}
#high-score-screen button {
  font-family: var(--disp);
  font-size: 11px;
  letter-spacing: 1px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 0;
  background: var(--slate1);
  border: 2px solid var(--slate4);
  color: var(--fog);
}
#high-score-screen button:hover {
  background: var(--slate2); border-color: var(--amber2); color: var(--amber3);
}
