/* Deskovania — bright, cozy office tycoon. Distinct from the noir skill builder. */

:root {
  --bg: #cdd6e6;
  --bg2: #b9c4da;
  --ink: #22262e;
  --muted: #5a6472;
  --card: #ffffff;
  --card-2: #f2f5fa;
  --line: #d7dde7;
  --brand: #2f9c95;
  --brand-ink: #1c6b66;
  --gold: #f2b134;
  --danger: #e35b4c;
  --shadow: 0 8px 24px rgba(30, 40, 60, 0.18);
  --radius: 14px;
  font-family: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(120% 120% at 50% 0%, var(--bg) 0%, var(--bg2) 100%);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: pointer;
}

.badge, .btn, .build-btn, h1, h2, .coin-amt { font-family: "Fredoka", "Inter", sans-serif; }

/* ---- HUD ---------------------------------------------------------------- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  gap: 12px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-right { display: flex; gap: 8px; align-items: center; }

.coin {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.coin-amt { font-size: 26px; font-weight: 700; }
.coin-amt::before { content: "\00A2 "; color: var(--gold); }
.coin-rate { font-size: 13px; color: var(--brand-ink); font-weight: 600; }

.badge {
  background: var(--card);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  box-shadow: var(--shadow);
  color: var(--brand-ink);
}
.badge.muted { color: var(--muted); }

.btn {
  background: var(--card);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary.poor { background: #9fb1b0; cursor: not-allowed; }
.btn.ghost { width: 38px; padding: 9px 0; text-align: center; }
.btn.big { width: 100%; padding: 12px; font-size: 16px; margin-top: 12px; }

/* ---- build bar ---------------------------------------------------------- */
.buildbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  scrollbar-width: none;
}
.buildbar::-webkit-scrollbar { display: none; }
.build-btn {
  border: 2px solid transparent;
  background: var(--card-2);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.build-btn:hover { transform: translateY(-2px); }
.build-btn.active { border-color: var(--brand); background: #e6f4f2; }
.build-btn.poor { opacity: 0.55; }
.build-btn.disabled { opacity: 0.5; cursor: default; }
.build-btn.cursor { background: #eef1f6; }
.build-btn.expand { background: #fff6e2; }
.b-glyph { font-size: 20px; }
.b-name { font-size: 11px; font-weight: 600; }
.b-cost { font-size: 11px; color: var(--brand-ink); font-weight: 700; }
.b-cost::before { content: "\00A2"; opacity: 0.7; }

/* ---- side panel --------------------------------------------------------- */
.panel {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(340px, 88vw);
  background: var(--card);
  box-shadow: -10px 0 30px rgba(30, 40, 60, 0.18);
  transform: translateX(105%);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 18px;
  overflow-y: auto;
  z-index: 20;
}
.panel.open { transform: translateX(0); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.x { border: none; background: var(--card-2); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; }

.stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stat-l { color: var(--muted); }
.stat-v { font-weight: 700; }
.panel-actions { display: flex; gap: 8px; margin-top: 16px; }
.panel-actions .btn { flex: 1; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.field { display: block; margin: 14px 0; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.name-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: var(--card-2);
}

/* ---- wardrobe ----------------------------------------------------------- */
.ward-slot { margin: 14px 0; }
.ward-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.ward-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  background: var(--card-2);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
}
.chip:hover { border-color: var(--brand); }
.chip.equipped { border-color: var(--brand); background: #e6f4f2; }
.chip.locked { opacity: 0.92; }
.sw {
  width: 22px; height: 22px; border-radius: 6px;
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: #d8dee7; font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.chip-name { flex: 1; font-size: 12px; font-weight: 600; }
.chip-tag { font-size: 11px; font-weight: 700; color: var(--muted); }
.chip-tag.on { color: var(--brand-ink); }
.chip-tag.buy { color: var(--gold); }
.chip-tag.buy::before { content: "\00A2"; }

/* ---- toast + modal ------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  pointer-events: none;
  z-index: 30;
}
.toast-item {
  background: rgba(24, 28, 36, 0.92);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast-item.show { opacity: 1; transform: translateY(0); }

.modal-back {
  position: fixed; inset: 0;
  background: rgba(20, 26, 38, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
}
.modal {
  background: var(--card);
  border-radius: 18px;
  padding: 24px;
  max-width: 440px;
  box-shadow: var(--shadow);
}
.modal h2 { margin: 0 0 8px; font-size: 24px; }
.help-list { margin: 12px 0; padding-left: 18px; color: var(--ink); }
.help-list li { margin: 6px 0; font-size: 14px; }

.cross-link {
  position: fixed;
  left: 14px; bottom: 14px;
  background: var(--card);
  color: var(--brand-ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.boot-error {
  position: fixed; inset: auto 16px 16px 16px;
  background: var(--danger); color: #fff;
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
  z-index: 99;
}

/* ---- Joe Time additions ------------------------------------------------- */
.stat-chips { display: flex; gap: 6px; margin-top: 6px; }
.schip {
  background: var(--card); border-radius: 999px; padding: 4px 9px;
  font-size: 12px; font-weight: 700; box-shadow: var(--shadow);
}
.schip.brain { color: #4b56b8; }
.schip.build { color: #c9772f; }
.badge.big { font-size: 13px; padding: 8px 12px; }
.badge.alert, .btn.alert { background: var(--gold); color: #3a2c00; }

.spec-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }

/* build bar tag tints */
.build-btn.t-brain { box-shadow: inset 0 -3px 0 #4b56b8; }
.build-btn.t-build { box-shadow: inset 0 -3px 0 #c9772f; }
.build-btn.t-neutral { box-shadow: inset 0 -3px 0 #7f8794; }

/* gear + look */
.chip-buff { font-size: 11px; font-weight: 700; color: var(--brand-ink); margin-right: 4px; }
.ward-sub { font-size: 12px; color: var(--muted); margin: 4px 0; }
.look-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--line);
  cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.swatch.on { border-color: var(--ink); transform: scale(1.06); }

/* team pot */
.pot-balance { text-align: center; margin: 8px 0 12px; }
.pot-amt { font-family: "Fredoka", sans-serif; font-size: 40px; font-weight: 700; color: var(--gold); display: block; }
.pot-amt::before { content: "\00A2"; opacity: 0.7; }
.pot-sub { font-size: 12px; color: var(--muted); }
.pot-phase { text-align: center; padding: 8px; border-radius: 10px; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.pot-phase.grow { background: #e6f4f2; color: var(--brand-ink); }
.pot-phase.vote { background: #fff2d6; color: #8a5a00; }
.invest-row { display: flex; gap: 8px; margin-top: 10px; }
.invest-row .name-input { margin: 0; }
.invest-row .btn { flex: 0 0 auto; }
.quick-row { display: flex; gap: 6px; margin-top: 8px; }
.qbtn { flex: 1; border: 1px solid var(--line); background: var(--card-2); border-radius: 8px; padding: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.qbtn:hover { border-color: var(--brand); }
.prop { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 2px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 10px; margin-top: 8px; cursor: pointer; }
.prop:hover { border-color: var(--brand); }
.prop.mine { border-color: var(--brand); background: #e6f4f2; }
.prop-glyph { font-size: 22px; }
.prop-body { flex: 1; display: flex; flex-direction: column; }
.prop-name { font-weight: 700; }
.prop-tally { font-weight: 700; color: var(--brand-ink); }

/* Build Your Joey */
.creator {
  background: var(--card); border-radius: 20px; padding: 22px;
  width: min(720px, 94vw); max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow);
}
.creator h2 { margin: 0 0 14px; font-size: 26px; letter-spacing: 0.04em; }
.creator-body { display: flex; gap: 18px; }
.creator-left { flex: 0 0 170px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.joey-preview { background: radial-gradient(120% 120% at 50% 30%, #eef2f8, #d9e0ec); border-radius: 14px; }
.creator-right { flex: 1; min-width: 0; }
.sect-label { font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 14px; color: var(--muted); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.sect-label:first-child { margin-top: 0; }
.spec-row { display: flex; gap: 10px; }
.spec-card { flex: 1; border: 2px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 12px; cursor: pointer; text-align: left; }
.spec-card:hover { border-color: var(--brand); }
.spec-card.on { border-color: var(--brand); background: #e6f4f2; }
.spec-glyph { font-size: 24px; }
.spec-name { font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 16px; }
.spec-blurb { margin: 4px 0; }
.spec-start { font-weight: 600; color: var(--ink); }
.adj-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.adj-wrap { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.adj-card { border: 2px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 10px; cursor: pointer; text-align: center; }
.adj-card:hover { border-color: var(--brand); }
.adj-card.on { border-color: var(--brand); background: #e6f4f2; }
.adj-word { font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 14px; }
.adj-buff { color: var(--brand-ink); font-weight: 600; margin-top: 2px; }
.start-info { text-align: center; margin: 14px 0 4px; }
.btn.small { padding: 6px 10px; font-size: 12px; }

/* ---- inventory / locker ------------------------------------------------- */
.acct-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0; padding: 8px 10px; background: var(--card-2); border-radius: 10px; }

.equip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.equip-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px dashed var(--line); background: var(--card-2); border-radius: 10px; padding: 8px 4px; cursor: pointer; }
.equip-slot.filled { border-style: solid; border-color: var(--brand); background: #e6f4f2; }
.eq-glyph { font-size: 20px; min-height: 22px; }
.eq-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.bag-grid { display: grid; gap: 3px; justify-content: center; margin: 6px auto; padding: 6px; background: #e5e9f0; border-radius: 10px; width: max-content; }
.bag-cell { width: 34px; height: 34px; border: 1px solid rgba(120,130,150,0.35); border-radius: 6px; background: #f4f6fa; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.bag-cell.occ { border-color: rgba(0,0,0,0.15); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25); }
.bag-cell.sel { outline: 3px solid var(--gold); outline-offset: -3px; }
.bag-cell.immov { cursor: not-allowed; }
.bag-glyph { font-size: 16px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3)); }
.sel-info { margin-top: 8px; }

.shop-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card-2); border-radius: 10px; padding: 8px 10px; margin-top: 6px; cursor: pointer; }
.shop-row:hover { border-color: var(--brand); }
.shop-glyph { font-size: 20px; }
.shop-body { flex: 1; display: flex; flex-direction: column; }
.shop-name { font-weight: 600; font-size: 13px; }
.shop-price { font-weight: 700; color: var(--gold); }
.shop-price::before { content: "\00A2"; opacity: 0.7; }

.login-modal .field { margin: 10px 0; }
.login-err { color: var(--danger); min-height: 16px; margin: 4px 0; }

@media (max-width: 560px) {
  .coin-amt { font-size: 22px; }
  .build-btn { min-width: 58px; }
  .cross-link { bottom: 88px; }
  .creator-body { flex-direction: column; align-items: center; }
  .adj-wrap { grid-template-columns: 1fr; }
}

/* ---- BUILD/BRAIN: research, locks, build queue -------------------------- */
.schip.research { color: #7a3fb8; }
.build-btn.locked { opacity: 0.6; filter: grayscale(0.4); }
.build-btn.locked .b-cost { color: var(--muted); }
.shop-row.locked { opacity: 0.6; filter: grayscale(0.4); cursor: help; }
.queue-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 6px 8px; background: var(--card-2); border-radius: 10px; }
.queue-body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.qbar { height: 6px; background: #dfe4ec; border-radius: 4px; overflow: hidden; }
.qbar-fill { height: 100%; background: #c9772f; border-radius: 4px; transition: width 0.3s linear; }
