/* Leo's Voxel Game interface — chunky bevelled voxel kit (art-direction §10).
   No browser-default fonts/buttons/scrollbars anywhere. */
@font-face {
  font-family: 'Rubik';
  src: url('../../assets/fonts/rubik-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('../../assets/fonts/rubik-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('../../assets/fonts/rubik-800.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'PixelDisplay';
  src: url('../../assets/fonts/press-start-2p-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --ink: #10131c;
  --ink2: #1b2130;
  --bone: #efe6d2;
  --bone2: #c9bca1;
  --wood: #4c2f16;
  --wood-lt: #63401e;
  --wood-dk: #241609;
  --stone: #4a4f5a;
  --stone-lt: #838a99;
  --stone-dk: #33373f;
  --gold: #f5c445;
  --gold-dk: #b2740e;
  --berry: #c93254;
  --leaf: #4fb04c;
  --water: #1a73b8;
  --sky: #2e86ff;
  --slot: 64px;
  --btn: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0e1a2e;
  font-family: 'Rubik', system-ui, sans-serif;
  color: var(--bone);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  font-size: 15px;
}

#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#touchsurface {
  position: absolute; inset: 0;
  touch-action: none;
  background: transparent;
  cursor: crosshair;
}

/* ---------- bevelled widgets ---------- */
.panel {
  background:
    linear-gradient(180deg, var(--wood-lt), var(--wood) 18%, var(--wood));
  border: 3px solid var(--ink);
  box-shadow:
    inset 0 3px 0 rgba(255, 234, 190, 0.28),
    inset 0 -4px 0 rgba(0, 0, 0, 0.35),
    0 6px 0 rgba(0, 0, 0, 0.35);
  border-radius: 6px;
}
.btn {
  font-family: 'Rubik', sans-serif;
  font-weight: 700;
  color: var(--bone);
  background: linear-gradient(180deg, #8a8f9c, #5d626e);
  border: 3px solid var(--ink);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.35),
    inset 0 -4px 0 rgba(0, 0, 0, 0.32),
    0 4px 0 rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  min-height: 56px;
  min-width: 56px;
  padding: 10px 18px;
  font-size: 17px;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 60ms ease, filter 60ms ease;
}
.btn:active, .btn.pressed {
  transform: translateY(3px);
  box-shadow:
    inset 0 3px 0 rgba(0, 0, 0, 0.3),
    inset 0 -2px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 rgba(0, 0, 0, 0.4);
  filter: brightness(1.08);
}
.btn.primary { background: linear-gradient(180deg, #f5c445, #c98a12); color: #2a1a05; text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.btn.danger  { background: linear-gradient(180deg, #d4546a, #9a1e3f); }
.btn.ghost   { background: linear-gradient(180deg, #3a4257, #262c3d); }
.btn:disabled { filter: saturate(0.3) brightness(0.75); cursor: default; }
.btn img { width: 26px; height: 26px; image-rendering: pixelated; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
/* overlays ignore touches; only the interactive clusters take them */
#hud > * { pointer-events: none; }
#hud .hotbar, #hud .hud-corner-tl, #hud .hud-corner-tr, #hud .tbtn { pointer-events: auto; }

.hud-corner-tl {
  position: absolute;
  top: calc(8px + var(--safe-t));
  left: calc(8px + var(--safe-l));
  display: flex;
  gap: 8px;
}
.hud-corner-tr {
  position: absolute;
  top: calc(8px + var(--safe-t));
  right: calc(8px + var(--safe-r));
  display: flex;
  gap: 8px;
  flex-direction: column;
  align-items: flex-end;
}
.iconbtn {
  width: 56px; height: 56px;
  padding: 0;
  background: linear-gradient(180deg, rgba(58,66,87,.92), rgba(38,44,61,.92));
  border: 3px solid var(--ink);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.35), 0 3px 0 rgba(0,0,0,.35);
  border-radius: 8px;
}
.iconbtn img { width: 32px; height: 32px; image-rendering: pixelated; }

.vitals {
  position: absolute;
  top: calc(72px + var(--safe-t));
  left: calc(8px + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(16, 19, 28, 0.55);
  border: 2px solid rgba(239, 230, 210, 0.25);
  border-radius: 6px;
  max-width: 46vw;
}
.row-icons { display: flex; gap: 2px; flex-wrap: wrap; }
.pip { position: relative; width: 22px; height: 22px; image-rendering: pixelated; }
.pip img { position: absolute; inset: 0; width: 22px; height: 22px; image-rendering: pixelated; }
.pip .empty { filter: grayscale(1) brightness(0.5); opacity: 0.85; }
.pip .fill { position: absolute; left: 0; top: 0; height: 100%; overflow: hidden; }
.bar { width: 180px; height: 12px; background: rgba(0,0,0,.55); border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; transition: width 140ms linear; }
.bar.stamina > i { background: linear-gradient(180deg, #aee64f, #5da114); }
.bar.mana > i { background: linear-gradient(180deg, #b488e0, #6c33a0); }
.bar.airbar > i { background: linear-gradient(180deg, #6fc3ea, #1a73b8); }

.hotbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + var(--safe-b));
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(16, 19, 28, 0.6);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.14), 0 4px 0 rgba(0,0,0,.35);
}
.slot {
  position: relative;
  width: var(--slot); height: var(--slot);
  background: linear-gradient(180deg, rgba(90,96,110,.85), rgba(56,61,74,.85));
  border: 3px solid var(--ink);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.slot img.icon { width: 44px; height: 44px; image-rendering: pixelated; pointer-events: none; }
.slot .count {
  position: absolute; right: 2px; bottom: 0;
  font-size: 13px; font-weight: 800;
  color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000;
  pointer-events: none;
}
.slot.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px #7a4a08, inset 0 0 12px rgba(245,196,69,.35);
  transform: translateY(-4px);
  background: linear-gradient(180deg, rgba(120,110,80,.95), rgba(80,70,50,.95));
}

.crosshair {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px;
  pointer-events: none;
  opacity: .9;
  image-rendering: pixelated;
}
.aim-label {
  position: absolute;
  left: 50%;
  bottom: calc(112px + var(--safe-b));
  transform: translateX(-50%);
  text-align: center;
  min-width: 200px;
  pointer-events: none;
  text-shadow: 0 2px 0 #000;
}
.aim-label .name { font-weight: 700; font-size: 16px; }
.aim-label .prog {
  margin: 6px auto 0; width: 220px; height: 10px;
  background: rgba(0,0,0,.6); border: 2px solid var(--ink); border-radius: 4px; overflow: hidden;
}
.aim-label .prog i { display:block; height:100%; width:0%; background: linear-gradient(180deg,#ffe58a,#e0a016); }

.break-ring {
  position: absolute; width: 84px; height: 84px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
}
.break-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.break-ring circle { fill: none; stroke-width: 7; }
.break-ring .bg { stroke: rgba(0,0,0,.45); }
.break-ring .fg { stroke: var(--gold); stroke-linecap: square; }

.clockchip {
  position: absolute;
  top: calc(8px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16,19,28,.6);
  border: 2px solid rgba(239,230,210,.3);
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  pointer-events: none;
}

.toasts {
  position: absolute;
  left: calc(10px + var(--safe-l));
  bottom: calc(18px + var(--safe-b));
  display: flex; flex-direction: column-reverse; gap: 6px;
  pointer-events: none;
  max-width: 40vw;
}
.toast {
  background: rgba(16,19,28,.82);
  border: 2px solid rgba(245,196,69,.6);
  border-radius: 6px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 14px;
  display: flex; gap: 8px; align-items: center;
  animation: toast-in 180ms ease;
}
.toast img { width: 22px; height: 22px; image-rendering: pixelated; }
@keyframes toast-in { from { transform: translateX(-16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- touch controls ---------- */
.touch-layer { position: absolute; inset: 0; pointer-events: none; }
/* children of #hud default to auto (see '#hud > *') — these two cover the
   whole screen and must let taps through to the world and the HUD beneath */
#hud .touch-layer, #hud .touch-buttons { pointer-events: none; }
.stick {
  position: absolute;
  width: 168px; height: 168px;
  border-radius: 50%;
  border: 4px solid rgba(239,230,210,.5);
  background: radial-gradient(circle, rgba(16,19,28,.18) 30%, rgba(16,19,28,.42) 100%);
  transform: translate(-50%, -50%);
  display: none;
  pointer-events: none;
}
.stick .knob {
  position: absolute;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.75), rgba(140,150,170,.75));
  border: 3px solid var(--ink);
  transform: translate(-50%, -50%);
  left: 50%; top: 50%;
}
.stick.running { border-color: var(--gold); }
.stick.running .knob { background: radial-gradient(circle at 35% 30%, #ffe58a, #e0a016); }

.touch-buttons { position: absolute; inset: 0; pointer-events: none; }
.tbtn {
  pointer-events: auto;
  position: absolute;
  width: var(--btn); height: var(--btn);
  border-radius: 12px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  padding: 0;
  background: linear-gradient(180deg, rgba(138,143,156,.9), rgba(93,98,110,.9));
  border: 3px solid var(--ink);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.3), inset 0 -4px 0 rgba(0,0,0,.3), 0 4px 0 rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
.tbtn img { width: 58%; height: 58%; image-rendering: pixelated; pointer-events: none; }
.tbtn.pressed { transform: translate(-50%, -46%); filter: brightness(1.15); box-shadow: inset 0 3px 0 rgba(0,0,0,.3), 0 1px 0 rgba(0,0,0,.4); }
.tbtn.big { width: 96px; height: 96px; border-radius: 50%; }
.tbtn.big img { width: 52%; height: 52%; }

.fpschip {
  position: absolute;
  right: calc(10px + var(--safe-r));
  top: calc(72px + var(--safe-t));
  background: rgba(16,19,28,.75);
  border: 2px solid rgba(239,230,210,.3);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  display: none;
  pointer-events: none;
  white-space: pre;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------- portrait layout ---------- */
@media (orientation: portrait) {
  :root { --slot: 68px; }
  .hotbar { bottom: calc(250px + var(--safe-b)); }
  .aim-label { bottom: calc(350px + var(--safe-b)); }
  .vitals { top: calc(68px + var(--safe-t)); max-width: 40vw; }
  .vitals .bar { width: 130px; }
  .toasts { bottom: calc(350px + var(--safe-b)); max-width: 60vw; }
  .clockchip { font-size: 13px; padding: 5px 10px; }
}

/* ---------- screens (title, pause, settings, controls) ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(8, 12, 22, 0.62);
  z-index: 20;
  overflow: auto;
  overscroll-behavior: contain;
}
.screen.open { display: flex; }
.screen .box {
  width: min(920px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 26px 26px;
  position: relative;
}
.screen h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(0,0,0,.6);
  letter-spacing: 0.5px;
}
.closebtn {
  position: absolute;
  top: 12px; right: 12px;
  width: 64px; height: 64px;
  font-size: 26px;
  z-index: 5;
}
.menu { display: flex; flex-direction: column; gap: 12px; width: min(420px, 86vw); }
.menu .btn { width: 100%; font-size: 19px; }

/* title */
#screen-title { background: transparent; pointer-events: none; align-items: flex-start; }
#screen-title .box {
  pointer-events: auto;
  margin-top: clamp(6px, 3vh, 40px);
  background: transparent; border: none; box-shadow: none;
  display: flex; flex-direction: column; align-items: center;
  max-height: calc(100vh - 8px); overflow-y: auto; padding: 0 4px;
}
#title-logo { image-rendering: pixelated; height: min(34vh, 300px); width: auto; max-width: 92vw; filter: drop-shadow(0 8px 0 rgba(0,0,0,.45)); }
#title-sub { margin-top: 6px; font-weight: 700; letter-spacing: 3px; color: var(--bone); text-shadow: 0 2px 0 #000; }
#title-dev { margin-top: 8px; font-size: 13px; color: var(--gold); text-shadow: 0 1px 0 #000; }
#screen-title .menu { margin-top: clamp(8px, 2.6vh, 26px); }

/* settings rows */
.setrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 4px;
  border-bottom: 2px solid rgba(0,0,0,.25);
  min-height: 56px;
}
.setrow label { font-weight: 700; font-size: 15px; }
.setrow .val { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 800; min-width: 54px; text-align: right; }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: min(300px, 44vw); height: 34px;
  background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 12px; background: #262c3d; border: 2px solid var(--ink); border-radius: 6px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -9px;
  background: linear-gradient(180deg, #f5c445, #c98a12);
  border: 3px solid var(--ink); border-radius: 6px;
}
input[type=range]::-moz-range-track { height: 12px; background: #262c3d; border: 2px solid var(--ink); border-radius: 6px; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; background: #f5c445; border: 3px solid #10131c; border-radius: 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg .btn { min-height: 48px; padding: 8px 14px; font-size: 14px; }
.seg .btn.on { background: linear-gradient(180deg, #f5c445, #c98a12); color: #2a1a05; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.keytable { width: 100%; border-collapse: collapse; font-size: 14px; }
.keytable td { padding: 7px 8px; border-bottom: 1px solid rgba(0,0,0,.3); }
.keytable td:first-child { font-weight: 700; color: var(--gold); width: 46%; }
kbd {
  font-family: 'Rubik', monospace; font-weight: 700;
  background: #262c3d; border: 2px solid var(--ink);
  border-radius: 4px; padding: 2px 7px; font-size: 13px;
  box-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.touchdiagram {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, #2e86ff 0%, #79bbff 58%, #43a047 58%, #2e7d32 100%);
  border: 3px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}
.touchdiagram .zone {
  position: absolute;
  border: 3px dashed rgba(255,255,255,.85);
  background: rgba(16,19,28,.35);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; text-align: center;
  padding: 4px;
  text-shadow: 0 1px 0 #000;
}
.hint { color: var(--bone2); font-size: 14px; line-height: 1.5; }

/* loading */
#screen-loading { background: #0b1226; z-index: 40; flex-direction: column; }
#screen-loading .box { border: none; background: transparent; box-shadow: none; text-align: center; }
#screen-loading img { width: min(520px, 80vw); image-rendering: pixelated; }
.loadbar { width: min(520px, 80vw); height: 18px; background: #262c3d; border: 3px solid var(--ink); border-radius: 6px; margin: 22px auto 10px; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 0%; background: linear-gradient(180deg, #ffe58a, #e0a016); transition: width 200ms ease; }
#loading-tip { color: var(--bone2); font-size: 14px; }

/* fullscreen refusal chip */
.chip {
  position: absolute;
  left: 50%; top: 18%;
  transform: translateX(-50%);
  background: rgba(16,19,28,.9);
  border: 2px solid var(--berry);
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 700;
  z-index: 60;
  display: none;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #1b2130; }
::-webkit-scrollbar-thumb { background: #5d626e; border: 2px solid #10131c; border-radius: 6px; }

/* ---------- phone (<500px) ---------- */
@media (max-width: 500px) {
  :root { --slot: 38px; --btn: 56px; }
  .slot img.icon { width: 30px; height: 30px; }
  .slot .count { font-size: 11px; }
  .hotbar { gap: 3px; padding: 4px; }
  .tbtn.big { width: 76px; height: 76px; }
  .vitals { padding: 6px 8px; }
  .vitals .bar { width: 120px; }
  .pip, .pip img { width: 18px; height: 18px; }
}

/* ---------------- stage (c): inventory, crafting, stations, death ---------------- */
.inv-body { display: flex; gap: 18px; flex-wrap: wrap; }
.inv-left { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.inv-right { flex: 1 1 380px; min-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.paperdoll { width: 150px; height: 230px; display: flex; align-items: flex-start; justify-content: center; padding-top: 14px; }
.doll { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.d-head { width: 54px; height: 46px; border: 3px solid var(--ink); border-radius: 4px; }
.doll .d-body { position: relative; width: 84px; height: 74px; }
.d-chest { position: absolute; inset: 0 8px 0 8px; border: 3px solid var(--ink); border-radius: 4px; }
.d-arm { position: absolute; top: 2px; width: 18px; height: 66px; background: #e9b98a; border: 3px solid var(--ink); border-radius: 4px; }
.d-arm.left { left: -14px; } .d-arm.right { right: -14px; }
.d-legs { position: relative; width: 84px; height: 76px; }
.d-leg { position: absolute; top: 0; width: 32px; height: 54px; border: 3px solid var(--ink); border-radius: 4px; }
.d-leg:first-child { left: 6px; } .d-leg:nth-child(2) { right: 6px; }
.d-feet { position: absolute; bottom: 0; width: 34px; height: 18px; border: 3px solid var(--ink); border-radius: 3px; }
.d-feet:nth-child(3) { left: 5px; } .d-feet:nth-child(4) { right: 5px; }
.equip-grid { display: grid; grid-template-columns: repeat(4, 56px); gap: 6px; }
.slot.equip { position: relative; }
.eqslot-label { position: absolute; bottom: -14px; left: 0; right: 0; font-size: 9px; text-align: center; color: var(--bone2); text-transform: uppercase; }
.equip-grid { margin-bottom: 18px; }
.bag-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; }
.bag-grid .slot { width: auto; aspect-ratio: 1; height: auto; min-width: 0; }
.bag-grid .slot.hb { outline: 2px solid rgba(245,196,69,.35); outline-offset: -2px; }
.slot .dura { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 4px; border-radius: 2px; display: none; border: 1px solid var(--ink); }
.inv-actions { display: flex; gap: 10px; }
.craft-bar { display: flex; gap: 10px; align-items: center; }
.searchbox {
  flex: 1; min-height: 48px; padding: 8px 12px; font-family: 'Rubik'; font-size: 15px; font-weight: 600;
  color: var(--bone); background: #262c3d; border: 3px solid var(--ink); border-radius: 6px;
}
.searchbox:focus { outline: 3px solid var(--gold); }
.craft-count { font-weight: 800; color: var(--gold); white-space: nowrap; }
.craft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.craft-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; background: #262c3d; border: 3px solid var(--ink); border-radius: 6px;
  opacity: .55; cursor: pointer; text-align: center;
}
.craft-tile.ready { opacity: 1; border-color: #b2740e; box-shadow: inset 0 0 0 2px rgba(245,196,69,.25); }
.craft-tile img.icon { width: 40px; height: 40px; image-rendering: pixelated; }
.craft-tile .nm { font-size: 12px; font-weight: 700; line-height: 1.15; }
.craft-tile .ings { display: flex; flex-direction: column; gap: 1px; font-size: 10px; }
.craft-tile .ings i { font-style: normal; }
.craft-tile .ings i.ok { color: #86d96f; } .craft-tile .ings i.no { color: #e5484d; }
.craft-tile .stn { position: absolute; top: 2px; right: 4px; font-size: 9px; color: var(--bone2); text-transform: uppercase; }
.tooltip { position: absolute; width: 236px; padding: 12px 14px; z-index: 30; font-size: 13px; line-height: 1.45; pointer-events: none; }
.tooltip b { color: var(--gold); font-size: 15px; }
.tooltip .kind { color: var(--bone2); font-size: 11px; text-transform: uppercase; }
.tooltip b.better { color: #86d96f; } .tooltip b.worse { color: #e5484d; }
.station-status { padding: 10px 14px; font-weight: 700; }
.station-fuel { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; }
.tab-on { background: linear-gradient(180deg, #f5c445, #c98a12); color: #2a1a05; }
#screen-death .box { text-align: center; }
#screen-death .hint { font-size: 16px; margin: 8px 0; }
.tabs.small .btn { min-height: 42px; padding: 6px 10px; font-size: 13px; }
@media (max-width: 560px) { .bag-grid { grid-template-columns: repeat(6, 1fr); } }


/* ---------------- stage (d): creature bars, damage numbers, boss bar ---------------- */
#bars { position: fixed; inset: 0; pointer-events: none; z-index: 14; overflow: hidden; }
.entbar {
  position: absolute; left: 0; top: 0; width: 92px; margin-left: -46px;
  text-align: center; will-change: transform;
}
.entbar .ent-name {
  display: block; font-size: 11px; font-weight: 800; color: var(--bone);
  text-shadow: 0 2px 0 var(--ink), 0 0 6px var(--ink);
  margin-bottom: 3px; white-space: nowrap;
}
.entbar .ent-lvl { position: absolute; right: -6px; top: -4px; font-size: 10px; color: var(--gold); text-shadow: 0 1px 0 var(--ink); }
.entbar i.ent-fill {
  display: block; height: 7px; background: linear-gradient(180deg, #86d96f, #2f9e44);
  border: 2px solid var(--ink); border-radius: 3px; box-sizing: border-box;
}
.entbar i.ent-fill.boss-low { background: linear-gradient(180deg, #ff8a8a, #d63c3c); }
.dmgnum {
  position: absolute; left: 0; top: 0; font-size: 20px; font-weight: 900;
  color: #ffffff; text-shadow: 0 2px 0 var(--ink), 0 0 6px var(--ink);
  will-change: transform; margin-left: -8px;
}
.dmgnum.crit { color: var(--gold); font-size: 27px; }
.heartpop {
  position: absolute; left: 0; top: 0; font-size: 22px; color: #ff6b8a;
  text-shadow: 0 2px 0 var(--ink); will-change: transform;
}
.bossbar {
  position: absolute; left: 50%; bottom: 132px; transform: translateX(-50%);
  width: min(560px, 74vw); text-align: center;
}
.bossbar .boss-name {
  display: block; color: var(--gold); font-weight: 900; font-size: 16px;
  text-shadow: 0 2px 0 var(--ink); margin-bottom: 5px; letter-spacing: 0.4px;
}
.bossbar .boss-track {
  position: relative; height: 18px; background: #26242c;
  border: 3px solid var(--ink); border-radius: 5px; overflow: hidden;
}
.bossbar .boss-fill {
  position: absolute; inset: 0; width: 100%;
  background: linear-gradient(180deg, #e5484d, #a3121a);
  transition: width 180ms linear;
}
.bossbar .boss-seg {
  position: absolute; inset: 0; --segs: 2;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / var(--segs) - 3px), var(--ink) calc(100% / var(--segs) - 3px), var(--ink) calc(100% / var(--segs)));
  pointer-events: none;
}
.bossbar .boss-lvl { display: block; color: var(--bone2); font-size: 12px; margin-top: 3px; font-weight: 700; }
