/* HOODVERSE - Robinhood-style UI chrome over the canvas world.
   Black ground, near-black panels with 1px borders, hood-green as the only
   action accent, red for loss/danger, gold for prize/legendary. See docs/BRAND.md. */

/* Manrope is a variable font: one file covers 400-800. Nunito stays as the
   fallback face so old canvas text never falls back to a system serif. */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/manrope-var.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/manrope-var-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/nunito-400.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/nunito-600.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/nunito-700.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/nunito-800.woff2') format('woff2'); }

:root {
  --font: 'Manrope', 'Nunito', system-ui, -apple-system, sans-serif;

  --hood-green:   #00C805;   /* signature green: CTAs, links, positive, active */
  --hood-green-2: #00A804;   /* hover / pressed */
  --hood-mint:    #CCFFD0;   /* light highlight text on green surfaces */
  --bg:           #000000;   /* page ground */
  --bg-2:         #0B0F0C;   /* app ground */
  --panel:        #141A16;   /* panels, cards */
  --panel-2:      #1A221C;   /* nested cards */
  --line:         #243027;   /* borders */
  --text:         #FFFFFF;
  --text-2:       #C9D1CB;
  --muted:        #7C8A80;
  --gold:         #F5C542;   /* legendary / prize */
  --red:          #FF5000;   /* Robinhood loss red: danger, PvP, errors */
  --blue:         #5AC8FA;   /* rare */
  --purple:       #B388FF;   /* epic */

  --green-soft:   rgba(0, 200, 5, 0.12);
  --green-line:   rgba(0, 200, 5, 0.45);
  --gold-soft:    rgba(245, 197, 66, 0.14);
  --red-soft:     rgba(255, 80, 0, 0.14);
  --glass:        rgba(11, 15, 12, 0.92);
  --shadow:       0 12px 40px rgba(0, 0, 0, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea { user-select: text; -webkit-user-select: text; }

button, input, textarea, select { font-family: inherit; }

#game { display: block; position: fixed; inset: 0; }

/* -- login ------------------------------------------------------------------ */

#login[hidden], #hud[hidden] { display: none; }

#login {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(0, 200, 5, 0.16), transparent 65%),
    var(--bg);
}

.login-card {
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 34px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow);
}

.login-mark { display: flex; justify-content: center; margin-bottom: 4px; }
.login-mark svg { width: 34px; height: 34px; display: block; }

.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
  margin: 6px 0 4px;
}

.login-tag { color: var(--text-2); font-size: 14px; line-height: 1.5; margin-bottom: 18px; }
.login-rule { margin-top: 14px; font-size: 13px; color: var(--text-2); }
.login-rule b { color: var(--text); font-weight: 700; }
.login-wallets { margin-top: 8px; line-height: 1.45; }

/* buy $HOODVERSE block on the login gate */
.login-buy[hidden] { display: none; }
.login-buy {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.login-buy__label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.login-buy__ca {
  display: flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 9px; margin-bottom: 10px;
}
.login-buy__ca code { font-size: 11px; color: var(--text-2); word-break: break-all; line-height: 1.3; font-variant-numeric: tabular-nums; }
.login-buy__copy {
  flex: none; cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-family: inherit; font-weight: 700; font-size: 11px;
  padding: 5px 10px; border-radius: 8px;
  transition: border-color 0.1s, color 0.1s;
}
.login-buy__copy:hover { border-color: var(--hood-green); color: var(--hood-green); }
.login-buy__btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.login-buy__btn {
  text-decoration: none; font-weight: 700; font-size: 13px;
  padding: 9px 16px; border-radius: 10px;
  transition: background 0.1s, border-color 0.1s, transform 0.06s;
}
.login-buy__btn--pump { background: var(--hood-green); color: #000; }
.login-buy__btn--pump:hover { background: var(--hood-green-2); }
.login-buy__btn--pump:active { transform: translateY(1px); }
.login-buy__btn--chart { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
.login-buy__btn--chart:hover { border-color: var(--text-2); color: var(--text); }

/* -- buttons & inputs ------------------------------------------------------- */

.btn {
  border: 1px solid transparent; cursor: pointer;
  background: var(--hood-green);
  color: #000;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 12px;
  transition: background 0.1s, transform 0.06s, box-shadow 0.1s;
}
.btn:hover { background: var(--hood-green-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--panel-2); color: var(--muted); border-color: var(--line); cursor: default; transform: none; }
.btn--big { width: 100%; padding: 13px 18px; font-size: 16px; margin-top: 10px; border-radius: 14px; }
/* links styled as buttons (Guide -> wiki, buy links): the panel link colour must not win over the button text */
a.btn, a.btn:visited, a.btn:hover, .panel a.btn, .modal a.btn { color: #000; text-decoration: none; }
a.btn--ghost, a.btn--ghost:visited { color: var(--text-2); }
.btn--small { padding: 5px 12px; font-size: 12px; border-radius: 9px; }
.btn--gold { background: var(--gold); color: #000; }
.btn--gold:hover { background: #ffd35a; }
.btn--gold:active { transform: translateY(1px); }
/* secondary / cancel: outlined, muted - green stays reserved for the primary action */
.btn--ghost { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn--ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--text-2); }
/* danger: destructive or PvP-flavoured actions only */
.btn--danger { background: var(--red-soft); color: var(--red); border-color: rgba(255, 80, 0, 0.5); }
.btn--danger:hover { background: rgba(255, 80, 0, 0.26); }

.input {
  display: block; width: 100%;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-2);
  outline: none;
  transition: border-color 0.1s;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--hood-green); }
.name-input { text-align: center; font-weight: 700; letter-spacing: 0.02em; }

/* -- HUD -------------------------------------------------------------------- */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-variant-numeric: tabular-nums; }
#hud > * { pointer-events: auto; }

/* unit frame - MMO-style player card, top-left */
.unitframe {
  position: absolute; top: 12px; left: 12px;
  display: flex; gap: 10px; align-items: center;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 8px 14px 8px 8px;
  min-width: 240px;
}
#uf-portrait {
  background: radial-gradient(circle at 50% 35%, #1f2b22, var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 9px;
}
.unitframe__body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.unitframe__row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.unitframe__row b { color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.unitframe__cmb {
  color: var(--hood-green); font-size: 12px; font-weight: 800;
  background: var(--green-soft); border: 1px solid var(--green-line);
  padding: 1px 8px; border-radius: 99px;
}
.uf-hpbar {
  position: relative; height: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.uf-hpbar__fill {
  height: 100%; width: 100%;
  background: var(--hood-green);
  transition: width 0.25s ease;
}
.uf-hpbar__text {
  position: absolute; inset: 0;
  text-align: center; font-size: 10px; font-weight: 800; line-height: 12px;
  color: var(--text); text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.unitframe__row--sub { font-size: 11px; color: var(--text-2); justify-content: flex-start; gap: 12px; }
.uf-tendies #hud-tendies { color: var(--text); font-weight: 800; }
.uf-online { margin-left: auto; color: var(--muted); }
.uf-buff {
  color: var(--hood-green); font-weight: 800; font-size: 10px;
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  padding: 1px 7px; border-radius: 99px;
}
.uf-buff[hidden] { display: none; }

/* combat style picker */
.stylebox {
  position: absolute; top: 108px; left: 12px;
  display: flex; gap: 5px;
}
.style-chip {
  position: relative;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--glass);
  color: var(--text-2); font-size: 11px; font-weight: 700;
  padding: 6px 11px; cursor: pointer;
  transition: border-color 0.1s, color 0.1s, box-shadow 0.1s;
}
.style-chip:hover { border-color: var(--hood-green); color: var(--text); }
.style-chip--on {
  border-color: var(--hood-green); color: var(--hood-green);
  background: var(--green-soft);
  box-shadow: 0 0 0 1px var(--green-soft);
}
.style-chip::after {
  content: attr(data-tip);
  position: absolute; top: 110%; left: 0;
  background: var(--panel); color: var(--text);
  font-size: 10px; font-weight: 600;
  padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--line);
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.12s;
  z-index: 20;
}
.style-chip:hover::after { opacity: 1; }
.stylebox--pulse .style-chip {
  border-color: var(--hood-green);
  animation: abpulse 1.1s ease-in-out infinite;
}

.story-quest {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--hood-green);
  border-radius: 11px;
  padding: 9px 13px;
  display: flex; flex-direction: column; gap: 3px;
}
.story-quest__head { display: flex; justify-content: space-between; align-items: center; }

/* trade window */
.tradewin { width: min(96vw, 560px); z-index: 45; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-col { display: flex; flex-direction: column; gap: 7px; }
.trade-col h3 { font-size: 14px; }
.trade-status { text-align: center; font-size: 12px; color: var(--muted); }
.gear-cluster { display: flex; align-items: center; gap: 7px; }
@media (max-width: 600px) { .trade-cols { grid-template-columns: 1fr; } }

/* action bar - framed grid, bottom-right */
.actionbar {
  position: absolute; right: 14px; bottom: 14px;
  display: grid; grid-template-columns: repeat(8, 46px);
  gap: 5px;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 7px;
}
.ab-btn {
  position: relative;
  width: 46px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.06s, box-shadow 0.1s, border-color 0.1s, background 0.1s;
}
/* the open tab stays lit, OSRS-style */
.ab-btn--active {
  background: var(--green-soft) !important;
  border-color: var(--hood-green) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 200, 5, 0.25) !important;
}
.ab-btn:hover {
  border-color: var(--hood-green);
  background: var(--panel-2);
  transform: translateY(-2px);
}
.ab-btn__emoji { font-size: 21px; }
.ab-btn__icon { width: 23px; height: 23px; display: flex; color: var(--text); transition: color 0.1s; }
.ab-btn__icon svg { width: 100%; height: 100%; }
.ab-btn:hover .ab-btn__icon { color: var(--hood-green); }
.ab-btn--active .ab-btn__icon { color: var(--hood-green); }

/* free-look recenter control - only visible while the camera is unlocked */
.recenter-btn {
  position: fixed; top: 12px; left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 30; display: none;
  padding: 7px 14px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--text); cursor: pointer;
  background: var(--glass);
  border: 1px solid var(--hood-green); border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0; transition: opacity 0.15s, transform 0.15s;
}
.recenter-btn.show { display: block; opacity: 1; transform: translateX(-50%) translateY(0); }
.recenter-btn:hover { background: var(--green-soft); color: var(--hood-green); }
.ab-btn kbd {
  position: absolute; right: 4px; bottom: 3px;
  font-size: 8px; color: var(--muted); font-family: inherit;
}
.ab-btn::after {
  content: attr(data-tip);
  position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%) translateY(3px);
  background: var(--panel); color: var(--text);
  font-size: 11px; font-weight: 700;
  padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--line);
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.12s, transform 0.12s;
}
.ab-btn:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -- chat ------------------------------------------------------------------- */

.chatdock {
  position: absolute; left: 12px; bottom: 14px;
  width: 330px;
  display: flex; flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 14px;
  overflow: hidden;
  transition: opacity 0.25s;
}
.chatdock:not(:hover):not(:focus-within) { opacity: 0.9; }
.chatdock__head {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 12px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--line);
}
.chatdock__title {
  flex: 1;
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  color: var(--hood-green); text-transform: uppercase;
}
.chatdock__btn {
  border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13px;
  padding: 2px 6px; border-radius: 6px;
}
.chatdock__btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.chatdock--collapsed .chatlog,
.chatdock--collapsed .chatinput { display: none; }
/* folded = JUST the toggle bubble, so it never overlaps the action bar on phones */
.chatdock--collapsed .chatdock__head > :not(#chat-toggle) { display: none; }
.chatdock--collapsed { width: auto; }
.chatdock--collapsed .chatdock__head { padding: 2px; }
.chatdock--collapsed #chat-toggle { font-size: 18px; padding: 6px 9px; }

.chatlog {
  height: 138px; overflow-y: auto;
  font-size: 12px; color: var(--text-2);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.chatline { line-height: 1.4; word-wrap: break-word; }
.chatline b { color: var(--text); font-weight: 700; }
.chatline b.chatline--self { color: var(--hood-green); }
.chatline--sys { color: var(--muted); font-style: italic; }
.chatinput {
  border: 0;
  border-top: 1px solid var(--line);
  padding: 9px 12px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
}
.chatinput::placeholder { color: var(--muted); }
.chatinput:focus { background: rgba(0, 0, 0, 0.55); box-shadow: inset 0 1px 0 var(--hood-green); }

/* custom scrollbars */
.chatlog::-webkit-scrollbar, .panel__body::-webkit-scrollbar { width: 8px; }
.chatlog::-webkit-scrollbar-thumb, .panel__body::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 6px;
}
.chatlog::-webkit-scrollbar-track, .panel__body::-webkit-scrollbar-track { background: transparent; }

/* -- panels ----------------------------------------------------------------- */

/* OSRS-style interface pane: docked above the tab strip, world stays visible.
   Open a tab -> the pane swaps in place; same tab -> closes. */
.panel {
  position: fixed; z-index: 30;
  right: 14px; bottom: 132px;
  width: min(94vw, 420px);
  max-height: calc(100vh - 220px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: panelIn 0.13s ease-out;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* small screens: the pane takes the stage like before */
@media (max-width: 700px), (max-height: 560px) {
  .panel {
    right: 50%; bottom: auto; top: 50%;
    transform: translate(50%, -50%);
    width: min(94vw, 460px);
    max-height: 84vh;
    animation: none;
  }
}

.panel__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: var(--bg-2);
  font-weight: 800; font-size: 16px; color: var(--text);
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--line);
}
.panel__close {
  border: 0; background: none; cursor: pointer;
  font-size: 16px; color: var(--muted);
  padding: 4px 8px; border-radius: 8px;
}
.panel__close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.panel__body {
  padding: 16px 18px;
  overflow-y: auto;
  color: var(--text-2);
  font-size: 14px;
  display: flex; flex-direction: column; gap: 10px;
  font-variant-numeric: tabular-nums;
}
.panel__body h3 { color: var(--text); font-size: 15px; font-weight: 700; margin-top: 6px; }
.panel__body b { color: var(--text); }
.panel__body a { color: var(--hood-green); }
.panel__body table { border-collapse: collapse; width: 100%; }
.panel__body th { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.panel__body td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.panel__body tr:last-child td { border-bottom: 0; }

.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.error { color: var(--red); font-size: 13px; min-height: 1em; }

.tag {
  display: inline-block;
  color: #000; font-size: 11px; font-weight: 800;
  padding: 2px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.tag--green { background: var(--hood-green); }

/* tab strip inside panels: outlined chips, the live one goes green */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs .btn { background: transparent; color: var(--text-2); border-color: var(--line); }
.tabs .btn:hover { color: var(--text); border-color: var(--text-2); }
.tabs .btn--gold, .tabs .btn[disabled] { background: var(--green-soft); color: var(--hood-green); border-color: var(--hood-green); }

/* -- eggs ------------------------------------------------------------------- */

.egg-row { display: flex; gap: 12px; }
.egg-card {
  flex: 1;
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.egg-card--gold { background: var(--gold-soft); border-color: rgba(245, 197, 66, 0.55); }
.egg-art { font-size: 42px; }
.odds { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 11px; font-weight: 700; }
.odds__item { color: var(--text-2); }

/* -- pets / bag / listings -------------------------------------------------- */

.pet-grid { display: flex; flex-direction: column; gap: 10px; }
.pet-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
}
.pet-card--active { border-color: var(--hood-green); box-shadow: 0 0 0 1px var(--green-line); }
.pet-card__info { flex: 1; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.pet-card__actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.hoodling-canvas { flex-shrink: 0; }

.bar { width: 100%; height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--hood-green); border-radius: 99px; }

.bag-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 8px 13px;
  font-size: 13px;
}
.bag-row > span:nth-child(2), .bag-row > span:first-child + span { flex: 1; }
.bag-row__icon { font-size: 18px; }
.bag-row--limited { background: var(--gold-soft); border-color: rgba(245, 197, 66, 0.55); }
.stepper { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
/* collection-log completion bar */
.collbar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 2px 0 6px; }
.collbar__fill { height: 100%; background: var(--hood-green); transition: width .4s ease; }

.listing {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 13px;
}
.listing__info { flex: 1; }
.listing__icon { font-size: 26px; }

.merchant-status { display: flex; flex-direction: column; gap: 4px; }
.race-info { display: flex; flex-direction: column; gap: 4px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
  font-size: 13px;
  color: var(--muted);
}
.stat b { font-size: 17px; color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
code { font-size: 11px; word-break: break-all; color: var(--text-2); }

/* -- quest tracker / dialogue / skills / dex -------------------------------- */

.quest-tracker {
  position: absolute; top: 152px; right: 14px;
  max-width: 230px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-left: 3px solid var(--hood-green);
  border-radius: 10px;
  padding: 9px 13px;
  color: var(--text-2);
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.quest-tracker:hover { background: var(--panel); }
.qt-title { font-size: 12px; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.qt-hint { font-size: 11px; color: var(--text-2); line-height: 1.4; }
.qt-hint--done { color: var(--hood-green); }
.qt-prog { font-size: 11px; font-weight: 700; color: var(--hood-green); margin-top: 2px; }

/* The Trenches run HUD - top-centre so it clears the minimap + quest tracker.
   Danger zone, so it carries the red. */
.maw-hud {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 35; min-width: 184px; text-align: center;
  background: var(--glass);
  border: 1px solid var(--line); border-top: 3px solid var(--red);
  border-radius: 10px; padding: 8px 14px; color: var(--text-2);
  backdrop-filter: blur(4px); pointer-events: auto;
}
.maw-hud__title { font-size: 12px; font-weight: 800; color: var(--red); }
.maw-hud__title span { font-weight: 600; color: var(--muted); }
.maw-hud__wave { font-size: 15px; margin-top: 2px; color: var(--text); font-weight: 800; }
.maw-hud__mod { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.maw-hud__alive { font-size: 12px; color: var(--gold); margin-top: 2px; }
.maw-hud__flee {
  margin-top: 6px; font-size: 11px; padding: 3px 10px; cursor: pointer;
  background: var(--red-soft); color: var(--red); border: 1px solid rgba(255, 80, 0, 0.5); border-radius: 6px;
  font-weight: 700;
}
.maw-hud__flee:hover { background: rgba(255, 80, 0, 0.26); }
.maw-hud__sup { font-size: 12px; color: var(--hood-green); margin-top: 2px; }
@media (max-width: 760px) { .maw-hud { top: 60px; min-width: 150px; padding: 6px 10px; } }

/* persistent skill-XP progress widget - last skill trained + bar to next level */
.xp-hud {
  position: absolute; top: 156px; left: 12px; z-index: 34; /* below the stance box (top 108) */
  min-width: 140px; padding: 6px 9px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text-2); pointer-events: none;
}
.xp-hud__top { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.xp-hud__icon { font-size: 14px; }
.xp-hud__lvl { margin-left: auto; color: var(--text); font-weight: 800; }
.xp-hud__bar { height: 6px; background: var(--line); border-radius: 4px; margin: 4px 0 2px; overflow: hidden; }
.xp-hud__fill { height: 100%; background: var(--hood-green); transition: width .25s ease; }
.xp-hud__sub { font-size: 10px; color: var(--muted); }
@media (max-width: 760px) { .xp-hud { top: 128px; min-width: 116px; padding: 4px 7px; } }

.dialogue {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 40;
  animation: slidein 0.2s;
}
.dialogue__card {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 18px;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.dialogue__text { flex: 1; font-size: 13px; color: var(--text-2); }
.dialogue__text b { color: var(--hood-green); display: block; margin-bottom: 2px; }
.dialogue__text p { line-height: 1.45; }

.skill-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.skill-row__head { display: flex; justify-content: space-between; color: var(--text); font-weight: 700; }

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 6px;
}
.dex-cell {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.dex-cell--unknown { color: var(--muted); font-weight: 800; font-size: 18px; }

/* Collection Log chips */
.coll-grid { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 8px; }
.coll-chip {
  font-size: 11px; padding: 3px 8px; border-radius: 8px;
  background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--line); text-transform: capitalize; white-space: nowrap;
}
.coll-chip--on { background: var(--green-soft); color: var(--hood-green); border-color: var(--hood-green); }

.bag-row--dim { opacity: 0.55; }

/* -- reveal + toasts -------------------------------------------------------- */

.reveal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  animation: fadein 0.25s;
}
.reveal__card {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 38px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  color: var(--text-2);
  box-shadow: var(--shadow);
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.reveal__card h2 { letter-spacing: 0.08em; color: var(--text); font-weight: 800; }

#toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 70;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none;
}

/* objective pulse on action-bar buttons */
.ab-btn--pulse {
  border-color: var(--hood-green) !important;
  animation: abpulse 1.1s ease-in-out infinite;
}
@keyframes abpulse {
  0%, 100% { box-shadow: 0 0 4px rgba(0, 200, 5, 0.35); }
  50% { box-shadow: 0 0 16px rgba(0, 200, 5, 0.85), inset 0 0 8px rgba(0, 200, 5, 0.3); }
}

/* welcome modal */
.welcome {
  position: fixed; inset: 0; z-index: 85;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  animation: fadein 0.3s;
}
.welcome__card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px 28px;
  max-width: 560px; width: 92vw;
  display: flex; flex-direction: column; gap: 14px;
  color: var(--text-2);
  box-shadow: var(--shadow);
}
.welcome__card h2 { color: var(--text); text-align: center; font-family: var(--font); font-weight: 800; letter-spacing: 0.02em; }
.welcome__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.welcome__item {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center;
}
.welcome__emoji { font-size: 26px; }
.welcome__item b { color: var(--text); font-size: 13px; }
.welcome__item p { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* guide */
.guide-sec { display: flex; flex-direction: column; gap: 5px; }
.guide-p { font-size: 13px; line-height: 1.55; color: var(--text-2); }
.guide-p b { color: var(--text); }

/* responsive: the island fits every screen */
@media (max-width: 1100px) {
  .chatdock { width: 270px; }
  .chatlog { height: 110px; }
  .actionbar { grid-template-columns: repeat(8, 40px); }
  .ab-btn { width: 42px; height: 40px; }
  .ab-btn__emoji { font-size: 17px; }
  .ab-btn__icon { width: 21px; height: 21px; }
  .unitframe { min-width: 200px; }
  .quest-tracker { top: 130px; max-width: 190px; }
}
@media (max-width: 760px) {
  .unitframe { min-width: 0; padding: 6px 10px 6px 6px; gap: 7px; }
  #uf-portrait { width: 44px; height: 44px; }
  .unitframe__row b { font-size: 12px; }
  .unitframe__row--sub { font-size: 10px; gap: 7px; }
  .stylebox { top: 86px; }
  .style-chip { font-size: 10px; padding: 5px 8px; }
  .chatdock { width: min(62vw, 250px); }
  .chatlog { height: 84px; font-size: 11px; }
  .actionbar { grid-template-columns: repeat(8, 40px); gap: 4px; padding: 6px; right: 8px; bottom: 8px; }
  .ab-btn { width: 40px; height: 38px; border-radius: 8px; }
  .ab-btn__emoji { font-size: 16px; }
  .ab-btn__icon { width: 20px; height: 20px; }
  .ab-btn kbd { display: none; }
  .quest-tracker { top: 108px; max-width: 150px; padding: 7px 10px; right: 8px; }
  .qt-hint { font-size: 10px; }
  .panel { width: 96vw; max-height: 88vh; }
  .toast { font-size: 12px; max-width: 78vw; }
  .dialogue { bottom: 120px; width: 94vw; }
  .dialogue__card { padding: 10px 12px; gap: 8px; }
  .login-card { padding: 24px 20px 20px; }
}

/* right-click context menu */
.ctxmenu {
  position: fixed; z-index: 80;
  min-width: 170px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: ctxpop 0.08s ease-out;
}
.ctxmenu__head {
  padding: 5px 12px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--hood-green);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.ctxmenu__item {
  display: block; width: 100%;
  text-align: left;
  border: 0; background: none; cursor: pointer;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-2);
  font-family: inherit;
}
.ctxmenu__item b { color: var(--text); font-weight: 700; }
.ctxmenu__item:hover { background: var(--green-soft); color: var(--text); }
@keyframes ctxpop { from { transform: scale(0.92); opacity: 0; } }

/* boot screen */
#boot {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 60%, rgba(0, 200, 5, 0.10), transparent 65%),
    var(--bg);
  transition: opacity 0.5s;
}
#boot.boot--out { opacity: 0; pointer-events: none; }
.boot__brand { display: flex; align-items: center; gap: 14px; }
.boot__mark { width: 44px; height: 44px; display: block; }
#boot h1 {
  font-size: 34px; font-weight: 800; letter-spacing: 0.12em; color: var(--text);
  font-family: var(--font);
}
.boot__bar {
  width: 280px; height: 6px;
  background: var(--line);
  border: 0; border-radius: 99px;
  overflow: hidden;
}
.boot__fill {
  height: 100%; width: 0%;
  background: var(--hood-green);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.boot__tip { font-size: 13px; color: var(--muted); max-width: 420px; text-align: center; line-height: 1.5; }
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  max-width: 300px;
  box-shadow: var(--shadow);
  animation: slidein 0.2s;
}
.toast--error { background: #1d0f08; border-color: rgba(255, 80, 0, 0.6); color: #ffb391; }
.toast--gold { background: #1c1707; border-color: rgba(245, 197, 66, 0.6); color: var(--gold); }
.toast--out { opacity: 0; transition: opacity 0.5s; }

@keyframes fadein { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
