/* Cashflow web edition. A blocky game HUD: dark green bars with black
   outlines, heavy outlined type, square tiles with pixel icons. */
:root {
  --font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --black: #000;
  --bar: rgba(0, 52, 10, 0.94);
  --bar-edge: #1c7a32;
  --tile: rgba(0, 32, 40, 0.88);
  --tile-hi: rgba(0, 52, 64, 0.94);
  --tile-edge: #0a4b58;
  --frame: #0b2e14;
  --frame-2: #10401d;
  --frame-3: #165a28;
  --well: #06180c;
  --text: #eef7ea;
  --muted: #a9cdb0;
  --gold: #f4b81c;
  --cash: #3ad13a;
  --xp: #2bd45e;
  --frost: #d2ecfa;
  --red: #e8322a;
  --purple: #8a34f0;
  --cyan: #19e6f0;
  --green-btn: #2fb53c;
  --ol1: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000, 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
  --ol2: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 1.5px 1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px -1.5px 0 #000, 0 3px 0 #000;
  --gap: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --stats-w: 300px;
  --tile-s: 64px;
  --dock-w: calc(var(--tile-s) * 2 + 4px);
  --mini-s: 168px;
  --panel-r: calc(var(--gap) * 2 + var(--dock-w));
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #007818;
  color: var(--text);
  font: 600 15px/1.4 var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
input { user-select: text; -webkit-user-select: text; }
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; cursor: crosshair; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
kbd {
  display: inline-block; min-width: 20px; padding: 2px 5px 1px; vertical-align: 1px;
  font: 800 12px/1 var(--font); color: #0b0b0b; text-align: center; text-shadow: none;
  background: #e8efe9; border: 2px solid #000; border-bottom-width: 3px; border-radius: 3px;
}
body.touch kbd { display: none; }

/* pixel icons: 16 x 16 art drawn at whole-number scales */
.ico { display: block; flex: none; width: 32px; height: 32px; }
.ico svg { display: block; width: 100%; height: 100%; }

/* the outlined type used everywhere on the HUD */
.t, .board-box, .quest, .zone, .toast, .alarm, .prompt, .ko, .slot, .dock button, .btn, .tab, .seg-btn, .panel-head h2 { text-shadow: var(--ol1); }

/* ---------- your stats, top left (at every window size) ---------- */
.statbars {
  position: fixed; z-index: 5; left: var(--gap); top: var(--gap);
  width: var(--stats-w); display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.bar {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 10px 0 5px;
  background: var(--bar); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--bar-edge), 0 3px 0 rgba(0, 0, 0, 0.35);
}
.bar .t { font: 800 23px/1 var(--font); letter-spacing: 0.005em; white-space: nowrap; text-shadow: var(--ol2); font-variant-numeric: tabular-nums; }
.t.gold { color: var(--gold); }
.t.cash { color: var(--cash); }
.t.xp { color: var(--xp); }
.t.frost { color: var(--frost); font-size: 21px; }
.t-sub { margin-left: auto; font: 700 13px/1 var(--font); color: var(--muted); white-space: nowrap; text-shadow: var(--ol1); }
#note { transform-origin: 20% 50%; }
#note.paid { animation: paid 0.22s ease-out; }
@keyframes paid { 40% { transform: scale(1.03); } }

.hpbar { height: 32px; }
.hpbar .ico { width: 24px; height: 24px; margin-left: 3px; }
.track { position: relative; overflow: hidden; }
.hpbar .track { flex: 1; height: 14px; background: #2a0c08; border: 2px solid #000; }
.hp-fill { position: absolute; inset: 0 auto 0 0; background: #4fe25a; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); transition: width 0.15s linear; }
.hp-fill.mid { background: var(--gold); }
.hp-fill.low { background: var(--red); animation: low-hp 0.7s steps(2) infinite; }
@keyframes low-hp { 50% { background: #ff7a6a; } }
.bar .t.hp { font-size: 16px; color: #fff; min-width: 76px; text-align: right; }

.xpbar { padding-bottom: 7px; }
.xp-track { position: absolute; left: 46px; right: 8px; bottom: 4px; height: 6px; background: #0f6a26; box-shadow: 0 0 0 1px #000; }
.xp-fill { position: absolute; inset: 0 auto 0 0; background: #8ff09a; transition: width 0.2s linear; }
.gem {
  position: relative; isolation: isolate; flex: none; width: 36px; height: 34px; margin-top: 3px;
  display: grid; place-items: center;
  font: 900 18px/1 var(--font); color: #fff; text-shadow: var(--ol2); font-variant-numeric: tabular-nums;
}
.gem::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  transform: rotate(45deg); background: var(--xp); border: 2px solid #000;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.22), inset 3px 3px 0 rgba(255, 255, 255, 0.35);
}

/* ---------- what to do next, top left ---------- */
/* A solid card built like the stat bars (black edge, a lighter inner line, a hard
   shadow) so it holds up on the grass; purple marks it as what to do next. */
.quest {
  position: fixed; z-index: 6; left: var(--gap); top: var(--gap);
  width: var(--stats-w); padding: 9px 12px 11px;
  color: #fff; font: 800 17px/1.25 var(--font); text-shadow: var(--ol2);
  background: #43168a; border: 2px solid #000;
  box-shadow: inset 0 0 0 1px #7c4ae0, 0 3px 0 rgba(0, 0, 0, 0.35);
}
.quest p { margin: 0; }
.tut-step { display: block; margin-top: 6px; font: 900 22px/1 var(--font); color: var(--gold); font-variant-numeric: tabular-nums; }
.goal-head { display: flex; align-items: center; gap: 8px; font-size: 20px; line-height: 1; }
.goal-head .ico { width: 26px; height: 26px; }
.goal-line { margin-top: 8px; }
.need + .need { margin-top: 7px; }
.need-t { display: block; font: 800 17px/1.1 var(--font); font-variant-numeric: tabular-nums; }
.need-bar { position: relative; display: block; height: 10px; margin-top: 3px; background: #22094d; border: 2px solid #000; }
.need-bar span { position: absolute; inset: 0 auto 0 0; background: var(--gold); }
.need.done .need-t { color: var(--cash); }
.need.done .need-bar span { background: var(--cash); }
.buildbar .bb-rot kbd { margin-right: 4px; }
body.touch .buildbar .bb-rot kbd { display: none; }
.row.ach .meter { margin-top: 6px; height: 12px; }
.tut-actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; font-style: normal; }
.tut-actions .btn { min-height: 34px; padding: 4px 14px; font-size: 16px; }
.link { background: none; border: 0; padding: 4px 0; font: 700 14px/1 var(--font); color: #e6d4ff; text-decoration: underline; text-shadow: var(--ol1); }

.zone {
  position: fixed; z-index: 5; left: var(--gap); top: calc(var(--gap) + 130px);
  margin: 0; padding: 5px 12px 5px 16px; max-width: var(--stats-w);
  font: 800 15px/1.25 var(--font); color: #fff;
  background: #5c0d0d; border: 2px solid #000; box-shadow: inset 5px 0 0 var(--red), 0 3px 0 rgba(0, 0, 0, 0.35);
}
.zone.safe { background: #00434f; box-shadow: inset 5px 0 0 var(--cyan), 0 3px 0 rgba(0, 0, 0, 0.35); }

/* ---------- events, top left (Roblox "Cashflow!": TopBar.EventList, HoverEventInfo) ---------- */
/* a 35 px square per event, its colour 40% see-through, a 1 px black edge, and a dark
   layer from the bottom that shrinks as the time runs out. No tweens, as in Roblox. */
.events { position: fixed; z-index: 6; left: var(--gap); top: var(--gap); display: flex; gap: 5px; }
.ev {
  position: relative; width: 35px; height: 35px; padding: 0; overflow: hidden;
  display: grid; place-items: center; cursor: help;
  background: rgba(255, 180, 180, 0.6); border: 1px solid #000; border-radius: 0;
}
.ev-left { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.2); }
.ev-emoji { position: relative; font: 25px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.ev:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ev-weekend { background: rgba(150, 205, 255, 0.6); }
.ev-walls { background: rgba(255, 205, 140, 0.6); }
.ev-surge { background: rgba(255, 196, 20, 0.6); }
.ev-star { background: rgba(255, 236, 120, 0.6); }
/* the box under an event you point at: 250 px wide, centred under it, kept 6 px from the edges,
   darker than in Roblox so it reads over the card under it */
.ev-info {
  position: fixed; z-index: 9; left: 0; top: 0; width: 250px; min-height: 30px; margin: 0; padding: 4px 4px;
  transform: translateX(-50%); pointer-events: none;
  font: 700 12px/1.15 var(--font); letter-spacing: -0.1px; color: #fff; text-shadow: var(--ol1); text-align: center; white-space: pre-line;
  background: rgba(30, 30, 30, 0.88); border: 1px solid #000;
}
/* the fever tints the world (not the HUD): the map is multiplied by a colour that
   fades round, like Roblox's ColorCorrection TintColor. It snaps on and off. */
.tint {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  mix-blend-mode: multiply; background: #ffb4b4; opacity: 0;
}
.tint.on { opacity: 1; }

/* ---------- map and players, top right ---------- */
.side { position: fixed; z-index: 5; top: var(--gap); right: var(--gap); width: var(--mini-s); display: flex; flex-direction: column; gap: 6px; }
.mini { display: block; width: var(--mini-s); height: var(--mini-s); background: #0b5a14; border: 3px solid #000; box-shadow: inset 0 0 0 2px var(--frame-3); }
/* zoom buttons in the map's bottom left corner */
.zoom { position: absolute; left: 5px; top: calc(var(--mini-s) - 2 * var(--zoom-s) - 7px); display: flex; flex-direction: column; gap: 2px; --zoom-s: 24px; }
.zoom button {
  width: var(--zoom-s); height: var(--zoom-s); padding: 0; display: grid; place-items: center;
  font: 900 18px/1 var(--font); color: #fff; text-shadow: var(--ol1);
  background: var(--tile); border: 2px solid #000; border-radius: 3px;
}
.zoom button:hover { background: var(--tile-hi); }
.zoom button:active { transform: translateY(1px); }
body.touch .zoom { --zoom-s: 30px; }
body.compact .zoom { left: 4px; top: calc(var(--mini-s) - 2 * var(--zoom-s) - 6px); }
.board-box { padding: 5px 7px 6px; background: var(--tile); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--tile-edge); }
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font: 800 15px/1.2 var(--font); color: #fff; }
.board-head #rank { font: 700 12px/1 var(--font); color: var(--muted); white-space: nowrap; }
.board { list-style: none; margin: 4px 0 0; padding: 0; font: 700 13px/1.25 var(--font); }
.board li { display: grid; grid-template-columns: 10px 1fr auto; gap: 6px; align-items: center; padding: 2px 0; }
.board li + li { border-top: 1px solid rgba(0, 0, 0, 0.45); }
.board .dot, .top .dot { width: 10px; height: 10px; background: var(--c); border: 2px solid #000; }
.board .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .amt { color: var(--cash); font-variant-numeric: tabular-nums; }
.board .me .who { color: var(--gold); }
.board li.away, .top li.away { opacity: 0.55; }

/* ---------- menus, bottom right ---------- */
.dock {
  position: fixed; z-index: 6; right: var(--gap); bottom: calc(var(--gap) + var(--safe-b));
  display: grid; grid-template-columns: repeat(2, var(--tile-s)); gap: 4px;
}
.dock button {
  position: relative; width: var(--tile-s); height: var(--tile-s); padding: 6px 0 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--tile); border: 2px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 2px var(--tile-edge);
  color: #fff;
}
.dock .lbl { font: 800 12px/1 var(--font); white-space: nowrap; }
.dock kbd, .slot kbd {
  position: absolute; left: 3px; top: 2px; min-width: 0; padding: 0;
  font: 800 12px/1 var(--font); color: #fff; background: none; border: 0; text-shadow: var(--ol1);
}
.dock button:hover { background: var(--tile-hi); }
.dock button:active { transform: translateY(2px); }
.dock button[aria-expanded="true"] { background: rgba(70, 52, 0, 0.92); box-shadow: inset 0 0 0 2px var(--gold); }
.badge:empty { display: none; }
.badge {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 4px;
  display: grid; place-items: center; font: 900 13px/1 var(--font); color: #000; text-shadow: none;
  background: #ffd21a; border: 2px solid #000; border-radius: 3px;
}
.badge.alert { background: var(--red); color: #fff; text-shadow: var(--ol1); }
.dock button.nudge { animation: nudge 1.1s ease-in-out infinite; box-shadow: inset 0 0 0 2px var(--gold); }
@keyframes nudge { 50% { transform: translateY(-5px); } }

/* ---------- what's in your hands, bottom middle ---------- */
.hotbar {
  position: fixed; z-index: 5; left: 50%; bottom: calc(var(--gap) + var(--safe-b)); transform: translateX(-50%);
  display: flex; gap: 6px;
}
.slot {
  position: relative; width: 58px; height: 58px; padding: 0;
  display: grid; place-items: center; overflow: hidden;
  color: #fff; background: rgba(18, 22, 20, 0.78); border: 2px solid #000; border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.slot .ico { width: 32px; height: 32px; margin-top: -6px; }
.slot.sword .ico { margin-top: 0; }
.slot-label { position: absolute; left: 0; right: 0; bottom: 3px; font: 800 12px/1 var(--font); text-align: center; white-space: nowrap; }
.slot-label small { font: inherit; color: var(--muted); }
.slot.on { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }
button.slot:hover { background: rgba(34, 40, 38, 0.86); }
button.slot:active { transform: translateY(2px); }
#buildBtn[aria-pressed="true"] { background: rgba(70, 52, 0, 0.9); box-shadow: inset 0 0 0 2px var(--gold); }
.slot .cool { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); transform-origin: 50% 100%; transform: scaleY(var(--cd, 0)); pointer-events: none; }
.kick.ready { box-shadow: inset 0 0 0 2px var(--gold); animation: nudge 0.9s ease-in-out infinite; }
.kick.cooling .ico { opacity: 0.55; }

/* ---------- prompts above the hotbar ---------- */
.prompt {
  position: fixed; z-index: 6; left: 50%; bottom: calc(var(--gap) + var(--safe-b) + 72px); transform: translateX(-50%);
  max-width: calc(100vw - 4 * var(--gap) - 2 * var(--stats-w));
  padding: 7px 14px; font: 800 16px/1.2 var(--font); color: #fff;
  background: var(--bar); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--bar-edge);
  cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prompt.act { cursor: pointer; }
.prompt.act:hover { background: rgba(0, 76, 14, 0.92); }
.prompt kbd { margin-right: 6px; }

.buildbar {
  position: fixed; z-index: 6; left: 50%; bottom: calc(var(--gap) + var(--safe-b) + 72px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  width: max-content; max-width: calc(100vw - 4 * var(--gap) - 2 * var(--stats-w));
  background: var(--bar); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--bar-edge);
}
.bb-swatch, .swatch {
  flex: none; width: 32px; height: 32px; border-radius: 2px;
  background: var(--c, var(--cash)); border: 2px solid #000;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.28), inset 0 3px 0 rgba(255, 255, 255, 0.32);
}
/* the item itself, drawn as on the map (CM.pic) */
.bb-swatch.pic, .swatch.pic { background-color: #0e8c26; background-size: 100% 100%; background-repeat: no-repeat; box-shadow: none; image-rendering: auto; }
.bb-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; max-width: 340px; }
.bb-main b { font: 800 18px/1.15 var(--font); color: #fff; text-shadow: var(--ol1); }
.bb-main span { font: 700 12.5px/1.25 var(--font); color: var(--muted); }
.bb-main span.warn-text { color: #ff8a7e; }
.bb-arrow {
  flex: none; width: 32px; height: 38px; padding: 0 0 3px;
  font: 900 28px/1 var(--font); color: #fff; text-shadow: var(--ol1);
  background: var(--tile); border: 2px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--tile-edge);
}
.bb-arrow:hover { background: var(--tile-hi); }
.bb-arrow:active { transform: translateY(1px); }
.buildbar .btn { min-height: 38px; padding: 4px 12px; font-size: 16px; flex-direction: row; gap: 6px; }
.buildbar .bb-place { display: none; }
body.touch .buildbar .bb-place { display: inline-flex; }

/* ---------- alerts ---------- */
.alarm {
  position: fixed; z-index: 7; top: var(--gap); left: 50%; transform: translateX(-50%);
  margin: 0; max-width: min(520px, calc(100vw - 2 * var(--gap) - 760px)); min-width: 260px; padding: 8px 14px;
  font: 800 16px/1.25 var(--font); color: #fff; text-align: center;
  background: #b01c14; border: 2px solid #000; box-shadow: inset 0 0 0 2px #ff5a4a;
  animation: alarm 0.9s steps(2) infinite;
}
@keyframes alarm { 50% { background: #d8281e; } }

.toasts {
  position: fixed; z-index: 8; left: 50%; top: var(--gap); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none;
  width: min(480px, calc(100vw - 2 * var(--gap) - 760px)); min-width: 260px;
}
.toast {
  padding: 6px 12px; font: 800 16px/1.25 var(--font); color: #fff; text-align: center;
  background: rgba(0, 0, 0, 0.62); border: 2px solid #000;
  animation: toast-in 0.18s ease-out;
}
.toast.good { color: #6cf274; }
.toast.bad { color: #ff7d70; }
.toast.gold { color: #ffd21a; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity 0.3s, transform 0.3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.97); } }

.ko {
  position: fixed; z-index: 7; left: 50%; top: 42%; transform: translate(-50%, -50%);
  width: max-content; max-width: calc(100vw - 32px); padding: 14px 24px; text-wrap: balance;
  font: 900 26px/1.2 var(--font); color: #fff; text-align: center; text-shadow: var(--ol2);
  background: rgba(120, 10, 6, 0.9); border: 3px solid #000; box-shadow: inset 0 0 0 2px #ff5a4a;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 40px; padding: 5px 14px 8px;
  font: 800 17px/1 var(--font); color: #fff;
  background: var(--green-btn); border: 2px solid #000; border-radius: 3px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.btn small { font: 700 11px/1.1 var(--font); opacity: 0.95; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3); }
.btn.go { background: var(--gold); }
.btn.ghost { background: #1d4552; }
.btn.warn { background: var(--red); }
.btn.big { min-height: 54px; padding: 8px 28px 12px; font-size: 24px; text-shadow: var(--ol2); }
.btn.cant { filter: grayscale(0.75) brightness(0.8); }
.btn.cant:hover:not(:disabled) { filter: grayscale(0.75) brightness(0.88); }   /* stays grey under the mouse */
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- menu panel ---------- */
.panel {
  position: fixed; z-index: 9; top: var(--gap); right: var(--panel-r); bottom: calc(var(--gap) + var(--safe-b));
  width: min(440px, calc(100vw - var(--panel-r) - var(--gap)));
  display: flex; flex-direction: column;
  background: rgba(11, 46, 20, 0.97); border: 3px solid #000; border-radius: 4px; box-shadow: inset 0 0 0 2px var(--frame-3);
  user-select: text; -webkit-user-select: text;
}
body.panel-open .side, body.panel-open .hotbar, body.panel-open .prompt { visibility: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 2px 2px 0; padding: 10px 10px 10px 16px; background: var(--frame-2); border-bottom: 3px solid #000;
}
.panel-head h2 { margin: 0; font: 900 28px/1 var(--font); color: #fff; text-shadow: var(--ol2); }
.x {
  width: 38px; height: 38px; display: grid; place-items: center; padding: 0;
  color: #fff; background: var(--red); border: 2px solid #000; border-radius: 3px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}
.x svg { filter: drop-shadow(1px 1px 0 #000) drop-shadow(-1px -1px 0 #000); }
.x:active { transform: translateY(2px); }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 16px 18px; overscroll-behavior: contain; scrollbar-color: var(--frame-3) transparent; }
.panel-body h3 { margin: 18px 0 6px; font: 800 20px/1.1 var(--font); color: var(--gold); text-shadow: var(--ol1); }
.panel-body p { margin: 8px 0; }
.panel-body b { color: #fff; }
.sub { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-style: italic; }
.warn-text { color: #ff8a7e; font-weight: 700; }
.ok-text { color: var(--cash); font-weight: 700; }
.panel-body .warn-text b, .panel-body .ok-text b { color: inherit; }
.warn-text:empty { display: none; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; }
.row + .row { border-top: 2px solid rgba(0, 0, 0, 0.4); }
.row.on { background: rgba(244, 184, 28, 0.12); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-main b { font: 800 16.5px/1.2 var(--font); color: #fff; }
.meta { font-size: 13px; color: var(--muted); }
.lvl { font-size: 13.5px; margin-top: 3px; }
.lvl .arrow { color: var(--cash); font-weight: 800; }
.row-buy { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sold { font: 800 14px/1 var(--font); color: var(--muted); padding: 0 6px; }
.odds { list-style: none; margin: 6px 0 0; padding: 0; max-width: 320px; }
.odds li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 5px 2px; font: 700 15px/1.2 var(--font); color: #fff; border-top: 1px solid rgba(0, 0, 0, 0.45); }
.odds li:first-child { border-top: 0; }
.odds li > span:last-child { color: var(--gold); font-weight: 800; }
.odds .swatch { display: inline-block; width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; margin-right: 6px; box-shadow: none; }
.swatch.empty-slot { background: transparent; border-style: dashed; box-shadow: none; }

.tabs { display: flex; gap: 6px; margin: 12px 0 4px; }
.tab, .seg-btn {
  flex: 1; padding: 8px 6px 9px; font: 800 16px/1 var(--font); color: #fff;
  background: var(--tile); border: 2px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--tile-edge);
}
.tab:hover, .seg-btn:hover { background: var(--tile-hi); }
.tab[aria-selected="true"], .seg-btn[aria-pressed="true"] { background: var(--gold); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3); }
.shop-top { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; }
.shop-top .sub { flex: none; }
.qty { flex: 1; }
.qty .seg-btn { padding: 7px 4px 8px; font-size: 15px; }
.cmd { display: flex; gap: 6px; }
.cmd input, .field input {
  flex: 1; min-width: 0; padding: 8px 10px;
  font: 700 16px/1.2 var(--font); color: #fff;
  background: var(--well); border: 2px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--frame-3);
}
.cmd input::placeholder, .field input::placeholder { color: #5f8a68; }

.top { list-style: none; margin: 10px 0 0; padding: 0; }
.top li { display: grid; grid-template-columns: 28px 14px 1fr auto; gap: 8px; align-items: center; padding: 8px 4px; font-size: 15.5px; }
.top.team li { grid-template-columns: 14px 1fr auto; }   /* the team list has no places */
.top li + li { border-top: 2px solid rgba(0, 0, 0, 0.4); }
.top .place { font: 900 20px/1 var(--font); color: #fff; text-align: right; text-shadow: var(--ol1); }
.top li:first-child .place { color: var(--gold); }
.top .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .amt { font-weight: 800; color: var(--cash); font-variant-numeric: tabular-nums; }
.top .me .who, .top li.me .who { color: var(--gold); }
.daily-seal {
  flex: none; width: 52px; height: 52px; display: grid; place-items: center;
  font: 900 20px/1 var(--font); color: #fff; text-shadow: var(--ol1);
  background: var(--gold); border: 2px solid #000; border-radius: 3px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25), inset 0 3px 0 rgba(255, 255, 255, 0.35);
}

.result { display: flex; align-items: center; gap: 12px; padding: 14px; margin: 12px 0; background: rgba(0, 0, 0, 0.3); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--frame-3); }
.result > div { flex: 1; display: flex; flex-direction: column; }
.result b { font: 800 20px/1.1 var(--font); }
.result .swatch { width: 44px; height: 44px; }
.roll-cta { display: flex; justify-content: center; margin: 18px 0 8px; }
.wait { font-size: 16px; }

.meter { height: 18px; margin-top: 12px; overflow: hidden; background: var(--well); border: 2px solid #000; }
.meter span { display: block; height: 100%; background: var(--cash); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25); }
.meter-label { text-align: right; font-weight: 700; font-size: 13px; margin: 4px 0 0 !important; }

.field { display: flex; flex-direction: column; gap: 4px; margin: 14px 0; font-weight: 700; font-size: 13px; color: var(--muted); }
.field input { flex: none; padding: 9px 11px; }
/* online: your account and its password */
.acct { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 4px; }
.acct p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.acct .btn { flex: none; }
.pass-code { margin: 14px 0; padding: 12px 10px; border-radius: 8px; background: var(--well); border: 2px solid var(--frame-3);
  font: 800 clamp(18px, 5.2vw, 26px)/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.04em;
  color: var(--gold); text-align: center; user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }
.pass-btns { display: flex; gap: 8px; }
.pass-btns .btn { flex: 1; }
.seg { border: 0; padding: 0; margin: 14px 0; }
.seg legend { font-weight: 700; font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 4px; }
.seg-row { display: flex; gap: 6px; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggles .seg-btn { flex: 1 1 30%; white-space: nowrap; }
.vol { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; font-weight: 700; font-size: 13px; color: var(--muted); }
.vol input { flex: 1; min-width: 0; height: 24px; accent-color: var(--gold); cursor: pointer; }
.vol input:disabled { opacity: 0.4; cursor: default; }
.now { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 10px 0 4px; padding: 8px 10px; background: var(--well); border: 2px solid #000; border-radius: 3px; }
.now p { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 1.35; }
.now .np .hint { display: block; font-size: 12px; }
.now a { color: var(--gold); }
.now .btn { flex: none; }
.stats, .keys { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0; font-size: 14px; }
.stats dt, .keys dt { color: var(--muted); }
.stats dd, .keys dd { margin: 0; font-weight: 700; }
.stats dd { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- the owner's Admin Panel ---------- */
.adm-stats { margin: 12px 0; }
.adm-btns { margin: 10px 0 0; }
.adm-btns .btn { flex: 1 1 30%; white-space: nowrap; }
.sets { list-style: none; margin: 0; padding: 0; }
.set-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 7px 2px; }
.set-row + .set-row { border-top: 2px solid rgba(0, 0, 0, 0.4); }
.set-name { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 2px; font: 700 15px/1.2 var(--font); color: #fff; }
.set-name small { font-size: 12px; color: var(--gold); }
.set-in { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; font: 700 14px/1 var(--font); color: var(--muted); }
.set-in i { width: 48px; font-style: normal; }   /* the units line up in one column */
.set-in input, .adm-tool input, .adm-tool select {
  width: 104px; padding: 7px 9px; font: 700 16px/1.2 var(--font); color: #fff; text-align: right; font-variant-numeric: tabular-nums;
  background: var(--well); border: 2px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--frame-3);
}
.set-row.wide .set-in { flex: 1 1 100%; }
.set-row.wide .set-in input { flex: 1; width: auto; min-width: 0; text-align: left; }
.set-pick { flex: 0 0 auto; }
.set-pick .seg-btn { flex: none; padding: 7px 12px 8px; font-size: 15px; }
.adm-save { display: flex; gap: 8px; margin: 14px 0 0; }
.adm-save .btn { flex: 1; }
.adm-p { flex-wrap: wrap; }   /* the tools go under the player */
.adm-p.on { background: rgba(244, 184, 28, 0.08); }
.adm-tools { flex-basis: 100%; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 6px 0 2px; }
.adm-tool { align-items: center; }
.tool-name { flex: 0 0 52px; font: 700 14px/1 var(--font); color: var(--muted); }
.adm-tool input, .adm-tool select { flex: 1; width: auto; min-width: 0; text-align: left; }
.adm-tool input.small { flex: 0 0 60px; text-align: right; }
.adm-tool select { color-scheme: dark; cursor: pointer; }
.adm-tools .adm-btns { margin: 0; }

/* ---------- roll reel ---------- */
.stage { margin: 0 2px; padding: 14px 16px 4px; border-bottom: 2px solid #000; }
.reel { position: relative; height: 82px; overflow: hidden; background: #000; border: 2px solid #000; box-shadow: inset 0 0 0 2px var(--frame-3); }
.reel-strip { position: absolute; left: 0; top: 8px; display: flex; will-change: transform; }
.reel-item {
  flex: none; width: 112px; height: 62px; margin-right: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--frame-2); border-bottom: 6px solid var(--c);
}
.reel-item b { font: 800 15px/1 var(--font); color: #fff; text-shadow: var(--ol1); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reel-item span { font-size: 12px; font-weight: 800; color: var(--c); }
.reel-mark { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; background: var(--gold); box-shadow: 0 0 0 2px #000; }
.reel-out { min-height: 44px; margin: 10px 0 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reel-out b { font: 800 18px/1.2 var(--font); }

/* ---------- touch controls ---------- */
.touchpad { display: none; }
body.touch .touchpad { display: block; }
.stick { position: fixed; z-index: 4; width: 104px; height: 104px; margin: -52px 0 0 -52px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.55); background: rgba(0, 0, 0, 0.22); pointer-events: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: #fff; border: 3px solid #000; }
.tbtn {
  position: fixed; z-index: 5; display: grid; place-items: center; border-radius: 50%; touch-action: none;
  font: 800 15px/1 var(--font); color: #fff; text-shadow: var(--ol1);
  border: 3px solid #000; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.3);
}
.tbtn:active { transform: translateY(3px); }
.tbtn.slash { right: 18px; bottom: calc(96px + var(--safe-b)); width: 84px; height: 84px; background: var(--green-btn); font-size: 18px; }
.tbtn.lunge { right: 112px; bottom: calc(86px + var(--safe-b)); width: 62px; height: 62px; background: #1d4552; }
body.touch #world { cursor: default; }
body.panel-open .touchpad { display: none; }

/* ---------- start screen ---------- */
.start { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(0, 28, 8, 0.5); overflow-y: auto; }
body.on-start #hud, body.on-start .touchpad { display: none; }
.start-card {
  width: min(440px, 100%); padding: 24px 24px 18px;
  background: rgba(11, 46, 20, 0.97); border: 3px solid #000; border-radius: 4px; box-shadow: inset 0 0 0 2px var(--frame-3);
  user-select: text;
}
.logo { margin: 0 auto; max-width: 400px; line-height: 0; }
.logo img { display: block; width: 100%; height: auto; }
.start-pitch { text-align: center; margin: 18px 0 6px; font-size: 15.5px; }
.start-card .btn.big { width: 100%; margin-top: 4px; }
.start-card .hint { text-align: center; margin: 8px 0 0; }
.start-card .seg .hint { text-align: left; margin-top: 6px; }

/* ---------- short windows ---------- */
@media (max-height: 720px) {
  .board-box { display: none; }
  :root { --tile-s: 56px; }
  .dock .ico { width: 28px; height: 28px; }
}

/* ---------- compact: phones, tablets and narrow windows (set by main.js) ---------- */
body.compact {
  --gap: 8px;
  --stats-w: 196px;
  --tile-s: 44px;
  --mini-s: 104px;
}
body.compact .statbars { gap: 3px; }
body.compact .bar { height: 28px; gap: 5px; padding: 0 6px 0 3px; }
body.compact .bar .ico { width: 20px; height: 20px; }
body.compact .bar .t { font-size: 16px; text-shadow: var(--ol1); }
body.compact .t.frost { font-size: 14px; }
body.compact .t-sub { display: none; }
body.compact .hpbar { height: 24px; }
body.compact .hpbar .ico { width: 16px; height: 16px; margin-left: 2px; }
body.compact .hpbar .track { height: 10px; }
body.compact .bar .t.hp { font-size: 12px; min-width: 0; }
body.compact .xpbar { padding-bottom: 5px; }
body.compact .xp-track { left: 30px; right: 6px; bottom: 3px; height: 4px; }
body.compact .gem { width: 24px; height: 24px; margin-top: 1px; font-size: 13px; text-shadow: var(--ol1); }
body.compact .gem::before { width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; }
body.compact .quest { width: min(300px, calc(100vw - var(--mini-s) - 3 * var(--gap))); padding: 6px 10px 8px; font-size: 14px; }
body.compact .quest.goal { width: var(--stats-w); }
body.compact .tut-step { font-size: 17px; margin-top: 4px; }
body.compact .goal-head { font-size: 15px; gap: 6px; }
body.compact .goal-head .ico { width: 20px; height: 20px; }
body.compact .goal-line { margin-top: 6px; }
body.compact .need + .need { margin-top: 5px; }
body.compact .need-t { font-size: 13px; }
body.compact .need-bar { height: 8px; }
body.compact .tut-actions { margin-top: 7px; }
body.compact .zone { max-width: calc(100vw - var(--mini-s) - 3 * var(--gap)); font-size: 12.5px; padding: 3px 8px 3px 12px; }
body.compact .board-box { display: none; }
body.compact .dock { top: calc(var(--gap) + var(--mini-s) + 6px); bottom: auto; }
body.compact .dock button { padding: 0; justify-content: center; }
body.compact .dock .lbl, body.compact .dock kbd { display: none; }
body.compact .dock .ico { width: 32px; height: 32px; }
body.compact .badge { top: -6px; right: -6px; min-width: 18px; height: 18px; font-size: 12px; }
body.compact .alarm, body.compact .toasts { left: var(--gap); transform: none; width: auto; min-width: 0; max-width: calc(100vw - var(--dock-w) - 3 * var(--gap)); }
body.compact .toasts { align-items: flex-start; }
body.compact .alarm { font-size: 14px; text-align: left; }
body.compact .toast { font-size: 14px; text-align: left; }
body.compact .prompt, body.compact .buildbar { max-width: calc(100vw - 2 * var(--gap)); }
body.compact .slot { width: 52px; height: 52px; }
body.compact .prompt, body.compact .buildbar { bottom: calc(var(--gap) + var(--safe-b) + 64px); }
body.touch .hotbar .sword { display: none; }
body.touch .prompt, body.touch .buildbar { bottom: calc(var(--safe-b) + 196px); }
body.touch .slot kbd { display: none; }

/* with a menu open, the alerts move into the left column (ui.js places them) */
body.panel-open .alarm, body.panel-open .toasts { left: var(--gap); transform: none; min-width: 0; width: min(360px, calc(100vw - var(--panel-r) - 440px - 3 * var(--gap))); max-width: none; }
body.panel-open .toasts { align-items: flex-start; }
body.panel-open .toast, body.panel-open .alarm { text-align: left; }
body.panel-open .quest, body.panel-open .zone { max-width: min(360px, calc(100vw - var(--panel-r) - 440px - 2 * var(--gap))); }

/* phones: the menu becomes a sheet from the bottom */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 74vh; height: 74dvh; border-bottom: 0; }
  body.panel-open .alarm, body.panel-open .toasts { width: auto; max-width: calc(100vw - var(--dock-w) - 3 * var(--gap)); }
  body.panel-open .quest, body.panel-open .zone { display: none; }
  body.panel-open .statbars .bar:not(#note) { display: none; }
  body.panel-open .dock { top: auto; left: var(--gap); right: var(--gap); bottom: calc(74dvh + 6px); grid-template-columns: repeat(8, 1fr); }
  body.panel-open .dock button { width: auto; height: 40px; }
  body.panel-open .dock .ico { width: 28px; height: 28px; }
  .panel-head h2 { font-size: 24px; }
  .panel-body { padding: 2px 12px calc(16px + var(--safe-b)); }
  .shop-top .sub { display: none; }
  .row { gap: 6px 9px; flex-wrap: wrap; }
  .row-buy { flex-basis: 100%; justify-content: flex-start; padding-left: 41px; }
  .upg .row-buy { padding-left: 0; }
  .adm-list .row-buy { flex-basis: auto; padding-left: 0; }
  .btn { min-height: 38px; padding: 4px 10px 7px; font-size: 16px; }
  .tbtn.slash { bottom: calc(78px + var(--safe-b)); right: 12px; width: 76px; height: 76px; }
  .tbtn.lunge { bottom: calc(72px + var(--safe-b)); right: 98px; width: 56px; height: 56px; }
  body.touch .prompt, body.touch .buildbar { bottom: calc(var(--safe-b) + 166px); }
  .buildbar { gap: 6px; padding: 6px 8px; }
  .bb-main b { font-size: 16px; }
  .buildbar .btn { padding: 4px 9px; }
  .ko { font-size: 20px; }
  .start-card { padding: 18px 16px 14px; }
}

/* phones on their side: the menu column reaches the bottom, so Slash and Lunge sit left of it */
@media (max-height: 500px) {
  body.touch .tbtn.slash { right: calc(var(--dock-w) + 2 * var(--gap) + 4px); bottom: calc(70px + var(--safe-b)); width: 76px; height: 76px; }
  body.touch .tbtn.lunge { right: calc(var(--dock-w) + 2 * var(--gap) + 90px); bottom: calc(64px + var(--safe-b)); width: 56px; height: 56px; }
  body.touch .prompt, body.touch .buildbar { bottom: calc(var(--safe-b) + 150px); }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body.calm *, body.calm *::before, body.calm *::after { animation: none !important; transition: none !important; }
