/* =============================================================================
   FORNWARD — interface styles
   -----------------------------------------------------------------------------
   Dark stone dungeon play field, neon HUD chrome. Portrait first, one thumb.
   No web fonts, no images, no build step. System fonts only, so first paint
   is instant and the whole thing works offline.
   ========================================================================== */

:root {
  --bg:        #0a0d13;
  --panel:     #11151d;
  --panel-2:   #151a23;
  --line:      #232b38;
  --line-2:    #2b3342;
  --text:      #e8ecf2;
  --dim:       #8fa3b8;
  --dim-2:     #6b7c92;

  --cyan:      #39d7c4;
  --accent:    #10b981;
  --gold:      #f0b429;
  --magic:     #8b7bff;
  --danger:    #e5484d;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --r: 10px;
  --tap: 44px;
}

/* Studio-only controls are hidden in ordinary play. Keep them readable on
   narrow screens without relying on the browser's light button defaults. */
#studioPlacement:not([hidden]) { display:block; margin:5px 0; color:#d9e6ee; font-size:11px; line-height:1.35;
  white-space:pre-line; max-height:min(22vh,9rem); overflow:auto; }
#studioReceipt:not([hidden]), #studioRestart:not([hidden]), #studioModeToggle:not([hidden]) {
  display:inline-block; margin:2px 5px 4px 0; padding:6px 9px; border:1px solid #39d7c4;
  border-radius:5px; background:#152a30; color:#e8ecf2; font:inherit; font-size:11px; cursor:pointer;
}
#studioReceipt:disabled { opacity:.65; cursor:wait; }
#studioReceipt:focus-visible, #studioRestart:focus-visible, #studioModeToggle:focus-visible { outline:2px solid #f0c65e; outline-offset:2px; }

/* The embedded Studio camera is a room viewer, not the full player shell.
   Drop the game HUD and mobile nav so the authored room gets the viewport. */
body.studio-live-preview #app { max-width:none; }
body.studio-live-preview #hud,
body.studio-live-preview #tabs,
body.studio-live-preview #skillbar { display:none; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  /* the page itself never scrolls; the panels do */
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

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

/* ── shell ──────────────────────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* ── HUD ────────────────────────────────────────────────────────────────── */

#hud {
  flex: 0 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: linear-gradient(180deg, #0d1119 0%, #0a0d13 100%);
  border-bottom: 1px solid var(--line);
}

.hud-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: baseline;
  gap: 10px;
}

.hud-cell { display: flex; flex-direction: column; min-width: 0; }
.hud-cell:last-child { align-items: flex-end; }

.hud-cell .k {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--dim-2);
  text-transform: uppercase;
}

.hud-cell .v {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}

.hud-cell .v.gold { color: var(--gold); }

.hp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.hp-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #1c2431;
  overflow: hidden;
}

.hp-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3fbf6f, #7ee08c);
  transition: width .18s ease;
}

.hp-text {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  min-width: 62px;
  text-align: right;
}

/* The active champion is read from the combat owner; this overlay never
   captures a touch and does not resize the canvas or cover the skill bar.
   Its height comes from DATA.TUNING.bossHudBand, which the page publishes as
   --boss-hud-h, so the canvas can move the room banner below it and the two
   can never overlap. */
.boss-hud {
  position: absolute; z-index: 3; pointer-events: none;
  top: 0; left: 50%; transform: translateX(-50%);
  width: min(78%, 290px); height: var(--boss-hud-h, 42px);
  display: flex; flex-direction: column; justify-content: center;
  text-align: center;
  padding: 0 8px; background: rgba(10, 13, 19, .86);
  border: 1px solid rgba(201, 169, 104, .55); border-top: none; border-radius: 0 0 4px 4px;
  /* THE ARRIVAL. A champion's bar is the first thing that says "this fight
     is not an ordinary one", so it arrives rather than appearing. It is a
     short fade and a few pixels of travel, it plays once per engagement,
     and it is the bar -- never the play field -- so it cannot hide a
     telegraph. */
  animation: boss-hud-arrive .32s ease-out;
}
@keyframes boss-hud-arrive {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .boss-hud { animation: none; }
}
.boss-hud[hidden] { display: none; }
.boss-hud-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 700 12px var(--mono); letter-spacing: .05em; color: #f1d7a2;
}
.boss-hud-bar { height: 7px; margin-top: 4px; background: #39272a; overflow: hidden; }
.boss-hud-bar i { display: block; height: 100%; background: #c84c43; transition: width .12s linear; }
.res-boss { color: #e8c788; font-size: 11px; font-weight: 700; letter-spacing: .07em; }

/* ── wave HUD: the endless run's pressure, one fixed-height row ────────────
   Reads Game.waveHud(). The row is a FIXED height so the numbers never move
   the layout; its children toggle in place inside that box. */
.wave-hud {
  height: 30px;
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.wave-hud[hidden] { display: none !important; }

.wave-hud-line {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 16px;
  overflow: hidden;
}

.wave-pips {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}
.wave-pip {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #232b38;
}
.wave-pip.cleared { background: var(--accent); }
.wave-pip.current { background: var(--cyan); box-shadow: 0 0 6px rgba(57, 215, 196, .65); }

.wave-bodies {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.wave-bodies b { color: var(--text); font-weight: 700; }
.wave-bodies-label {
  font-size: 8px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim-2);
}

.wave-incoming {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  white-space: nowrap;
  color: var(--gold);
}
.wave-incoming[hidden] { display: none; }

.wave-clear-label {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  white-space: nowrap;
  color: var(--accent);
  animation: wave-clear-flash 1s ease-out forwards;
}
.wave-clear-label[hidden] { display: none; }

@keyframes wave-clear-flash {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  100% { opacity: .55; }
}

.wave-bar {
  height: 4px;
  border-radius: 2px;
  background: #1c2431;
  overflow: hidden;
}
.wave-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--accent));
  transition: width .12s linear;
}
.wave-bar.gap i { background: var(--gold); }

/* the champion's name over the play field: large, low-contrast, never
   interactive, always under the overlay menus. */
.champion-overlay {
  position: absolute;
  left: 0;
  right: 0;
  top: 16%;
  z-index: 4;
  padding: 0 20px;
  text-align: center;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .14em;
  color: rgba(232, 236, 242, .26);
  text-shadow: 0 0 18px rgba(57, 215, 196, .18);
  opacity: 0;
  transition: opacity .4s ease;
}
.champion-overlay.show { opacity: 1; }
.champion-overlay[hidden] { display: none !important; }

/* the wave label names the champion at the title card's heading weight
   (bold mono, matching .ov-card h1); size and clamp keep it inside the HUD. */
.hud-cell .v.champion {
  color: var(--gold);
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .wave-clear-label { animation: none !important; }
  .champion-overlay { transition: none !important; }
}

/* ── view: play field and panels share one box ──────────────────────────── */

#view {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#stage {
  position: absolute;
  inset: 0;
}

#stage.hidden { display: none; }

#studioPreviewGate:not([hidden]) {
  position:absolute; inset:0; z-index:12; display:grid; place-items:center;
  padding:24px; background:rgba(7,10,15,.86);
}
.studio-preview-card {
  width:min(100%, 340px); padding:22px; border:1px solid var(--line-2);
  border-radius:12px; background:var(--panel); color:var(--text); text-align:center;
  box-shadow:0 16px 48px rgba(0,0,0,.42);
}
.studio-preview-card h2 { margin:0 0 10px; font-size:18px; }
.studio-preview-card p { margin:0 0 18px; color:var(--dim); font-size:14px; line-height:1.5; }
.studio-preview-card button {
  min-height:var(--tap); padding:0 18px; border:1px solid var(--cyan); border-radius:7px;
  background:#152a30; color:var(--text); font:inherit; font-weight:700; cursor:pointer;
}
.studio-preview-card button:focus-visible { outline:2px solid var(--gold); outline-offset:3px; }

#game {
  display: block;
  width: 100%;
  height: 100%;
  /* the field owns every gesture: no scroll, no double-tap zoom */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ── skill bar ──────────────────────────────────────────────────────────── */

#skillbar {
  position: absolute;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}

#skillbar.hidden { display: none; }

.skill {
  width: 64px;
  min-height: var(--tap);
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: rgba(17, 21, 29, .86);
  backdrop-filter: blur(6px);
  color: var(--dim-2);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}

.skill b {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
}

.skill .cd {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  opacity: .8;
}

.skill.ready {
  color: var(--cyan);
  border-color: rgba(57, 215, 196, .55);
  background: rgba(57, 215, 196, .12);
}

.skill:active { transform: scale(.96); }

/* ── overlay (title, run summary) ───────────────────────────────────────── */

#overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  /* The card must be able to scroll to its OWN top. A flex container that
     centres a child taller than itself pushes the child's top edge ABOVE
     the scrollport, and that overflow cannot be scrolled to: the top of the
     card, and everything in it, is unreachable. The card is centred by its
     own auto margins instead, which centre it when it fits and top-align it
     when it does not. */
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(7, 9, 13, .93);
  backdrop-filter: blur(3px);
}

#overlay .ov-card { margin: auto; }

#overlay.hidden { display: none !important; }

/* ── modal (confirmations) ────────────────────────────────────────────────── */

#modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(7, 9, 13, .88);
  backdrop-filter: blur(2px);
}

#modal.hidden { display: none !important; }

#modal .ov-card { max-width: 360px; text-align: center; }

#modal .ov-actions { justify-content: center; }

.ov-card {
  width: 100%;
  max-width: 420px;
  padding: 16px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #141a24 0%, #0f131b 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

.brand { text-align: center; margin-bottom: 10px; }

.brand h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--text);
  text-shadow: 0 0 22px rgba(57, 215, 196, .28);
}

.brand .tagline {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.ov-card h1 { font-family: var(--mono); font-size: 20px; letter-spacing: .14em; margin: 0 0 8px; text-align: center; }
.ov-card h1.good { color: var(--accent); }
.ov-card h1.bad  { color: var(--danger); }

.dim { color: var(--dim); }
.tiny { font-size: 11px; }
.mono { font-family: var(--mono); }

.intro { font-size: 12px; margin: 0 0 10px; }
.intro b { color: var(--text); }
.foot { font-size: 10px; margin: 8px 0 0; }

/* route cards */
.section-label {
  margin: 12px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.route { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.route-entry { display: flex; flex-direction: column; gap: 4px; }
.route-entry.locked { opacity: .6; }
.route-entry.cleared .route-card { border-color: rgba(16, 185, 129, .45); }

.route-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}

.route-card:active { transform: scale(.99); }
.route-card.locked { opacity: .7; cursor: not-allowed; }
.route-card.cleared { border-color: rgba(16, 185, 129, .45); }

/* the route the player has chosen: the ENTER button names it. */
.route-card.sel {
  border-color: rgba(57, 215, 196, .7);
  box-shadow: inset 0 0 0 1px rgba(57, 215, 196, .2);
}

/* the challenge variations a player can pick for a cleared dungeon. they are
   never applied on their own: the default is the dungeon's authored band. */
.rc-bands {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 0 6px;
}
.rc-bands-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--dim);
}
/* Difficulty is a selection, not a decorative chip: every choice must be
   legible and independently tappable on a 320px portrait phone. */
.rc-band {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: #1b222d;
  color: var(--dim);
  cursor: pointer;
}
.rc-band.sel { border-color: var(--accent); color: var(--accent); }
.rc-band:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* the authored band: the route as it was written. it is always one of the
   buttons, so picking a challenge variation is reversible. */
.rc-band.base { border-style: solid; }
.rc-band.base .dim { font-size: 11px; letter-spacing: .02em; }

/* an item's behaviour, stated on the card */
.note { display: block; color: var(--accent); margin-top: 1px; }

.rc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rc-head b { font-size: 13px; }
.rc-sub { font-size: 10px; color: var(--dim); margin-top: 1px; }
.rc-rooms { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.rc-room {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .06em;
  padding: 1px 5px;
  border-radius: 4px;
  background: #1b222d;
  color: var(--dim-2);
}
.rc-frontier { margin-top: 5px; font-size: 10px; color: var(--accent); font-family: var(--mono); }
.lock { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--dim-2); }
.lock.cleared { color: var(--accent); }
.lock.sel { color: var(--cyan); }

/* what unlocks a locked route, in words. */
.rc-lockreq { margin-top: 4px; font-size: 11px; color: var(--dim); }

.rc-intel {
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: rgba(13, 17, 24, .72);
  padding: 6px 8px;
}
.rc-intel summary {
  color: var(--cyan);
  cursor: pointer;
  font: 8px var(--mono);
  letter-spacing: .12em;
  list-style-position: inside;
}
.rc-intel[open] summary { margin-bottom: 7px; }
.rc-intel-row {
  display: grid;
  grid-template-columns: minmax(74px, .55fr) 1.45fr;
  gap: 7px;
  padding: 3px 0;
  font-size: 10px;
  line-height: 1.35;
}
.rc-intel-row + .rc-intel-row { border-top: 1px solid rgba(255,255,255,.05); }
.rc-intel-row > span:first-child {
  color: var(--dim-2);
  font: 8px var(--mono);
  letter-spacing: .06em;
}
.rc-intel-row > span:last-child { color: var(--text); }

/* the overlay's own status line: a message raised while a card is up. */
.ov-status {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--dim);
}
.ov-status.bad { color: var(--danger); }

/* ── the expedition results panel ────────────────────────────────────────── */

.res-outcome { text-align: center; }
.res-outcome .res-sub-title { margin: 0 0 2px; font-size: 13px; }
.res-outcome .res-line { margin: 0; }
.res-outcome .res-when { margin: 2px 0 0; color: var(--dim-2); }

.res-actions { margin: 12px 0 2px; }

.res-rewards { margin-top: 12px; }

.res-sub {
  margin: 12px 0 4px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .16em;
  color: var(--dim-2);
}

.res-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.res-row b { font-size: 12px; }
.res-row .dim { font-size: 10px; }
.res-row .res-cond { color: var(--dim-2); }

.res-empty { margin: 2px 0 0; color: var(--dim-2); }
.res-truth { margin: 10px 0 0; color: var(--dim); }

.res-lab {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--gold);
}

/* an acquisition row: it opens its own detail in place. */
.res-item {
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 6px;
  cursor: pointer;
}
.res-item:focus-visible { outline: 1px solid var(--cyan); }
.res-item-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.res-item-main b { font-size: 12px; }
.res-item-main .dim { font-size: 10px; }
.res-item-source { margin-top: 2px; font-size: 10px; color: var(--dim-2); }
.res-item-detail { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.res-item-detail[hidden] { display: none; }
.res-item-detail-inner { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.res-item-detail-inner .res-back { min-height: 26px; }

.tag.new { background: rgba(16, 185, 129, .16); color: #6ee7b7; }
.tag.owned { background: rgba(143, 163, 184, .14); color: var(--dim); }

/* stats strip */
.ov-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ov-stats > div { text-align: center; min-width: 0; }
.ov-stats b {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.ov-stats span {
  display: block;
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim-2);
  margin-top: 2px;
}

/* buttons */
.ov-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ov-actions .btn { flex: 1 1 140px; }
/* The primary action owns its row; the weekly modes own theirs. */
.ov-actions .btn.wide { flex: 1 1 100%; }

/* ── weekly competition modes ────────────────────────────────────────────────
   Two modes, one authored week, ONE ROW. A stacked pair put the second mode
   below the fold at 390x844, so the choice a player makes before entering is
   the one thing that must never need a scroll. Each button carries its own
   sub-line rather than a paragraph underneath: the target stays >= 58px tall
   and the label stays readable at arm's length. */
.wave-modes {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 2px;
}

.btn.wave-mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 7px 10px;
  text-align: left;
  line-height: 1.2;
}

.wave-label { flex: 1 1 100%; margin: 0 0 1px; }

.wave-note { flex: 1 1 100%; margin: 0; }


.wave-mode b { font-size: 12px; letter-spacing: .1em; }

.wave-mode .mode-sub {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dim);
}

.btn {
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}

.btn:active { transform: scale(.98); }
.btn.primary { background: rgba(16, 185, 129, .16); border-color: rgba(16, 185, 129, .6); color: #6ee7b7; }
.btn.ghost { background: transparent; color: var(--dim); }
.btn.ghost.danger { color: var(--danger); border-color: rgba(229, 72, 77, .4); }
.btn.tiny { min-height: 30px; padding: 0 10px; font-size: 10px; letter-spacing: .1em; }
.btn.big { min-height: 46px; font-size: 12px; }
.btn:disabled { opacity: .38; cursor: not-allowed; }

/* ── panels ─────────────────────────────────────────────────────────────── */

.panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(env(safe-area-inset-bottom) + 24px);
  background: var(--bg);
  z-index: 8;
}

.panel.hidden { display: none; }

.panel h3 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .18em;
  color: var(--cyan);
}

.panel h5 {
  margin: 18px 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim-2);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel p { margin: 0 0 10px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* equipment slots */
.gear-slots { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
}

.slot-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim-2);
  width: 58px;
  flex: 0 0 auto;
}

.slot-item { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.slot-item b { font-size: 13px; }
.slot-item span { display: block; }

/* inventory rows */
.inv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 6px;
}

.inv-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inv-row b { font-size: 13px; }
.inv-row span { display: block; }
.inv-row .source { color: var(--dim-2); font-size: 10px; }
.material-sources {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
.material-sources > span:first-child { color: var(--dim-2); font-size: 10px; }
.material-source-route {
  min-height: 30px;
  padding: 3px 7px;
  border: 1px solid rgba(57, 215, 196, .3);
  border-radius: 5px;
  background: rgba(57, 215, 196, .07);
  color: var(--cyan);
  font-size: 10px;
  cursor: pointer;
}
.material-source-route:active { background: rgba(57, 215, 196, .16); }
.material-source-locked { color: var(--dim-2); font-size: 9px; }

.tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(57, 215, 196, .14);
  color: var(--cyan);
  white-space: nowrap;
}
.tag.small { font-size: 8px; }

/* skills note */
.skills-note { display: flex; flex-direction: column; gap: 6px; }
.skills-note > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.skills-note b { font-size: 13px; min-width: 46px; }
.skills-note span { font-size: 11px; }
.skills-note .locked-skill { opacity: .45; }

/* mastery */
.mast {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 6px;
}

.mast-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

/* THE WANDERER'S LEVEL AND THE WEAPON FAMILIES.

   They look like the mastery cards because they ARE progress cards and the
   panel should read as one thing -- but they are NOT mastery cards, so they
   do not wear the `.mast` class. A card that is not a mastery card must
   not carry the mastery card's name: the panel's own counts have to mean
   what they say they mean. */
.wcard {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 6px;
}

/* THE FAMILY IN HAND. The technique the equipped weapon can use is marked
   in the panel, so the player can see which of the families their current
   weapon is practising without counting rows. */
.wcard-held { border-color: var(--accent); }

/* A LEVEL REQUIREMENT THE PLAYER CANNOT MEET YET. It is a locked thing, and
   it says what it wants in the colour the rest of the game uses for "not
   yet", rather than in the colour of an error. */
.req-locked { color: var(--dim, #9aa5b5); }
.mast-head b { font-size: 13px; }
.mast p { margin: 6px 0 0; }

/* the mastery that belongs to a skill: folded away, with the rank and the
   progress always on the line */
.mast-detail { margin-top: 5px; }
.mast-detail summary {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.mast-detail summary::-webkit-details-marker { display: none; }
.mast-detail summary::before { content: '\25B8'; margin-right: 5px; color: var(--dim-2); }
.mast-detail[open] summary::before { content: '\25BE'; }
.mast-body { padding: 2px 0 0 14px; }
.mast-body p { margin: 3px 0 0; }

.votebar {
  height: 4px;
  border-radius: 2px;
  background: #1c2431;
  overflow: hidden;
  margin-top: 7px;
}
.votebar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--accent));
  transition: width .3s ease;
}

/* ledger */
.ledger-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 14px;
}

.ledger-grid > div { background: var(--panel); padding: 10px 8px; text-align: center; }
.ledger-grid b {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.ledger-grid span {
  display: block;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim-2);
  margin-top: 2px;
}

.faucet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 10px;
}
.faucet-row > div { flex: 1; min-width: 0; }
.faucet-row b { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; }
.faucet-row span { display: block; }

/* sigils */
.sigil {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 6px;
}
.sigil.on { border-color: rgba(57, 215, 196, .45); }
.sigil .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.sigil > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sigil b { font-size: 13px; }
.sigil span { display: block; }

/* lists */
.sink-list, .check-list { list-style: none; margin: 0; padding: 0; }

.sink-list li, .check-list li {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.sink-list li span, .check-list li span {
  font-family: var(--mono);
  width: 12px;
  flex: 0 0 auto;
  color: var(--dim-2);
}
.sink-list li.ok span, .check-list li.ok span { color: var(--accent); }
.sink-list li.na { opacity: .5; }
.check-list li.bad { color: var(--danger); }
.check-list li.bad span { color: var(--danger); }
.sink-list b, .check-list li { font-weight: 500; }
.sink-list .dim, .check-list .dim { font-size: 10px; }

/* ── tabs ───────────────────────────────────────────────────────────────── */

#tabs {
  flex: 0 0 auto;
  display: grid;
  /* PLAY, GEAR and MORE. The experimental modules live behind MORE, so the
     primary navigation is the journey and nothing else. */
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  background: #0c1017;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Alpha journey navigation: menu only, separate from the in-run controls. */
#journey-nav { flex:0 0 auto; display:grid; grid-template-columns:repeat(4,minmax(0,1fr));
  border-top:1px solid #625f52; background:linear-gradient(#111b20,#080d12);
  padding:5px 4px max(5px,env(safe-area-inset-bottom)); z-index:12; }
#journey-nav[hidden] { display:none; }
.journey-tab { min-width:0; min-height:58px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  border:0; border-bottom:2px solid transparent; background:transparent; color:#c0b9a6; font:inherit; font-size:11px; cursor:pointer; }
.journey-icon { display:block; width:25px; height:25px; flex:none; background:currentColor; opacity:.9;
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat; -webkit-mask-position:center; mask-position:center;
  -webkit-mask-size:contain; mask-size:contain; }
.journey-tab[data-page="home"] .journey-icon { -webkit-mask-image:url("../assets/ui/alpha-navigation/icons/home.svg"); mask-image:url("../assets/ui/alpha-navigation/icons/home.svg"); }
.journey-tab[data-page="dungeons"] .journey-icon { -webkit-mask-image:url("../assets/ui/alpha-navigation/icons/dungeons.svg"); mask-image:url("../assets/ui/alpha-navigation/icons/dungeons.svg"); }
.journey-tab[data-page="wanderer"] .journey-icon { -webkit-mask-image:url("../assets/ui/alpha-navigation/icons/wanderer.svg"); mask-image:url("../assets/ui/alpha-navigation/icons/wanderer.svg"); }
.journey-tab[data-page="challenges"] .journey-icon { -webkit-mask-image:url("../assets/ui/alpha-navigation/icons/challenges.svg"); mask-image:url("../assets/ui/alpha-navigation/icons/challenges.svg"); }
.journey-tab.on .journey-icon { opacity:1; filter:drop-shadow(0 0 5px #39d7a4); }
.journey-tab.on { color:#78e2c4; border-bottom-color:#39d7a4; text-shadow:0 0 12px #36c99c; }
.journey-tab:focus-visible { outline:2px solid var(--gold); outline-offset:-3px; }
body.journey-open #tabs { display:none; }
body.journey-open #hud { display:none; }
body.journey-open #overlay { background:radial-gradient(ellipse at 50% 0,#132932 0,#080c10 66%); }
body.journey-open .title-card { width:min(100%,560px); border:1px solid #59594e; border-radius:3px; background:linear-gradient(145deg,rgba(20,33,35,.98),rgba(8,14,18,.99)); box-shadow:0 10px 34px #000b,inset 0 0 0 3px #1b2727; }
body.journey-open .title-card h1, body.journey-open .title-card h4 { color:#e6d7b7; font-family:Georgia,'Times New Roman',serif; letter-spacing:.07em; }
body.journey-open .title-card .tagline { color:#b7a987; letter-spacing:.24em; }
.journey-brand-emblem { display:block; width:52px;height:52px;object-fit:contain;margin:0 auto 4px;mix-blend-mode:screen; }
body.journey-open .section-label { color:#d8c69e; border-bottom-color:#555546; }
body.journey-open[data-journey-page="home"] #route,
body.journey-open[data-journey-page="home"] .ov-stats,
body.journey-open[data-journey-page="home"] .wave-label,
body.journey-open[data-journey-page="home"] .wave-modes,
body.journey-open[data-journey-page="home"] .wave-note { display:none; }
body.journey-open[data-journey-page="home"] .title-card { padding-top:22px; }
body.journey-open[data-journey-page="home"] .section-label:not(.wave-label) { display:none; }
body.journey-open[data-journey-page="home"] .intro { display:none; text-align:center; font:italic 17px Georgia,serif; color:#d9cba9; margin:8px 0 14px; }
body.journey-open[data-journey-page="home"] #enter-btn { order:-1; min-height:58px; border-color:#67dbb2; background:linear-gradient(110deg,#164f45,#16765c,#174f49); color:#f2dfb4; font:700 19px Georgia,serif; letter-spacing:.08em; box-shadow:0 0 20px #14af7955,inset 0 0 0 2px #5dcc9b55; }
body.journey-open[data-journey-page="home"] .home-shortcuts { order:0; }
body.journey-open[data-journey-page="home"] .ov-actions { display:flex; flex-direction:column; }
body.journey-open[data-journey-page="home"] #title-gear { display:none; }
body.journey-open[data-journey-page="dungeons"] .route { display:flex; flex-direction:column; gap:9px; }
body.journey-open[data-journey-page="dungeons"] .title-card { display:flex; flex-direction:column; }
body.journey-open[data-journey-page="dungeons"] .title-card > .brand { order:0; }
body.journey-open[data-journey-page="dungeons"] .title-card > .intro { order:1; }
body.journey-open[data-journey-page="dungeons"] .title-card > .ov-actions { order:2; }
body.journey-open[data-journey-page="dungeons"] .title-card > .section-label { order:3; }
body.journey-open[data-journey-page="dungeons"] .title-card > .route { order:4; }
body.journey-open[data-journey-page="dungeons"] .title-card > .ov-stats { order:5; }
body.journey-open[data-journey-page="dungeons"] .featured-expedition { position:relative; min-height:clamp(150px,25vh,210px); display:flex; align-items:end; overflow:hidden; margin:4px 0 10px; padding:0; border:1px solid #6f7767; background-size:cover; background-position:center 38%; box-shadow:inset 0 0 0 3px #111b20,0 8px 20px #0008; }
body.journey-open[data-journey-page="dungeons"] .featured-copy { width:100%; padding:12px; background:linear-gradient(0deg,#071014e8,transparent); }
body.journey-open[data-journey-page="dungeons"] .featured-copy h2 { margin:4px 0 8px; color:#f0e2c2; font:600 clamp(21px,6vw,28px) Georgia,serif; text-shadow:0 2px 8px #000; }
body.journey-open[data-journey-page="dungeons"] .featured-copy .eyebrow { color:#d9c89f; font:600 10px var(--mono); letter-spacing:.14em; }
body.journey-open[data-journey-page="dungeons"] #enter-btn { min-height:50px; }
body.journey-open[data-journey-page="dungeons"] .title-card > .brand { padding-bottom:4px; }
body.journey-open[data-journey-page="dungeons"] .route-card { min-height:76px; padding:12px; border-radius:3px; background:linear-gradient(100deg,#172627,#101619); }
body.journey-open[data-journey-page="dungeons"] .route-card.sel { border-color:#57c9a0; box-shadow:inset 0 0 0 1px #57c9a066,0 0 14px #1dbf8333; }
body.journey-open[data-journey-page="dungeons"] .ov-actions { margin-top:12px; }
body.journey-open[data-journey-page="dungeons"] .home-shortcuts { display:none; }
body.journey-open[data-journey-page="dungeons"] .ov-actions .wave-modes,
body.journey-open[data-journey-page="dungeons"] .ov-actions .section-label { display:none; }
body.journey-open[data-journey-page="challenges"] .challenge-screen { text-align:center; padding:24px 18px; }
body.journey-open[data-journey-page="challenges"] .challenge-screen .tagline { font:italic 18px Georgia,serif; text-transform:none; letter-spacing:.04em; }
body.journey-open #panel-gear { background:radial-gradient(ellipse at 50% 0,#142a30,#0a0e12 55%); }
.wanderer-heading { min-height:176px; display:flex; align-items:center; justify-content:center; gap:14px; padding:8px 12px; margin:-14px -14px 14px; text-align:left; border-bottom:1px solid #505246; background:radial-gradient(ellipse at 20% 100%,#244541,#172c30 50%,#0d1519); }
.wanderer-heading canvas { flex:0 0 154px; width:154px; height:172px; image-rendering:pixelated; background:radial-gradient(ellipse at 50% 85%,#84917448,transparent 65%); }
.wanderer-heading .eyebrow { color:#c8b489; font:11px var(--mono); letter-spacing:.2em; }
.wanderer-heading h2 { color:#e4d3af; font:30px Georgia,serif; margin:4px 0; }
.wanderer-heading p { color:#aeb6ad; margin:0; font:14px Georgia,serif; }
.gear-tab { border-radius:2px; }
@media(max-width:340px) { .wanderer-heading { gap:6px; padding:6px; } .wanderer-heading canvas { flex-basis:138px;width:138px;height:154px; } .wanderer-heading h2 { font-size:23px; } }
.challenge-modes { display:grid; gap:12px; grid-template-columns:1fr; margin:18px 0; }
.home-shortcuts { display:grid; gap:9px; grid-template-columns:1fr 1fr; margin:14px 0; }
.home-shortcuts button { min-height:68px; padding:10px; border:1px solid #55594e; background:linear-gradient(145deg,#1a2828,#101719); color:#e0d1b2; font:600 15px Georgia,serif; text-align:left; cursor:pointer; }
.home-shortcuts button:last-child { grid-column:1/-1; }
.home-shortcuts span { display:block; color:#a9b3a7; font:12px var(--sans); margin-top:4px; }
.challenge-modes .wave-mode { min-height:100px; }
/* Controls remain large and legible on both narrow and wide phones. */
.gear-disclosure { margin: 10px 0; border: 1px solid #596257; background: #111b1d; }
.gear-disclosure > summary { min-height: 44px; display: flex; align-items: center; padding: 10px 12px; color: #e4d3af; font: 600 15px Georgia, serif; cursor: pointer; }
.gear-disclosure > summary::after { content: '+'; margin-left: auto; color: #78e2c4; font-size: 20px; }
.gear-disclosure[open] > summary::after { content: '−'; }
.gear-disclosure > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.gear-disclosure .gear-filters { padding: 0 10px; }
.gear-disclosure [data-reset-inventory] { margin: 4px 10px 12px; min-height: 44px; }
.inventory-count { color: #d5c7a8; margin: 8px 0; }
.inventory-active { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px; margin:8px 0; border:1px solid #596257; background:#111b1d; color:#d5c7a8; font:11px var(--mono); letter-spacing:.04em; }
.inventory-active > span { min-width:0; }
.inventory-active .btn { flex:none; }
.workshop-heading { color: #e4d3af; font: 600 20px Georgia, serif; margin: 16px 0 8px; }
.challenge-modes { grid-template-columns: 1fr; }
@media(max-width:340px) { #journey-nav { padding-left:0;padding-right:0; } .journey-tab { font-size:10px; } .journey-icon { width:22px;height:22px; } }

.tab {
  min-height: 52px;
  border: 0;
  border-top: 2px solid transparent;
  background: transparent;
  color: var(--dim-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.tab.on { color: var(--cyan); border-top-color: var(--cyan); }
.tab:active { background: rgba(57, 215, 196, .07); }

/* ── the notice zone (the priority notification queue) ───────────────────── */

/* The zone is a LAYER, not a modal: it never takes focus, never captures a
   pointer, and it sits UNDER the overlay (z-index 10), so a banner can never
   cover the Results panel's buttons or the title card. */
.toast-zone {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 9;
}

/* While a run is on, the zone steps aside from the skill bar's column, so a
   banner never covers Nova or Blink. */
.toast-zone.inset { right: 84px; }

.toast-item {
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: rgba(17, 21, 29, .96);
  color: var(--text);
  font-size: 12px;
  text-align: left;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.toast-item.show { opacity: 1; transform: translateY(0); }

.toast-item .ti-text { flex: 0 1 auto; }
.toast-item .ti-detail { flex: 1 0 100%; color: var(--dim); font-size: 11px; }
.toast-item .ti-glyph { font-size: 13px; line-height: 1; }

/* a passive unlock: a full-width bar with a left accent rule, the name in
   caps. It is the one notice that is also announced assertively. */
.toast-item.passive {
  width: 100%;
  border-left: 3px solid var(--accent);
  background: rgba(16, 185, 129, .14);
}
.toast-item.passive .ti-text {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: .1em;
}

/* a rare find: the glyph AND the name, so the rarity is never carried by
   colour alone. */
.toast-item.rare_item {
  border-color: rgba(240, 180, 41, .55);
  background: rgba(240, 180, 41, .1);
}
.toast-item.rare_item .ti-glyph { color: var(--gold); }

/* a mastery rank: a thin bar, distinct from the passive's. */
.toast-item.mastery {
  padding: 5px 10px;
  border-width: 1px 0;
  border-radius: 0;
  background: rgba(20, 26, 36, .95);
}
.toast-item.mastery .ti-text { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }

/* an ordinary find: a plain small banner. */
.toast-item.item { padding: 6px 10px; }

/* a status message: the border the old toast used. */
.toast-item.status.good { border-color: rgba(16, 185, 129, .5); }
.toast-item.status_bad { border-color: rgba(229, 72, 77, .5); }

/* a room cleared: a one-line cue, no border. */
.toast-item.room_clear {
  padding: 3px 8px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 11px;
}

/* a material: a compact line, the smallest type. */
.toast-item.material {
  padding: 4px 9px;
  font-size: 11px;
  color: var(--dim);
  border-color: var(--line);
}

/* Visually hidden, still announced: the assertive announcement region. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── board (vote tab) — markup comes from js/board.js ───────────────────── */

.board-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.board-head > div:first-child { flex: 1; min-width: 0; }
.board-head h3 { margin-bottom: 3px; }
.board-head p { font-size: 11px; }

.board-wallet {
  flex: 0 0 auto;
  text-align: right;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(240, 180, 41, .35);
  background: rgba(240, 180, 41, .08);
}
.board-wallet .amt { display: block; font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--gold); }
.board-wallet .sym { display: block; font-family: var(--mono); font-size: 9px; color: var(--dim-2); }

.pool-strip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 12px;
}
.pool-strip > span:first-child {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--dim-2);
}
.pool-strip b { font-family: var(--mono); font-size: 13px; color: var(--gold); }
.pool-strip .dim { font-size: 10px; margin-left: auto; }

.next-card {
  padding: 14px;
  border-radius: var(--r);
  border: 1px solid rgba(57, 215, 196, .45);
  background: linear-gradient(180deg, rgba(57, 215, 196, .09), rgba(57, 215, 196, .02));
  margin-bottom: 14px;
}
.next-card .tag { display: inline-block; margin-bottom: 8px; }
.next-card h4 { margin: 0 0 4px; font-size: 15px; }
.next-card p { margin: 0 0 10px; font-size: 12px; color: var(--dim); }
.next-card .votebar { margin-top: 10px; }

.votemeta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim-2);
}

.task-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.task {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
}
.task.done { opacity: .62; }
.task-main { flex: 1; min-width: 0; }
.task-main h6 { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.task-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 10px; }

.status {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .1em;
  padding: 2px 6px;
  border-radius: 4px;
}
.status.plan { background: rgba(240, 180, 41, .16); color: var(--gold); }
.status.prop { background: rgba(143, 163, 184, .16); color: var(--dim); }
.status.done { background: rgba(16, 185, 129, .16); color: var(--accent); }

.task-side { flex: 0 0 auto; }

.contract { margin-top: 8px; }
.contract summary {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan);
  cursor: pointer;
  list-style: none;
  padding: 3px 0;
}
.contract summary::-webkit-details-marker { display: none; }
.contract summary::before { content: '+ '; }
.contract[open] summary::before { content: '− '; }
.contract dl { margin: 6px 0 0; display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; }
.contract dt {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim-2);
}
.contract dd { margin: 0; font-size: 11px; }

.votebtn {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, .5);
  background: rgba(16, 185, 129, .12);
  color: #6ee7b7;
  cursor: pointer;
  white-space: nowrap;
}
.votebtn.voted { background: transparent; border-color: var(--line-2); color: var(--dim); }
.votebtn.shipped { background: transparent; border-color: var(--line-2); color: var(--dim-2); cursor: default; }
.votebtn .undo {
  border: 0;
  background: none;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 9px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 0 0 4px;
}

.propose-btn {
  width: 100%;
  min-height: var(--tap);
  border-radius: var(--r);
  border: 1px dashed var(--line-2);
  background: transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  cursor: pointer;
}
.propose-btn.hidden { display: none; }

.propose-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
}
.propose-form.hidden { display: none; }
.propose-form label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim-2);
}
.propose-form input, .propose-form textarea, .propose-form select {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #0d1119;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
}
.propose-form textarea { min-height: 72px; resize: vertical; }
.propose-form input:focus, .propose-form textarea:focus, .propose-form select:focus { outline: 1px solid var(--cyan); }

.board-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.board-foot p { margin-top: 8px; }

.changelog { margin-top: 18px; }
.changelog .log {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.changelog .log b { font-family: var(--mono); font-size: 10px; color: var(--cyan); margin-right: 6px; }
.changelog .log p { margin: 3px 0 0; }

/* ── landscape / wide: keep the portrait column, just wider ────────────── */

@media (min-width: 620px) {
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* Short screens: the title card must fit without scrolling, or the primary
   action ends up below the fold on a small phone. */
@media (max-height: 720px) {
  .ov-card { padding: 12px 12px 10px; }
  .brand h1 { font-size: 21px; }
  .brand .tagline { font-size: 10px; }
  .intro { font-size: 11px; margin-bottom: 8px; }
  .ov-stats { margin: 8px 0; padding: 6px 0; }
  .ov-stats b { font-size: 14px; }
  .route-card { padding: 7px 9px; }
  .rc-rooms { display: none; }
  .btn.big { min-height: 42px; }
  .foot { display: none; }
}

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

/* ── a phone: the small text has to be READABLE ──────────────────────────
   The design is a dense one, and on a phone at arm's length the 8px and
   10px text is not readable: the results screen and the gear panel both
   carry facts the player is meant to READ, and a fact in text too small
   to read is a fact that is not being told.

   So on a narrow viewport the small type is scaled up rather than the
   layout being changed: the same words, at a size a thumb-held phone can
   show. The dimmed colours are lifted at the same time, because the
   secondary text is exactly the text that was hardest to read.

   This does NOT change the desktop layout: a wide window has room for the
   compact type, and the density there is deliberate. */
@media (max-width: 420px) {
  /* THE TITLE CARD CARRIES ONE MORE CHOICE THAN IT USED TO. Two competition
     modes on the same authored week is a wider entry, and at 390x844 the
     extra row pushed the primary action below the fold -- measured, not
     guessed. The chrome around the expedition list is tightened by the same
     declarations the short-screen rule already uses; the list's CONTENT is
     untouched, so nothing the player reads is removed. */
  .ov-card { padding: 12px 12px 10px; }
  .brand h1 { font-size: 21px; }
  .brand .tagline { font-size: 10px; }
  .intro { font-size: 11px; margin-bottom: 8px; }
  .ov-stats { margin: 8px 0; padding: 6px 0; }
  .ov-actions { gap: 6px; }
  .btn.wave-mode { min-height: 54px; }
  /* THE TITLE CARD FITS ITS SCROLLPORT, NOT THE VIEWPORT. #overlay and #view
     both clip, so a control whose box ends below the scrollport is unreachable
     without scrolling even when the viewport still has room. Rather than tune
     the card's height by hand, the card is capped to the scrollport and the
     expedition list -- the only element on it that grows without bound --
     absorbs the difference. Every control then sits inside the clipping
     ancestor by construction, at any phone height. */
  .ov-card.title-card {
    max-height: 100%;
    display: flex;
    flex-direction: column;
  }
  .ov-card.title-card > * { flex: 0 0 auto; }
  .ov-card.title-card .route {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
  .tiny { font-size: 12px; }
  .res-row .dim { font-size: 12px; }
  .res-item-main .dim { font-size: 12px; }
  .res-item-source { font-size: 11px; }
  .rc-band.base .dim { font-size: 10px; }
  .sink-list .dim, .check-list .dim { font-size: 12px; }
  .pool-strip .dim { font-size: 12px; }
  .foot { font-size: 11px; }
  .brand .tagline { font-size: 11px; }

  /* THE SECONDARY TEXT IS LIFTED, NOT JUST ENLARGED. --dim-2 was the
     least legible colour in the game and it is used on exactly the
     supporting lines a player is asked to read. */
  :root {
    --dim: #a9bccf;
    --dim-2: #8598ad;
  }

  /* AND THE SMALL BUTTONS GROW TO A THUMB. A 30px target is not a target
     on a phone; 44px is the smallest that is reliably tappable. */
  .btn.tiny { min-height: 44px; padding: 0 12px; font-size: 11px; }
}

/* ── the gear screen: four sections, one inspector ────────────────────────────
   The gear panel is one long scroll in the old build, and every row in it
   looked like every other row. The section nav is sticky, so the player
   always knows which of the four questions they are looking at, and the
   controls are big enough for a thumb. */

.gear-nav {
  position: sticky;
  top: -14px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: -14px -14px 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.gear-tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  cursor: pointer;
}

.gear-tab.on {
  color: var(--cyan);
  border-color: rgba(57, 215, 196, .45);
  background: rgba(57, 215, 196, .1);
}

.gear-tab:active { transform: scale(.98); }

.gear-hint { margin: 0 0 10px; }

.gear-stack { display: flex; flex-direction: column; gap: 8px; }

.gear-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.gear-card .card-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim-2);
  margin-bottom: 8px;
}

.gear-card .card-title + .slot-item { margin-bottom: 6px; }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* An equipped slot is a ROW now, not a tall card: the row carries the slot
   label, the item and its numbers, and opens the inspector. The class stays
   because it says what the row IS. */
.slot-card { display: flex; align-items: center; gap: 10px; min-height:76px; border:1px solid #71674f; border-radius:4px; background:linear-gradient(110deg,#1c2928,#11191b); box-shadow:inset 0 0 0 2px #11191b,inset 0 0 0 3px #71674f55; }
.slot-card .inv-main { padding:8px 4px; }
.slot-card:not(.unavailable-slot) .inspect-cue { color:#78e2c4; }

/* the filter and sort chips: a row of small targets, never a search box */
.gear-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}

.sort-label { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; }

.chip {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  cursor: pointer;
}

.chip.on { color: var(--cyan); border-color: rgba(57, 215, 196, .45); background: rgba(57, 215, 196, .1); }
.chip:active { transform: scale(.98); }

/* the derived numbers, in a grid a thumb can read */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-grid > div {
  background: var(--panel-2);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  min-width: 0;
}

.stat-grid b {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.stat-grid span { font-size: 10px; color: var(--dim-2); }

/* a labelled value: what it is, and what it does */
.stat-lines { display: flex; flex-direction: column; gap: 4px; }

.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.stat-line:last-child { border-bottom: 0; }
.stat-line > span:last-child { text-align: right; }

/* the inventory row: the whole row opens the inspector, and the row's own
   button is a real target rather than a dot */
.inv-row { align-items: flex-start; }

.inv-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 44px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.inv-main b { font-size: 13px; }
.inv-main span { display: block; }

.row-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

/* the row buttons are small, but they are not tiny: a thumb has to hit them */
#panel-gear .btn.tiny { min-height: 44px; padding: 0 12px; }
#panel-gear [data-craft] { min-height: 44px; }
#panel-gear [data-inspect] { min-height: 44px; }

/* what a recipe is missing, said plainly */
.cost-missing { color: var(--gold); font-size: 11px; }
.cost-ok { color: var(--accent); font-size: 11px; }

/* the passive slots */
.passive-slots { display: flex; gap: 8px; margin-bottom: 10px; }

.passive-slot {
  flex: 1;
  min-width: 0;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
}

.passive-slot.filled { border-style: solid; border-color: rgba(57, 215, 196, .35); }
.passive-slot .slot-label { display: block; margin-bottom: 2px; }
.passive-slot b { display: block; font-size: 12px; }

/* ── the item inspector ──────────────────────────────────────────────────────
   ONE component. It covers the panels and the results card, it scrolls on
   its own, and it never rebuilds the page underneath it. */

#inspector {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(env(safe-area-inset-bottom) + 20px);
}

#inspector.hidden { display: none; }

/* The first keyboard target must be visible above the item content, rather
   than focusing the old Back button at the end of a long inspector. */
.insp-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px;
  min-height:44px; padding-bottom:8px; border-bottom:1px solid var(--line); }
.insp-toolbar .btn { min-height:44px; }
.insp-toolbar > span { color:var(--dim); font:600 11px var(--mono); letter-spacing:.1em; }

.insp { display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.insp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.insp-head b { font-size: 15px; }

.insp-body { display: flex; flex-direction: column; gap: 10px; }

.insp-block {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  padding: 10px 12px;
}

.insp-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim-2);
  margin-bottom: 8px;
}

/* a comparison line: the value, and the difference */
.cmp {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}

.cmp:last-child { border-bottom: 0; }
.cmp > span:nth-child(2) { text-align: right; font-family: var(--mono); font-size: 11px; }
.cmp .up { color: var(--accent); font-family: var(--mono); font-size: 11px; }
.cmp .down { color: var(--gold); font-family: var(--mono); font-size: 11px; }
.cmp .flat { color: var(--dim-2); font-family: var(--mono); font-size: 11px; }
.cmp.missing > span:first-child { color: var(--gold); }

/* the swap: what you wear, what you would wear, and what it means.
   A gain and a loss are told apart by the ARROW and the SIGN as well as by
   the colour, so the reading does not depend on seeing the colour. */
.cmp.up > span:first-child { color: var(--accent); }
.cmp.down > span:first-child { color: var(--gold); }
.cmp.flat > span:first-child { color: var(--dim-2); }

.cmp-vs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.cmp-vs b { font-size: 13px; }

.cmp-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--dim-2);
  margin: 10px 0 2px;
}

.cmp-read {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text);
}

.insp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.insp-actions .btn { flex: 1 1 120px; min-height: 44px; }

/* the name and its badges share a line, so a row is one line of text and one
   target rather than three */
/* the selector has to beat `.inv-main span`, which makes a span a block */
.inv-main .inv-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.inv-title b { font-size: 13px; }

/* a recipe: the name, the exact cost, and what is missing */
.inv-row.recipe { flex-direction: column; align-items: stretch; gap: 8px; }
.recipe-main { display: flex; flex-direction: column; gap: 4px; }
.recipe-main b { font-size: 13px; }

.cost-list { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }

.cost-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.cost-line.short > span:first-child { color: var(--gold); }

/* a list inside a card is one list, not a stack of cards */
.gear-card .inv-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
  margin-bottom: 0;
}

.gear-card .inv-row:last-of-type { border-bottom: 0; }

/* the two experimental modules, behind MORE: they keep their own tab
   buttons, and they look like the rows they live in */
#panel-more .tab {
  display: block;
  flex: 0 0 auto;
  width: auto;
  min-width: 104px;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-top-width: 1px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--dim);
  text-align: left;
}

#panel-more .tab.on { color: var(--cyan); border-color: rgba(57, 215, 196, .45); }
@media (min-width: 520px) { body.journey-open .title-card { max-width: 620px; } }
body.journey-open[data-journey-page="home"] .home-shortcuts { order: 0; }
body.journey-open[data-journey-page="home"] .featured-expedition { order: -1; position: relative; overflow: hidden; min-height: clamp(150px, 29vh, 238px); display: flex; align-items: end; margin: 8px 0 12px; border: 1px solid #6f7767; background: linear-gradient(90deg,#071016bb 0%,#08131755 55%,#08101433),linear-gradient(0deg,#071014 0%,transparent 75%),var(--expedition-art,linear-gradient(135deg,#172b2d,#0b1117)); background-size: cover; background-position: center 38%; box-shadow: inset 0 0 0 3px #111b20,0 8px 20px #0008; }
body.journey-open .featured-copy { width: 100%; padding: 14px; }
body.journey-open .featured-copy .eyebrow { color:#b9c4ae; font:600 10px var(--mono); letter-spacing:.14em; }
body.journey-open .featured-copy h2 { margin:4px 0 10px; color:#f0e2c2; font:600 clamp(21px,6vw,30px) Georgia,serif; text-shadow:0 2px 8px #000; }
body.journey-open[data-journey-page="home"] #enter-btn { min-height:52px; font-size:clamp(15px,4.5vw,19px); }
.home-shortcuts button { display:grid; grid-template-columns:38px 1fr; align-items:center; column-gap:9px; min-height:76px; }
.home-shortcuts button>b { align-self:end; }
.home-shortcuts button>span:last-child { grid-column:2; align-self:start; }
.shortcut-icon { grid-row:1/3; width:38px;height:38px;background:#c5b58f; -webkit-mask:url("../assets/ui/alpha-navigation/icons/dungeons.svg") center/contain no-repeat; mask:url("../assets/ui/alpha-navigation/icons/dungeons.svg") center/contain no-repeat; }
.shortcut-icon.challenge { -webkit-mask-image:url("../assets/ui/alpha-navigation/icons/challenges.svg");mask-image:url("../assets/ui/alpha-navigation/icons/challenges.svg"); }
.home-wanderer { width:100%; min-height:72px; display:flex; align-items:center; gap:10px; padding:6px 10px; color:#e4d3af; text-align:left; border:1px solid #596257; background:linear-gradient(120deg,#132423,#0c1418); cursor:pointer; }
.home-wanderer canvas { flex:none; width:52px;height:60px; image-rendering:pixelated; }
.home-wanderer>span:nth-child(2) { flex:1;min-width:0; }
.home-wanderer small { display:block; margin-top:3px; color:#aeb6ad; overflow-wrap:anywhere; }
.route-card { display:flex!important; align-items:stretch; gap:10px; }
.route-art { flex:none; width:76px; min-height:58px; object-fit:cover; align-self:stretch; border:1px solid #58615a; }
.route-copy { flex:1; min-width:0; }
.route-copy .rc-head { display:flex; flex-wrap:wrap; gap:5px 8px; align-items:center; }
.route-copy .rc-sub,.route-copy .rc-frontier,.route-copy .rc-lockreq { font-size:12px; }
body.journey-open[data-journey-page="dungeons"] .route { gap:7px; }
body.journey-open[data-journey-page="dungeons"] .title-card { max-height:none; }
body.journey-open[data-journey-page="dungeons"] #route { max-height:none; overflow:visible; overscroll-behavior:auto; }
body.journey-open[data-journey-page="dungeons"] .route-card { min-height:82px; }
body.journey-open[data-journey-page="dungeons"] .route-card.sel { background:linear-gradient(100deg,#164039,#11191a); }
body.journey-open[data-journey-page="dungeons"] .route-entry.locked,
body.journey-open[data-journey-page="dungeons"] .route-card.locked { opacity:1; }
body.journey-open[data-journey-page="dungeons"] .route-card.locked .route-art { filter:grayscale(.55) brightness(.82); }
body.journey-open[data-journey-page="challenges"] .challenge-modes .wave-mode { position:relative; text-align:left; padding:14px 14px 14px 62px; }
body.journey-open[data-journey-page="challenges"] .challenge-modes .wave-mode::before { content:""; position:absolute; left:16px;top:18px;width:32px;height:32px;background:#c7b78e; -webkit-mask:url("../assets/ui/alpha-navigation/icons/challenges.svg") center/contain no-repeat;mask:url("../assets/ui/alpha-navigation/icons/challenges.svg") center/contain no-repeat; }
body.journey-open[data-journey-page="challenges"] .challenge-modes .wave-mode:last-child::before { background:#75dfbc;-webkit-mask-image:url("../assets/ui/alpha-navigation/icons/wanderer.svg");mask-image:url("../assets/ui/alpha-navigation/icons/wanderer.svg"); }
@media (max-width: 340px) {
 body.journey-open .featured-expedition { min-height:145px; }
 .route-art { width:62px; }
 .home-shortcuts button { grid-template-columns:28px 1fr; padding:7px; font-size:13px; }
 .shortcut-icon { width:28px;height:28px; }
}
@media (max-width: 520px) {
 .gear-item-art { flex:0 0 46px !important; display:inline-flex; align-items:center; justify-content:center; width:46px;height:52px; border:1px solid #555e55; background:linear-gradient(145deg,#172321,#0d1416); color:var(--item-tint,#c7b78f); }
 .gear-item-art svg { width:30px;height:30px; }
 .item-main { display:flex;align-items:center;gap:10px;min-height:64px; }
 .item-copy { display:flex;flex:1;min-width:0;flex-direction:column;gap:3px; }
 .gear-tab { min-height:58px; display:flex; flex-direction:column;align-items:center;justify-content:center;gap:3px; }
 .gear-tab svg { width:23px;height:23px;flex:none; }
}
@media (min-width: 521px) {
 .gear-item-art { flex:0 0 58px !important;display:inline-flex;align-items:center;justify-content:center;width:58px;height:62px;border:1px solid #555e55;background:linear-gradient(145deg,#172321,#0d1416);color:var(--item-tint,#c7b78f); }
 .gear-item-art svg { width:38px;height:38px; }
 .gear-tab svg { width:22px;height:22px; }
}
.inv-row .gear-item-art { display:inline-flex !important; flex:0 0 44px !important; width:44px !important; height:48px !important; align-items:center; justify-content:center; overflow:hidden; color:var(--item-tint,#c7b78f); border:1px solid #555e55; background:linear-gradient(145deg,#172321,#0d1416); }
.inv-row .gear-item-art > svg { display:block; flex:none; width:28px !important; height:28px !important; max-width:28px; max-height:28px; }
.inv-row .item-main { flex-direction:row; align-items:center; gap:10px; }
.gear-tab > svg { display:block; width:22px; height:22px; flex:none; }
.gear-tab { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:3px; }
body.journey-open[data-journey-page="dungeons"] #enter-btn { min-height:48px; }
body.journey-open[data-journey-page="dungeons"] .rc-intel > summary { min-height:44px; display:flex; align-items:center; padding:8px 10px; cursor:pointer; }
body.journey-open[data-journey-page="home"] #enter-btn { white-space:nowrap; font-size:clamp(13px,4vw,17px); letter-spacing:.025em; padding-inline:6px; }

/* The card is the action: its visible label is real text and fills the phone. */
body.journey-open[data-journey-page="challenges"] .challenge-screen { width:calc(100vw - 24px); max-width:620px; padding:18px 12px; }
body.journey-open[data-journey-page="challenges"] .challenge-modes { width:100%; gap:12px; }
body.journey-open[data-journey-page="challenges"] .challenge-modes .wave-mode { width:100%; min-height:150px; padding:16px 14px 16px 60px; }
body.journey-open[data-journey-page="challenges"] .challenge-modes .mode-sub { font-size:13px; line-height:1.4; }
body.journey-open[data-journey-page="challenges"] .challenge-modes .mode-sub::after { content:none; }
.challenge-action { display:flex; align-items:center; justify-content:center; min-height:48px; margin-top:10px; padding:8px; border:1px solid #39b78f; background:#154539; color:#f2e8d1; font:600 14px var(--sans); }
.recipe-library > summary { gap:6px; }
body.journey-open[data-journey-page="dungeons"] .route-art { width:clamp(88px,28vw,132px); aspect-ratio:16/9; }
.gear-item-art img { display:block; width:90%; height:90%; object-fit:contain; image-rendering:pixelated; }
.gear-item-art { position:relative; overflow:hidden; }
.gear-item-art.has-sprite > svg { display:none; }
.gear-sprite-single { position:absolute; z-index:1; inset:0; width:100% !important; height:100% !important; object-fit:contain !important; image-rendering:pixelated; }
.gear-sprite-window { position:absolute; z-index:1; inset:0; overflow:hidden; }
.gear-sprite-sheet { position:absolute; left:0; top:var(--sprite-top,0); width:var(--sprite-width) !important; height:var(--sprite-height) !important; max-width:none !important; max-height:none !important; object-fit:fill !important; image-rendering:pixelated; }
.catalog-recipe-summary::after { content:'+'; flex:none; color:#81d6b4; font:600 18px Georgia,serif; }
.catalog-recipe[open] > .catalog-recipe-summary::after { content:'−'; }
.catalog-more > summary::after { content:'+'; margin-left:auto; color:#81d6b4; font:600 18px Georgia,serif; }
.catalog-more[open] > summary::after { content:'−'; }
.destination-subtitle { display:block; margin:-6px 0 10px; color:#d0d7cb; font:italic 13px Georgia,serif; text-shadow:0 1px 6px #000; }
body.journey-open .featured-expedition::before { content:''; position:absolute; inset:0; pointer-events:none; background:linear-gradient(135deg,transparent 18%,rgba(5,13,14,.34) 100%); mix-blend-mode:soft-light; }
body.journey-open .featured-copy { position:relative; z-index:1; }
body.journey-open .featured-expedition[data-dungeon-id='first-vigil']::before { background:linear-gradient(135deg,rgba(126,78,36,.3),rgba(8,14,16,.05) 60%); }
body.journey-open .featured-expedition[data-dungeon-id='ossuary-descent']::before { background:linear-gradient(125deg,rgba(30,103,111,.32),rgba(8,14,16,.04) 62%); }
body.journey-open .featured-expedition[data-dungeon-id='ash-vault']::before { background:linear-gradient(135deg,rgba(132,69,32,.42),rgba(24,19,14,.04) 64%); }
body.journey-open .featured-expedition[data-dungeon-id='sundered-keep']::before { background:linear-gradient(135deg,rgba(43,75,104,.38),rgba(8,14,16,.04) 62%); }

body.journey-open[data-journey-page='dungeons'] .route-entry[data-dungeon-id='first-vigil'] .route-art { object-position:right center; }
body.journey-open[data-journey-page='dungeons'] .route-entry[data-dungeon-id='ossuary-descent'] .route-art { object-position:right center; }
body.journey-open[data-journey-page='dungeons'] .route-entry[data-dungeon-id='ash-vault'] .route-art { object-position:right center; }
body.journey-open[data-journey-page='dungeons'] .route-entry[data-dungeon-id='sundered-keep'] .route-art { object-position:right center; }
.gear-item-art.insp-art-large { flex:0 0 112px !important; width:112px !important; height:112px !important; border-color:#8b7850; background:radial-gradient(circle at 50% 36%,#293b35,#0b1114 78%); box-shadow:inset 0 0 0 3px #10191a,inset 0 0 0 4px #9c825044,0 6px 18px #0007; }
.gear-item-art.insp-art-large > svg { width:58px; height:58px; }
.insp-head { align-items:flex-start; flex-wrap:nowrap; gap:14px; padding:10px 0 12px; }
.insp-title { flex:1; min-width:0; }
.insp-title b { overflow-wrap:anywhere; }
.inspector-primary-stats { display:flex; flex-wrap:wrap; gap:6px; width:100%; margin-top:4px; }
.item-stat-pill { display:flex; flex-direction:column; gap:2px; min-width:96px; padding:6px 8px; border:1px solid #5c705e; background:linear-gradient(135deg,#1b3028,#10191a); }
.item-stat-pill b { color:#b5e1bf; font:600 13px Georgia,serif; }
.item-stat-pill small,.item-stat-hidden { color:#bac8bc; font-size:11px; line-height:1.35; }
@media (max-width:380px) { .gear-item-art.insp-art-large { flex-basis:88px !important; width:88px !important; height:88px !important; } .insp-head { gap:10px; } }

.catalog-recipe { border-bottom:1px solid #35433e; background:linear-gradient(100deg,#142120,#0e1719); }
.catalog-recipe-summary { display:flex; align-items:center; gap:10px; min-height:58px; padding:6px 8px; cursor:pointer; list-style:none; }
.catalog-recipe-summary::-webkit-details-marker { display:none; }
.catalog-recipe-summary:focus-visible,.catalog-more > summary:focus-visible { outline:2px solid var(--gold); outline-offset:-2px; }
.catalog-recipe-summary .gear-item-art { flex:0 0 42px !important; width:42px !important; height:44px !important; }
.catalog-recipe-summary .gear-item-art > svg { width:26px !important; height:26px !important; }
.catalog-recipe-name { display:flex; flex:1; min-width:0; flex-direction:column; gap:2px; }
.catalog-recipe-name b { color:#e6dfd0; font:600 14px Georgia,serif; overflow-wrap:anywhere; }
.catalog-recipe-name small { color:#aebcb3; font-size:11px; }
.catalog-recipe-state { flex:none; color:#e4c592; font:600 10px var(--mono); letter-spacing:.04em; text-align:right; }
.catalog-recipe-state.ready { color:#91dfb4; }
.catalog-recipe-state.unavailable { color:#adb3b0; }
.catalog-recipe-detail { padding:0 10px 10px 60px; }
.catalog-costs { display:grid; gap:4px; }
.catalog-cost { display:flex; align-items:center; gap:8px; min-height:30px; color:#d7ded8; font-size:12px; }
.catalog-cost .material-art { flex-basis:26px; width:26px; height:26px; }
.catalog-cost > span:nth-child(2) { flex:1; min-width:0; }
.catalog-cost b { color:#c4d0c5; font:500 11px var(--mono); white-space:nowrap; }
.catalog-actions { display:flex; gap:8px; margin-top:8px; }
.catalog-actions .btn { flex:1; min-height:44px; }
.catalog-unavailable { margin:0 0 8px; }
.catalog-more { margin-top:8px; border:1px solid #566257; background:#111b1d; }
.catalog-more > summary { display:flex; align-items:center; min-height:48px; padding:8px 12px; color:#d8c69e; font:600 13px Georgia,serif; cursor:pointer; }
.catalog-more .catalog-recipe:first-of-type { border-top:1px solid #35433e; }

body.journey-open[data-journey-page="dungeons"] .route-art { width:clamp(88px,28vw,120px); min-height:74px; aspect-ratio:4/3; object-position:center; border-color:#726b56; box-shadow:inset 0 0 0 2px #0b1113,0 3px 9px #0008; }
body.journey-open[data-journey-page="dungeons"] [data-dungeon-id="first-vigil"] .route-art { object-position:right center; filter:saturate(.9) sepia(.12) contrast(1.06); }
body.journey-open[data-journey-page="dungeons"] [data-dungeon-id="ossuary-descent"] .route-art { object-position:right center; filter:saturate(.78) hue-rotate(155deg) contrast(1.1); }
body.journey-open[data-journey-page="dungeons"] [data-dungeon-id="ash-vault"] .route-art { object-position:right center; filter:saturate(1.2) sepia(.3) hue-rotate(345deg) contrast(1.06); }
body.journey-open[data-journey-page="dungeons"] [data-dungeon-id="sundered-keep"] .route-art { object-position:right center; filter:saturate(.7) hue-rotate(178deg) brightness(.88) contrast(1.14); }
.ability-icon { display:inline-flex; flex:0 0 32px; width:32px; height:32px; align-items:center; justify-content:center; color:#c7b78f; border:1px solid #596257; background:#111b1d; }

/* Player-first hierarchy for item details, recipe costs and filtered inventory. */
.insp-head { align-items:center; gap:12px; }
.insp-head .gear-item-art { flex:0 0 56px; width:56px; height:58px; }
.insp-title { display:flex; flex-direction:column; align-items:flex-start; gap:4px; min-width:0; }
.insp-title b { font:600 20px Georgia,serif; }
.insp-advanced { border:1px solid var(--line); background:var(--panel-2); }
.insp-advanced > summary { min-height:48px; display:flex; align-items:center; padding:10px 12px; color:var(--text); font:600 14px Georgia,serif; cursor:pointer; }
.insp-advanced[open] { display:flex; flex-direction:column; gap:8px; padding:0 8px 8px; }
.recipe-availability { color:#d7c295; font-size:13px; line-height:1.35; }
.recipe-availability.ready { color:#8de1b7; font-weight:700; }
.inventory-empty { display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding:14px; border:1px solid #596257; background:linear-gradient(135deg,#182725,#101719); }
.inventory-empty p { margin:0; font-size:15px; line-height:1.45; }
.inventory-empty button { min-height:48px; }
.ability-icon svg { width:23px; height:23px; }
body.journey-open[data-journey-page="home"] .home-shortcuts { grid-template-columns:1fr; }
body.journey-open[data-journey-page="home"] .home-shortcuts button { min-height:80px; background-size:cover; background-position:center; }
body.journey-open[data-journey-page="home"] .home-shortcuts button:first-child { background-image:linear-gradient(105deg,#1a302b,#0d1819); }
body.journey-open[data-journey-page="home"] .home-shortcuts button:last-child { grid-column:auto; background-image:linear-gradient(105deg,#263024,#0e191a); }
body.journey-open[data-journey-page="home"] .brand { background:linear-gradient(0deg,#0b1619 0%,#0b1619b3 65%,#0b161980),url('../assets/ui/alpha-navigation/home-landscape.webp') center/cover; padding:12px; }
.equipment-slots { display:grid; grid-template-columns:minmax(0,1fr); gap:7px; }
.gear-card .equipment-slots .slot-card, .gear-card .equipment-slots .slot-card:last-of-type { display:flex; flex-direction:row; align-items:center; gap:8px; min-width:0; padding:8px; border:1px solid #48554a; background:linear-gradient(105deg,#1b2924,#10191a); }
.equipment-slots .slot-card .inv-main { display:flex; width:100%; min-width:0; flex:1; flex-direction:row; align-items:center; gap:10px; text-align:left; }
.equipment-slots .slot-card .item-copy { align-items:flex-start; width:auto; min-width:0; overflow-wrap:anywhere; }
.equipment-slots .slot-card .inv-title { justify-content:flex-start; }
.equipment-slots .slot-card .inspect-cue { font-size:12px; }
.equipment-slots .slot-card .btn { width:auto; min-width:82px; min-height:44px; padding-inline:7px; }
@media(max-width:340px) {
  .gear-card .equipment-slots .slot-card { gap:5px; padding:7px 5px; }
  .equipment-slots .slot-card .inv-main { gap:6px; }
  .equipment-slots .slot-card .btn { min-width:72px; }
}
