/* Fonts are bundled (no external network calls, Playables rule; task 9.1). Latin subset from @fontsource, SIL Open Font License. */
@font-face { font-family: 'Press Start 2P'; src: url('../fonts/press-start-2p.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'VT323'; src: url('../fonts/vt323.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
/* Layout: header strip, the game canvas with the buy menu sliding over its lower half,
   then backpack and hint. Single deliberate theme: a mossy forest night around a bright glade. */
:root {
  --bg: #121d17;
  --bg-grid: #17261e;
  --panel: #1f3226;
  --panel-hi: #2b4435;
  --line: #08100b;
  --fg: #f1ead2;
  --dim: #9db8a4;
  --coin: #ffd35c;
  --ink: #2a1a05;
  --good: #7be08f;
  --bad: #ff8a80;
  --font-display: 'Press Start 2P', ui-monospace, 'Courier New', monospace;
  --font-body: 'VT323', ui-monospace, 'Courier New', monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(var(--bg-grid) 2px, transparent 2px), linear-gradient(90deg, var(--bg-grid) 2px, transparent 2px);
  background-size: 32px 32px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.15;
  padding-block: 10px 28px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--coin); outline-offset: 2px; }
.wrap { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.box {
  background: var(--panel); border: 4px solid var(--line);
  box-shadow: inset 4px 4px 0 rgba(255,255,255,.06), inset -4px -4px 0 rgba(0,0,0,.35);
}
canvas.px { image-rendering: pixelated; image-rendering: crisp-edges; display: inline-block; vertical-align: middle; }

.top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; }

.where { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#area { font-family: var(--font-display); font-size: 10px; line-height: 1.5; color: var(--good); }
#away { color: var(--dim); font-size: 18px; min-height: 1em; }
#wallet { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.cur { display: flex; align-items: center; gap: 6px; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--coin); }

.stage { position: relative; border: 4px solid var(--line); box-shadow: 0 0 0 3px var(--panel-hi); background: #4f9441; }
#game { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; cursor: pointer; }

.toast {
  position: absolute; left: 8px; right: 8px; top: 8px; z-index: 5; pointer-events: none;
  background: var(--panel); border: 4px solid var(--line); padding: 8px 10px; text-align: center; font-size: 21px;
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.08);
}

/* area intros sit at the bottom so they never cover the patches the first hint points at */
.toast.low { top: auto; bottom: 6px; font-size: 17px; line-height: 1.05; padding: 4px 8px; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; max-height: 50%; overflow-y: auto;
  background: var(--panel); border-top: 4px solid var(--line);
  padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px;
}
.sheet.upper { top: 0; bottom: auto; border-top: 0; border-bottom: 4px solid var(--line); }
.shead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shead h2 { margin: 0; font-family: var(--font-display); font-size: 10px; line-height: 1.5; color: var(--coin); }
.x { font-family: var(--font-display); font-size: 8px; padding: 7px 8px; background: var(--panel-hi); border: 3px solid var(--line); color: var(--dim); }
.offer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; padding: 6px 8px; background: var(--bg); border: 3px solid var(--line); }
.oinfo { flex: 1 1 150px; min-width: 0; }
.otop { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.oname { font-family: var(--font-display); font-size: 9px; line-height: 1.5; }
.olv { font-size: 18px; color: var(--coin); }
.odesc { margin: 2px 0 0; font-size: 19px; color: var(--dim); }
.obuy {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--coin); color: var(--ink); border: 3px solid var(--line);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.4), inset -3px -3px 0 rgba(0,0,0,.25);
}
.obuy:active:not(:disabled) { transform: translateY(2px); }
.obuy:disabled { background: var(--panel-hi); color: var(--dim); box-shadow: none; cursor: default; }
.olabel { font-family: var(--font-display); font-size: 8px; }
.costs { display: flex; gap: 6px; }
.cost { display: inline-flex; align-items: center; gap: 3px; font-size: 22px; font-variant-numeric: tabular-nums; }
.obuy:disabled .cost.short { color: var(--bad); }

.packrow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.packrow .lbl { font-family: var(--font-display); font-size: 8px; color: var(--dim); flex: none; }
#bag { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 0; }
.bi { display: inline-flex; align-items: center; gap: 4px; font-size: 24px; font-variant-numeric: tabular-nums; }
.bcount { margin-left: auto; font-size: 24px; color: var(--dim); font-variant-numeric: tabular-nums; }
#hint { margin: 0; padding: 0 4px; color: var(--dim); font-size: 21px; min-height: 2.3em; }
footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--dim); font-size: 19px; }
.reset { font-family: var(--font-display); font-size: 8px; padding: 8px; background: transparent; border: 3px solid var(--line); color: var(--dim); }
.reset.armed { background: var(--bad); color: var(--ink); }


.fbtns { display: flex; gap: 8px; flex: none; }
.statpanel {
  position: absolute; inset: 0; z-index: 6; overflow-y: auto; background: var(--panel);
  padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.sumrow { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 20px; color: var(--dim); }
.sumrow b { color: var(--coin); font-weight: normal; }
.acard { padding: 6px 8px; background: var(--bg); border: 3px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.acard.locked { opacity: .55; }
.ahead { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.aname { font-family: var(--font-display); font-size: 9px; line-height: 1.5; }
.astat { font-size: 18px; color: var(--good); }
.agrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; font-size: 19px; color: var(--dim); }
.agrid b { color: var(--fg); font-weight: normal; }
.agold { color: var(--coin) !important; }
.ashare { height: 6px; background: var(--panel-hi); }
.ashare i { display: block; height: 100%; background: var(--coin); }

.tabs { display: flex; gap: 6px; }
.tab { flex: 1; font-family: var(--font-display); font-size: 9px; padding: 9px 6px; background: var(--bg); border: 3px solid var(--line); color: var(--dim); }
.tab.on { background: var(--panel-hi); color: var(--coin); }
.tabbody { display: flex; flex-direction: column; gap: 8px; }
.trow { display: flex; justify-content: space-between; gap: 8px; font-size: 19px; color: var(--dim); }
.trow b { color: var(--fg); font-weight: normal; }
.tnote { margin: 0; font-size: 18px; color: var(--dim); }

.itop { display: inline-flex; align-items: center; gap: 8px; }
.tpad { display: flex; gap: 6px; align-items: stretch; }
.tsel { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 8px; padding: 8px; background: var(--panel-hi); border: 3px solid var(--line); color: var(--fg); }
.tgo { font-family: var(--font-display); font-size: 8px; line-height: 1.4; padding: 8px; background: var(--panel-hi); border: 3px solid var(--line); color: var(--fg); }
.tgo.here, .tgo:disabled { opacity: .45; cursor: default; }
.tgo:active:not(:disabled) { transform: translateY(2px); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* character selection */
.pick { position: absolute; inset: 0; z-index: 8; background: #0e1a13; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; padding: 12px; overflow-y: auto; }
.pick h2 { margin: 0; font-family: var(--font-display); font-size: 11px; line-height: 1.6; color: var(--coin); text-align: center; }
.pick .cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; max-width: 340px; }
.pick .card { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px; background: var(--panel); border: 3px solid var(--line); color: var(--fg); font: inherit; cursor: pointer; }
.pick .card:active { transform: translateY(2px); }
.pick .card img, .pick .card canvas { width: 100%; aspect-ratio: 1; image-rendering: pixelated; background: #5aa7e8; border: 3px solid var(--line); }
.pick .card b { font-family: var(--font-display); font-size: 10px; font-weight: normal; color: var(--coin); }
.pick .card span { font-size: 15px; line-height: 1; color: var(--dim); text-align: center; }

.pick .big { width: 100%; max-width: 170px; aspect-ratio: 1; image-rendering: pixelated; background: #5aa7e8; border: 4px solid var(--line); box-shadow: 0 0 0 3px var(--panel-hi); }
.pick .story { margin: 0; max-width: 320px; text-align: center; font-size: 19px; line-height: 1.1; color: var(--fg); }
.pick .go { font-family: var(--font-display); font-size: 12px; padding: 12px 22px; background: var(--coin); color: var(--ink); border: 3px solid var(--line); box-shadow: inset 3px 3px 0 rgba(255,255,255,.4), inset -3px -3px 0 rgba(0,0,0,.25); }
.pick .go:active { transform: translateY(2px); }
.pick .back { font-family: var(--font-display); font-size: 8px; padding: 8px; background: transparent; border: 3px solid var(--line); color: var(--dim); }

/* admin keypad */
.keypad { position: absolute; inset: 0; z-index: 9; background: #0e1a13; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 12px; }
.keypad .kphead { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 240px; }
.keypad h2 { margin: 0; font-family: var(--font-display); font-size: 11px; color: var(--coin); }
.kpshow { width: 100%; max-width: 240px; text-align: center; font-family: var(--font-display); font-size: 18px; letter-spacing: 2px; padding: 12px; background: var(--bg); border: 3px solid var(--line); color: var(--good); }
.kpshow.bad { color: var(--bad); }
.kpgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 240px; }
.kpkey { font-family: var(--font-display); font-size: 14px; padding: 14px 0; background: var(--panel-hi); border: 3px solid var(--line); color: var(--fg); box-shadow: inset 3px 3px 0 rgba(255,255,255,.08), inset -3px -3px 0 rgba(0,0,0,.3); }
.kpkey:active { transform: translateY(2px); }

.pick canvas.big { width: 100%; max-width: 170px; aspect-ratio: 1; image-rendering: pixelated; border: 4px solid var(--line); box-shadow: 0 0 0 3px var(--panel-hi); }

.ubtns { display: flex; flex-direction: column; gap: 4px; }
.sheet > .obuy { margin: 4px 0 8px; width: 100%; }

.qpop { position: absolute; inset: 0; z-index: 9; background: rgba(8,16,12,.8); display: flex; align-items: center; justify-content: center; padding: 12px; }
.qcard { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--panel); border: 4px solid var(--coin); box-shadow: 0 0 0 3px var(--line); padding: 14px; max-width: 300px; width: 100%; }
.qtag { font-family: var(--font-display); font-size: 9px; color: var(--ink); background: var(--coin); padding: 5px 8px; }
.qface { width: 96px; height: 96px; image-rendering: pixelated; border: 3px solid var(--line); background: #5aa7e8; }
.qwho { font-family: var(--font-display); font-size: 10px; color: var(--coin); }
.qname { font-family: var(--font-display); font-size: 10px; color: var(--fg); text-align: center; line-height: 1.5; }
.qtext { margin: 0; text-align: center; font-size: 19px; line-height: 1.1; color: var(--fg); }
.qrew { display: flex; align-items: center; gap: 6px; font-size: 17px; color: var(--coin); }
.qpop .go { font-family: var(--font-display); font-size: 11px; padding: 10px 20px; background: var(--coin); color: var(--ink); border: 3px solid var(--line); }
.qpop .back { font-family: var(--font-display); font-size: 8px; padding: 7px; background: transparent; border: 3px solid var(--line); color: var(--dim); }

.qhint { font-size: 14px; color: var(--dim); }

.quest .tnote { white-space: pre-line; }

.ava { flex: none; width: 46px; height: 46px; padding: 0; border-radius: 50%; background: #000; border: 3px solid var(--line); overflow: hidden; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; }
.ava img { width: 92%; height: auto; max-height: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; }
.ava:active { transform: translateY(2px); }
.menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; display: flex; flex-direction: column; gap: 6px; padding: 8px; min-width: 150px; background: var(--panel); border: 4px solid var(--line); box-shadow: inset 4px 4px 0 rgba(255,255,255,.06), inset -4px -4px 0 rgba(0,0,0,.35); }
.menu[hidden] { display: none; }
.menu .reset { text-align: left; padding: 10px; color: var(--fg); }
.cur.rep { color: #8fc0ff; }

/* fixed top row: nothing shifts when the region changes */
.top { height: 66px; }
.where { flex: 0 0 112px; width: 112px; }
#area { overflow-wrap: anywhere; }
#wallet { flex: 1; min-width: 0; flex-wrap: nowrap; justify-content: flex-start; gap: 14px; }
.curv { display: inline-block; min-width: 4ch; }

.avawrap { position: relative; flex: none; width: 46px; height: 46px; }
.alert { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%; background: #ff2d2d; border: 3px solid var(--line); box-shadow: 0 0 8px 2px rgba(255,45,45,.8); animation: flash .7s steps(2) infinite; pointer-events: none; }
@keyframes flash { 0% { opacity: 1; } 50% { opacity: .15; } 100% { opacity: 1; } }
.menu .reset.hot { color: #ff8a80; animation: flash .7s steps(2) infinite; }
.evcard { padding: 8px 10px; background: var(--bg); border: 3px solid var(--line); display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.evcard.open { border-color: var(--coin); }
.evtop { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.evtitle { font-family: var(--font-display); font-size: 9px; line-height: 1.5; color: var(--fg); }
.evtag { font-family: var(--font-display); font-size: 7px; padding: 4px 6px; color: var(--ink); background: var(--bad); }
.evtag.social { background: #8fc0ff; }
.evtag.minor { background: var(--dim); }
.evdesc { margin: 0; font-size: 19px; line-height: 1.1; color: var(--dim); }
.evfx { margin: 0; font-size: 17px; color: var(--bad); }
.evfx.ok { color: var(--dim); }
.evopts { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.evbtn { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 8px; background: var(--coin); color: var(--ink); border: 3px solid var(--line); font-family: var(--font-display); font-size: 8px; line-height: 1.5; box-shadow: inset 3px 3px 0 rgba(255,255,255,.4), inset -3px -3px 0 rgba(0,0,0,.25); }
.evbtn:disabled { background: var(--panel-hi); color: var(--dim); box-shadow: none; }
.evbtn.ghost { background: transparent; color: var(--dim); box-shadow: none; }
.evbtn span.q { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-body); font-size: 20px; }
.alert.still { animation: none; box-shadow: none; }
.evbtn { flex-direction: column; }
.evline { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.evsub { font-family: var(--font-body); font-size: 18px; letter-spacing: 0; line-height: 1; text-transform: none; }
.where { flex-basis: 96px; width: 96px; }
#wallet { gap: 10px; }
.cur { font-size: 26px; }
.curv { min-width: 2.2ch; }
.evwho { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #000; border: 3px solid var(--line); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.evwho img { width: 92%; height: auto; max-height: 100%; object-fit: contain; image-rendering: pixelated; }
.evtop .evtitle { flex: 1; }
/* portraits zoomed in on the face */
.ava, .evwho { position: relative; display: block; }
.ava img, .evwho img { position: absolute; left: 50%; top: 50%; width: 190%; max-height: none; height: auto; transform: translate(-50%, -56%); object-fit: cover; }

.photosel { font-family: var(--font-body); font-size: 22px; padding: 6px 8px; margin: 4px 0 8px; background: var(--panel-hi); color: var(--fg); border: 3px solid var(--line); width: 100%; }
.qrep { color: #8fc0ff; }

/* v163: portrait placeholder before a hero is picked (7.12) */
.ava.empty { background: var(--panel-hi); }
.ava.empty img { display: none; }
.ava.empty::after { content: '?'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 16px; color: var(--dim); }
/* v163: menu dot sits fully inside the round portrait (7.20); centre 13 px from the top-right corner */
.alert { top: 5px; right: 5px; width: 16px; height: 16px; border-width: 2px; }
/* v163: narrow phones (320 px) - the reputation number no longer slides under the portrait (7.3) */
#wallet { overflow: hidden; }
@media (max-width: 359px) {
  .top { gap: 6px; padding: 8px 8px; }
  .where { flex-basis: 78px; width: 78px; }
  #area { font-size: 8px; }
  #wallet { gap: 6px; }
  .cur { font-size: 22px; gap: 4px; }
  .curv { min-width: 0; }
}

/* v164: fit to screen (7.1) with whole-number pixel scaling (7.2). ui.js fitLayout() sets the canvas size in px and the wrap width;
   the stage centres the canvas and fills any spare room with the dark frame colour. */
.stage { display: flex; align-items: center; justify-content: center; background: var(--line); }
#game { flex: none; }
/* v164: the hint is at most two lines (7.6), so its height is fixed and the layout never jumps */
#hint { height: 2.3em; min-height: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.15; }
/* v164: short landscape screens (844x390): play area on the left, top bar, pack and hint stacked on the right */
.wrap.side { display: grid; grid-template-columns: auto minmax(240px, 360px); grid-template-rows: auto auto auto 1fr; column-gap: 12px; row-gap: 10px; align-items: start; justify-content: center; }
.wrap.side > .stage { grid-column: 1; grid-row: 1 / span 4; }
.wrap.side > .top { grid-column: 2; grid-row: 1; }
.wrap.side > .packrow { grid-column: 2; grid-row: 2; }
.wrap.side > #hint { grid-column: 2; grid-row: 3; height: auto; max-height: 4.6em; -webkit-line-clamp: 4; line-clamp: 4; }

/* 2.1: waking up from the opening dream */
.dream { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: #fff8e6; color: #3a2a4a; text-align: center; padding: 16px; animation: dreamIn .7s ease-out; transition: opacity .6s; cursor: pointer; }
.dream p { margin: 0; font-family: 'Press Start 2P', monospace; font-size: 14px; line-height: 1.4; }
.dream p.sub { font-family: 'VT323', monospace; font-size: 22px; }
.dream.out { opacity: 0; }
@keyframes dreamIn { from { opacity: 0; } to { opacity: 1; } }

/* v174: pictures instead of words — effect chips, level pips, word-free buttons */
.fxrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fxchip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px 1px 4px; background: rgba(0,0,0,.25); border: 2px solid var(--line); }
.fxchip b { font-family: var(--font-body); font-size: 22px; line-height: 1; color: var(--coin); font-weight: normal; }
.fxchip .fxall { font-family: var(--font-display); font-size: 6px; color: var(--dim); }
.otop { align-items: center; justify-content: flex-start; }
.otop .oname { flex: 1; }
.pips { display: inline-flex; gap: 2px; align-items: center; }
.pips i { display: inline-block; width: 6px; height: 6px; background: var(--panel-hi); border: 1px solid var(--line); }
.pips i.on { background: var(--coin); }
.olabel { display: inline-flex; align-items: center; gap: 3px; }
.olabel b { font-family: var(--font-body); font-size: 22px; font-weight: normal; }
.olabel:empty { display: none; }
.obuy.done { background: var(--panel-hi); box-shadow: none; }
.hintrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hintrow .harrow { color: var(--coin); font-size: 22px; line-height: 1; }
.hintrow b { font-weight: normal; color: var(--coin); }
.qgoal { display: flex; align-items: center; gap: 6px; font-size: 22px; }
.qgoal .ashare { flex: 1; margin: 0; }
.qcard .fxrow, .quest .fxrow { justify-content: center; }
.quest .fxrow { justify-content: flex-start; }
.evchips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.evstory { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); font-size: 18px; }
.fxchip.bad { border-color: var(--bad); }
.fxchip.bad b { color: var(--bad); }
.qgoals { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.qgoal b { font-weight: normal; color: var(--fg); min-width: 4.5em; text-align: right; }
.qgoal.met b { color: var(--good, #6fe08b); }
.qrewrow { display: flex; align-items: center; gap: 6px; }
.qrewrow .fxrow { margin: 0; }
.quest.needwalk .ahead::after { content: ''; }
.qdown { text-align: center; font-size: 26px; }
.qsay { font-style: italic; }
.quest { cursor: pointer; }
.quest .itop { display: inline-flex; align-items: center; gap: 6px; }
.quest .evwho { width: 32px; height: 32px; }
.back canvas, .tgo canvas { vertical-align: middle; }
.fxchip .harrow, .qgoal .harrow { color: var(--dim); font-size: 18px; }
.sumrow span { display: inline-flex; align-items: center; gap: 4px; }
.agrid > div { display: flex; align-items: center; gap: 4px; }
.ahead .itop { display: inline-flex; align-items: center; gap: 6px; }
/* v178: quest goal lines in one grid: verb | count | icon | name | quantity */
.qlines { display: grid; grid-template-columns: auto auto auto 1fr auto; column-gap: 6px; row-gap: 2px; align-items: center; margin: 4px 0; font-size: 22px; line-height: 1; }
.qcard .qlines { grid-template-columns: repeat(5, auto); justify-content: center; margin: 4px auto; text-align: left; }
.qverb { font-family: var(--font-body); font-size: 20px; color: var(--dim); }
.qnum { font-weight: normal; color: var(--coin); white-space: nowrap; }
.qcnt:empty, .qqty:empty { width: 0; }
.qic { display: inline-flex; align-items: center; justify-content: center; }
.qobj { white-space: nowrap; }
.qcard .qlines { column-gap: 4px; font-size: 20px; }
.qcard .qverb { font-size: 18px; }
.qbar { grid-column: 1 / -1; margin: 0 0 4px; }
.qbar.met ~ * {}
.qcard .qqty:not(:empty) { margin-left: 4px; }

/* v179 hud: on phones (and any stacked layout) the top bar and the pack row float over the 176x320 play area */
.wrap.hud { position: relative; gap: 0; }
.wrap.hud > .top { position: absolute; top: 4px; left: 4px; right: 4px; z-index: 6; height: 56px; padding: 4px 10px; background: rgba(20, 34, 26, .88); border-width: 3px; }
.wrap.hud > .packrow { position: absolute; bottom: 4px; left: 4px; right: 4px; z-index: 6; padding: 3px 8px; min-height: 40px; background: rgba(20, 34, 26, .88); border-width: 3px; pointer-events: none; flex-wrap: nowrap; }
.wrap.hud > .packrow #hint { margin: 0 0 0 auto; padding: 0; min-height: 0; height: auto; flex: none; display: block; overflow: visible; -webkit-line-clamp: unset; }
.wrap.hud > .packrow #bag { flex: 1; min-width: 0; overflow: hidden; }
.wrap.hud .toast { top: 70px; }
.wrap.hud .toast.low { top: auto; bottom: 56px; }
.wrap.hud .sheet, .wrap.hud .statpanel { z-index: 7; }
@media (max-width: 420px) { body { padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); padding-block: 6px 8px; } }
