/* Today's Journey — Release 2 "Feel": retro game UI/UX sweep.
   8-bit / classic JRPG presentation. Calm, shame-free soul; chunky pixels.
   Encounter modules (battle/sudoku/sage/traveler/puzzles/closet) inject their
   own scoped <style> blocks; this file covers the app shell screens + map. */

/* ---------- bundled pixel font ---------- */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/press-start-2p.woff2') format('woff2');
}

:root {
  --paper: #f7f4ec;
  --paper-deep: #efe9da;
  --ink: #2b2b26;
  --ink-soft: #5c5a50;
  --moss: #2e4038;
  --moss-deep: #223129;
  --moss-ink: #1a2620;
  --sage: #7d9b76;
  --gold: #c9a227;
  --gold-bright: #e8c46a;
  --clay: #b0714f;
  --cream: #f6f2e6;
  --card: #fffdf7;
  --danger: #a4442f;
  --tap: 48px;
  --font-px: 'Press Start 2P', monospace;
  --font-body: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --px-shadow: 4px 4px 0 rgba(26, 38, 32, 0.28);
  --title-glow: rgba(232, 196, 106, 0.35); /* R7.3: title halo color per theme */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* v7.3.2: document must never scroll horizontally on narrow phones.
   Internal scrollers (bottom nav, encounter body) keep their own overflow. */
html, body { max-width: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  /* clearance so the fixed bottom nav never covers the last control:
     #root is always at least viewport-tall, so this padding is reachable */
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}
#root {
  max-width: 480px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 2px; }

/* ---------- screens ---------- */
.screen { padding: 16px 16px 32px; }
.screen-setup {
  background:
    linear-gradient(180deg, var(--moss-deep) 0, var(--moss-deep) 300px, var(--paper) 300px);
}
.screen-cleared { background: linear-gradient(180deg, var(--moss-deep) 0, var(--moss-deep) 190px, var(--paper) 190px); }
.screen-camped { background: linear-gradient(180deg, var(--moss-deep) 0, var(--moss-deep) 150px, var(--paper) 150px); }
.app-header { color: var(--cream); padding: 22px 4px 16px; }
.app-title {
  margin: 0; font-family: var(--font-px); font-size: 21px; line-height: 1.5;
  color: var(--cream);
  /* R7.3: themeable soft halo behind the chunky pixel shadow */
  text-shadow: 3px 3px 0 var(--moss-ink), 0 0 18px var(--title-glow);
  letter-spacing: 1px;
}
.setup-date { margin: 10px 0 0; font-size: 13px; color: var(--gold-bright); font-family: var(--font-px); font-size: 10px; }
/* R7.1: app tagline — inherits parent color (dark or light), stays quiet. */
.tagline {
  margin: 8px 0 0; text-align: center;
  font-size: 11px; letter-spacing: 0.16em; line-height: 1.8;
  opacity: 0.55;
}
.error-text {
  color: #ffd9a8; background: rgba(0,0,0,0.35);
  border: 3px solid #ffd9a8; border-radius: 4px; padding: 8px 10px; font-size: 14px;
}
.hint { color: var(--ink-soft); font-size: 13px; margin: 6px 0 0; }
.screen-active .hint, .screen-cleared .hint, .screen-camped .hint { color: var(--ink-soft); }

/* ---------- pixel panels & fields ---------- */
.card {
  background: var(--card);
  border: 3px solid var(--moss-deep);
  border-radius: 4px;
  padding: 14px;
  margin: 14px 0;
  box-shadow: var(--px-shadow);
}
.card-title { margin: 0 0 10px; font-family: var(--font-px); font-size: 13px; line-height: 1.6; color: var(--moss-deep); }
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin: 10px 0 6px; font-family: var(--font-px); font-size: 10px; }
.text-input {
  width: 100%; min-height: var(--tap); font-size: 16px; font-family: var(--font-body);
  border: 3px solid var(--moss-deep); border-radius: 4px; padding: 10px 12px;
  background: #fff; color: var(--ink);
  box-shadow: inset 3px 3px 0 rgba(26, 38, 32, 0.08);
}
.voucher-card { border-left: 8px solid var(--gold); }

/* ---------- R7.7: prize tiers ---------- */
.prize-card { border-left: 8px solid var(--gold); }
.prize-opt { font-family: var(--font-body); font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.tier-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.tier-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tier-n-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); white-space: nowrap; }
.tier-n-input { width: 64px; flex: 0 0 auto; text-align: center; }
.tier-arrow { color: var(--ink-soft); font-weight: 700; }
.tier-text-input { flex: 1 1 140px; min-width: 120px; }
.prize-ladder { list-style: none; margin: 6px 0 8px; padding: 0; }
.prize-tier { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 2px dashed var(--ink-soft); flex-wrap: wrap; }
/* v7.8: edit prizes demoted to a quiet text button */
.prize-edit-link { background: none; border: none; color: var(--ink-soft); font-size: 12px; text-decoration: underline; cursor: pointer; padding: 10px 4px; min-height: 44px; font-family: inherit; }
.prize-tier:last-child { border-bottom: none; }
.prize-state { width: 20px; text-align: center; color: var(--ink-soft); flex: 0 0 auto; }
.prize-n { font-family: var(--font-px); font-size: 10px; color: var(--ink); white-space: nowrap; }
.prize-text { color: var(--ink); flex: 1 1 auto; }
.prize-tier-won .prize-text { font-weight: 700; }
.prize-won-tag { font-family: var(--font-px); font-size: 9px; color: var(--moss-deep); background: var(--gold); border-radius: 3px; padding: 3px 6px; }
.prize-edit { margin-top: 10px; border-top: 2px dashed var(--ink-soft); padding-top: 10px; }
.prize-edit .btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.prize-earned { margin-top: 10px; }
.prize-earned-title { font-family: var(--font-px); font-size: 11px; color: var(--ink); margin: 0 0 6px; }
.prize-earned-list { margin: 0; padding-left: 20px; color: var(--ink); }
.prize-earned-list li { margin-bottom: 4px; }

/* ---------- task editor ---------- */
.task-add { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.task-add .text-input { flex: 1 1 160px; }
.seg { display: flex; border: 3px solid var(--moss-deep); border-radius: 4px; overflow: hidden; box-shadow: var(--px-shadow); }
.seg-btn {
  border: 0; background: #fff; padding: 0 14px; min-height: var(--tap);
  font-family: var(--font-px); font-size: 11px; cursor: pointer; color: var(--moss-deep);
}
.seg-btn + .seg-btn { border-left: 3px solid var(--moss-deep); }
.seg-active { background: var(--moss); color: var(--cream); }
.task-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
/* v7.8: compact rows — ~68px, wider title column (Game Boy density) */
.task-row {
  display: flex; align-items: center; gap: 6px;
  background: #fff; color: #2b2b26; border: 2px solid var(--moss-deep); border-radius: 4px; padding: 6px 10px;
}
.task-title { font-size: 15px; line-height: 1.3; }
.task-title { flex: 1; overflow-wrap: anywhere; }
.task-row-done .task-title { text-decoration: line-through; color: var(--ink-soft); }
.task-done { color: var(--sage); font-weight: 700; }
.task-steps { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.size-badge {
  font-family: var(--font-px); font-size: 10px;
  border-radius: 4px; padding: 4px 6px;
  background: var(--moss-deep); color: var(--gold-bright); white-space: nowrap;
  border: 2px solid var(--moss-deep);
}
.size-S { color: #bfe3b4; } .size-M { color: var(--gold-bright); } .size-L { color: #f0a35e; }
.icon-btn {
  border: 3px solid var(--moss-deep); background: #fff; border-radius: 4px;
  min-width: 44px; min-height: 44px; font-size: 18px; cursor: pointer;
  box-shadow: 0 3px 0 var(--moss-deep);
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--moss-deep); }
.route-preview { font-size: 13px; color: var(--ink-soft); margin: 10px 2px 0; font-family: var(--font-px); font-size: 10px; line-height: 1.7; }

/* ---------- habit-pack picker (Tasks view) ---------- */
.pack-picker { margin-top: 10px; }
.pack-picker-label { display: block; font-family: var(--font-px); font-size: 10px; line-height: 1.7; color: var(--ink-soft); margin-bottom: 6px; }
.pack-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pack-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 3px solid var(--moss-deep); background: var(--card); color: var(--ink);
  border-radius: 4px; padding: 8px 10px; min-height: var(--tap);
  font-family: var(--font-px); font-size: 10px; line-height: 1.5; cursor: pointer;
  box-shadow: var(--px-shadow);
}
.pack-chip:active { transform: translateY(3px); box-shadow: none; }
.pack-chip-name { color: var(--ink); }
.pack-chip-count { color: var(--ink); opacity: 0.75; }

/* ---------- chunky buttons ---------- */
.btn {
  border: 3px solid var(--moss-deep); background: #fff; color: var(--moss-deep);
  border-radius: 4px; min-height: var(--tap); padding: 10px 18px;
  font-family: var(--font-px); font-size: 11px; line-height: 1.5; cursor: pointer;
  box-shadow: 0 4px 0 var(--moss-deep);
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--moss-deep); }
.btn-primary { background: var(--moss); color: var(--cream); }
.btn-secondary { background: var(--gold); border-color: var(--moss-deep); color: var(--moss-deep); }
.btn-ghost { border-color: var(--moss-deep); color: var(--ink-soft); box-shadow: 0 4px 0 rgba(26,38,32,0.35); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; display: block; margin-top: 10px; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row .btn { flex: 1; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-armed { background: var(--gold-bright); border-color: var(--moss-deep); color: var(--moss-deep); }
/* v7.8: slimmer Done button — frees the title column */
.task-complete-btn { min-width: 64px; padding: 8px 8px; font-size: 10px; }

/* ---------- HUD header (game HUD on the map) ---------- */
/* v7.8: tighter HUD — ~92px */
.hud {
  display: flex; align-items: center; gap: 8px;
  background: var(--moss-deep); color: var(--cream);
  border: 3px solid var(--moss-ink); border-radius: 4px;
  padding: 8px 10px; margin: 4px 0 8px;
  box-shadow: var(--px-shadow);
}
.hud-avatar {
  width: 36px; height: 36px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--moss); border: 3px solid var(--gold); border-radius: 4px;
  font-size: 22px; overflow: hidden;
}
.hud-main { flex: 1; min-width: 0; }
.hud-day { margin: 0; font-family: var(--font-px); font-size: 12px; color: var(--gold-bright); white-space: nowrap; }
.hud-sub { margin: 2px 0 0; font-size: 12px; color: var(--cream); opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; row-gap: 4px; }
/* v7.3.2: narrow phones — the HUD wraps to two rows instead of pushing
   the page wider than the viewport (flex-wrap only kicks in when needed,
   so wide screens keep the single-row HUD). */
.hud { flex-wrap: wrap; row-gap: 8px; }
.hud-streak, .hud-shards {
  font-family: var(--font-px); font-size: 10px; white-space: nowrap;
  background: var(--moss-ink); border: 2px solid var(--gold); border-radius: 4px;
  padding: 5px 6px; color: var(--cream);
}
.hud .icon-btn { background: var(--moss); border-color: var(--gold); color: var(--cream); box-shadow: 0 3px 0 var(--moss-ink); }

/* legacy map-header bits kept for other screens */
.map-header { padding: 14px 4px 6px; }
.map-header-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.map-date { font-size: 13px; color: var(--ink-soft); margin: 0; }
.map-biome { font-size: 13px; font-weight: 700; color: var(--moss); margin: 0; }
.bank-line { display: flex; align-items: center; gap: 8px; margin: 6px 2px 0; font-size: 13px; }
.bank-dots { letter-spacing: 3px; color: var(--gold); font-size: 16px; }

/* ---------- map: the game board ---------- */
.map { display: flex; flex-direction: column; gap: 4px; padding: 10px 4px; }
.task-segment {
  position: relative; padding: 8px 0 12px 10px;
  border-left: 4px solid var(--moss-deep); margin-left: 16px;
}
.task-segment-pad { opacity: 0.55; border-left-style: dashed; }
.segment-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.6px; }
.segment-title { font-size: 14px; font-weight: 600; margin: 0 0 8px; font-family: var(--font-body); }
.tile-run { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tile {
  width: 38px; height: 38px; border-radius: 4px;
  border: 3px solid var(--moss-deep); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; position: relative;
  box-shadow: 2px 2px 0 rgba(26, 38, 32, 0.2);
}
.tile-walked { background: var(--sage); border-color: var(--moss-deep); color: #fff; }
.tile-current {
  border-color: var(--gold); background: #fffdf4;
  box-shadow: 0 0 0 3px var(--gold), 2px 2px 0 rgba(26, 38, 32, 0.2);
}
.tile-dot { width: 8px; height: 8px; background: var(--moss-deep); opacity: 0.25; }
.tile-walked .tile-dot { background: #fff; opacity: 0.9; }
.tile-marker { font-size: 17px; line-height: 1; }

/* pixel-art hero token (box-shadow sprite) hopping along the path */
.px-hero { display: inline-block; width: 3px; height: 3px; position: relative; }
.px-hero::after {
  content: ''; position: absolute; left: -12px; top: -15px; width: 3px; height: 3px;
  box-shadow:
    6px 0 0 #c9a227, 9px 0 0 #c9a227, 12px 0 0 #c9a227, 15px 0 0 #c9a227,
    6px 3px 0 #c9a227, 9px 3px 0 #c9a227, 12px 3px 0 #c9a227, 15px 3px 0 #c9a227,
    6px 6px 0 #f0c08a, 9px 6px 0 #f0c08a, 12px 6px 0 #f0c08a, 15px 6px 0 #f0c08a,
    6px 9px 0 #f0c08a, 9px 9px 0 #f0c08a, 12px 9px 0 #f0c08a, 15px 9px 0 #f0c08a,
    6px 12px 0 #2e4038, 9px 12px 0 #2e4038, 12px 12px 0 #2e4038, 15px 12px 0 #2e4038,
    3px 15px 0 #2e4038, 6px 15px 0 #2e4038, 9px 15px 0 #2e4038, 12px 15px 0 #2e4038, 15px 15px 0 #2e4038, 18px 15px 0 #2e4038,
    3px 18px 0 #2e4038, 6px 18px 0 #2e4038, 9px 18px 0 #2e4038, 12px 18px 0 #2e4038, 15px 18px 0 #2e4038, 18px 18px 0 #2e4038,
    6px 21px 0 #2e4038, 9px 21px 0 #2e4038, 12px 21px 0 #2e4038, 15px 21px 0 #2e4038,
    6px 24px 0 #223129, 9px 24px 0 #223129, 12px 24px 0 #223129, 15px 24px 0 #223129,
    6px 27px 0 #223129, 15px 27px 0 #223129;
}
.px-hero-hop { display: inline-block; animation: px-hop 0.55s steps(4) 1; }
@keyframes px-hop {
  0% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

/* map token: the closet sprite is built for big previews — shrink to tile size
   and hide its caption label inside tiles and the HUD avatar. */
.tile .wf-sprite, .hud-avatar .wf-sprite { vertical-align: top; }
.tile-current .wf-sprite-label, .hud-avatar .wf-sprite-label { display: none; }
.tile-current .wf-sprite { pointer-events: none; }
.node-marker {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 4px; padding: 6px 10px; font-size: 14px; font-weight: 700;
  border: 3px dashed var(--clay); background: #fff; margin: 2px 0;
  box-shadow: 2px 2px 0 rgba(26, 38, 32, 0.2);
}
.node-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.node-rest { border-color: var(--clay); }
/* rest stops glow like save points */
.node-rest:not(.node-crossed) { animation: rest-glow 2.2s ease-in-out infinite; }
@keyframes rest-glow {
  0%, 100% { box-shadow: 2px 2px 0 rgba(26,38,32,0.2), 0 0 0 0 rgba(201,162,39,0); }
  50% { box-shadow: 2px 2px 0 rgba(26,38,32,0.2), 0 0 0 6px rgba(201,162,39,0.45); }
}
.node-sage { border-color: var(--gold); }
.node-finish { border-style: solid; border-color: var(--moss-deep); background: var(--gold-bright); }
.node-crossed { opacity: 0.6; border-style: solid; animation: none; }

/* ---------- breather / tasks / voucher / camp ---------- */
.breather { margin: 12px 0; }
.breather-menu { display: grid; gap: 10px; margin-top: 8px; }
.token-cost { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.task-drawer { margin: 12px 0; }
.task-check { margin-right: 2px; }
.voucher-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.voucher-text { font-style: italic; }
.camp-section { margin: 16px 0; }
.camp-confirm { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* sage prompt as a JRPG dialog box */
.sage-prompt {
  border: 3px solid var(--cream); outline: 3px solid var(--moss-deep);
  background: var(--moss-deep); color: var(--cream);
  border-radius: 4px; padding: 14px; margin: 14px 0;
  box-shadow: var(--px-shadow);
}
.sage-prompt-text { margin: 0 0 10px; font-size: 15px; }
.sage-prompt .btn-ghost { color: var(--cream); border-color: var(--cream); }
.sage-name-tag {
  display: inline-block; font-family: var(--font-px); font-size: 9px;
  background: var(--gold); color: var(--moss-deep);
  padding: 5px 8px; border-radius: 2px; margin-bottom: 8px;
}

/* ---------- clear / camped ---------- */
.victory-panel {
  border: 3px solid var(--moss-deep); border-radius: 4px;
  background: var(--card); padding: 18px 16px; margin: 14px 0; text-align: center;
  box-shadow: var(--px-shadow);
}
.victory-title {
  font-family: var(--font-px); font-size: 16px; color: var(--moss-deep);
  margin: 0 0 6px; text-shadow: 2px 2px 0 var(--gold-bright);
}
.voucher-stamped {
  border: 3px solid var(--gold); border-radius: 4px;
  background: #fffdf4; padding: 16px; margin: 14px 0; text-align: center;
  box-shadow: var(--px-shadow);
  transform: rotate(-1.2deg);
}
.stamp-line { font-family: var(--font-px); font-size: 10px; line-height: 1.8; color: var(--moss-deep); }
.camp-card { text-align: center; padding: 28px 16px; }
.camp-line { font-size: 17px; margin: 6px 0; }
.voucher-archived { color: var(--ink-soft); font-size: 14px; }

/* ---------- modal / settings: chunky dialog ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(26, 38, 32, 0.65);
  display: flex; align-items: flex-end; justify-content: center; z-index: 60;
}
.modal {
  background: var(--card); border: 4px solid var(--moss-deep); border-radius: 4px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35);
  padding: 18px 18px 28px;
  width: 100%; max-width: 480px; max-height: 85vh; max-height: 85dvh; overflow-y: auto;
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.toggle {
  width: 62px; height: 36px; border-radius: 4px; border: 3px solid var(--moss-deep);
  background: #fff; position: relative; cursor: pointer; flex-shrink: 0;
}
.toggle-knob {
  position: absolute; top: 2px; left: 3px; width: 24px; height: 24px; border-radius: 2px;
  background: var(--moss-deep); transition: left 0.15s steps(3), background 0.15s steps(3);
}
.toggle-on { background: var(--sage); }
.toggle-on .toggle-knob { left: 27px; background: #fff; }
.settings-row { padding: 10px 0; border-top: 3px solid var(--moss-deep); }
.file-label {
  display: inline-block; border: 3px solid var(--moss-deep); color: var(--moss-deep);
  background: var(--gold); border-radius: 4px; min-height: var(--tap); padding: 10px 18px;
  font-family: var(--font-px); font-size: 11px; cursor: pointer;
  box-shadow: 0 4px 0 var(--moss-deep);
}
.settings-btn { position: absolute; }

/* ---------- bottom nav: persistent, every screen ----------
   Fixed; body padding-bottom (see body rule) guarantees the last control
   always scrolls clear of it, even on short screens. */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: 480px; z-index: 50;
  display: flex; gap: 8px;
  /* Hotfix v7.3.1: the row must never clip a tab — on narrow viewports the
     buttons keep their min tap width and the nav scrolls horizontally. */
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--moss-deep);
  border-top: 4px solid var(--moss-ink);
}
.nav-btn {
  /* flex: 1 0 48px — grow to fill room, NEVER shrink below the 48px tap
     target; overflow-x on the nav then takes over on narrow viewports. */
  flex: 1 0 48px; min-width: 48px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 56px; justify-content: center;
  background: var(--moss); color: var(--cream);
  border: 3px solid var(--moss-ink); border-radius: 4px;
  font-size: 20px; cursor: pointer;
  box-shadow: 0 3px 0 var(--moss-ink);
}
.nav-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--moss-ink); }
.nav-label { font-family: var(--font-px); font-size: 9px; }
.nav-btn.nav-active { background: var(--gold); color: var(--moss-deep); border-color: var(--moss-deep); }
.nav-btn[disabled] { opacity: 0.45; cursor: default; box-shadow: none; }
.nav-notice {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  width: calc(100% - 32px); max-width: 448px; z-index: 55;
  background: var(--moss-ink); color: var(--cream);
  border: 3px solid var(--gold); border-radius: 4px;
  padding: 10px 12px; font-size: 13px; text-align: center;
}
.nav-lock-hint { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; }

/* ---------- boot error ---------- */
.boot-error { padding: 48px 24px; text-align: center; }
.boot-error h1 { font-size: 22px; font-family: var(--font-px); }

/* ---------- desktop ---------- */
@media (min-width: 520px) {
  #root { border-left: 4px solid var(--moss-deep); border-right: 4px solid var(--moss-deep); }
  .modal-backdrop { align-items: center; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:active, .icon-btn:active, .nav-btn:active { transform: none !important; }
}

/* ---------- Phase 1: biomes / themes / screens ---------- */
.shard-chip {
  font-family: var(--font-px); font-size: 10px; color: var(--moss-deep);
  background: #fff; border: 3px solid var(--moss-deep); border-radius: 4px;
  padding: 10px 11px; white-space: nowrap;
  box-shadow: 0 3px 0 var(--moss-deep);
}
.page-header { display: flex; align-items: center; gap: 10px; padding: 14px 4px 10px; }
.page-title { font-family: var(--font-px); font-size: 16px; line-height: 1.6; margin: 0; flex: 1; color: var(--moss-deep); }
.back-btn { flex-shrink: 0; }

/* biome reskins — subtle tints only; mechanics untouched */
.map[class*="biome-"] { border-radius: 4px; padding: 10px 6px 10px 2px; }
.biome-mosswood { background: transparent; }
.biome-coast { background: rgba(122,162,178,0.10); }
.biome-coast .tile { border-color: #3d6b7a; }
.biome-cavern { background: rgba(102,94,128,0.10); }
.biome-cavern .tile { border-color: #5a4f78; }
.biome-highland { background: rgba(178,150,100,0.12); }
.biome-highland .tile { border-color: #8a6d35; }
/* equipped theme overrides the biome class entirely */
.map[class*="theme-"] { background: rgba(201,162,39,0.07); }
.map[class*="theme-"] .tile { border-color: #8a6d35; }

/* trail shimmer on walked tiles; rain-boost doubles it */
@keyframes trail-p {
  0%, 100% { box-shadow: 2px 2px 0 rgba(26,38,32,0.2), 0 0 0 0 rgba(125,155,118,0); }
  50% { box-shadow: 2px 2px 0 rgba(26,38,32,0.2), 0 0 0 4px rgba(125,155,118,0.35); }
}
.tile-walked { animation: trail-p 2.6s ease-in-out infinite; }
.map.rain-boost .tile-walked { animation-duration: 1.3s; }
.keepsake { font-size: 13px; margin-left: 3px; }
.tomorrow-hint { font-style: italic; }

/* shop / closet */
.shop-tabs { display: flex; margin: 4px 0 12px; }
#closet-mount { min-height: 120px; }

/* history */
.streak-card { text-align: center; }
.streak-line { font-size: 16px; font-weight: 700; margin: 4px 0; }
.streak-flame { font-size: 22px; }
.history-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.history-row { background: #fff; color: #2b2b26; border: 3px solid var(--moss-deep); border-radius: 4px; padding: 10px 12px; box-shadow: var(--px-shadow); }
.history-toggle {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left; min-height: 44px;
  font-family: var(--font-body);
}
.history-date { font-weight: 700; }
.history-status { font-size: 13px; font-weight: 700; color: var(--moss); }
.history-meta { font-size: 13px; color: var(--ink-soft); }
.history-detail { margin-top: 8px; border-top: 3px dashed var(--moss-deep); padding-top: 8px; }
.history-tasks { margin: 0 0 8px; padding-left: 20px; font-size: 14px; }
.history-voucher { font-size: 14px; margin: 8px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-mini { min-height: 36px; padding: 4px 12px; font-size: 13px; }

/* settings: encounter mix sliders + difficulty */
.settings-sub { font-size: 15px; margin: 0 0 4px; font-family: var(--font-px); font-size: 11px; }
.weight-row { padding: 6px 0; }
.weight-row label { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.weight-val { font-variant-numeric: tabular-nums; color: var(--moss); font-family: var(--font-px); font-size: 10px; }
input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--moss); }

/* difficulty nudge */
.hud-diff {
  font-family: var(--font-px); font-size: 9px; white-space: nowrap; line-height: 1.6;
  background: var(--moss-ink); border: 2px solid var(--sage); border-radius: 4px;
  padding: 7px 8px; color: var(--cream);
}
.hud-diff-standard { border-color: var(--gold-bright); }

/* ---------- home button row on cleared/camped screens ---------- */
.screen-cleared .app-header, .screen-camped .app-header {
  display: flex; align-items: center; gap: 12px;
}
.home-btn { background: var(--gold); border-color: var(--moss-ink); color: var(--moss-deep); }

/* setup screen: title-screen treatment */
.press-start {
  font-family: var(--font-px); font-size: 11px; color: var(--moss-deep);
  background: var(--gold-bright); border: 3px solid var(--moss-deep); border-radius: 4px;
  padding: 8px 12px; display: inline-block; margin-top: 8px;
  box-shadow: var(--px-shadow);
  animation: press-blink 1.6s steps(2) infinite;
}
@keyframes press-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- overworld pixel map (Final Fantasy / Mario RPG style) ---------- */
.overworld {
  position: relative; width: 100%; max-width: 560px; margin: 12px auto;
  border: 4px solid var(--moss-ink); border-radius: 4px;
  box-shadow: var(--px-shadow); overflow: hidden; background: #5da24a;
  container-type: inline-size; /* R7.9: landmark labels scale with the map */
}
.overworld-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
/* R7.14: David's finished map painting fills the viewport; the canvas draws
 * only the dotted road over it. The painting is detailed art — never
 * pixelated — and cover-fit crops it cleanly to the map box. */
.overworld-art {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  object-fit: cover; image-rendering: auto; pointer-events: none;
  user-select: none; -webkit-user-select: none;
}
.overworld-overlay { position: absolute; inset: 0; pointer-events: none; }
.ow-marker {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
}
.ow-emoji {
  font-size: clamp(16px, 5vw, 24px); line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}
/* rest stops pulse like save points */
.ow-rest:not(.ow-crossed) .ow-emoji { animation: ow-bounce 1.6s ease-in-out infinite; }
@keyframes ow-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.12); }
}
.ow-crossed { opacity: 0.55; }
.ow-crossed .ow-emoji { animation: none; }
.ow-label {
  font-family: var(--font-px); font-size: clamp(7px, 1.9vw, 9px); white-space: nowrap;
  background: rgba(26, 38, 32, 0.88); color: var(--cream);
  border: 2px solid var(--gold); border-radius: 3px; padding: 3px 5px; margin-top: 2px;
}
/* R7.10 landmark place-names: small reference-map style — parchment text with
 * a dark outline tucked under the building, no black box. The box chips were
 * half of what made the map look cheap (and what covered David's head). */
.ow-marker.ow-landmark .ow-label {
  font-family: var(--font-px);
  font-size: clamp(8px, 2.6cqw, 11px);
  line-height: 1.4;
  white-space: nowrap;
  color: #f7ecc8;
  background: none;
  border: none;
  border-radius: 0;
  padding: 1px 0 0;
  margin-top: 0;
  text-shadow:
    1px 0 0 #241a10, -1px 0 0 #241a10,
    0 1px 0 #241a10, 0 -1px 0 #241a10;
}
/* character token on the world map — tile-sized, hop animation intact */
.ow-token { position: absolute; transform: translate(-50%, -62%); pointer-events: none; }
.ow-token .wf-sprite-label { display: none; }
.ow-token .wf-sprite { pointer-events: none; }
.ow-token .keepsake { font-size: 12px; }
/* R7.12: task destinations — numbered badges on the road (Map Pack 1 style).
 * The stacked .ow-chip bars are gone; each task is a badge pinned to the path. */
.ow-dest {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 6px; margin: 0; cursor: pointer;
  pointer-events: auto; /* the overlay is pointer-events:none; badges opt back in */
  -webkit-tap-highlight-color: transparent;
}
.ow-dest-badge {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-px); font-size: 11px; line-height: 1; color: #fff;
  background: #1d2733; border: 2px solid #f5d76e;
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.45);
}
.ow-dest:active .ow-dest-badge { transform: scale(0.92); }
.ow-dest-done .ow-dest-badge { border-color: #8bc34a; opacity: 0.8; }
/* tiny place-name tucked below the badge — same reference-map treatment as
 * landmark labels: outlined text, no box */
.ow-dest-label {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--font-px);
  font-size: clamp(7px, 2.2cqw, 9px);
  line-height: 1.4; white-space: nowrap;
  max-width: 84px; overflow: hidden; text-overflow: ellipsis;
  color: #fdf6dd; background: none; border: none; border-radius: 0;
  padding: 1px 0 0; margin: 0; pointer-events: none;
  text-shadow:
    1px 0 0 #241a10, -1px 0 0 #241a10,
    0 1px 0 #241a10, 0 -1px 0 #241a10;
}
.ow-dest-done.ow-dest-label { text-decoration: line-through; opacity: 0.75; }
/* tapped-badge flash on the task row in the drawer */
.task-row-flash {
  outline: 3px solid var(--gold); outline-offset: 2px;
  border-radius: 4px;
  transition: outline-color 0.6s ease;
}

/* ---------- Release 3: route select ---------- */
.route-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.route-card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left;
  background: var(--card); color: var(--ink); border: 3px solid var(--moss-deep); border-radius: 4px;
  padding: 10px; min-height: 120px; min-width: 0; cursor: pointer;
  box-shadow: var(--px-shadow); overflow-wrap: anywhere;
}
.route-card:active { transform: translateY(4px); box-shadow: none; }
.route-selected { border-color: var(--gold); background: var(--card); box-shadow: 0 0 0 3px var(--gold), var(--px-shadow); }
.route-locked { opacity: 0.55; cursor: not-allowed; }
.route-biome { font-family: var(--font-px); font-size: 9px; line-height: 1.7; color: var(--moss-deep); overflow-wrap: normal; word-break: normal; }
.route-flavor { font-size: 12px; color: var(--ink-soft); }
.route-steps { font-size: 12px; font-weight: 700; }
.route-mix { font-size: 11px; color: var(--ink); background: var(--paper-deep); border: 2px solid var(--moss-deep); border-radius: 3px; padding: 3px 6px; }
.route-lock { font-size: 12px; font-style: italic; color: var(--ink-soft); }

/* Release 4: setup difficulty selector — segmented control after the
   route cards, before Start. Same chunky retro cards as route select. */
.diff-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.diff-card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left;
  background: var(--card); color: var(--ink); border: 3px solid var(--moss-deep); border-radius: 4px;
  padding: 12px 10px; min-height: 96px; min-width: 0; cursor: pointer;
  box-shadow: var(--px-shadow); overflow-wrap: anywhere;
}
.diff-card:active { transform: translateY(4px); box-shadow: none; }
.diff-selected { border-color: var(--gold); background: var(--card); box-shadow: 0 0 0 3px var(--gold), var(--px-shadow); }
.diff-name { font-family: var(--font-px); font-size: 10px; line-height: 1.7; color: var(--moss-deep); }
.diff-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

/* Release 3: unlock notice on the cleared screen */
.unlock-card { border-color: var(--gold); text-align: center; background: var(--card); }
.unlock-title { font-family: var(--font-px); font-size: 11px; line-height: 1.7; color: var(--moss-deep); margin: 0 0 6px; }

/* Release 3: overworld base tints per biome (canvas is the main event; this is the pre-paint flash) */
.overworld.biome-mosswood { background: #5da24a; }
.overworld.biome-coast { background: #e7d39a; }
.overworld.biome-cavern { background: #3a3a4d; }
.overworld.biome-highland { background: #c4703a; }

/* Release 3: biome-flavored rest stop rings.
   drop-shadow only — glyph/layout boxes are unchanged (chip-collision fix safe). */
.ow-rest.rest-biome-coast .ow-emoji { filter: drop-shadow(0 2px 0 rgba(0,0,0,0.35)) drop-shadow(0 0 3px #7fd4ff); }
.ow-rest.rest-biome-cavern .ow-emoji { filter: drop-shadow(0 2px 0 rgba(0,0,0,0.35)) drop-shadow(0 0 3px #c9b3f5); }
.ow-rest.rest-biome-highland .ow-emoji { filter: drop-shadow(0 2px 0 rgba(0,0,0,0.35)) drop-shadow(0 0 3px #ffb02a); }

/* ---------- Release 5: growth (level, XP, perks, you-screen, milestones) ---------- */
.hud-level {
  font-family: var(--font-px); font-size: 9px; white-space: nowrap; line-height: 1.6;
  background: var(--moss-ink); border: 2px solid var(--gold-bright); border-radius: 4px;
  padding: 7px 8px; color: var(--gold-bright);
}
.xp-bar {
  height: 8px; border: 2px solid var(--moss-ink); border-radius: 4px;
  background: rgba(26, 38, 32, 0.22); margin: 6px 4px 0; overflow: hidden;
}
.xp-bar > span { display: block; height: 100%; background: var(--gold-bright); border-radius: 1px; }
.xp-numbers {
  font-family: var(--font-px); font-size: 10px; line-height: 1.6;
  color: var(--moss-deep); margin: 0 0 6px;
}
.xp-earned {
  font-family: var(--font-px); font-size: 11px; line-height: 1.6;
  color: var(--moss-deep); margin: 8px 0 0;
}
.levelup-note {
  font-family: var(--font-px); font-size: 11px; line-height: 1.7;
  color: var(--moss-deep); margin: 6px 0 0;
}
/* level-up perk picker */
.perk-modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(26, 38, 32, 0.55); padding: 16px;
}
.perk-modal { width: 100%; max-width: 420px; margin-bottom: 12px; }
.perk-modal .card-title { text-align: center; }
.perk-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.perk-card {
  min-height: 64px; width: 100%; padding: 12px 14px; text-align: left; cursor: pointer;
  border: 3px solid var(--moss-deep); border-radius: 6px; background: var(--card);
  box-shadow: 0 4px 0 rgba(26, 38, 32, 0.55);
  display: flex; flex-direction: column; gap: 4px; font-family: inherit;
}
.perk-card:active { transform: translateY(4px); box-shadow: none; }
.perk-name { font-family: var(--font-px); font-size: 11px; line-height: 1.6; color: var(--moss-deep); }
.perk-blurb { font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.perk-held { padding: 10px 2px; border-top: 2px solid var(--paper-deep); }
.perk-held .perk-name { display: block; margin-bottom: 2px; }
/* you screen */
.you-screen .page-header { padding-bottom: 4px; }
.you-head { display: flex; align-items: center; gap: 14px; }
.you-avatar { flex: none; }
.you-avatar .wf-sprite-label { display: none; }
.you-id { min-width: 0; }
.you-name { font-family: var(--font-px); font-size: 13px; line-height: 1.6; color: var(--moss-deep); margin: 0; }
.you-title { font-size: 14px; font-style: italic; color: var(--ink-soft); margin: 4px 0 0; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.sheet-stat {
  border: 2px solid var(--paper-deep); border-radius: 6px; padding: 8px 10px;
  background: var(--paper);
}
.sheet-stat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-soft);
}
.sheet-stat-value { font-family: var(--font-px); font-size: 12px; line-height: 1.6; color: var(--moss-deep); margin-top: 4px; }
/* achievements shelf */
.ach-shelf { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ach-card {
  display: flex; gap: 10px; align-items: flex-start;
  border: 3px solid var(--moss-deep); border-radius: 6px; background: var(--card);
  padding: 10px 12px; box-shadow: var(--px-shadow);
}
.ach-card.ach-locked { border-style: dashed; opacity: 0.8; box-shadow: none; }
.ach-icon { font-size: 24px; line-height: 1.2; flex: none; }
.ach-info { min-width: 0; }
.ach-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.ach-date { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.ach-hint { font-size: 13px; font-style: italic; color: var(--ink-soft); margin-top: 2px; }
/* milestone rows in the shop (never buyable) */
.milestone-row .wf-milestone-state {
  font-size: 14px; font-weight: 700; white-space: nowrap; color: var(--moss-deep); flex: none;
}
@media (max-width: 390px) {
  .perk-modal-backdrop { padding: 10px; }
  .sheet-grid { gap: 6px; }
  .sheet-stat-value { font-size: 11px; }
}
/* HUD header: difficulty + streak + shards + level chip + settings ~= 402px;
   without tightening it overflows viewports under ~402px. */
@media (max-width: 430px) {
  .hud { gap: 8px; padding: 8px 10px; }
  .hud-stats { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .perk-card:active { transform: none; }
}

/* ---------- Release 5.1: footer stamp, extend-day, setup task editing ---------- */
/* App version footer: subtle, retro, rendered on every screen by shell.render(). */
.app-footer {
  text-align: center;
  font-family: var(--font-px); font-size: 8px; line-height: 1.8;
  color: var(--ink-soft); opacity: 0.75;
  padding: 12px 12px 16px;
}
/* Keep-walking card on the cleared screen (reuses .btn styles). */
.extend-card { margin: 14px 0; }
/* Task adder on the active map after an extended day (reuses .task-add). */
.extend-adder { border-color: var(--gold); }
/* Setup task edit mode: input + buttons inline, 44px targets via .icon-btn. */
.task-row-edit { gap: 8px; }
.task-row-edit .text-input { flex: 1 1 120px; min-width: 0; }

/* ---------- Release 7 "Avatar" ---------- */
/* Pixel-avatar canvases: crisp nearest-neighbor rendering everywhere. */
.wf-avatar-canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.wf-avatar-holder { display: inline-block; line-height: 0; }
/* Map token glides between steps; the walking bob lives on the avatar
   canvas only (the token's own translate transform must not be disturbed). */
.ow-token { transition: left .6s ease, top .6s ease; }
.ow-token .wf-avatar-canvas { display: block; }
.ow-token.walking .wf-avatar-canvas { animation: wf-avatar-bob .5s ease-in-out infinite; }
@keyframes wf-avatar-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) {
  .ow-token { transition: none; }
  .ow-token.walking .wf-avatar-canvas { animation: none; }
}
/* Legacy Closet hat overlay: floats above the pixel avatar on the map. */
.avatar-legacy-wrap { position: relative; display: inline-block; line-height: 0; }
.avatar-legacy-hat { position: absolute; left: 50%; transform: translateX(-50%); top: -34%;
  pointer-events: none; line-height: 1; }
/* Cleared-screen celebration avatar (mountAvatar pose 'cheer', ~72px). */
.cheer-avatar { text-align: center; margin: 10px 0 2px; }
/* You tab: large avatar mount (96px idle). */
.you-avatar .wf-avatar-canvas { display: block; }
/* Avatar studio (dresser) mount: 390px-safe, scrollable grids, 44px targets.
   Class names here are the agreed R7 dresser surface: renderDresser should
   use .dresser-* classes (see CONTRACTS / worker notes); grids scroll
   vertically and wrap safely at 320-390px. */
.avatar-dresser-mount { min-height: 160px; }
.dresser { max-width: 100%; }
.dresser-preview { display: flex; justify-content: center; align-items: center; margin: 8px 0 12px; }
.dresser-preview .wf-avatar-canvas { border: 3px solid var(--moss-deep); border-radius: 4px;
  background: var(--card); padding: 8px; }
.dresser-group { margin: 12px 0; }
.dresser-group-title { font-family: var(--font-px); font-size: 11px; line-height: 1.7; margin: 0 0 8px; }
.dresser-base-row, .dresser-swatch-row, .dresser-gear-row {
  display: flex; flex-wrap: wrap; gap: 8px; max-height: 180px; overflow-y: auto; padding: 2px; }
.dresser-base-btn { min-height: var(--tap); min-width: 44px; padding: 8px 12px;
  border: 3px solid var(--moss-deep); border-radius: 4px; background: #fff;
  font-family: var(--font-px); font-size: 11px; color: var(--moss-deep); cursor: pointer; }
.dresser-swatch { width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border: 3px solid var(--moss-deep); border-radius: 4px; cursor: pointer; padding: 0; }
.dresser-gear-btn { min-height: var(--tap); min-width: 44px; padding: 8px 10px;
  border: 3px solid var(--moss-deep); border-radius: 4px; background: #fff;
  font-size: 22px; line-height: 1; cursor: pointer; }
.dresser-base-btn.dresser-selected, .dresser-swatch.dresser-selected,
.dresser-gear-btn.dresser-selected { outline: 3px solid var(--gold); outline-offset: 2px; }
.dresser-note { font-size: 13px; opacity: .8; margin: 8px 0 0; }

/* ---------- Release 7 "Avatar": journal notes ---------- */
.journal-note { margin: 0 0 6px; line-height: 1.55; }
.journal-note-label { font-family: var(--font-px); font-size: 10px; display: block;
  margin-bottom: 4px; opacity: .75; }
.journal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.journal-actions .btn { flex: 1 1 120px; }
.journal-editor { display: grid; gap: 8px; margin-top: 10px; }
.journal-title-input, .journal-textarea {
  width: 100%; box-sizing: border-box; font-family: var(--font-body); font-size: 16px;
  padding: 10px 12px; border: 3px solid var(--moss-deep); border-radius: 4px;
  background: #fff; color: var(--ink); }
.journal-textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.journal-editor .btn-row .btn { min-height: var(--tap); }

/* ---------- Release 7 "Avatar": hard moments ---------- */
/* A quiet corner: calm, obvious one-tap entry below the breather panel.
   Quiet styling on purpose — not in the header, not shouty. */
.hard-entry { margin: 14px 0; }
.hard-entry-btn { opacity: .92; }
/* v7.8: Game-Boy-menu row — breather / hard moment / campfire in one row */
.map-menu { margin: 10px 0; }
.map-menu-row { display: flex; gap: 8px; }
.map-menu-btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 6px 4px; font-size: 10px; }
.hard-you-card { margin-top: 12px; }
/* The hard-moments screen itself: warm, unhurried, no scoreboard anywhere. */
/* v7.8: sparse ritual tabs — pull content up toward the tabs */
.screen-ritual .ritual-tabs { margin-bottom: 2px; }
.screen-ritual .card { margin-top: 8px; }
.screen-hard .hard-calm { text-align: center; }
.hard-card { background: #fffdf7; color: #2b2b26; }
.hard-title { font-family: var(--font-px); font-size: 13px; line-height: 1.7; margin: 0 0 8px; }
.hard-text { font-size: 1.05rem; line-height: 1.6; margin: 0; }
.hard-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.hard-tools .btn { flex: 1 1 100px; }
.hard-sounds { margin-top: 0; }
.hard-write { margin-top: 12px; }
.hard-footer { text-align: center; font-size: 12px; opacity: .7; font-style: italic; margin: 16px 0 8px; }
/* v7.8: center the quiet stack when the viewport has room */
.screen-hard { display: flex; flex-direction: column; justify-content: center; min-height: 70vh; min-height: 70dvh; }
@media (prefers-reduced-motion: reduce) {
  .hard-tools .btn:active { transform: none; }
}

/* R7 finisher: screen-wake toggle row (campfire + Quiet Grove) */
.wake-row { margin: 10px 0; }

/* R7 easter eggs: map fireflies + shard jingle line */
.fireflies { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.firefly {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: #ffe9a0; box-shadow: 0 0 6px 2px rgba(255, 220, 130, .8);
  opacity: 0; animation: firefly-drift 8s ease-in-out infinite;
}
@keyframes firefly-drift {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: .95; }
  50% { opacity: .5; transform: translate(14px, -18px); }
  85% { opacity: .9; }
  100% { opacity: 0; transform: translate(-10px, -30px); }
}
@media (prefers-reduced-motion: reduce) {
  .firefly { animation: none; opacity: .7; }
}
.shard-jingle { margin: 4px 0 0; font-size: 11px; }
.hud-day[data-act] { cursor: default; }
.hud-shards[data-act] { cursor: default; }

/* R7.1: gratitude ember */
.gratitude-glow { border: 1px solid rgba(255,215,106,.35); box-shadow: 0 0 18px rgba(255,190,80,.12); }
.gratitude-row { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.gratitude-row:last-child { border-bottom: 0; }
.gratitude-date { font-size: 11px; opacity: .65; margin: 0 0 2px; }
.gratitude-flash { color: var(--ink); }

/* ==========================================================================
   Release 7.2 — goals, step log, workout flex, strength card.
   Markup classes live in js/shell.js (goals views, step log row, flex burst,
   strength card). Single source of styles: this section. Mobile-first,
   wraps cleanly at 320-360px, prefers-reduced-motion honored.
   ========================================================================== */
.goal-list{list-style:none;margin:12px 0 0;padding:0;display:grid;gap:10px;}
.goal-open{display:block;width:100%;text-align:left;background:#fff;color:inherit;border:3px solid var(--moss-deep);border-radius:4px;padding:12px;cursor:pointer;font-family:inherit;}
.goal-open:active{transform:translate(2px,2px);box-shadow:none;}
.goal-title{font-family:var(--font-px);font-size:11px;line-height:1.7;display:block;margin-bottom:4px;}
.goal-meta{display:block;font-size:12px;opacity:.8;margin-bottom:2px;}
.goal-why-line{font-style:italic;}
.goal-prog{display:block;height:10px;background:var(--paper-deep);border:2px solid var(--moss-deep);border-radius:4px;overflow:hidden;margin:8px 0 4px;}
.goal-prog>span{display:block;height:100%;background:var(--moss);}
.goal-count{font-size:12px;opacity:.85;}
.goal-done{opacity:.75;}
.goal-detail-title{margin-top:8px;}
.goal-why-full{font-style:italic;margin:0 0 8px;line-height:1.55;}
.goal-sub{font-family:var(--font-px);font-size:10px;margin:14px 0 6px;color:var(--moss-deep);}
.goal-prog-wrap{margin:8px 0;}
.goal-done-line{margin:10px 0;font-weight:700;}
.goal-foot{margin-top:14px;display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.ms-check{width:44px;height:44px;flex:0 0 auto;border-radius:50%;border:3px solid var(--moss-deep);background:#fff;font-size:18px;cursor:pointer;color:var(--moss-deep);}
.ms-check[aria-pressed="true"]{background:var(--moss);color:var(--cream);}
.ms-link-row{display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:4px 0 4px 54px;}
.ms-link-input{flex:1 1 140px;}
.ms-linked{font-size:12px;opacity:.85;display:inline-flex;align-items:center;gap:4px;}
/* v7.8: compressed step card — ~110px, everything inline */
.step-log-card{margin-top:8px;padding:10px 12px;}
.step-log-row{display:flex;align-items:center;justify-content:flex-start;gap:8px;flex-wrap:nowrap;}
.step-log-btn{min-height:40px;padding:6px 10px;font-size:10px;flex:0 0 auto;}
.step-count{flex:0 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.step-log-postcard{margin-left:auto;display:inline-flex;flex:0 0 auto;}
.step-log-postcard .wf-postcard-btn{background:none;border:none;box-shadow:none;min-height:44px;padding:10px 4px;font-size:12px;color:var(--ink-soft);text-decoration:underline;white-space:nowrap;}
.step-count{font-family:var(--font-px);font-size:10px;color:var(--moss-deep);}
.step-log-form{display:flex;gap:8px;margin-top:8px;}
.step-input{flex:1 1 auto;}
.step-flash{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(120px + env(safe-area-inset-bottom,0px));background:var(--moss-ink);color:var(--cream);border:3px solid var(--gold);border-radius:4px;padding:8px 14px;font-family:var(--font-px);font-size:11px;z-index:60;pointer-events:none;margin:0;}
.strength-title{font-family:var(--font-px);font-size:11px;line-height:1.7;margin:0 0 4px;color:var(--moss-deep);}
.goal-pulse{position:fixed;top:12px;left:50%;transform:translateX(-50%);width:calc(100% - 32px);max-width:448px;z-index:70;pointer-events:none;}
.goal-pulse-card{pointer-events:auto;background:var(--moss);color:var(--cream);border:3px solid var(--gold);border-radius:4px;padding:14px;text-align:center;box-shadow:var(--px-shadow);}
.goal-pulse-title{font-family:var(--font-px);font-size:12px;margin:0 0 6px;}
.goal-pulse-goal{font-weight:700;margin:0 0 6px;}
.goal-pulse-line{margin:0 0 10px;font-size:13px;opacity:.92;}
.ow-flex{position:absolute;transform:translate(-50%,-130%);pointer-events:none;z-index:5;font-size:30px;line-height:1;}
.flex-main{display:inline-block;animation:flex-pop 1.6s ease-out forwards;}
.flex-spark{position:absolute;font-size:16px;color:var(--gold-bright);opacity:0;animation:flex-burst 1.6s ease-out forwards;}
.flex-spark.f1{left:-8px;top:-8px;--fx:-24px;}
.flex-spark.f2{left:14px;top:-12px;--fx:6px;}
.flex-spark.f3{left:32px;top:-6px;--fx:28px;}
@keyframes flex-pop{0%{transform:scale(.3);opacity:0;}
25%{opacity:1;}
55%{transform:scale(1.3);}
80%{transform:scale(1);opacity:1;}
100%{transform:scale(1);opacity:0;}
}
@keyframes flex-burst{0%{opacity:0;transform:translate(0,0) scale(.5);}
30%{opacity:1;}
100%{opacity:0;transform:translate(var(--fx,10px),-30px) scale(1.2);}
}
@media (prefers-reduced-motion: reduce){.flex-main,.flex-spark{animation:none;}
.flex-spark{opacity:.85;}
}

/* ================================================================
   Release 7.3 "Theming" — theme var overrides, retro styling,
   title branding polish, and theme picker styles. (Worker B)
   Themes apply via `document.documentElement.dataset.theme = "<id>"`;
   the default (no data-theme, or ember-night) is the :root set above.
   Every theme block sets all 15 keys + --title-glow. Reskin only:
   no layout changes, easter eggs untouched.
   ================================================================ */

/* ---------- R7.3 theme var overrides ---------- */

/* ember-night: explicit selection matches the default :root values */
html[data-theme="ember-night"] {
  --paper: #f7f4ec;
  --paper-deep: #efe9da;
  --ink: #2b2b26;
  --ink-soft: #5c5a50;
  --moss: #2e4038;
  --moss-deep: #223129;
  --moss-ink: #1a2620;
  --sage: #7d9b76;
  --gold: #c9a227;
  --gold-bright: #e8c46a;
  --clay: #b0714f;
  --cream: #f6f2e6;
  --card: #fffdf7;
  --danger: #a4442f;
  --px-shadow: 4px 4px 0 rgba(26,38,32,0.28);
  --title-glow: rgba(232, 196, 106, 0.35);
}

/* morning-meadow: warm light — soft cream, warm dark-brown ink, sage + gold */
html[data-theme="morning-meadow"] {
  --paper: #faf6ea;
  --paper-deep: #f0e9d6;
  --ink: #2e2b23;
  --ink-soft: #6b6558;
  --moss: #4a6b4e;
  --moss-deep: #33473a;
  --moss-ink: #1e2a21;
  --sage: #8fb284;
  --gold: #b98f1f;
  --gold-bright: #e8c46a;
  --clay: #b0714f;
  --cream: #f6f2e6;
  --card: #fffdf6;
  --danger: #a4442f;
  --px-shadow: 4px 4px 0 rgba(51,71,58,0.28);
  --title-glow: rgba(232, 196, 106, 0.5);
}

/* pine-hollow: deep forest dark — near-black green, pale mint text */
html[data-theme="pine-hollow"] {
  --paper: #16211a;
  --paper-deep: #101812;
  --ink: #e9e4d4;
  --ink-soft: #a9ab9c;
  --moss: #3f5f47;
  --moss-deep: #0d130e;
  --moss-ink: #141d17;
  --sage: #7ba384;
  --gold: #c9a227;
  --gold-bright: #e8c46a;
  --clay: #c08a60;
  --cream: #f0ebda;
  --card: #1d2721;
  --danger: #c05b44;
  --px-shadow: 4px 4px 0 rgba(0,0,0,0.45);
  --title-glow: rgba(143, 196, 135, 0.35);
}

/* twilight-trail: dusky purple dark — deep plum, lavender-cream text */
html[data-theme="twilight-trail"] {
  --paper: #1e1830;
  --paper-deep: #161222;
  --ink: #ece6f2;
  --ink-soft: #a89fb8;
  --moss: #5a4a72;
  --moss-deep: #100c1c;
  --moss-ink: #171223;
  --sage: #9a8fb0;
  --gold: #c9a86a;
  --gold-bright: #e8cf8a;
  --clay: #b08268;
  --cream: #f2ecf6;
  --card: #272138;
  --danger: #c05b44;
  --px-shadow: 4px 4px 0 rgba(0,0,0,0.45);
  --title-glow: rgba(217, 194, 122, 0.3);
}

/* old-map: sepia parchment light — aged paper, dark sepia ink, leather */
html[data-theme="old-map"] {
  --paper: #f3e9d2;
  --paper-deep: #e7d8b8;
  --ink: #3a2f22;
  --ink-soft: #6e5f49;
  --moss: #5a6b3f;
  --moss-deep: #3d4429;
  --moss-ink: #262b18;
  --sage: #8a9455;
  --gold: #a87f1e;
  --gold-bright: #d9a94f;
  --clay: #a05f38;
  --cream: #f7efdc;
  --card: #faf3e2;
  --danger: #9c3f28;
  --px-shadow: 4px 4px 0 rgba(60,45,25,0.3);
  --title-glow: rgba(217, 184, 74, 0.4);
}

/* pixel-past: RETRO Game Boy greens */
html[data-theme="pixel-past"] {
  --paper: #9bbc0f;
  --paper-deep: #8bac0f;
  --ink: #0f380f;
  --ink-soft: #306230;
  --moss: #306230;
  --moss-deep: #0f380f;
  --moss-ink: #0f380f;
  --sage: #8bac0f;
  --gold: #306230;
  --gold-bright: #9bbc0f;
  --cream: #9bbc0f;
  --clay: #306230;
  --card: #8bac0f;
  --danger: #0f380f;
  --px-shadow: 4px 4px 0 rgba(15,56,15,0.35);
  --title-glow: rgba(15, 56, 15, 0.3);
}

/* ---------- R7.3 dark-theme legibility guards ----------
   .text-input carries a hardcoded white background elsewhere in the file;
   in the two dark themes that would wash pale --ink text out, so they use
   the theme card surface instead. (No light-on-light anywhere.) */
html[data-theme="pine-hollow"] .text-input,
html[data-theme="twilight-trail"] .text-input {
  background: var(--card);
}

/* ---------- R7.3 RETRO extras (pixel-past only) ---------- */

/* chunkier pixel borders on cards / panels / buttons, ink color —
   border-radius language stays at 4px, matching the rest of the app */
html[data-theme="pixel-past"] .card,
html[data-theme="pixel-past"] .hud,
html[data-theme="pixel-past"] .btn,
html[data-theme="pixel-past"] .icon-btn,
html[data-theme="pixel-past"] .seg,
html[data-theme="pixel-past"] .task-row {
  border-width: 4px;
  border-color: var(--ink);
}
html[data-theme="pixel-past"] .hud .icon-btn { box-shadow: 0 3px 0 var(--ink); }

/* SUBTLE scanline overlay, setup screen only — faint CRT shimmer,
   never intercepts taps, never covers content legibility */
html[data-theme="pixel-past"] .screen-setup::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(15, 56, 15, 0.06) 2px,
    rgba(15, 56, 15, 0.06) 4px
  );
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme="pixel-past"] .screen-setup::after { display: none; }
}

/* a touch more monospace flavor in RETRO land */
html[data-theme="pixel-past"] .tagline { letter-spacing: 0.28em; }
html[data-theme="pixel-past"] .app-title { letter-spacing: 2px; }

/* ---------- R7.3 branding polish: theme divider ---------- */
/* Worker C's shell.js renders <div class="theme-divider"> under the tagline
   on setup + campfire screens: small centered pixel-diamond row in --gold
   with a soft glow from --title-glow. */
.theme-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 4px;
}
.theme-divider span {
  width: 8px;
  height: 8px;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--title-glow);
}
.theme-divider span.big { width: 12px; height: 12px; }

/* ---------- R7.3 theme picker styles ---------- */
/* Worker C renders the markup: .theme-swatch-row > .theme-swatch (button)
   with three .dots span color dots + the theme name. .is-active = chosen. */
.theme-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}
.theme-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 48px;
  min-height: 48px;
  padding: 8px 12px;
  background: var(--card);
  color: var(--ink);
  border: 3px solid var(--moss-deep);
  border-radius: 4px;
  box-shadow: var(--px-shadow);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
}
.theme-swatch .dots { display: flex; gap: 4px; }
.theme-swatch .dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--moss-ink);
  display: inline-block;
}
.theme-swatch .name { overflow-wrap: anywhere; }
.theme-swatch.is-active {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.theme-swatch:active { transform: translateY(4px); box-shadow: 0 0 0 var(--moss-deep); }

/* R7.3 coordinator fix: hardcoded #fff controls go theme-aware in the two
   dark themes so buttons/rows don't stay white on dark backgrounds. */
html[data-theme="pine-hollow"] .btn,
html[data-theme="twilight-trail"] .btn,
html[data-theme="pine-hollow"] .icon-btn,
html[data-theme="twilight-trail"] .icon-btn,
html[data-theme="pine-hollow"] .task-row,
html[data-theme="twilight-trail"] .task-row,
html[data-theme="pine-hollow"] .seg-btn,
html[data-theme="twilight-trail"] .seg-btn {
  background: var(--card);
}
html[data-theme="pine-hollow"] .btn,
html[data-theme="twilight-trail"] .btn,
html[data-theme="pine-hollow"] .seg-btn,
html[data-theme="twilight-trail"] .seg-btn,
html[data-theme="pine-hollow"] .task-row,
html[data-theme="twilight-trail"] .task-row {
  color: var(--ink);
}

/* ---------- v7.3.2 hotfix: dark-theme text legibility ----------
   In the two dark themes --moss-deep is near-black, but many text
   classes still paint with it on dark surfaces (cards, paper) — e.g.
   the You tab's "Traveler · Lv N". David's rule: dark themes get
   light text everywhere. Flip those to --ink. Dark-on-gold buttons
   are left alone (gold backgrounds are light, already readable).
   White-surface controls (.dresser-base-btn, .ms-check) go theme-aware
   like the R7.3 guard did for .btn/.task-row/.seg-btn. */
html[data-theme="pine-hollow"] .card-title,
html[data-theme="twilight-trail"] .card-title,
html[data-theme="pine-hollow"] .victory-title,
html[data-theme="twilight-trail"] .victory-title,
html[data-theme="pine-hollow"] .stamp-line,
html[data-theme="twilight-trail"] .stamp-line,
html[data-theme="pine-hollow"] .file-label,
html[data-theme="twilight-trail"] .file-label,
html[data-theme="pine-hollow"] .page-title,
html[data-theme="twilight-trail"] .page-title,
html[data-theme="pine-hollow"] .route-biome,
html[data-theme="twilight-trail"] .route-biome,
html[data-theme="pine-hollow"] .diff-name,
html[data-theme="twilight-trail"] .diff-name,
html[data-theme="pine-hollow"] .unlock-title,
html[data-theme="twilight-trail"] .unlock-title,
html[data-theme="pine-hollow"] .xp-numbers,
html[data-theme="twilight-trail"] .xp-numbers,
html[data-theme="pine-hollow"] .xp-earned,
html[data-theme="twilight-trail"] .xp-earned,
html[data-theme="pine-hollow"] .levelup-note,
html[data-theme="twilight-trail"] .levelup-note,
html[data-theme="pine-hollow"] .perk-name,
html[data-theme="twilight-trail"] .perk-name,
html[data-theme="pine-hollow"] .you-name,
html[data-theme="twilight-trail"] .you-name,
html[data-theme="pine-hollow"] .sheet-stat-value,
html[data-theme="twilight-trail"] .sheet-stat-value,
html[data-theme="pine-hollow"] .wf-milestone-state,
html[data-theme="twilight-trail"] .wf-milestone-state,
html[data-theme="pine-hollow"] .goal-sub,
html[data-theme="twilight-trail"] .goal-sub,
html[data-theme="pine-hollow"] .step-count,
html[data-theme="twilight-trail"] .step-count,
html[data-theme="pine-hollow"] .strength-title,
html[data-theme="twilight-trail"] .strength-title,
html[data-theme="pine-hollow"] .wf-year-title,
html[data-theme="twilight-trail"] .wf-year-title {
  color: var(--ink);
}
html[data-theme="pine-hollow"] .dresser-base-btn,
html[data-theme="twilight-trail"] .dresser-base-btn,
html[data-theme="pine-hollow"] .ms-check,
html[data-theme="twilight-trail"] .ms-check {
  background: var(--card);
  color: var(--ink);
}
/* v7.6.1: pixel-past's --ink-soft (#306230) on --card (#8bac0f) is only 2.75:1 —
   too faint for the small pack/route/difficulty labels, so they use --ink. */
html[data-theme="pixel-past"] .route-flavor,
html[data-theme="pixel-past"] .route-lock,
html[data-theme="pixel-past"] .diff-desc { color: var(--ink); }
/* ============ Wayfarer R7.6 — global pixel density (Worker D) ============
 * Every game canvas renders nearest-neighbor, always: avatar + companion
 * mounts, look-closer portraits, the campfire scene, the overworld map, and
 * any future sprite canvases inside .wf-sprite / companion holders. (No
 * "wildlife" canvases exist in the tree yet; the defensive selectors below
 * cover them if they arrive.) Never upscale-blur sprites. */
[data-avatar-mount] canvas,
[data-companion-mount] canvas,
[data-portrait-mount] canvas,
.look-closer-canvas canvas,
.campfire-scene canvas,
.overworld-canvas,
.wf-sprite canvas,
.companion-follower canvas,
.companion-row-sprite canvas,
[data-wildlife-mount] canvas,
.wf-wildlife canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------- R7.4 Display modes (Worker C) ----------
 * Additive overrides scoped to body.dm-<id>. dm-classic intentionally has
 * NO rules here — the base stylesheet IS classic. Every rule composes with
 * html[data-theme="<id>"] by reading the 15 theme vars; the only hardcoded
 * colors are mode-specific chrome (the Game Boy device frame/backdrop,
 * warm hearth glows, ultra vignette blacks). No !important anywhere:
 * body.dm-<id> (0,2,1-ish) outranks base selectors, and equal-specificity
 * theme rules lose by source order (this section appends last).
 * Display modes introduce no animation of their own; the base stylesheet's
 * prefers-reduced-motion block already kills transitions/animations. */

/* ----- switcher (rendered by WF.Display.renderSwitcher) -----
 * Scoped to any display-mode body so it never leaks into unstyled
 * contexts; applyToDom() always leaves exactly one dm-* class on body. */
body[class*="dm-"] .display-mode-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
body[class*="dm-"] .display-mode {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--moss-deep); border-radius: 4px;
  padding: 10px 12px; box-shadow: 0 3px 0 var(--moss-deep);
}
body[class*="dm-"] .display-mode:active { transform: translateY(3px); box-shadow: none; }
/* R7.6: the name chip is inline-block with fixed padding in BOTH states so
   toggling active never shifts layout; base name uses --ink (the v7.3.2
   dark-theme legibility rule — --moss-deep was near-invisible on dark paper). */
body[class*="dm-"] .display-mode-name {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-family: var(--font-px); font-size: 12px; line-height: 1.5;
  color: var(--ink);
}
body[class*="dm-"] .display-mode-blurb {
  display: block; font-size: 13px; line-height: 1.45; color: var(--ink-soft); margin-top: 4px;
}
/* R7.6: strong active treatment — gold outline + filled name chip + halo.
   Name fill pairs --gold-bright (light) with --moss-deep (dark) text, the
   same pairing as .hud-day, so it stays readable in all six themes. */
body[class*="dm-"] .display-mode.is-active {
  border-color: var(--gold);
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
  box-shadow: 0 4px 0 var(--gold),
    0 0 18px color-mix(in srgb, var(--gold) 50%, transparent);
  background: color-mix(in srgb, var(--gold) 16%, var(--paper));
}
body[class*="dm-"] .display-mode.is-active .display-mode-name {
  background: var(--gold-bright);
  color: var(--moss-deep);
}

/* ================= dm-gameboy — handheld console ================= */
body.dm-gameboy { background: #141419; } /* device backdrop chrome */
body.dm-gameboy #root {
  max-width: 430px; margin-left: auto; margin-right: auto;
  box-sizing: border-box; /* the 4px frame must not push past 320px viewports */
  border: 4px solid #1a1a22; /* device chrome, not a theme color */
  border-radius: 18px;
  position: relative; overflow: hidden;
  background: var(--paper);
}
/* dot-matrix scanline overlay: faint, never intercepts taps */
body.dm-gameboy #root::after {
  content: ""; position: absolute; inset: 0; z-index: 120;
  pointer-events: none; border-radius: 14px;
  background: repeating-linear-gradient(0deg,
    rgba(10, 10, 16, 0.055) 0 1px, transparent 1px 3px);
}
/* bigger viewport: pixel canvases render larger, kept crisp */
body.dm-gameboy [data-avatar-mount] canvas,
body.dm-gameboy [data-companion-mount] canvas {
  image-rendering: pixelated;
  zoom: 1.35; /* layout-aware scale; unsupported engines simply keep 1x */
}
/* chunky card borders (theme border colors preserved) */
body.dm-gameboy .card { border-width: 3px; }
/* console buttons along the bottom: rounded, bold, tall */
body.dm-gameboy .bottom-nav { max-width: 430px; gap: 10px; padding-left: 14px; padding-right: 14px; }
body.dm-gameboy .nav-btn {
  border-width: 4px; border-radius: 16px;
  min-height: 64px; font-size: 22px;
}
body.dm-gameboy .display-mode { border-width: 4px; border-radius: 10px; }

/* ================= dm-ultra — 16-bit painterly showpiece ================= */
/* R7.6: strengthened — deeper layered washes (four theme-aware washes +
   a top sheen; if color-mix is unsupported the whole background-image is
   dropped and flat theme paper shows — graceful). */
body.dm-ultra {
  background-color: var(--paper);
  background-image:
    radial-gradient(130% 70% at 50% -10%,
      color-mix(in srgb, var(--gold) 30%, transparent), transparent 62%),
    radial-gradient(105% 60% at 105% 110%,
      color-mix(in srgb, var(--moss) 36%, transparent), transparent 65%),
    radial-gradient(95% 55% at -5% 108%,
      color-mix(in srgb, var(--sage) 32%, transparent), transparent 62%),
    radial-gradient(80% 45% at 50% 115%,
      color-mix(in srgb, var(--clay) 28%, transparent), transparent 65%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--cream) 35%, transparent) 0, transparent 22%);
}
/* fine 1px borders, deep layered shadow, faint top highlight */
body.dm-ultra .card {
  border-width: 1px; border-color: var(--ink-soft);
  box-shadow:
    0 18px 38px rgba(8, 10, 14, 0.34),
    0 4px 10px rgba(8, 10, 14, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
/* gold accents glow — stronger in R7.6; press shadows preserved */
body.dm-ultra .btn-secondary {
  box-shadow: 0 4px 0 var(--moss-deep),
    0 0 16px color-mix(in srgb, var(--gold) 75%, transparent);
}
body.dm-ultra .nav-btn.nav-active {
  box-shadow: 0 3px 0 var(--moss-ink),
    0 0 16px color-mix(in srgb, var(--gold) 75%, transparent);
}
/* R7.6: glow extends to the shard/economy chips and the press-start badge */
body.dm-ultra .shard-chip {
  box-shadow: 0 3px 0 var(--moss-deep),
    0 0 12px color-mix(in srgb, var(--gold) 65%, transparent);
}
body.dm-ultra .hud-streak, body.dm-ultra .hud-shards {
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 65%, transparent);
}
body.dm-ultra .press-start {
  box-shadow: var(--px-shadow),
    0 0 14px color-mix(in srgb, var(--gold) 65%, transparent);
}
/* R7.6: HUD gets a gold-kissed border + halo of its own */
body.dm-ultra .hud {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--moss-ink));
  box-shadow: 0 0 18px color-mix(in srgb, var(--gold) 30%, transparent),
    var(--px-shadow);
}
body.dm-ultra .hud-day {
  text-shadow: 0 0 10px color-mix(in srgb, var(--gold-bright) 55%, transparent);
}
/* larger, crisper sprites */
body.dm-ultra [data-avatar-mount] canvas,
body.dm-ultra [data-companion-mount] canvas {
  image-rendering: pixelated;
  zoom: 1.3;
}
/* rich map vignette — ::after sits above tiles/markers, never taps.
   R7.6: deeper edge falloff + a warm gold glow rising from the bottom. */
body.dm-ultra .overworld::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 120% at 50% 45%,
      transparent 50%, rgba(6, 6, 12, 0.52) 100%),
    radial-gradient(70% 45% at 50% 108%,
      color-mix(in srgb, var(--gold) 26%, transparent), transparent 70%);
}
/* R7.6: the painted map gets a saturation/contrast lift */
body.dm-ultra .overworld-canvas { filter: saturate(1.22) contrast(1.06); }

/* ================= dm-hearth — cozy ================= */
/* R7.6: strengthened from "~only font-size" to unmistakable — a warm
   theme-aware gradient backdrop (warm tints mixed INTO the theme paper,
   so all six themes keep working), a stronger hearth glow, soft rounded
   cards with warm shadows, warm-tinted nav, larger type. */
body.dm-hearth {
  font-size: 108%; /* slightly larger base type */
  background-color: var(--paper);
  background-image: linear-gradient(180deg,
    color-mix(in srgb, #ffb066 26%, var(--paper)) 0%,
    color-mix(in srgb, #e8955a 18%, var(--paper)) 40%,
    color-mix(in srgb, #c97b3f 14%, var(--paper)) 100%);
}
/* warm hearth glow rising from the bottom; pointer-events none */
body.dm-hearth::before {
  content: ""; position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background:
    radial-gradient(90% 55% at 50% 108%, rgba(255, 150, 70, 0.14), transparent 70%),
    linear-gradient(180deg,
      rgba(255, 176, 102, 0.10), rgba(190, 120, 60, 0.07));
}
body.dm-hearth .card {
  border-radius: 16px;
  border-color: color-mix(in srgb, var(--clay) 60%, var(--moss-deep));
  box-shadow: 0 12px 28px rgba(122, 74, 28, 0.20),
    0 3px 8px rgba(122, 74, 28, 0.12);
}
body.dm-hearth .card-title { font-size: 14px; }
/* everything soft and round */
body.dm-hearth .btn { border-radius: 22px; }
body.dm-hearth .icon-btn { border-radius: 14px; }
body.dm-hearth .nav-btn { border-radius: 20px; }
body.dm-hearth .text-input,
body.dm-hearth .journal-title-input,
body.dm-hearth .journal-textarea { border-radius: 12px; }
body.dm-hearth .seg { border-radius: 14px; }
body.dm-hearth .modal { border-radius: 18px; }
body.dm-hearth .hud { border-radius: 14px; }
body.dm-hearth .tile { border-radius: 8px; }
/* warm-tinted nav — tints mix into the theme's nav colors, never hardcoded */
body.dm-hearth .bottom-nav {
  background: color-mix(in srgb, #8a4f1f 34%, var(--moss-deep));
  border-top-color: color-mix(in srgb, #a05a24 60%, var(--moss-ink));
}
body.dm-hearth .nav-btn {
  background: color-mix(in srgb, #a05a24 22%, var(--moss));
  border-color: color-mix(in srgb, #c97b3f 55%, var(--moss-ink));
}
/* cozy breathing room on the map too */
body.dm-hearth .screen { padding: 20px 18px 40px; }
body.dm-hearth .tile-run { gap: 10px; }

/* ================= dm-ink — quiet minimal ================= */
/* R7.6: strengthened to quiet-minimal-OBVIOUS. Paper grain via two subtle
   repeating gradients (laid lines + faint vertical fibers). Accent vars
   are desaturated toward the theme's own --ink/--paper with color-mix —
   IMPORTANT: they reference --ink/--paper only, never themselves, so there
   is no self-referential cycle; all six themes keep working. Text colors
   (--ink/--ink-soft) are untouched: no hardcoded text colors anywhere. */
body.dm-ink {
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg,
      rgba(0, 0, 0, 0.032) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg,
      rgba(0, 0, 0, 0.014) 0 1px, transparent 1px 7px);
  --sage: color-mix(in srgb, var(--ink) 55%, var(--paper));
  --gold: color-mix(in srgb, var(--ink) 55%, var(--paper));
  --gold-bright: color-mix(in srgb, var(--ink) 32%, var(--paper));
  --clay: color-mix(in srgb, var(--ink) 55%, var(--paper));
  --danger: color-mix(in srgb, var(--ink) 62%, var(--paper));
}
/* thin 1px ink rules everywhere, no shadows, soft corners */
body.dm-ink .card,
body.dm-ink .btn,
body.dm-ink .nav-btn,
body.dm-ink .icon-btn,
body.dm-ink .task-row,
body.dm-ink .hud,
body.dm-ink .seg,
body.dm-ink .overworld,
body.dm-ink .display-mode,
body.dm-ink .text-input,
body.dm-ink .journal-title-input,
body.dm-ink .journal-textarea,
body.dm-ink .route-card,
body.dm-ink .diff-card,
body.dm-ink .modal,
body.dm-ink .perk-card,
body.dm-ink .ach-card,
body.dm-ink .victory-panel,
body.dm-ink .voucher-stamped,
body.dm-ink .history-row,
body.dm-ink .hud-streak,
body.dm-ink .hud-shards,
body.dm-ink .hud-level,
body.dm-ink .hud-diff,
body.dm-ink .shard-chip,
body.dm-ink .size-badge,
body.dm-ink .node-marker,
body.dm-ink .ow-dest-badge,
body.dm-ink .goal-open,
body.dm-ink .sheet-stat,
body.dm-ink .letter-toast,
body.dm-ink .wf-year-recap {
  border-width: 1px; border-color: var(--ink); border-radius: 2px;
  box-shadow: none;
}
body.dm-ink .seg-btn + .seg-btn { border-left-width: 1px; }
body.dm-ink .toggle { border-width: 1px; }
body.dm-ink .btn:active,
body.dm-ink .nav-btn:active,
body.dm-ink .display-mode:active { transform: none; }
/* generous whitespace */
body.dm-ink .card { padding: 22px; margin: 20px 0; }
body.dm-ink .screen { padding: 28px 22px 48px; }
body.dm-ink .tile-run { gap: 12px; }
body.dm-ink .task-list,
body.dm-ink .history-list,
body.dm-ink .goal-list { gap: 14px; }

/* dm-classic: no rules — the base stylesheet IS classic. */

/* ---------- reduced motion ----------
 * Display modes introduce no animation, transition, or motion of their
 * own; the base stylesheet's prefers-reduced-motion block already
 * disables transitions/animations globally, so nothing further is needed. */

/* ============ Wayfarer R7.4 — Companions (Worker B) ============ */

/* Follower sprites trailing the traveler on the map.
   The coordinator places these inside a positioned traveler wrapper. */
.companion-follower {
  position: absolute;
  z-index: 1; /* below the traveler */
  display: inline-block;
  line-height: 0;
  image-rendering: pixelated;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.companion-follower canvas { display: block; }
.companion-follower[data-companion-id="cat1"] { left: -16px; bottom: 2px; }
.companion-follower[data-companion-id="cat2"] { left: -30px; bottom: 0; }
.companion-follower[data-companion-id="hound"] { right: -18px; bottom: 2px; }
.companion-follower:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Trailing bounce. Honest note: CSS cannot swap the canvas walk0/walk1
   frames — the bob implies motion. */
@keyframes follower-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.follower-bob { animation: follower-bob 1.6s ease-in-out infinite; }
.follower-bob[data-companion-id="cat2"] { animation-delay: 0.25s; }
.follower-bob[data-companion-id="hound"] { animation-delay: 0.5s; }

/* Pet reaction: joyful hop + a tiny heart float-up. JS removes the class on
   animationend (~1.2s). Defined AFTER .follower-bob so it wins while active. */
@keyframes pet-hop {
  0% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-10px) rotate(-6deg); }
  45% { transform: translateY(0) rotate(4deg); }
  65% { transform: translateY(-5px) rotate(-3deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
@keyframes pet-heart {
  0% { opacity: 0; transform: translate(-50%, 4px) scale(0.6); }
  30% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(0.9); }
}
.pet-happy {
  position: relative;
  animation: pet-hop 1.2s ease-in-out 1;
}
.pet-happy::after {
  content: '\2665';
  position: absolute;
  left: 50%;
  top: -6px;
  font-size: 14px;
  line-height: 1;
  color: #e58e8e;
  pointer-events: none;
  animation: pet-heart 1.2s ease-out 1;
}

/* Reduced-motion path: gentle glow pulse, no bounce, no hop. */
@keyframes pet-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 220, 150, 0)); }
  50% { filter: drop-shadow(0 0 7px rgba(255, 220, 150, 0.9)); }
}
.pet-calm { animation: pet-glow 1.2s ease-in-out 1; }

@media (prefers-reduced-motion: reduce) {
  .follower-bob { animation: none; }
  .pet-happy { animation: pet-glow 1.2s ease-in-out 1; }
  .pet-happy::after { animation: none; opacity: 0; }
}

/* Companion panel (naming UI). 390px-safe: rows flex, inputs shrink. */
.companion-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 100%;
  box-sizing: border-box;
}
.companion-panel-blurb {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.85;
}
.companion-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
}
.companion-row-sprite { flex: 0 0 auto; line-height: 0; }
.companion-row-sprite canvas { display: block; image-rendering: pixelated; }
.companion-row-body { flex: 1 1 auto; min-width: 0; }
.companion-row-name { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.companion-row-edit { display: flex; gap: 8px; max-width: 100%; }
.companion-row-edit input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid currentColor;
}
.companion-row-edit button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.companion-pet-hint { font-size: 12px; opacity: 0.7; margin-top: 6px; }

/* "Look closer" portrait: chunky pixel frame, dark backdrop. */
.look-closer-frame {
  background: #1d2230;
  border: 4px solid #0f1220;
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px #3a4258, 0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 12px 10px;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.look-closer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 100%;
}
.look-closer-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.look-closer-canvas { line-height: 0; max-width: 100%; }
.look-closer-canvas canvas {
  display: block;
  image-rendering: pixelated;
  max-width: 140px;
  height: auto;
}
/* v7.8: companion portraits slightly smaller so three fit one row */
.look-closer-row .look-closer-canvas canvas { max-width: 80px; }
.look-closer-name {
  color: #eadfc3;
  font-size: 14px;
  text-align: center;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ============ Wayfarer R7.4 — coordinator additions ============ */

/* The map token (.ow-token) is pointer-events:none so it never intercepts
   map taps; companions must opt back in or petting silently does nothing. */
.companion-follower { pointer-events: auto; }

/* Text-color controller (Settings). */
.textcolor-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px;
  max-width: 100%;
}
.textcolor-swatch {
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; padding: 0;
  border: 2px solid var(--moss-deep); box-shadow: 0 2px 0 var(--moss-deep);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.textcolor-swatch:active { transform: translateY(2px); box-shadow: none; }
.textcolor-swatch.is-active { border-color: var(--gold-bright); box-shadow: 0 0 0 2px var(--gold-bright); }
.textcolor-default {
  width: auto; height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px;
  background: var(--paper); color: var(--ink); cursor: pointer;
  border: 2px solid var(--moss-deep); box-shadow: 0 2px 0 var(--moss-deep);
  font-family: inherit;
}
.textcolor-default:active { transform: translateY(2px); box-shadow: none; }
.textcolor-default.is-active { border-color: var(--gold-bright); box-shadow: 0 0 0 2px var(--gold-bright); }
.textcolor-custom {
  width: 44px; height: 38px; border-radius: 10px; padding: 2px; cursor: pointer;
  border: 2px dashed var(--moss-deep); background: transparent;
}

/* ================= Release 7.5 ================= */

/* LETTERS CSS START */
.letters-mailbox { display: flex; flex-direction: column; gap: 6px; }
.letter-row {
  display: flex; gap: 10px; align-items: flex-start;
  width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 10px 6px; cursor: pointer; font: inherit; color: inherit;
}
.letter-row:last-child { border-bottom: 0; }
.letter-env { font-size: 18px; line-height: 1.4; flex: 0 0 auto; }
.letter-env-read { color: rgba(0,0,0,0.25); }
.letter-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.letter-unread .letter-from { font-weight: 700; }
.letter-from { font-size: 15px; }
.letter-date { font-size: 12px; opacity: 0.55; }
.letter-first { font-size: 13px; opacity: 0.7; font-style: italic; }
.letters-empty { text-align: center; padding: 28px 16px; opacity: 0.85; }
.letters-empty-mark { font-size: 28px; margin-bottom: 8px; }
.letters-empty p { margin: 0; font-size: 14px; line-height: 1.5; }
.letters-reader { max-width: 100%; padding: 4px 2px; }
.letters-reader-head { margin-bottom: 10px; }
.letters-reader-from { font-size: 17px; font-weight: 700; }
.letters-reader-date { font-size: 12px; opacity: 0.55; margin-top: 2px; }
.letters-reader-body {
  background: rgba(0,0,0,0.03); border-radius: 10px;
  padding: 14px 14px; margin-bottom: 14px;
}
.letters-reader-body p { margin: 0 0 1em; font-size: 15px; line-height: 1.6; }
.letters-reader-body p:last-child { margin-bottom: 0; }
.letters-back, .letter-row:focus-visible {
  outline: 2px solid currentColor; outline-offset: 2px;
}
.letters-back {
  display: block; width: 100%; padding: 12px; font: inherit; font-size: 15px;
  border-radius: 10px; border: 1px solid rgba(0,0,0,0.15);
  background: none; color: inherit; cursor: pointer;
}
.letters-missing { text-align: center; padding: 20px 12px; font-size: 14px; opacity: 0.8; }
/* R7.5: letter arrival toast (one-shot, calm). */
.letter-toast {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 60;
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--card); border: 2px solid var(--gold); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  font-size: 14px; color: var(--ink);
}
.letter-toast p { margin: 0; line-height: 1.4; }
/* LETTERS CSS END */

/* RECAP CSS START */
.wf-year-recap {
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 12px;
  box-shadow: 0 0 18px rgba(232, 196, 106, 0.22), 0 2px 0 rgba(26, 38, 32, 0.12);
  max-width: 100%;
}
.wf-year-title {
  margin: 0 0 8px;
  font-family: var(--font-px);
  font-size: 12px;
  line-height: 1.7;
  color: var(--moss-deep);
}
.wf-year-lines {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.wf-year-line {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.wf-year-quiet .wf-year-line { color: var(--ink-soft); }
.wf-year-copyrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.wf-year-copy { min-height: var(--tap); }
.wf-year-copied {
  font-size: 13px;
  color: var(--ink-soft);
  min-width: 4em;
}
.wf-year-box {
  width: 100%;
  max-width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-soft);
  border-radius: 8px;
  resize: vertical;
}
/* RECAP CSS END */

/* SCARF+FOOTPRINTS+CONSTELLATION CSS START */
.wf-footprints { position:absolute; left:50%; top:100%; width:0; height:0; pointer-events:none; }
.wf-print { position:absolute; width:5px; height:7px; border-radius:50% 50% 50% 50% / 60% 60% 40% 40%; background:#8a7a5f; }
.wf-constellation { border-radius:8px; background:linear-gradient(180deg,#141a33 0%,#1e2450 60%,#292055 100%); padding:12px 12px 10px; max-width:100%; }
.wf-const-sky { display:block; width:100%; height:auto; }
.wf-const-line { stroke:#aeb8ec; stroke-width:0.8; opacity:0.35; }
.wf-const-star { fill:#fff7e2; animation:wf-star-twinkle 3.4s ease-in-out infinite; }
.wf-const-label { margin:8px 0 2px; text-align:center; font-size:12px; color:#f2ecd9; opacity:0.9; }
.wf-const-empty { margin:10px 4px; text-align:center; font-style:italic; font-size:13px; line-height:1.6; color:#d8cfb8; }
@keyframes wf-star-twinkle { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
@media (prefers-reduced-motion: reduce) { .wf-const-star { animation:none; } }
/* SCARF+FOOTPRINTS+CONSTELLATION CSS END */

/* POSTCARD CSS START */
.wf-postcard-btn {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 16px;
  line-height: 1.2;
  border-radius: 12px;
  white-space: nowrap;
}
.step-log-row .wf-postcard-btn { margin-left: auto; }
.wf-postcard-preview {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 12px auto;
  border-radius: 8px;
  image-rendering: pixelated;
  box-shadow: var(--px-shadow, 4px 4px 0 rgba(26,38,32,0.28));
}
/* POSTCARD CSS END */

/* ---------- Companions R7.6 ---------- */
.companion-panel { margin: 1.5rem 0; }
.companion-panel-blurb { font-style: italic; opacity: .85; margin: 0 0 1rem; }
.companion-panel-empty { font-style: italic; opacity: .7; }
.companion-rows { display: grid; gap: 1rem; margin: 1rem 0; }
.companion-follow-all { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .5rem; }
.follow-all-toggle { align-self: flex-start; padding: .5rem 1rem; border-radius: 999px; border: 2px solid var(--gold, #b5621f); background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.follow-all-toggle[aria-pressed="true"] { background: var(--gold, #b5621f); color: #14100c; }
.companion-follow-all-hint { margin: 0; font-size: .85em; opacity: .7; font-style: italic; }
.companion-row { display: flex; gap: .9rem; align-items: flex-start; padding: .9rem; background: rgba(127,127,127,.06); border: 1px solid rgba(127,127,127,.18); border-radius: 12px; min-width: 0; max-width: 100%; box-sizing: border-box; }
.companion-row-sprite { flex: 0 0 auto; line-height: 0; }
.companion-row-body { flex: 1 1 auto; display: grid; gap: .5rem; min-width: 0; }
.companion-row-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; row-gap: .4rem; }
.companion-row-name { font-weight: 700; font-size: 1.05em; min-width: 0; overflow-wrap: anywhere; }
.companion-follow-toggle { flex: 0 0 auto; white-space: nowrap; max-width: 100%; padding: .35rem .8rem; border-radius: 999px; font: inherit; font-size: .85em; cursor: pointer; border: 2px solid var(--moss-deep, #8a6f52); background: transparent; color: var(--ink); }
.companion-follow-toggle[aria-pressed="true"] { background: var(--moss-deep, #8a6f52); color: #fff; border-color: var(--moss-deep, #8a6f52); }
.companion-row-edit { display: flex; gap: .5rem; flex-wrap: wrap; }
.companion-row-edit input { flex: 1 1 auto; min-width: 0; padding: .35rem .6rem; border-radius: 8px; border: 1px solid rgba(127,127,127,.35); background: var(--paper); color: var(--ink); font: inherit; }
.companion-row-edit button { flex: 0 0 auto; white-space: nowrap; padding: .35rem .8rem; min-height: 44px; border-radius: 8px; border: 1px solid var(--gold, #b5621f); background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.companion-swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.companion-swatch { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; cursor: pointer; padding: 0; border: 2px solid rgba(127,127,127,.4); }
.companion-swatch.is-selected, .companion-swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--gold, #b5621f); }
.companion-remove { justify-self: start; padding: .3rem .7rem; border-radius: 8px; font: inherit; font-size: .85em; border: 1px solid rgba(200,80,60,.5); background: transparent; color: var(--ink); opacity: .8; cursor: pointer; }
.companion-add { margin-top: 1rem; }
.companion-add-blurb { font-style: italic; opacity: .8; margin: 0 0 .5rem; }
.companion-species-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.companion-species-btn { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .6rem .8rem; border-radius: 12px; cursor: pointer; border: 1px solid rgba(127,127,127,.25); background: rgba(127,127,127,.06); color: var(--ink); font: inherit; }
.companion-species-btn:hover { border-color: var(--gold, #b5621f); }
.companion-species-sprite { line-height: 0; }
.companion-species-name { font-size: .85em; }
.companion-fireside { margin: 1.5rem 0; text-align: center; }
.fireside-greeting { font-style: italic; opacity: .9; margin: 0 0 1rem; }
.fireside-circle { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2rem; }
.fireside-companion { display: flex; flex-direction: column; align-items: center; gap: .3rem; background: none; border: none; cursor: pointer; padding: .4rem; color: inherit; font: inherit; }
.fireside-sprite { line-height: 0; }
.fireside-name { font-size: .9em; font-style: italic; opacity: .9; }
@keyframes companion-tail { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(7deg); } }
.idle-tail { animation: companion-tail 3.2s ease-in-out infinite; transform-origin: 70% 80%; display: inline-block; }
@keyframes companion-ear { 0%,88%,100% { transform: rotate(0deg); } 92% { transform: rotate(-9deg); } 96% { transform: rotate(4deg); } }
.idle-ear { animation: companion-ear 4.1s ease-in-out infinite; transform-origin: 50% 20%; display: inline-block; }
@keyframes companion-hop { 0%,90%,100% { transform: translateY(0); } 94% { transform: translateY(-4px); } }
.idle-hop { animation: companion-hop 3.8s ease-in-out infinite; display: inline-block; }
@keyframes companion-peck { 0%,86%,100% { transform: rotate(0deg); } 90% { transform: rotate(9deg); } 94% { transform: rotate(0deg); } }
.idle-peck { animation: companion-peck 4.6s ease-in-out infinite; transform-origin: 50% 100%; display: inline-block; }
@media (prefers-reduced-motion: reduce) { .idle-tail, .idle-ear, .idle-hop, .idle-peck { animation: none !important; } }

/* ---------- Fireside scene seats R7.6 ---------- */
.wf-fireside-row { max-width: 70%; }
.wf-fireside-caption { font-size: 11px; font-style: italic; color: #f2e8d5; text-shadow: 0 1px 3px rgba(0,0,0,.8); margin: 0 0 2px; text-align: center; }
.wf-fireside-seats { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 6px; }
.wf-fireside-seats .companion-fireside { margin: 0; }
.wf-fireside-seats .fireside-greeting { display: none; }
.wf-fireside-seats .fireside-circle { gap: .5rem; }
.wf-fireside-seats .fireside-companion { min-width: 44px; min-height: 44px; }
.wf-fireside-seats .fireside-sprite canvas { width: 44px !important; height: 44px !important; }
.wf-fireside-seats .fireside-name { display: none; }
.wf-fireside-seat { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font-size: 26px; cursor: pointer; border-radius: 10px; }
.wf-fireside-seat:active { transform: scale(1.15); }

/* ---------- Campfire visitors + scarf controls R7.6 ---------- */
.wf-visitor-seat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wf-visitor-name { font-size: 10px; font-style: italic; color: #f2e8d5; text-shadow: 0 1px 3px rgba(0,0,0,.85); white-space: nowrap; }
.wf-fireside-emoji { font-size: 26px; line-height: 1; }
.wf-fireside-name { font-size: 10px; font-style: italic; color: #f2e8d5; text-shadow: 0 1px 3px rgba(0,0,0,.85); }
.scarf-card { margin: 1.5rem 0; }
.scarf-row { margin: .5rem 0 1rem; }
.scarf-colors { display: flex; gap: .6rem; flex-wrap: wrap; }
.scarf-swatch { width: 40px; height: 40px; border-radius: 50%; cursor: pointer; padding: 0; border: 2px solid rgba(127,127,127,.4); min-width: 40px; }
.scarf-swatch.is-active, .scarf-swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--gold, #b5621f); }
.scarf-name { font-size: .85em; opacity: .8; }
/* R7.17: the finished painting owns the road. Do not draw a second generated route over it. */
.overworld-canvas { display:none !important; }
.overworld-art { object-fit:contain !important; background:#efe4c9; }

/* ---------- R7.26: companions actually gather around the campfire ---------- */
.wf-fireside-row { max-width: none; width: 100%; height: 100%; }
.wf-fireside-caption {
  position: absolute; left: 50%; bottom: 1.5%; transform: translateX(-50%);
  width: 70%; margin: 0; pointer-events: none; z-index: 90;
}
.wf-fireside-seats,
.wf-fireside-seats .companion-fireside,
.wf-fireside-seats .fireside-circle { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
.wf-fireside-seats .fireside-circle { display: block; }
.wf-fireside-seats .fireside-companion,
.wf-fireside-seat {
  margin: 0; padding: 0; min-width: 50px; min-height: 50px;
  filter: drop-shadow(0 3px 2px rgba(0,0,0,.38));
  transform-origin: 50% 85%;
}
.wf-fireside-seats .fireside-sprite canvas { width: 50px !important; height: 50px !important; }
.wf-fireside-seats .fireside-companion:focus-visible,
.wf-fireside-seat:focus-visible { outline: 2px solid #ffd88a; outline-offset: 2px; border-radius: 10px; }
@media (max-width: 520px) {
  .wf-fireside-seats .fireside-companion, .wf-fireside-seat { min-width: 44px; min-height: 44px; }
  .wf-fireside-seats .fireside-sprite canvas { width: 44px !important; height: 44px !important; }
  .wf-fireside-caption { width: 82%; font-size: 10px; }
}

/* ---------- R7.27: fireside companions are ground-anchored ---------- */
.wf-fireside-seats .fireside-companion[data-grounded="true"],
.wf-fireside-seat[data-grounded="true"] {
  top: auto !important;
  transform-origin: 50% 100%;
}
.wf-fireside-seats .fireside-companion[data-grounded="true"] .fireside-sprite,
.wf-fireside-seat[data-grounded="true"] {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
