:root {
  --ink: #12141a;
  --panel: #1b1f28;
  --mud: #2a2e24;
  --neon: #c8ff3a;
  --warn: #ff6a3d;
  --water: #2a6a78;
  --cream: #e8e2d4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: #0c0d10;
  color: var(--cream);
  font-family: "Segoe UI", Tahoma, sans-serif;
  overflow: hidden;
  user-select: none;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}
#hud {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  background: #10131a;
  border-bottom: 3px solid var(--neon);
  letter-spacing: 0.08em;
  font-size: 13px;
  z-index: 2;
  flex-shrink: 0;
}
#liqStrip {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #0e1218;
  border-bottom: 1px solid #3a4458;
  font-size: 10px;
  color: #9aa3b0;
  overflow: hidden;
  white-space: nowrap;
}
#plan ~ #liqStrip, body.planning #liqStrip { display: flex; }
body.plan-on #liqStrip { display: flex; }
#liqStrip.show { display: flex; }
.liq-rates { flex: 0 0 auto; max-width: 160px; white-space: normal; line-height: 1.25; }
.liq-tiers { display: flex; gap: 6px; flex: 1; min-width: 0; }
.liq-card {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #181c24;
  border: 1px solid #3a4458;
  padding: 3px 6px;
  flex: 1;
  min-width: 0;
}
.liq-card b { color: var(--neon); font-size: 10px; }
.liq-card input {
  width: 52px;
  background: #111;
  color: var(--cream);
  border: 1px solid #3a4458;
  padding: 2px 4px;
  font-size: 11px;
}
.liq-card button { padding: 3px 6px; font-size: 10px; }
.liq-lots { flex: 0 1 180px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; color: #c8ff3a; }
.brand {
  font-weight: 800;
  color: var(--neon);
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Black Ops One", Impact, sans-serif;
  letter-spacing: 0.06em;
}
.brand img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 2px solid var(--neon);
  image-rendering: auto;
}
.deal-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #181c24;
  border: 1px solid #3a4458;
  padding: 2px 8px 2px 2px;
  min-width: 0;
  position: relative;
  cursor: help;
}
.deal-chip img { width: 36px; height: 36px; object-fit: cover; border: 1px solid #111; }
.deal-chip small { display: block; font-size: 8px; letter-spacing: 0.08em; color: #9aa3b0; }
.deal-chip b { font-size: 11px; color: var(--cream); }
.deal-chip.clr { border-color: #a04030; }
.deal-chip.spot { border-color: #d4a024; }
.deal-chip[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 220px;
  background: #111;
  color: #c8ff3a;
  border: 1px solid #c8ff3a;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  z-index: 9;
  white-space: normal;
  line-height: 1.35;
}
#obj { color: #9aa3b0; }
.mute-btn {
  flex-shrink: 0;
  background: #181c24;
  color: var(--neon);
  border: 1px solid var(--neon);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  cursor: pointer;
}
.mute-btn.off {
  color: #9aa3b0;
  border-color: #3a4458;
}
.mute-btn:hover { background: #222834; }
@media (max-width: 900px) {
  #hud { flex-wrap: wrap; }
  .mute-btn {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 30;
  }
}
.stat.ico {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #181c24;
  border: 1px solid #3a4458;
  padding: 2px 10px 2px 2px;
  min-width: 72px;
}
.stat.ico img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#cashBox { cursor: pointer; }
#cashBox.neg, #cashBox.neg .apy { border-color: var(--warn); color: var(--warn); }
.apy { font-size: 10px; color: #9aa3b0; margin-left: 6px; letter-spacing: 0.04em; }
.apy.dn { color: var(--warn); }
.bank-h { margin: 12px 0 6px; font-size: 13px; color: var(--neon); letter-spacing: 0.12em; }
.bank-tier { text-align: left; margin: 8px 0; }
.bank-tier .hint { margin: 4px 0 8px; }
.bank-tier input { width: 120px; background: #181c24; color: var(--cream); border: 1px solid #3a4458; padding: 6px; }

.screen { flex: 1; min-height: 0; }
.hidden { display: none !important; }

#plan {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  background: #151820 url("../img/room.png") center / cover no-repeat;
  position: relative;
}
#plan::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10,12,16,0.72), rgba(10,12,16,0.55) 40%, rgba(10,12,16,0.7));
  pointer-events: none;
}
.col { padding: 18px 16px; overflow: auto; position: relative; z-index: 1; background: rgba(16, 20, 28, 0.55); }
.col.wide {
  border-left: 1px solid rgba(42, 49, 64, 0.8);
  background: #1a120c url("../img/board.jpg") center / cover no-repeat;
  overflow: hidden;
}
.col.wide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20,14,10,0.28), rgba(12,10,8,0.45));
  pointer-events: none;
}
h2 { font-size: 13px; letter-spacing: 0.16em; color: var(--neon); margin-bottom: 12px; }

.member {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  background: rgba(34, 40, 51, 0.92);
  border: 1px solid #3a4458;
  padding: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}
.member.on { outline: 2px solid var(--neon); }
.member.hot { border-color: var(--warn); }
.member.down { opacity: 0.42; filter: grayscale(1); }
.member.bio { border-color: #40c0e0; }
.member h3 { font-size: 13px; line-height: 1.2; }
.member .stats { font-size: 11px; color: #9aa3b0; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.member .quote { font-size: 11px; font-style: italic; color: #c4b48a; margin: 3px 0; }
.member .worth { font-size: 10px; color: var(--neon); margin-top: 4px; }
.port-wrap { position: relative; width: 88px; height: 110px; overflow: hidden; border: 2px solid #111; background: #111; }
.port-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cut-badge {
  position: absolute; top: 4px; right: 4px;
  background: #c8ff3a; color: #111; font-size: 10px; font-weight: 800;
  padding: 1px 4px; line-height: 1.2;
}
.sk { display: inline-flex; align-items: center; gap: 10px; position: relative; padding-right: 2px; }
.sk img { width: 32px; height: 32px; image-rendering: auto; border: 1px solid #111; }
.sk[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #111;
  color: #c8ff3a;
  border: 1px solid #c8ff3a;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 8;
  pointer-events: none;
}
.bars span { display: inline-block; width: 8px; height: 8px; background: #445; margin-right: 1px; }
.bars span.on { background: var(--neon); }

.drama {
  min-height: 64px;
  background: rgba(255, 248, 220, 0.88);
  color: #1a120c;
  border: 2px solid #3a2410;
  box-shadow: 3px 3px 0 #111;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  transform: rotate(-0.6deg);
  position: relative;
  z-index: 1;
}
.drama.empty { color: #5a4030; background: rgba(255, 248, 220, 0.7); }
.detail {
  min-height: 140px;
  background: rgba(255, 252, 240, 0.9);
  color: #1a120c;
  border: 2px solid #3a2410;
  box-shadow: 2px 2px 0 #111;
  padding: 14px;
  font-size: 13px;
  line-height: 1.4;
  transform: rotate(0.4deg);
  position: relative;
  z-index: 1;
}
.detail b { color: #111; }
.xpbar { height: 6px; background: #2a2418; margin: 6px 0; }
.xpbar i { display: block; height: 100%; background: #c8ff3a; }
.row { display: flex; gap: 8px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }
button {
  background: #2a3140;
  color: var(--cream);
  border: 1px solid #4a5568;
  padding: 8px 12px;
  cursor: pointer;
  letter-spacing: 0.08em;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
button img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.35; cursor: default; filter: none; }
button.go { background: #3a5018; border-color: var(--neon); color: var(--neon); }
button.ghost { background: transparent; }
button.warn { border-color: var(--warn); color: var(--warn); }

#mission { display: flex; flex-direction: column; background: #0e1014; position: relative; }
#game { flex: 1; width: 100%; background: #1c2018; cursor: crosshair; }
#orders {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: rgba(16, 19, 26, 0.94);
  border: 2px solid #3a4458;
  z-index: 4;
  justify-content: center;
}
#orders button.on, #buildMenu button.on { outline: 2px solid var(--neon); }
#buildMenu {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 74px;
  display: flex;
  gap: 6px;
  padding: 8px;
  background: rgba(16, 19, 26, 0.94);
  border: 2px solid #3a4458;
  z-index: 4;
  justify-content: center;
}
#buildMenu.hidden { display: none !important; }
.mkt { max-height: 360px; overflow: auto; text-align: left; font-size: 12px; }
.mkt-row {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr 0.6fr 0.5fr auto;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #2a3140;
}
.mkt-row button { padding: 4px 8px; font-size: 10px; margin: 0; }
.stock { display: flex; gap: 16px; text-align: left; justify-content: center; flex-wrap: wrap; }
.stock fieldset {
  border: 1px solid #4a5568;
  padding: 8px 10px;
  min-width: 140px;
}
.stock label { display: block; font-size: 12px; margin: 3px 0; cursor: pointer; }
.panel.wide { max-height: 88vh; overflow: auto; }

#overlay {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
  z-index: 8;
}
#overlay.show { display: flex; }
#overlay.show.hack-live {
  align-items: flex-end;
  justify-content: flex-end;
  padding: 12px 16px 18px;
  background: rgba(0,0,0,0.22);
  pointer-events: none;
}
#overlay.show.hack-live .panel { pointer-events: auto; }
.panel {
  width: min(520px, 92vw);
  background: #1b1f28;
  border: 3px solid var(--neon);
  padding: 28px;
  text-align: center;
}
.panel.wide { width: min(720px, 94vw); }
.panel.terminal {
  width: min(1080px, 96vw);
  max-height: 92vh;
  padding: 10px 12px 12px;
  text-align: left;
  background: #0d1117;
  border-color: #3a4458;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.term-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.term-head h1 { margin: 0; font-size: 18px; }
.term-head .hint { flex: 1; margin: 0; font-size: 11px; }
.term-head button { margin: 0 0 0 auto; }
.term-grid {
  display: grid;
  grid-template-columns: 168px 1fr 220px;
  gap: 8px;
  min-height: 0;
  flex: 1;
}
.term-list {
  overflow: auto;
  border: 1px solid #2a3140;
  background: #12161e;
  font-size: 11px;
}
.term-sp {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  border-bottom: 1px solid #1c2230;
}
.term-sp:hover, .term-sp.on { background: #1c2830; color: var(--neon); }
.term-sp .chg { font-variant-numeric: tabular-nums; }
.term-sp .up, .term-quote .up { color: #3dd68c; }
.term-sp .dn, .term-quote .dn { color: #ff6a3d; }
.term-sp .have { color: #9aa3b0; font-style: normal; font-size: 10px; }
.term-chart-col { display: flex; flex-direction: column; min-width: 0; }
#mktChart {
  width: 100%;
  height: 340px;
  background: #0a0d12;
  border: 1px solid #2a3140;
  image-rendering: auto;
}
.term-tape {
  height: 52px;
  overflow: auto;
  font-size: 10px;
  font-family: ui-monospace, Consolas, monospace;
  color: #9aa3b0;
  border: 1px solid #2a3140;
  background: #12161e;
  padding: 4px 6px;
  margin-top: 4px;
}
.term-side { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.term-quote {
  font-size: 11px;
  line-height: 1.45;
  background: #12161e;
  border: 1px solid #2a3140;
  padding: 8px;
  font-variant-numeric: tabular-nums;
}
.term-book {
  flex: 1;
  overflow: auto;
  font-size: 10px;
  font-family: ui-monospace, Consolas, monospace;
  background: #12161e;
  border: 1px solid #2a3140;
  padding: 4px;
}
.book-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  position: relative;
  padding: 1px 4px;
}
.book-row .bar {
  position: absolute;
  top: 0; bottom: 0;
  opacity: 0.22;
}
.book-row.ask .bar { right: 0; background: #ff6a3d; }
.book-row.bid .bar { left: 0; background: #3dd68c; }
.book-mid { text-align: center; color: #c8ff3a; padding: 4px 0; }
.term-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.term-acts button { margin: 0; width: 100%; justify-content: center; font-size: 10px; padding: 6px 4px; }
.panel h1 { letter-spacing: 0.14em; margin-bottom: 8px; color: var(--neon); }
.panel p { margin: 8px 0; color: #c5cdd8; line-height: 1.4; }
.hint { font-size: 13px; color: #8b93a3; }
.panel button { margin: 10px auto 0; display: flex; }
.grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.buy {
  width: 150px;
  background: #222833;
  border: 1px solid #4a5568;
  padding: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
}
.buy:hover { border-color: var(--neon); }
.row.wrap { position: relative; z-index: 1; }
.hire-grid { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hire-card {
  width: 200px;
  background: #161a22;
  border: 2px solid #c8ff3a;
  text-align: left;
  cursor: pointer;
  padding: 0 0 8px;
}
.hire-card img.port { width: 100%; height: 210px; object-fit: cover; display: block; }
.hire-card .cut-badge { position: absolute; }
.hire-card .port-wrap { width: 100%; height: 210px; }
.hire-card h3 { padding: 6px 8px 0; font-size: 14px; }
.hire-card .quote { padding: 0 8px; font-size: 12px; color: #c4b48a; font-style: italic; }
.hire-card .stats { padding: 4px 8px; font-size: 11px; }
.hire-card .cost { padding: 4px 8px; color: var(--neon); font-weight: 700; }
#hackCv { background: #0a0c10; border: 2px solid #c8ff3a; display: block; margin: 8px auto; }
#hackIn { background: #111; color: var(--neon); border: 2px solid #3a4458; padding: 8px; font-size: 18px; letter-spacing: 0.2em; text-align: center; width: 180px; }
.lv-sk { width: 140px; }
.easy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px auto 0;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 5px solid #7a1010;
  background: radial-gradient(circle at 38% 32%, #ff6a55, #c01010 55%, #7a0000 100%);
  color: #fff;
  font-family: "Black Ops One", Impact, sans-serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 0 #5a0000;
  box-shadow: 0 6px 0 #4a0000, 0 8px 10px rgba(0,0,0,0.4);
  position: relative;
  z-index: 2;
  cursor: pointer;
}
.easy-btn span { pointer-events: none; }
.easy-btn:hover { filter: brightness(1.08); }
.easy-btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #4a0000, 0 3px 6px rgba(0,0,0,0.4);
}
#logo-screen, #click-start {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0c10;
}
#logo-screen img { max-width: min(72vw, 420px); height: auto; }
#logo-screen.fade { opacity: 0; transition: opacity 0.55s ease; pointer-events: none; }
#click-start { cursor: pointer; background: #0c1016; }
#click-start h1 {
  font-family: "Black Ops One", Impact, sans-serif;
  font-size: clamp(28px, 7vw, 72px);
  color: var(--neon);
  letter-spacing: 0.12em;
  animation: clickPulse 1.4s ease-in-out infinite;
}
@keyframes clickPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.04); }
}
.shop-cat { margin: 10px 0; padding: 10px; border: 1px solid #3a4458; }
.shop-cat h3 { font-size: 12px; letter-spacing: 0.14em; margin: 0 0 8px; }
.cat-guns { background: rgba(90, 28, 24, 0.35); }
.cat-rods { background: rgba(24, 48, 72, 0.4); }
.cat-vehs { background: rgba(40, 56, 28, 0.4); }
.cat-own { background: rgba(40, 40, 24, 0.35); }
.gear-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.gear-card {
  width: 118px;
  background: rgba(16,18,22,0.85);
  border: 1px solid #4a5568;
  padding: 6px;
  cursor: pointer;
  text-align: center;
  font-size: 11px;
}
.gear-card img { width: 72px; height: 72px; object-fit: cover; display: block; margin: 0 auto 6px; border: 1px solid #111; }
.gear-card:hover { border-color: var(--neon); }
.gear-card.locked { opacity: 0.4; cursor: default; }
#skyWrap {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #081018;
  display: flex;
  flex-direction: column;
}
#skyWrap.hidden { display: none !important; }
#sky { width: 100%; flex: 1; background: #102030; cursor: crosshair; }
#skyHud {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  text-align: center;
  color: #c8ff3a;
  font-size: 12px;
  letter-spacing: 0.08em;
  pointer-events: none;
}
