/* COLD START — terminal-flavored, theme-aware. */
:root {
  --bg: #0b0d0e;
  --fg: #c9cfd1;
  --dim: #6f7a7d;
  --accent: #e8b04b;
  --good: #7dc47f;
  --bad: #d4695f;
  --line: #24292b;
  --btnbg: #121517;
  --btncool: #1c2124;
}
body.light {
  --bg: #f3f1ea;
  --fg: #2a2a28;
  --dim: #8a8a82;
  --accent: #a86f14;
  --good: #3a7d3d;
  --bad: #a53c33;
  --line: #d8d4c8;
  --btnbg: #eae7dd;
  --btncool: #ddd9cc;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.5;
  user-select: none;
}

#wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px 60px;
}

/* save indicator */
#saveNotify {
  position: fixed; top: 8px; right: 16px;
  color: var(--dim); opacity: 0;
  transition: opacity 0.8s;
  pointer-events: none;
  z-index: 50;
}
#saveNotify.show { opacity: 1; transition: opacity 0.1s; }

/* tabs */
#tabs { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 10px; }
.tabBtn {
  display: inline-block;
  cursor: pointer;
  margin-right: 18px;
  color: var(--dim);
  padding: 2px 2px;
}
.tabBtn:hover { color: var(--fg); }
.tabBtn.selected { color: var(--accent); }

/* layout */
#content { display: flex; gap: 18px; }
#notifications {
  width: 230px; flex: none;
  max-height: 80vh; overflow: hidden;
  mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
}
.notification { margin-bottom: 8px; color: var(--fg); font-size: 13px; }
.notification.good { color: var(--good); }
.notification.bad { color: var(--bad); }

#panels { flex: 1; min-width: 0; }
.panel { display: none; }
.panel.activePanel { display: block; }

#sidebar { width: 210px; flex: none; }
.storesTitle {
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  margin: 10px 0 4px;
}
.storeRow { display: flex; justify-content: space-between; font-size: 13px; }
.storeName { color: var(--fg); }
.storeVal { color: var(--accent); }
.perkRow .storeName { color: var(--good); }

/* panel content */
.panelStatus { margin: 8px 0; }
.dim { color: var(--dim); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.sectionTitle { color: var(--dim); margin: 14px 0 6px; }

.buttonRow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.button {
  position: relative;
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--btnbg);
  padding: 5px 14px;
  cursor: pointer;
  overflow: hidden;
  min-width: 90px;
  text-align: center;
}
.button:hover { border-color: var(--dim); }
.button.disabled { color: var(--dim); cursor: default; border-color: var(--line); }
.button.cooling { color: var(--dim); cursor: default; }
.button .btnLabel { position: relative; z-index: 2; }
.cooldownBar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--btncool);
  z-index: 1;
}

/* jobs */
.jobRow { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.jobName { width: 220px; }
.jobBtn {
  cursor: pointer; color: var(--accent);
  border: 1px solid var(--line);
  padding: 0 8px;
}
.jobBtn:hover { border-color: var(--dim); }
.jobBtn.small { font-size: 11px; padding: 0 5px; color: var(--dim); }
.jobCount { min-width: 26px; text-align: center; }
.incomeBox { margin-top: 14px; font-size: 13px; }

/* world map */
.worldMap {
  font-size: 13px;
  line-height: 1.05;
  letter-spacing: 2px;
  margin: 8px 0;
  color: var(--dim);
  overflow-x: auto;
  user-select: none;
}
.mPlayer { color: var(--fg); font-weight: bold; }
.mHome { color: var(--good); font-weight: bold; }
.mMark { color: var(--accent); font-weight: bold; }
.mUsed { color: var(--dim); }
.mFog { opacity: 0.25; }
.expStatus { color: var(--accent); font-size: 13px; }

.dpad { display: flex; gap: 8px; margin-top: 8px; }
.dpadBtn { min-width: 46px; }

/* combat */
.fightBox { display: flex; align-items: center; gap: 24px; margin: 18px 0; }
.fightSide { text-align: center; min-width: 120px; }
.fightName { color: var(--accent); }
.fightHp { font-size: 20px; }
.fightVs { color: var(--dim); }

/* modal */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
body.light .overlay { background: rgba(60,55,40,0.4); }
.modalBox {
  background: var(--bg);
  border: 1px solid var(--dim);
  padding: 18px 22px;
  max-width: 480px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}
.modalBox.wide { max-width: 640px; }
.modalTitle { color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 10px; }
.modalText { margin: 8px 0; }
.modalButtons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.modalTextarea {
  width: 100%; height: 110px;
  background: var(--btnbg); color: var(--fg);
  border: 1px solid var(--line);
  font-family: inherit; font-size: 12px;
  user-select: text;
}

/* slots */
.slotRow { border: 1px solid var(--line); padding: 8px 10px; margin: 8px 0; }
.slotRow.activeSlot { border-color: var(--accent); }
.slotLabel { margin-bottom: 6px; }

/* menu */
#menu {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  text-align: right;
}
.menuBtn { color: var(--dim); cursor: pointer; margin-left: 18px; }
.menuBtn:hover { color: var(--fg); }

/* small screens */
@media (max-width: 900px) {
  #content { flex-direction: column; }
  #notifications { width: 100%; max-height: 120px; order: 3; }
  #sidebar { width: 100%; order: 2;}
  #panels { order: 1; }
}
