/* ==========================================================================
   MOMIN QUEST - styles
   Layout idea: a fixed 3D world sits behind everything; story panels are
   "game dialogue boxes" that stick beside the island you are visiting.
   One committed look: a night-arcade cartoon (ink outlines, hard shadows).
   ========================================================================== */
:root {
  --ink: #0b0a1f;
  --night: #14112e;
  --night-2: #1d1942;
  --cream: #fff6dc;
  --mute: #c3bee6;
  --line: rgba(255, 246, 220, .16);
  --coral: #ff6b6b;
  --mint: #2ee6a6;
  --violet: #a78bfa;
  --sky: #4cc3ff;
  --sun: #ffc93c;
  --pink: #ff7ac6;
  --f-display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --f-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --f-pixel: 'Silkscreen', 'Courier New', ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 72px);
  --hud-h: 54px;
  --shadow: 6px 6px 0 var(--ink);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 400 17px/1.6 var(--f-body);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
body.is-booting { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pixel { font-family: var(--f-pixel); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; line-height: 1.3; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; touch-action: pan-y; }
.veil { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(11, 10, 31, .55) 100%); }
.no-webgl { background: linear-gradient(180deg, #1b1a4a, #ff8f6b 120%) fixed; }
.no-webgl #world { display: none; }

/* ---------- start screen ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  padding: 24px var(--gutter);
  background: radial-gradient(90% 80% at 50% 45%, rgba(11, 10, 31, .38), rgba(11, 10, 31, .82));
  overflow: auto; transition: opacity .5s ease, visibility .5s;
}
.boot.leave { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { width: min(760px, 100%); text-align: center; display: grid; gap: 14px; justify-items: center; }
.boot-eyebrow { color: var(--sun); margin: 0; }
.boot-title {
  margin: 0; font: 400 clamp(54px, 13vw, 132px)/.92 var(--f-display); letter-spacing: .01em;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .22em;
}
.boot-title span:first-child { color: var(--cream); text-shadow: 0 4px 0 var(--coral), 0 8px 0 var(--ink), 0 14px 22px rgba(0, 0, 0, .45); }
.boot-title span:last-child { color: var(--sun); text-shadow: 0 4px 0 #e0861a, 0 8px 0 var(--ink), 0 14px 22px rgba(0, 0, 0, .45); }
.boot-sub { margin: 0; font-size: clamp(16px, 2.4vw, 20px); font-weight: 700; color: var(--cream); max-width: 34ch; text-wrap: balance; text-shadow: 0 2px 0 var(--ink); }
.boot-cv { margin: 0; padding: 8px 14px; background: var(--sun); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; font-weight: 800; box-shadow: 4px 4px 0 var(--ink); }
.boot-pick { color: var(--mute); margin: 10px 0 0; }
.boot-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.boot-links { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; color: var(--mute); }
.boot-hint { color: var(--mute); margin: 8px 0 0; opacity: .85; }
@media (prefers-reduced-motion: no-preference) {
  .boot-title { animation: bob 4s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(-6px); } }
}

/* ---------- buttons ---------- */
.btn {
  --b: var(--cream);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 18px; border: 3px solid var(--ink); border-radius: 14px;
  background: var(--b); color: var(--ink); font: 800 15px/1.1 var(--f-body); text-decoration: none; text-align: left;
  box-shadow: 0 5px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease, filter .12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.btn.coral { --b: var(--coral); }
.btn.mint { --b: var(--mint); }
.btn.ghost { --b: var(--night-2); color: var(--cream); border-color: var(--ink); outline: 2px solid var(--line); outline-offset: -5px; }
.btn.small { padding: 8px 13px; font-size: 14px; border-radius: 12px; }
.btn.big { padding: 16px 18px; font-size: 19px; align-items: center; }
.btn.big small { display: block; font-size: 13px; font-weight: 700; opacity: .75; margin-top: 3px; }
.btn.big b { font: 400 24px/1 var(--f-display); letter-spacing: .01em; }
.btn-ico { display: inline-grid; place-items: center; width: 1.2em; height: 1.2em; flex: none; }
.btn.big .btn-ico { width: 34px; height: 34px; }
.btn-ico svg, .icon-btn svg { width: 100%; height: 100%; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--cream); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--sun); font-weight: 700; }
.link:hover { color: var(--sun); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 7px; border-radius: 10px;
  background: var(--night); border: 3px solid var(--ink); color: var(--cream); box-shadow: 0 3px 0 var(--ink);
}
.icon-btn:hover { background: var(--night-2); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* ---------- HUD ---------- */
.hud {
  position: fixed; inset: 0 0 auto 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(rgba(11, 10, 31, .82), rgba(11, 10, 31, 0));
  transition: opacity .4s, transform .4s;
}
body.is-booting .hud, body.is-booting .dock { opacity: 0; transform: translateY(-14px); pointer-events: none; }
body.is-booting .dock { transform: translate(-50%, 14px); }
.hud-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.hud-face { position: relative; width: 30px; height: 30px; flex: none; border-radius: 50%; background: #d9a37a; border: 3px solid var(--ink); overflow: hidden; }
.hud-face::before { content: ""; position: absolute; inset: -2px -2px 55% -2px; background: #1b1521; border-radius: 50% 50% 0 0; }
.hud-face::after { content: ""; position: absolute; left: 3px; right: 3px; top: 11px; height: 7px; border-radius: 4px;
  background: linear-gradient(90deg, transparent 0 1px, #0b0a1f 1px 3px, transparent 3px 40%, #0b0a1f 40% 60%, transparent 60% 80%, #0b0a1f 80% calc(100% - 1px), transparent 0); opacity: .75; }
.hud-name { color: var(--cream); white-space: nowrap; }
.hud-mid { display: grid; gap: 4px; justify-items: center; min-width: 0; }
.hud-chapter { color: var(--sun); white-space: nowrap; }
.xp { width: clamp(110px, 20vw, 240px); height: 10px; border: 2px solid var(--ink); border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--sun), var(--coral)); border-radius: 99px; }
.hud-right { display: flex; align-items: center; gap: 8px; }
.gemcount { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; background: var(--night); border: 3px solid var(--ink); border-radius: 10px; color: var(--sun); box-shadow: 0 3px 0 var(--ink); }
.gemcount b { color: var(--cream); }

/* map */
.map { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; background: rgba(8, 7, 24, .55); backdrop-filter: blur(4px); }
.map-card { width: min(340px, 100%); height: 100%; overflow: auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 18px 24px; background: var(--night); border-left: 3px solid var(--ink); display: flex; flex-direction: column; gap: 16px; animation: slideIn .28s ease; }
.map-head { display: flex; justify-content: space-between; align-items: center; color: var(--sun); }
.map-list { list-style: none; margin: 0; padding: 0 0 0 14px; display: grid; gap: 2px; position: relative; }
.map-list::before { content: ""; position: absolute; left: 20px; top: 14px; bottom: 14px; width: 4px; background: var(--line); border-radius: 4px; }
.map-list li { position: relative; }
.map-list button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px 8px 0; background: none; border: 0; text-align: left; font-weight: 800; color: var(--cream); }
.map-list .dot { width: 14px; height: 14px; flex: none; margin-left: 0; border-radius: 50%; background: var(--night-2); border: 3px solid var(--mute); position: relative; z-index: 1; }
.map-list li.seen .dot { background: var(--mint); border-color: var(--ink); }
.map-list li.now .dot { background: var(--sun); border-color: var(--ink); box-shadow: 0 0 0 4px rgba(255, 201, 60, .3); }
.map-list button:hover span { color: var(--sun); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* ---------- story stages ---------- */
main { position: relative; z-index: 2; pointer-events: none; transition: opacity .5s ease; }
body.is-booting main { opacity: 0; }
.stage { position: relative; display: flex; min-height: 150vh; padding: 14vh var(--gutter) 22vh; }
.stage.short { min-height: 115vh; padding-bottom: 14vh; }
/* the boss room is a form: let it scroll with the page instead of sticking */
#hire { min-height: 0; padding-bottom: 12vh; }
#hire .stage-col { position: relative; top: auto; max-height: none; overflow: visible; }
.stage[data-side="left"] { justify-content: flex-start; }
.stage[data-side="right"] { justify-content: flex-end; }
.stage-col { position: sticky; top: 14vh; align-self: flex-start; width: min(520px, 100%); max-height: calc(100vh - 14vh - 96px); overflow: auto; display: grid; gap: 22px; padding: 18px 4px 8px; margin: -18px -4px -8px; pointer-events: none; scrollbar-width: thin; }
.stage-col.wide { width: min(640px, 100%); }
.stage-col > * { pointer-events: auto; }

.dialog {
  --accent: var(--sun);
  position: relative; padding: 30px 24px 22px; display: grid; gap: 12px; align-content: start;
  background: rgba(20, 17, 46, .9); backdrop-filter: blur(10px) saturate(1.1);
  border: 3px solid var(--ink); border-radius: 20px; box-shadow: var(--shadow), inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent);
}
.js .dialog:not(.seen) { opacity: 0; transform: translateY(18px) scale(.97); }
.dialog.seen { animation: pop .55s cubic-bezier(.2, 1.3, .4, 1) both; }
.dialog.night { background: rgba(10, 8, 30, .92); }
.dialog.slim { padding-top: 26px; }
.dialog p { margin: 0; max-width: 62ch; }
.dialog .small:not(.btn), .small:not(.btn) { font-size: 14px; color: var(--mute); }
.dialog .lead, .lead { font-size: 18px; color: var(--cream); }
.tab {
  position: absolute; top: -15px; left: 16px; max-width: calc(100% - 32px); padding: 5px 11px;
  background: var(--accent); color: var(--ink); border: 3px solid var(--ink); border-radius: 9px; box-shadow: 3px 3px 0 var(--ink);
}
.tab.gold { background: var(--sun); } .tab.violet { background: var(--violet); color: var(--ink); }
.dlg-title { margin: 0; font: 400 clamp(28px, 3.4vw, 38px)/1.05 var(--f-display); letter-spacing: .005em; text-shadow: 0 3px 0 var(--ink); text-wrap: balance; }
.quote { font: 400 26px/1.1 var(--f-display); color: var(--violet); }
.hint { color: var(--mute); margin: 2px 0 0; }
.chips-label { color: var(--accent); margin-top: 4px; }
.chips, .loot, .bullets { list-style: none; margin: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips li { padding: 4px 11px; font-size: 14px; font-weight: 700; border: 2px solid var(--line); border-radius: 99px; background: rgba(255, 246, 220, .06); }
.bullets { display: grid; gap: 6px; }
.bullets li { position: relative; padding-left: 22px; }
.bullets li::before { content: ""; position: absolute; left: 3px; top: .55em; width: 9px; height: 9px; background: var(--accent); border: 2px solid var(--ink); transform: rotate(45deg); }
.loot { display: flex; flex-wrap: wrap; gap: 8px; }
.gem-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 9px; background: var(--night-2);
  border: 3px solid var(--ink); border-radius: 12px; font-weight: 800; font-size: 14px; box-shadow: 0 4px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.gem-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.gem-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.gem-btn i { width: 14px; height: 18px; background: var(--gc, var(--sun)); clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%); flex: none; }
.gem-btn.done { opacity: .72; } .gem-btn.done::after { content: "✓"; color: var(--mint); }
.row-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fact { padding: 10px 10px 9px; background: rgba(255, 246, 220, .06); border: 2px solid var(--line); border-radius: 14px; }
.fact b { display: block; font: 400 clamp(26px, 3vw, 34px)/1 var(--f-display); color: var(--accent); text-shadow: 0 2px 0 var(--ink); }
.fact span { display: block; margin-top: 4px; font-size: 13px; line-height: 1.3; color: var(--mute); }

.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: 96px 1fr 34px; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; }
.bar .track { height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar .fill { display: block; height: 100%; width: 0; background: var(--c); border-radius: 99px; transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.dialog.seen .bar .fill { width: var(--w); }

@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .dialog { animation: none; } .bar .fill { transition: none; } html { scroll-behavior: auto; } }

/* ---------- vault + codex ---------- */
.stage.flow { display: block; min-height: 0; padding: 16vh var(--gutter) 10vh; pointer-events: none; }
.flow-inner {
  pointer-events: auto; width: min(1240px, 100%); margin: 0 auto; padding: 38px clamp(16px, 3vw, 36px) 32px; position: relative; display: grid; gap: 20px;
  background: rgba(14, 11, 38, .88); backdrop-filter: blur(12px);
  border: 3px solid var(--ink); border-radius: 24px; box-shadow: 8px 8px 0 var(--ink);
}
.flow-head { display: grid; gap: 8px; }
.flow-head .tab { position: static; justify-self: start; }
.big-title { margin: 0; font: 400 clamp(32px, 5vw, 56px)/1 var(--f-display); text-shadow: 0 4px 0 var(--ink); text-wrap: balance; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border: 3px solid var(--ink); border-radius: 99px;
  background: var(--night-2); font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 var(--ink);
}
.fchip i { width: 11px; height: 11px; border-radius: 50%; background: var(--c, var(--cream)); border: 2px solid var(--ink); }
.fchip small { opacity: .7; font-weight: 700; }
.fchip[aria-pressed="true"] { background: var(--c, var(--cream)); color: var(--ink); }
.fchip[aria-pressed="true"] i { background: var(--ink); border-color: var(--ink); }
.search input { width: min(340px, 78vw); padding: 9px 14px; border: 3px solid var(--ink); border-radius: 12px; background: rgba(255, 255, 255, .08); outline-offset: 2px; }
.search input::placeholder { color: var(--mute); opacity: .8; }
.status-key { margin: -6px 0 0; }
.status-key b { color: var(--cream); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr)); gap: 20px; }
.empty { text-align: center; color: var(--mute); padding: 30px 0; }

.card {
  position: relative; display: grid; grid-template-rows: auto 1fr; background: var(--night); border: 3px solid var(--ink); border-radius: 18px; overflow: hidden;
  box-shadow: 5px 5px 0 var(--ink); transition: transform .15s, box-shadow .15s; min-width: 0;
}
.card:hover, .card:focus-within { transform: translate(-2px, -3px); box-shadow: 8px 9px 0 var(--ink); }
.card-hit { position: absolute; inset: 0; width: 100%; background: none; border: 0; border-radius: 15px; opacity: 0; }
.card-hit:focus-visible { opacity: 1; outline: 3px solid var(--sun); outline-offset: -3px; background: none; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--night-2); border-bottom: 3px solid var(--ink); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .thumb img { transform: scale(1.05); }
.thumb .art { width: 100%; height: 100%; display: block; }
.badge { position: absolute; left: 10px; top: 10px; padding: 3px 8px; font-size: 11px; font-weight: 800; letter-spacing: .03em; background: var(--cream); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; }
.badge.concept { background: var(--sun); } .badge.phase1 { background: var(--sky); } .badge.live { background: var(--mint); } .badge.research { background: var(--violet); }
.badge.graz { left: auto; right: 10px; background: var(--coral); }
.card-body { padding: 14px 16px 16px; display: grid; gap: 6px; align-content: start; }
.card-body h3 { margin: 0; font: 400 21px/1.1 var(--f-display); letter-spacing: .005em; }
.card-body .kind { color: var(--mute); font-size: 13px; font-weight: 700; }
.card-body p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--cream); opacity: .9; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dots { display: flex; gap: 5px; align-items: center; margin-top: 2px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); }
.dots span { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--mute); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tags li, .tag { list-style: none; padding: 2px 8px; font-size: 12px; font-weight: 700; border: 2px solid var(--line); border-radius: 99px; color: var(--mute); }
.card.got { box-shadow: 5px 5px 0 var(--ink), 0 0 0 3px color-mix(in srgb, var(--mint) 60%, transparent); }

.ccard { position: relative; padding: 16px 16px 14px; background: var(--night); border: 3px solid var(--ink); border-top: 7px solid var(--c); border-radius: 16px; box-shadow: 5px 5px 0 var(--ink); display: grid; gap: 8px; align-content: start; }
.ccard h3 { margin: 0; font: 400 20px/1.1 var(--f-display); }
.ccard p { margin: 0; font-size: 14.5px; line-height: 1.5; opacity: .95; }
.ccard .lab { color: var(--c); }
.ccard .uses { display: flex; flex-wrap: wrap; gap: 6px; }
.ccard .uses button { padding: 2px 9px; font-size: 12px; font-weight: 800; border: 2px solid var(--line); border-radius: 99px; background: rgba(255, 246, 220, .05); }
.ccard .uses button:hover { border-color: var(--c); color: var(--c); }

/* ---------- boss room ---------- */
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.door { display: grid; gap: 4px; padding: 14px 14px 12px; text-align: left; background: var(--night-2); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); transition: transform .12s, box-shadow .12s, background .12s; }
.door b { font: 400 26px/1 var(--f-display); }
.door span { font-size: 14px; color: var(--mute); line-height: 1.4; }
.door.coral { --dc: var(--coral); } .door.mint { --dc: var(--mint); }
.door:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.door[aria-checked="true"] { background: var(--dc); color: var(--ink); box-shadow: 0 5px 0 var(--ink), 0 0 0 4px color-mix(in srgb, var(--dc) 45%, transparent); }
.door[aria-checked="true"] span { color: var(--ink); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .full { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: 13px; font-weight: 800; color: var(--mute); }
.field input, .field select, .field textarea { width: 100%; min-width: 0; padding: 10px 12px; background: rgba(255, 255, 255, .07); border: 3px solid var(--ink); border-radius: 12px; }
.field select option { background: var(--night); color: var(--cream); }
.field textarea { resize: vertical; min-height: 96px; }
.addr { color: var(--sun); user-select: all; }
.contact { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.qr-row { display: flex; gap: 16px; align-items: center; }
.qr-box { width: 124px; height: 124px; flex: none; padding: 8px; background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); }
.qr-box svg { width: 100%; height: 100%; display: block; }
.foot { text-align: center; padding: 4px 0 0; pointer-events: auto; }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 35;
  display: flex; gap: 10px; padding: 9px 11px; background: rgba(20, 17, 46, .92); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink), 0 12px 30px rgba(0, 0, 0, .4);
  backdrop-filter: blur(8px); transition: opacity .3s, transform .3s;
}
.dock.hide { opacity: 0; transform: translate(-50%, 24px); pointer-events: none; }
body[data-mode="job"] .dock [data-door="job"], body[data-mode="project"] .dock [data-door="project"] { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; }
.modal-back { position: absolute; inset: 0; background: rgba(8, 7, 24, .66); backdrop-filter: blur(5px); animation: fade .25s ease; }
.sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: var(--night); border-left: 3px solid var(--ink); box-shadow: -10px 0 0 rgba(11, 10, 31, .5); overflow: auto; animation: slideIn .3s cubic-bezier(.2, .9, .3, 1); outline: none; }
.sheet .close { position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; z-index: 3; }
.sheet-body { display: grid; gap: 14px; padding: 18px 20px calc(28px + env(safe-area-inset-bottom, 0px)); }
.m-hero { margin: -18px -20px 0; aspect-ratio: 16 / 9; background: var(--night-2); border-bottom: 3px solid var(--ink); overflow: hidden; }
.m-hero img, .m-hero .art { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.m-badges .badge { position: static; }
.sheet h3 { margin: 0; font: 400 clamp(28px, 4vw, 36px)/1.05 var(--f-display); text-shadow: 0 3px 0 var(--ink); }
.sheet .m-kind { color: var(--mute); font-weight: 700; margin-top: -8px; }
.sheet h4 { margin: 4px 0 0; color: var(--sun); }
.m-builds { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.m-builds figure { margin: 0; display: grid; gap: 3px; }
.m-builds img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border: 2px solid var(--ink); border-radius: 8px; background: var(--night-2); }
.m-builds figcaption { font-size: 11px; line-height: 1.2; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-fit { padding: 12px 14px; background: color-mix(in srgb, var(--sun) 12%, transparent); border: 2px solid color-mix(in srgb, var(--sun) 45%, transparent); border-radius: 14px; font-size: 15px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: calc(64px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 120; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--sun); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink); font-weight: 800; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: .35s; }
.toast i { width: 20px; height: 26px; flex: none; background: var(--gc, var(--coral)); border: 0; clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%); outline: none; filter: drop-shadow(0 2px 0 var(--ink)); }
.toast small { display: block; font-weight: 700; opacity: .8; }

.noscript { position: relative; z-index: 5; padding: 40px 20px; max-width: 640px; margin: 0 auto; }

/* ---------- small screens: panels become bottom sheets under the 3D view ---------- */
@media (max-width: 820px) {
  :root { --hud-h: 50px; }
  .hud-name { display: none; }
  .xp { width: clamp(80px, 26vw, 160px); }
  .boot-choices { grid-template-columns: 1fr; }
  .stage { min-height: 160svh; padding: 42svh 14px 24svh; }
  .stage[data-side] { justify-content: center; }
  .stage-col, .stage-col.wide { top: 40svh; width: 100%; max-height: calc(60svh - 84px); }
  .dialog { padding: 26px 16px 16px; gap: 10px; }
  .dlg-title { font-size: 27px; }
  .dialog p, .lead { font-size: 15.5px; }
  .dialog .lead { font-size: 16.5px; }
  .facts { gap: 7px; } .fact { padding: 8px 7px; } .fact b { font-size: 24px; } .fact span { font-size: 12px; }
  .bar { grid-template-columns: 74px 1fr 30px; font-size: 13px; }
  .stage.flow { padding: 20svh 10px 14svh; }
  .flow-inner { padding: 30px 14px 24px; border-radius: 20px; }
  .doors, .form { grid-template-columns: 1fr; }
  .dock { width: calc(100% - 24px); justify-content: center; gap: 7px; padding: 8px; }
  .dock .btn { flex: 1; justify-content: center; padding-inline: 8px; }
  .sheet { width: 100%; border-left: 0; }
  .qr-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 380px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .gemcount { display: none; }
}
@media (min-width: 821px) and (max-height: 720px) {
  .stage-col { top: 10vh; max-height: calc(100vh - 10vh - 80px); }
}
@media print { .hud, .dock, #world, .veil, .boot { display: none !important; } }
