/* =============================================================================
 * TaskBane — Modern-Minimal design system (mobile-first)
 * Clean app shell (sans body, soft rounded cards, generous whitespace) with a
 * pixel-art soul: PixelDisplay for names/levels/labels + hand-drawn portraits.
 * ========================================================================== */
@import url('fonts.css');

:root {
  --bg: #F4F3EF; --card: #FFFFFF; --card2: #FAF9F5;
  --ink: #26221E; --soft: #8f897e; --line: #ECEAE3; --line2: #E2DFD6;
  --green: #2E9E6B; --green-ink: #ffffff; --gold: #E3A81F; --blue: #3E7CB1; --purple: #8E5BC4; --red: #D9503F;
  --accent: var(--green);
  --ring-bg: #E9E6DF;
  --r-common: #9aa1ab; --r-uncommon: #57C84D; --r-rare: #3B82F6; --r-epic: #A855F7; --r-legendary: #F5A623;
  --shadow: 0 6px 18px rgba(30,25,20,.06);
  --shadow-sm: 0 3px 10px rgba(30,25,20,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --bg:#16171B; --card:#212228; --card2:#1b1c21; --ink:#ECEAE3; --soft:#9a958b; --line:#2c2e35; --line2:#363843; --ring-bg:#2c2e35; --green:#37b57d; --shadow:0 8px 22px rgba(0,0,0,.35); --shadow-sm:0 3px 10px rgba(0,0,0,.3); color-scheme:dark; } }
:root[data-theme="dark"] { --bg:#16171B; --card:#212228; --card2:#1b1c21; --ink:#ECEAE3; --soft:#9a958b; --line:#2c2e35; --line2:#363843; --ring-bg:#2c2e35; --green:#37b57d; --shadow:0 8px 22px rgba(0,0,0,.35); --shadow-sm:0 3px 10px rgba(0,0,0,.3); color-scheme:dark; }
/* Nocturne shared Slate's rule outright, which is why the two were
   indistinguishable. It is a night SKY now — cool blues and a moonlit accent —
   rather than a slightly different grey. */
:root[data-theme="midnight"] { --bg:#0D1326; --card:#161E38; --card2:#111830; --ink:#DFE6F5; --soft:#8792AE; --line:#232C4A; --line2:#2E3A5C; --ring-bg:#232C4A; --green:#6C8FE8; --gold:#D9B45C; --accent:#6C8FE8; --shadow:0 8px 22px rgba(0,0,0,.45); --shadow-sm:0 3px 10px rgba(0,0,0,.35); color-scheme:dark; }
:root[data-theme="emberforge"] { --bg:#241413; --card:#301b19; --card2:#2a1715; --ink:#f4dccb; --soft:#b78e7c; --line:#3d2320; --line2:#4a2a26; --ring-bg:#3d2320; --green:#e07a3c; --gold:#f0b429; --accent:#e07a3c; --shadow:0 8px 22px rgba(0,0,0,.4); color-scheme:dark; }
:root[data-theme="meadow"] { --bg:#eef4e2; --card:#ffffff; --card2:#f6faee; --ink:#2b3a1c; --soft:#6b7a55; --line:#e0e9cf; --line2:#d3dfbd; --ring-bg:#dbe7c5; --green:#4f9d3a; --accent:#4f9d3a; color-scheme:light; }
:root[data-theme="frostfell"] { --bg:#e7f0f6; --card:#ffffff; --card2:#f0f6fb; --ink:#1e3444; --soft:#5f7a8c; --line:#d3e2ee; --line2:#c2d6e6; --ring-bg:#cfe0ee; --green:#3a8fbf; --gold:#4f9fd0; --accent:#3a8fbf; color-scheme:light; }
:root[data-theme="royal"] { --bg:#1c1630; --card:#271f42; --card2:#221b3a; --ink:#f0e7d0; --soft:#a99cc4; --line:#372c58; --line2:#443869; --ring-bg:#372c58; --green:#b98fe6; --gold:#e3b93f; --accent:#b98fe6; --shadow:0 8px 22px rgba(0,0,0,.4); color-scheme:dark; }

/* ---- base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  overflow-x: hidden; overscroll-behavior-y: contain;
}
img, svg { image-rendering: pixelated; }
.disp { font-family: 'PixelDisplay', monospace; font-weight: 400; letter-spacing: .2px; }
.num { font-family: 'PixelDisplay', monospace; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
a { color: var(--green); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 96px; }
.screen { display: none; padding: 4px 18px 24px; animation: fade .2s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.h-row { display: flex; align-items: center; gap: 8px; margin: 18px 2px 4px; }
.h-row h2 { font-size: 21px; }
h2.big { font-size: 22px; }
.subttl, .hint { color: var(--soft); font-size: 14px; }
.subttl { margin: 2px 0 14px; }
.spacer { flex: 1; } .center { text-align: center; } .mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; } .wrap { display: flex; flex-wrap: wrap; gap: 8px; }
hr.rule { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---- cards --------------------------------------------------------------- */
.card, .panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line2);
  border-radius: 12px; padding: 12px 18px; min-height: 48px; font-size: 15px; font-weight: 700;
  box-shadow: var(--shadow-sm); transition: transform .06s, filter .1s; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn.gold { background: var(--gold); color: #241a08; border-color: transparent; }
.btn.green { background: var(--green); color: var(--green-ink); border-color: transparent; }
.btn.blue { background: var(--blue); color: #fff; border-color: transparent; }
.btn.ruby { background: var(--red); color: #fff; border-color: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.ghost { box-shadow: none; background: transparent; border-color: var(--line); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---- banner -------------------------------------------------------------- */
#banner { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 16px 18px 12px; }
#banner .btop { display: flex; align-items: center; gap: 14px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex: none; position: relative;
  background: var(--card2); border: 2px solid var(--card); box-shadow: var(--shadow-sm); }
.avatar svg, .avatar img { width: 100%; height: 100%; }
.avatar .cos-ov { position: absolute; inset: 0; pointer-events: none; image-rendering: pixelated; z-index: 2; }
#banner .bmeta { flex: 1; min-width: 0; }
#banner .hello { font-size: 13px; color: var(--soft); }
#banner .bname { font-family: 'PixelDisplay'; font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvring { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--green) var(--p, 0%), var(--ring-bg) 0); }
.lvring::before { content: ''; position: absolute; inset: 4px; background: var(--bg); border-radius: 50%; }
.lvring b { position: relative; font-family: 'PixelDisplay'; font-size: 14px; }
.xpbar { height: 8px; background: var(--ring-bg); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.xpbar > i { display: block; height: 100%; width: 0; background: var(--green); border-radius: 99px; transition: width .5s ease; }
.xpbar.big { height: 12px; }
.xpsub { display: flex; justify-content: space-between; font-size: 12px; color: var(--soft); margin-top: 6px; }
.xplabel { font-size: 12px; color: var(--soft); margin-top: 6px; }
#banner .chips { display: flex; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.chip .ic { width: 15px; height: 15px; }

/* ---- town crier ---------------------------------------------------------- */
.crier { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 13px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.crier .rail { width: 4px; align-self: stretch; border-radius: 99px; background: var(--gold); flex: none; }
.crier.over .rail { background: var(--red); }
.crier .cavatar { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex: none; border: 2px solid var(--line); }
.crier .cl { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: #b7791f; }
.crier.over .cl { color: var(--red); }
.crier .ct { font-size: 14px; font-style: italic; color: var(--soft); margin-top: 2px; line-height: 1.45; }

/* ---- NPC group headers --------------------------------------------------- */
.grp { display: flex; align-items: center; gap: 10px; margin: 22px 2px 10px; }
.grp .portrait { width: 32px; height: 32px; }
.grp .gn { font-size: 14px; font-weight: 700; }
.grp .gt { font-size: 12px; color: var(--soft); }

/* portrait medallion (round default) */
.portrait { width: var(--pz, 44px); height: var(--pz, 44px); border-radius: 50%; overflow: hidden; flex: none;
  background: var(--pc, var(--card2)); border: 1px solid var(--line2); position: relative; }
.portrait svg, .portrait img { width: 100%; height: 100%; }
.portrait .cos-ov { position: absolute; inset: 0; pointer-events: none; image-rendering: pixelated; z-index: 2; }
.portrait.sq { border-radius: 12px; }

/* ---- quest card ---------------------------------------------------------- */
.quest { display: flex; gap: 14px; align-items: flex-start; }
.complete { flex: none; padding: 0; background: none; border: none; margin-top: 2px; }
.complete .box { width: 26px; height: 26px; border: 2px solid var(--line2); border-radius: 50%; background: var(--card);
  display: grid; place-items: center; transition: background .1s; }
.complete .box .seal { display: none; }
.quest.done .complete .box { background: var(--green); border-color: var(--green); }
.quest.done .complete .box::after { content: '✓'; color: #fff; font-family: 'PixelDisplay'; font-size: 13px; }
.qbody { flex: 1; min-width: 0; }
.qtext { font-size: 17px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.quest.done .qtext { color: var(--soft); text-decoration: line-through; }
.qmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.qflavor { font-size: 14px; font-style: italic; color: var(--soft); margin-top: 10px; line-height: 1.45; cursor: pointer; }

/* rarity: dot + label + slim difficulty meter */
.rar { display: inline-flex; align-items: center; gap: 6px; font-family: 'PixelDisplay'; font-size: 9px; letter-spacing: .5px; color: var(--soft); text-transform: uppercase; }
.rar .dot { width: 9px; height: 9px; border-radius: 50%; }
.dbar { display: inline-flex; gap: 3px; }
.dbar i { width: 15px; height: 5px; border-radius: 99px; background: var(--ring-bg); display: inline-block; }
.due { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.due.soon { background: rgba(227,168,31,.16); color: #b7791f; }
.due.over { background: rgba(217,80,63,.14); color: var(--red); }
.tag-pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); color: var(--soft); }
.ribbon { font-family: 'PixelDisplay'; font-size: 9px; padding: 4px 9px; border-radius: 99px; color: #241a10; }

/* subtasks */
.qexpand { color: var(--green); font-size: 13px; font-weight: 700; padding: 10px 0 2px; width: 100%; text-align: left; display: flex; align-items: center; gap: 8px; }
.subbarline { flex: 1; height: 5px; background: var(--ring-bg); border-radius: 99px; overflow: hidden; }
.subbarline > i { display: block; height: 100%; background: var(--green); }
.subs { margin-top: 8px; }
.sub { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.sub .sbox { width: 22px; height: 22px; flex: none; border: 2px solid var(--line2); border-radius: 7px; background: var(--card);
  display: grid; place-items: center; font-family: 'PixelDisplay'; font-size: 11px; }
.sub.done .sbox { background: var(--green); border-color: var(--green); color: #fff; }
.sub .stext { font-size: 15px; word-break: break-word; }
.sub.done .stext { color: var(--soft); text-decoration: line-through; }

/* empty state */
.empty { text-align: center; padding: 40px 16px; color: var(--soft); }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ---- forms --------------------------------------------------------------- */
label.fld { display: block; margin: 16px 0 7px; font-size: 13px; font-weight: 700; }
textarea, input[type=text], input[type=date], input[type=time], input[type=password], select {
  width: 100%; background: var(--card); color: var(--ink); border: 1px solid var(--line2);
  border-radius: 12px; padding: 13px; font-family: inherit; font-size: 16px; }
textarea { min-height: 80px; resize: vertical; line-height: 1.4; }
textarea:focus, input:focus, select:focus { border-color: var(--green); outline: none; }
.helpnote { font-size: 12px; color: var(--soft); margin-top: 5px; }

/* difficulty slider */
.slider-wrap { padding: 4px 2px; }

/* the posting form's folded parts. A quest needs a title and nothing else;
 * difficulty and the giver both answer themselves, and only open if asked. */
.foldrow { display: flex; align-items: center; gap: 7px; width: 100%; background: none;
  border: 0; border-radius: 10px; padding: 9px 6px; margin-top: 4px; cursor: pointer;
  font: inherit; color: var(--ink); text-align: left; }
.foldrow:hover { background: var(--card2); }
.foldrow .fr-v { font-weight: 800; font-size: 14px; }
.foldrow .fr-n { color: var(--soft); font-size: 12.5px; }
.foldrow .fr-go { margin-left: auto; color: var(--soft); font-size: 12.5px; font-weight: 700; }

/* place, deadline and tags as icons. Three empty full-width fields read as
 * three things you have failed to fill in; three icons read as three things
 * available if you want them. */
.qslots { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.qslot { display: inline-flex; align-items: center; gap: 6px; background: var(--card2);
  border: 1px solid var(--line); border-radius: 11px; padding: 8px 11px; cursor: pointer;
  font: inherit; color: var(--soft); min-height: 38px; }
.qslot:hover { border-color: var(--line2); }
.qslot.on { color: var(--ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.qslot.open { border-color: var(--accent); }
.qslot .qs-i { font-size: 15px; line-height: 1; }
.qslot .qs-l { font-size: 12.5px; font-weight: 700; max-width: 130px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.qslot.info { background: none; border-color: transparent; }
.qslot.info:hover { background: var(--card2); }
.qpanel { margin-top: 10px; padding: 11px; background: var(--card2); border-radius: 12px; }
.qpanel input { width: 100%; }

/* a rule worth stating only once it is actually true of this quest */
.critnote { margin-top: 10px; padding: 10px 11px; border-radius: 12px; font-size: 12.5px;
  line-height: 1.45; background: color-mix(in srgb, var(--gold) 13%, transparent); }

/* the scoring notes, behind the ⓘ */
.explain { margin-bottom: 13px; }
.explain .ex-h { font-weight: 800; font-size: 14px; margin-bottom: 3px; }
.explain .ex-b { color: var(--soft); font-size: 13px; line-height: 1.5; }
.slider-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.slider-top .tier { font-family: 'PixelDisplay'; font-size: 13px; }
.slider-top .xpwin { font-family: 'PixelDisplay'; font-size: 12px; color: var(--gold); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; background: var(--ring-bg); border-radius: 99px; }
input[type=range]::-moz-range-track { height: 8px; background: var(--ring-bg); border-radius: 99px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: var(--gem, var(--green)); border: 3px solid var(--card); box-shadow: var(--shadow-sm); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--gem, var(--green)); border: 3px solid var(--card); cursor: pointer; }
.notches { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--soft); }
.notches span.on { color: var(--ink); font-weight: 700; }

.npc-picker { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; -webkit-overflow-scrolling: touch; }
.npc-chip { flex: none; width: 62px; text-align: center; opacity: .5; cursor: pointer; }
.npc-chip.sel { opacity: 1; }
.npc-chip.sel .portrait { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.npc-chip .cn { font-size: 11px; margin-top: 4px; display: block; }
.npc-chip.locked { filter: grayscale(1); opacity: .3; }
.sbuild .srow, #qe-steps .srow { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.sbuild .srow input, #qe-steps .srow input { flex: 1; }
.sbuild .srow .del, #qe-steps .srow .del { width: 44px; min-height: 44px; }

/* ---- bottom nav ---------------------------------------------------------- */
#nav { position: fixed; bottom: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto; z-index: 30;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  padding: 10px 4px calc(12px + env(safe-area-inset-bottom)); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--soft); font-size: 11px; font-weight: 600; min-height: 50px; position: relative; }
.nav-item .ni { width: 24px; height: 24px; opacity: .5; }
.nav-item.active { color: var(--green); }
.nav-item.active .ni { opacity: 1; }
.nav-item .dot { position: absolute; top: 0; right: 14px; width: 9px; height: 9px; background: var(--red); border-radius: 50%; border: 2px solid var(--card); display: none; }
.nav-item.badge .dot { display: block; }
.nav-fab .plus { width: 52px; height: 52px; margin-top: -20px; background: var(--green); color: #fff; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px; box-shadow: 0 6px 16px rgba(46,158,107,.4); }
.nav-fab:active .plus { transform: translateY(2px); }

/* ---- skill tree ---------------------------------------------------------- */
/* ---- skill tree: the constellation --------------------------------------- */
.treewrap { background: radial-gradient(ellipse at 50% 90%, color-mix(in srgb, var(--green) 9%, var(--card)) 0%, var(--card) 62%);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 12px; }
.treesvg { display: block; width: 100%; height: auto; }
.treesvg .tl { stroke: var(--line2); stroke-width: 2.5; stroke-linecap: round; }
.treesvg .tl.lit { stroke-width: 3.5; filter: drop-shadow(0 0 3px currentColor); }
.treesvg .thub { fill: var(--card2); stroke: var(--line2); stroke-width: 2; }
.treesvg .tbl { font-family: 'PixelDisplay', monospace; font-size: 9px; letter-spacing: .5px; text-anchor: middle; opacity: .85; }
.treesvg .tico { text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.treesvg .tlv { font-family: 'PixelDisplay', monospace; font-size: 8px; fill: var(--soft); text-anchor: middle; }
.treesvg .tn { cursor: pointer; }
.treesvg .tn .tc { fill: var(--card2); stroke: var(--line2); stroke-width: 2; }
.treesvg .tn.picked .tc { fill: var(--bc); stroke: color-mix(in srgb, var(--bc) 60%, #000); filter: drop-shadow(0 0 5px var(--bc)); }
.treesvg .tn.picked .tico { filter: brightness(1.15); }
.treesvg .tn.available .tc { fill: var(--card); stroke: var(--gold); stroke-width: 2.5; }
.treesvg .tn.lockpre .tico, .treesvg .tn.locklv .tico, .treesvg .tn.lockpts .tico { opacity: .32; }
.treesvg .tn.sel .tc { stroke-width: 3.5; }
.treesvg .tn.sel { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--ink) 35%, transparent)); }
.tpulse { fill: none; stroke: var(--gold); stroke-width: 2; opacity: .5; transform-box: fill-box; transform-origin: center; animation: tpulse 1.6s ease-out infinite; }
@keyframes tpulse { 0% { transform: scale(.72); opacity: .55; } 70% { transform: scale(1.08); opacity: 0; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tpulse { animation: none; opacity: .3; } }
.tdetail .td-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 24px; flex: none; }
.tdetail .td-name { font-size: 16px; font-weight: 800; }
.tdetail .td-fx { font-size: 13.5px; color: var(--soft); line-height: 1.5; margin-top: 10px; }
.tn-lv { margin-left: auto; font-family: 'PixelDisplay'; font-size: 11px; color: var(--soft); }
.tn-foot { font-size: 12px; font-weight: 600; color: var(--soft); }
.tn-foot.ok { color: var(--green); }

/* ---- Town (evolving townscape) ------------------------------------------ */
.townwrap { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); line-height: 0; background: #2b2f36; }
#town-canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.town-hit { position: absolute; cursor: pointer; border-radius: 8px; }
.town-hit:active { background: rgba(255,255,255,.10); }
.towncap { margin-top: 12px; }
.ts-title { font-family: 'PixelDisplay'; font-size: 14px; color: var(--green); }
.ts-lv { font-family: 'PixelDisplay'; font-size: 11px; color: var(--soft); }
.ts-pulse { font-size: 13px; font-style: italic; color: var(--soft); margin-top: 4px; line-height: 1.4; }
.townbar { margin-top: 12px; }
.townbar .xpsub { display: flex; justify-content: space-between; font-size: 12px; color: var(--soft); margin-top: 5px; }
.lvring.has-pt { box-shadow: 0 0 0 3px rgba(227,168,31,.35); }

/* ---- Shop / Shopkeeper --------------------------------------------------- */
.backbtn { font-size: 24px; line-height: 1; width: 32px; height: 32px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); color: var(--ink); margin-right: 6px; }
.h-row .chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; font-size: 14px; }
.h-row .chip .ic { width: 16px; height: 16px; display: inline-block; }
.shoptabs { display: flex; gap: 6px; margin: 4px 0 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stab { flex: none; padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line2); background: var(--card2); color: var(--soft); font-size: 13px; font-weight: 600; }
.stab.on { background: var(--green); color: #fff; border-color: transparent; }
.shoplist { display: grid; gap: 10px; }
.shopgroup { font-family: 'PixelDisplay'; font-size: 11px; color: var(--soft); margin-top: 8px; }
.shopitem { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; box-shadow: var(--shadow-sm); }
.si-ic { font-size: 22px; width: 30px; text-align: center; flex: none; }
.si-body { flex: 1; min-width: 0; }
.si-name { font-size: 14px; font-weight: 700; }
.si-fx { font-size: 12px; color: var(--soft); line-height: 1.4; margin-top: 2px; }
.si-act { flex: none; display: flex; align-items: center; gap: 6px; }
.si-act .btn.gold::before { content: '◆ '; }
.owntag { font-size: 12px; font-weight: 700; color: var(--soft); }
.owntag.on { color: var(--green); }
.owntag.lock { color: var(--gold); }
.owncount { font-family: 'PixelDisplay'; font-size: 12px; color: var(--gold); }

/* ---- Class quiz + identity ---------------------------------------------- */
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt { text-align: left; padding: 13px 15px; border: 1px solid var(--line2); border-radius: 13px; background: var(--card2); color: var(--ink); font-size: 14px; line-height: 1.35; box-shadow: var(--shadow-sm); }
.quiz-opt:active { transform: translateY(1px); background: color-mix(in srgb, var(--green) 10%, var(--card2)); }
.classcard { border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
.class-ic { font-size: 30px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--card2); border-radius: 12px; flex: none; }
.class-name { font-family: 'PixelDisplay'; font-size: 13px; }
.class-line { font-size: 13px; color: var(--soft); margin-top: 8px; line-height: 1.4; }
.class-line b { color: var(--ink); font-family: 'PixelDisplay'; font-size: 11px; margin-right: 4px; }

/* ---- Achievements / trophy shelf ---------------------------------------- */
.ach-list { display: grid; gap: 10px; }
.ach { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; box-shadow: var(--shadow-sm); opacity: .72; }
.ach.on { opacity: 1; }
.ach.max { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: color-mix(in srgb, var(--gold) 7%, var(--card)); }
.ach-medal { font-size: 22px; width: 30px; text-align: center; flex: none; }
.ach-body { flex: 1; min-width: 0; }
.ach-name { font-size: 14px; font-weight: 700; }
.ach-desc { font-size: 12px; color: var(--soft); line-height: 1.4; margin-top: 2px; }
.ach-soon { color: var(--blue); font-weight: 600; }
.ach-bar { height: 5px; background: var(--ring-bg); border-radius: 99px; overflow: hidden; margin-top: 7px; }
.ach-bar > i { display: block; height: 100%; background: var(--green); }
.ach-prog { font-size: 11px; color: var(--soft); margin-top: 3px; font-family: 'PixelDisplay'; }

/* ---- methodologies: focus pill / frog / inbox / quest actions ------------ */
#focus-pill { position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; z-index: 60; }
.fpill { display: flex; align-items: center; gap: 8px; max-width: 78vw; background: var(--ink); color: var(--bg);
  border-radius: 99px; padding: 9px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.28); cursor: pointer; animation: fade .2s; }
.fpill b { font-family: 'PixelDisplay'; font-size: 13px; white-space: nowrap; }
.fpill .fq { font-size: 12px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fpill.brk { background: var(--green); color: #fff; }
.focus-modal .focus-count { font-family: 'PixelDisplay'; font-size: 44px; color: var(--green); margin: 10px 0 4px; }
.focus-modal .focus-quest { font-size: 15px; font-weight: 700; }
.frog-head { font-family: 'PixelDisplay'; font-size: 11px; color: var(--gold); margin: 14px 2px 6px; }
.frogwrap .card.quest, .frogwrap .crow { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); box-shadow: 0 0 0 3px rgba(227,168,31,.12), var(--shadow-sm); }
.inbox-head { margin-top: 10px; } .inbox-head .ib-ic { font-size: 22px; }
.crow.inboxrow { border-left-color: var(--blue); }
.crow.inboxrow .ctitle { color: var(--ink); }
.cchip.file { background: color-mix(in srgb, var(--blue) 14%, var(--card2)); color: var(--blue); font-weight: 700; }
.qact-w { margin-left: auto; display: inline-flex; gap: 4px; }
.qact { font-size: 12px; font-weight: 700; color: var(--soft); background: var(--card2); border: 1px solid var(--line2);
  border-radius: 8px; padding: 3px 8px; min-height: 26px; }
.qact.on { background: color-mix(in srgb, var(--gold) 18%, var(--card2)); color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, var(--line2)); }
.dbtn.cap { border: 1px solid var(--line2); border-radius: 8px; padding: 2px 8px; }
.npc-card .hired { font-size: 10px; font-weight: 800; color: var(--blue); text-transform: uppercase; letter-spacing: .4px; }

/* ---- crit-ready / boss fights / urgency ----------------------------------- */
.critchip { font-size: 11px; font-weight: 800; color: #B7791F; background: color-mix(in srgb, var(--gold) 16%, var(--card2));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line2)); border-radius: 99px; padding: 2px 8px; }
.bossrib { font-size: 10px; font-weight: 800; letter-spacing: .4px; color: #fff; background: linear-gradient(90deg, #8a1d12, #C0392B);
  border-radius: 99px; padding: 3px 9px; }
.card.quest.boss { border-color: color-mix(in srgb, #C0392B 45%, var(--line));
  box-shadow: 0 0 0 3px rgba(192,57,43,.10), var(--shadow); }
.subbarline.hp { background: color-mix(in srgb, #C0392B 12%, var(--ring-bg)); }
.subbarline.hp i { background: #C0392B; }
.qe-done { color: var(--green); font-weight: 800; flex: none; width: 18px; text-align: center; }

/* ---- prominent edit affordance -------------------------------------------- */
.card.quest { position: relative; }
.qedit { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700; color: var(--soft); background: var(--card2);
  border: 1px solid var(--line2); border-radius: 10px; padding: 6px 10px; min-height: 34px; z-index: 3; }
.qedit:active { transform: translateY(1px); }
.qedit span { font-size: 12px; }
.card.quest .qmeta { padding-right: 74px; }
.crow .cedit { margin-left: 4px; flex: none; }

/* ---- swipe to complete ----------------------------------------------------- */
.swipe { position: relative; margin-bottom: 12px; touch-action: pan-y; }
.swipe > .card, .swipe > .crow { margin-bottom: 0; }
.swipe.swipe-step { margin-bottom: 6px; }
.swipe-bg { position: absolute; inset: 0; border-radius: 18px; display: flex; align-items: center;
  font-weight: 800; font-size: 14px; opacity: 0; transition: opacity .12s; }
.swipe-bg.done { justify-content: flex-start; padding-left: 20px; background: var(--green); color: #fff; }
.swipe-bg.drop { justify-content: flex-end; padding-right: 20px; background: var(--red); color: #fff; }
.swipe.staged > .swipe-bg.done { background: var(--gold); color: #241a08; }
.swipe.dir-right > .swipe-bg.done, .swipe.dir-left > .swipe-bg.drop { opacity: .58; }
.swipe.armed.dir-right > .swipe-bg.done, .swipe.armed.dir-left > .swipe-bg.drop { opacity: 1; }
.swipe.swipe-step .swipe-bg { border-radius: 12px; padding-left: 14px; }
.swipe .swipe-card { position: relative; z-index: 1; will-change: transform; }
.swipe.swiping .swipe-card { box-shadow: 0 8px 22px rgba(0,0,0,.16); }
.swipe.swiping { user-select: none; }

/* ---- grudges & curses ------------------------------------------------------ */
.cursechip { font-size: 11px; font-weight: 800; color: #fff; background: var(--red); border-radius: 99px; padding: 3px 9px; }
.grudge { margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--soft); }
.grudge.cursed { color: #fff; background: var(--red); border-radius: 99px; padding: 3px 8px; display: inline-block; }

/* ---- quest places ---------------------------------------------------------- */
.placechip { font-size: 11px; font-weight: 700; color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, var(--card2));
  border: 1px solid color-mix(in srgb, var(--blue) 32%, var(--line2)); border-radius: 99px; padding: 3px 9px; max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placechip:active { transform: translateY(1px); }

/* ---- guided tour (spotlight coach-marks) ---------------------------------- */
#tour { position: fixed; inset: 0; z-index: 150; }
.tour-hole { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(18, 14, 9, .62); pointer-events: none; transition: all .25s ease; }
.tour-tip { position: absolute; left: 16px; right: 16px; max-width: 420px; margin: 0 auto; background: var(--card); border-radius: 16px; padding: 15px 17px; box-shadow: 0 16px 40px rgba(0,0,0,.35); animation: fade .2s; }
.tour-t { font-family: 'PixelDisplay'; font-size: 13px; color: var(--green); }
.tour-d { font-size: 13.5px; color: var(--soft); line-height: 1.5; margin-top: 6px; }
.tour-btns { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.tour-n { flex: 1; font-family: 'PixelDisplay'; font-size: 11px; color: var(--soft); }

/* ---- login gate ----------------------------------------------------------- */
#login { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
#login[hidden] { display: none; }
.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card h2 { font-family: 'PixelDisplay'; font-size: 22px; letter-spacing: 1px; }
.login-tabs { display: flex; gap: 6px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 14px 0 4px; }
.ltab { flex: 1; padding: 9px 0; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--soft); }
.ltab.on { background: var(--green); color: #fff; }
.login-card .fld { display: block; text-align: left; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
.login-card input { width: 100%; }
.lg-err { min-height: 18px; font-size: 13px; color: var(--red); font-weight: 600; margin-top: 8px; }
.lg-err.ok { color: var(--green); }
.linklike { display: block; margin: 8px auto 0; background: none; border: 0; padding: 6px;
  font: inherit; font-size: 13px; color: var(--soft); text-decoration: underline; cursor: pointer; }
.pbtn { margin-top: 10px; font-size: 15px; }
.pbtn.apple { background: #000; color: #fff; border-color: #000; }
.pbtn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.gmark { font-weight: 800; background: conic-gradient(from -45deg, #ea4335 110deg, #4285f4 90deg 180deg, #34a853 180deg 270deg, #fbbc05 270deg);
  -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 17px; }
.ordiv { display: flex; align-items: center; gap: 10px; color: var(--soft); font-size: 12px; margin: 14px 0 2px; }
.ordiv::before, .ordiv::after { content: ''; flex: 1; height: 1px; background: var(--line2); }

/* ---- tavern -------------------------------------------------------------- */
.roster { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.npc-card { text-align: center; cursor: pointer; }
.npc-card .portrait { --pz: 66px; margin: 0 auto 8px; }
.npc-card .nn { font-size: 14px; font-weight: 700; }
.npc-card .nd { font-size: 12px; color: var(--soft); }
.npc-card.locked .portrait { filter: grayscale(1) brightness(.7); }
.npc-card.locked .qmark { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'PixelDisplay'; font-size: 22px; color: var(--soft); background: rgba(0,0,0,.15); }
.affinity { height: 6px; background: var(--ring-bg); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.affinity > i { display: block; height: 100%; background: var(--gold); }

/* ---- hero sheet ---------------------------------------------------------- */
.hero-head { display: flex; gap: 14px; align-items: center; }
.hero-head .portrait { --pz: 80px; border-radius: 20px; }
.hero-lv { font-family: 'PixelDisplay'; font-size: 26px; color: var(--green); }
.hero-title { font-family: 'PixelDisplay'; font-size: 14px; margin: 2px 0; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow-sm); }
.stat .k { font-size: 12px; color: var(--soft); } .stat .v { font-family: 'PixelDisplay'; font-size: 16px; margin-top: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend .l { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 99px; color: #fff; }

/* ---- overlay / modal ----------------------------------------------------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(20,16,12,.5); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 18px; }
.overlay.show { display: flex; animation: fade .2s; }
.modal { max-width: 420px; width: 100%; background: var(--card); border-radius: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.3); padding: 22px; text-align: center; max-height: 88vh; overflow-y: auto; }
.modal h2 { font-size: 19px; margin-bottom: 6px; }
.modal .em { font-size: 14px; color: var(--soft); margin: 8px 0 16px; }
.levelup .lvbig { font-family: 'PixelDisplay'; font-size: 38px; color: var(--green); margin: 6px 0; }
.levelup .banner, .recap .banner { font-family: 'PixelDisplay'; font-size: 15px; color: var(--gold); letter-spacing: 1px; }
.recap .statgrid { margin-top: 12px; } .recap .stat { text-align: left; }
.unlock-card { background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; text-align: left; }
.unlock-card .un { font-family: 'PixelDisplay'; font-size: 12px; color: var(--green); }
.choose-paths { display: grid; gap: 10px; margin: 14px 0; }
.choose-path { text-align: left; padding: 14px; border: 1px solid var(--line2); border-radius: 14px; background: var(--card2); cursor: pointer; box-shadow: var(--shadow-sm); }
.choose-path:active { transform: translateY(1px); }
.choose-path .cp-h { font-size: 14px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.choose-path .cp-d { font-size: 13px; color: var(--soft); margin-top: 5px; }
.tut-tag { font-family: 'PixelDisplay'; font-size: 10px; color: var(--green); text-transform: uppercase; letter-spacing: 1px; }

/* ---- the welcome gate (first sign-in only) -------------------------------
   A full dark screen with the text typing itself out, the way the old RPGs
   opened. Deliberately ignores the chosen realm theme: this is the moment
   before the app exists, so it is always the same dark. */
.gate {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center; padding: 26px 22px;
  background: radial-gradient(120% 90% at 50% 30%, #1b1a24 0%, #0c0b10 70%, #070609 100%);
  color: #EDE7DA; opacity: 0; transition: opacity .32s ease;
  overflow-y: auto; -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.gate.in { opacity: 1; }
.gate-inner { max-width: 460px; width: 100%; text-align: center; }
.gate-emblem { width: 76px; height: 76px; margin: 0 auto 22px; }
.gate-emblem img { width: 100%; height: 100%; display: block; border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(243,201,105,.14); }
.gate p { margin: 0 auto 18px; max-width: 36ch; min-height: 1.2em; }
.gate .wg-h {
  font-family: 'PixelDisplay', monospace; font-size: 19px; letter-spacing: .04em;
  color: #F3C969; margin-bottom: 22px;
}
.gate .wg-p { font-size: 15.5px; line-height: 1.68; color: #CFC7B8; }
.gate .wg-call { font-size: 16px; font-weight: 700; color: #EDE7DA; margin-top: 24px; }
/* the cursor only blinks on the line currently being written */
.gate p.typing .ink::after {
  content: '▌'; margin-left: 2px; color: #F3C969;
  animation: gate-caret 1s steps(1) infinite;
}
@keyframes gate-caret { 50% { opacity: 0; } }
.gate-go {
  margin-top: 30px; min-width: 220px; opacity: 0; transform: translateY(6px);
  transition: opacity .45s ease, transform .45s ease; cursor: pointer;
}
.gate-go.in { opacity: 1; transform: none; }
.gate-skip {
  margin-top: 26px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: #6e6858; animation: gate-fade 2.4s ease-in-out infinite;
}
@keyframes gate-fade { 50% { opacity: .35; } }
@media (max-height: 700px) {
  .gate-emblem { width: 56px; height: 56px; margin-bottom: 14px; }
  .gate p { margin-bottom: 13px; }
  .gate .wg-p { font-size: 14.5px; line-height: 1.55; }
  .gate-go { margin-top: 20px; }
  .gate-skip { margin-top: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .gate, .gate-go { transition: none; }
  .gate p.typing .ink::after, .gate-skip { animation: none; }
}

/* ---- fx ------------------------------------------------------------------ */
#fx { pointer-events: none; position: fixed; inset: 0; pointer-events: none; z-index: 90; }

/* the level-up ceremony. Above the modal layer because for two and a half
 * seconds it IS the screen. It takes taps rather than passing them through:
 * a modal opens the moment it ends, so a tap here skips ahead to that rather
 * than being swallowed. */
.godrays { position: fixed; inset: 0; z-index: 300; cursor: pointer; }
.godrays canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.gr-text { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding-bottom: 12vh; }
.gr-inner { text-align: center; will-change: transform; }
.gr-kicker { font-family: 'PixelDisplay'; font-size: 13px; letter-spacing: 6px; color: #fff; }
.gr-lv { font-family: 'PixelDisplay'; font-size: 78px; line-height: 1; color: #fff;
  text-shadow: 0 0 24px var(--gold); margin: 8px 0; }
.gr-title { font-size: 19px; font-weight: 800; color: var(--gold); }
.floatxp { position: absolute; font-family: 'PixelDisplay'; font-size: 16px; color: var(--green); text-shadow: 0 1px 2px rgba(0,0,0,.2); animation: rise 1.1s ease-out forwards; }
.floatxp.crit { font-size: 24px; color: var(--gold); }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-52px); } }
#toast { pointer-events: none; position: fixed; left: 50%; bottom: 108px; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 6px; align-items: center; width: max-content; max-width: 92vw; }
.toast { background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 16px; font-size: 14px; box-shadow: var(--shadow); text-align: center; animation: fade .2s; }
@keyframes shake { 0%,100%{transform:none} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }
.shake { animation: shake .3s; }

/* ---- density toggle + tier ticks + compact rows (Season 1) --------------- */
.density { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.density .dbtn { padding: 4px 10px; font-size: 14px; color: var(--soft); background: var(--card); line-height: 1.2; }
.density .dbtn.on { background: var(--green); color: #fff; }

.notches { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.notches .ntick { flex: 1; height: 6px; border-radius: 99px; background: var(--tc, var(--ring-bg)); opacity: .28; transition: opacity .1s, transform .1s; }
.notches .ntick.on { opacity: 1; transform: scaleY(1.7); }

.crow { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--line2); border-radius: 12px; padding: 8px 10px; margin-bottom: 6px; box-shadow: var(--shadow-sm); min-height: 44px; }
.crow.done { opacity: .6; }
.crow .cbox { width: 22px; height: 22px; border: 2px solid var(--line2); border-radius: 50%; display: block; }
.crow.done .cbox { background: var(--green); border-color: var(--green); position: relative; }
.crow.done .cbox::after { content: '✓'; color: #fff; font-family: 'PixelDisplay'; font-size: 11px; position: absolute; inset: 0; display: grid; place-items: center; }
.crow .cdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.crow .ctitle { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow.done .ctitle { text-decoration: line-through; color: var(--soft); }
.crow .cclust { display: flex; align-items: center; gap: 5px; flex: none; }
.cchip { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); color: var(--soft); }
.cchip.soon { background: rgba(227,168,31,.16); color: #b7791f; border-color: transparent; }
.cchip.over { background: rgba(217,80,63,.14); color: var(--red); border-color: transparent; }
.cglyph { font-size: 12px; color: var(--soft); }
.crow-subs { margin: -2px 0 8px 32px; }

/* ---- look & feel picker (free for everyone, from the first launch) ------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 6px; }
.theme-chip { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px;
  border: 2px solid var(--line2); border-radius: 12px; background: var(--card2); color: var(--ink); cursor: pointer; }
.theme-chip:hover { border-color: var(--green); }
.theme-chip.on { border-color: var(--green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 40%, transparent); }
.theme-chip .tsw { position: relative; display: block; width: 100%; height: 30px; border-radius: 7px; border: 1px solid var(--line2); overflow: hidden; }
.theme-chip .tsw i { position: absolute; left: 6px; top: 7px; width: 44%; height: 16px; border-radius: 4px; }
.theme-chip .tsw b { position: absolute; right: 7px; top: 11px; width: 12px; height: 8px; border-radius: 3px; }
.theme-chip .tnm { font-size: 12px; font-weight: 700; }

.ac-presets { display: flex; flex-wrap: wrap; gap: 7px; }
.ac-preset { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; padding: 0; border: 2px solid var(--line2); background: var(--card); cursor: pointer; }
.ac-preset img { width: 100%; height: 100%; display: block; object-fit: cover; image-rendering: auto; }
.ac-preset:hover { border-color: var(--green); }
.ac-preset.on { border-color: var(--green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 45%, transparent); }
.ac-preset.px { display: grid; place-items: center; font-size: 20px; }
.ac-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.ac-chip:hover { border-color: var(--green); }
.ac-chip.on { background: var(--green); color: #fff; border-color: var(--green); box-shadow: inset 0 -2px 0 rgba(0,0,0,.13); }
.ac-sw { width: 27px; height: 27px; border-radius: 7px; border: 2px solid var(--card); padding: 0; background: var(--sw); box-shadow: 0 0 0 1px var(--line2); }
.ac-sw:hover { transform: translateY(-1px); }
.ac-sw.on { box-shadow: 0 0 0 2px var(--green), inset 0 0 0 2px rgba(255,255,255,.5); }

@media (max-width: 560px) {
    .ac-layout { grid-template-columns: 1fr; gap: 12px; }
  .ac-preview { position: static; grid-template-columns: 112px 1fr; grid-template-rows: 1fr 1fr; align-items: stretch; }
  .ac-frame { width: 112px; grid-row: 1 / 3; }
  .ac-controls { max-height: 46vh; }
  .ac-row { grid-template-columns: 70px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}


/* ---- daily rituals ---------------------------------------------------------
   A ritual row shows one number and it is a streak. No XP, no due date,
   nothing that can go red — a habit that punishes you for missing it is a
   habit you delete the app to escape. */
.ritual {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 13px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  cursor: pointer;
}
.ritual.kept { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, var(--card)); }
.ritual .rk { font-size: 17px; color: var(--soft); width: 20px; text-align: center; }
.ritual.kept .rk { color: var(--green); }
.ritual .rt { flex: 1; font-size: 14.5px; line-height: 1.3; }
.ritual.kept .rt { color: var(--soft); }
.ritual .rs { font-size: 12.5px; font-weight: 800; color: var(--gold); }
.ritual .rx {
  background: none; border: 0; color: var(--soft); font-size: 18px;
  cursor: pointer; padding: 0 4px; line-height: 1; opacity: .5;
}
.ritual .rx:hover { opacity: 1; color: var(--ruby); }
.npcrow { display: flex; gap: 11px; align-items: flex-start; }
.npcrow .npcimg { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }

.ritual .rn { font-size: 13px; font-weight: 800; color: var(--gold); min-width: 16px; }
.ritual.kept .rn { color: var(--soft); }
.ritual .rmv { display: flex; flex-direction: column; gap: 1px; }
.ritual .rq {
  background: none; border: 0; color: var(--soft); font-size: 9px; line-height: 1;
  cursor: pointer; padding: 1px 3px;
}
.ritual .rq[disabled] { color: var(--line); cursor: default; }

/* Hero destinations — four tiles directly under the portrait. */
.destgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dest {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--ink); font: inherit;
}
.dest .di { font-size: 20px; line-height: 1; }
.dest .dl { font-size: 11.5px; font-weight: 700; }
.dest .db {
  position: absolute; top: 6px; right: 8px; background: var(--green); color: #fff;
  font-size: 10px; font-weight: 800; border-radius: 99px; padding: 1px 5px;
}

.bgear {
  background: none; border: 0; color: var(--soft); font-size: 19px;
  cursor: pointer; padding: 4px 8px; line-height: 1;
}
.bgear:hover { color: var(--ink); }

/* ---- journey journal ---- */
.jentry {
  display: flex; align-items: center; gap: 11px; cursor: pointer;
  padding: 12px 13px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.jentry.unread { border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.jentry .ji { font-size: 18px; }
.jentry .jt { flex: 1; display: flex; flex-direction: column; }
.jentry .jt b { font-size: 14px; font-weight: 600; }
.jentry.unread .jt b { font-weight: 700; }
.jentry .jd {
  font-size: 12px; color: var(--soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jentry .jdot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.bgear { position: relative; }
.bbadge {
  position: absolute; top: 0; right: 2px; background: var(--gold); color: #241A08;
  font-size: 9.5px; font-weight: 800; border-radius: 99px; padding: 0 4px; line-height: 1.4;
}

.destgrid { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }

/* ---- Phase 2 parity: the chain, the bard, the board sorts, the frog ---- */

/* the combo chain, under the XP it multiplies */
#b-combo { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
#b-combo .cflame { line-height: 1; }
#b-combo .ctrack { flex: 1; display: flex; gap: 3px; }
#b-combo .ctrack i { flex: 1; height: 5px; border-radius: 99px; background: var(--line, #2a2836); }
#b-combo .ctrack i.lit { background: linear-gradient(90deg, var(--gold, #e7b416), #d4652f); }
#b-combo .cmult { font-size: 11px; font-weight: 800; color: var(--gold, #e7b416); }

/* Fenn's floating chip — a friend recognised, not a widget noticed */
#bard-chip {
  position: fixed; right: 12px; bottom: 92px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--gold, #e7b416); background: var(--card, #16151d);
  font-size: 24px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
#bard-chip .bnote {
  position: absolute; top: -6px; right: -2px; font-size: 15px;
  color: var(--gold, #e7b416); animation: bardbob 1.6s ease-in-out infinite;
}
@keyframes bardbob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }
@media (prefers-reduced-motion: reduce) { #bard-chip .bnote { animation: none } }
.bard-veil {
  position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.bard-sheet {
  background: var(--card, #16151d); border: 1px solid var(--line, #2a2836);
  border-radius: 22px 22px 0 0; padding: 22px 22px 28px;
  width: 100%; max-width: 520px;
}
.bard-head { display: flex; align-items: center; gap: 12px; }
.bard-quote { font-style: italic; line-height: 1.55; margin: 14px 0 18px; }

/* board sort chips */
.sortrow { margin-top: 4px; }
.sortchip.sel { background: var(--green, #3fa34d); color: #fff; border-color: transparent; }

/* drag-to-rearrange in "My order" */
.dragwrap[draggable] { cursor: grab; }
.dragwrap.dragging { opacity: .45; }

/* today's frog wears its status on the whole card */
.frogwrap .card, .frogwrap .crow {
  background: color-mix(in srgb, var(--green, #3fa34d) 8%, var(--card, #16151d));
  border-color: color-mix(in srgb, var(--green, #3fa34d) 55%, transparent);
}
.frogwrap.hop { animation: froghop .6s ease-out; }
@keyframes froghop {
  0% { transform: translateY(0) } 25% { transform: translateY(-9px) }
  50% { transform: translateY(0) } 70% { transform: translateY(-4px) }
  100% { transform: translateY(0) }
}
@media (prefers-reduced-motion: reduce) { .frogwrap.hop { animation: none } }

/* the idle gesture demonstration: the top card mimes its own swipes */
.ghostdemo { animation: ghostcard 2.6s ease-in-out; position: relative; }
@keyframes ghostcard {
  0%, 100% { transform: none }
  12% { transform: translateX(46px) }
  24% { transform: none }
  46% { transform: translateX(-46px) }
  60% { transform: none }
}
.ghostdemo::before, .ghostdemo::after {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-weight: 800; font-size: 13px; opacity: 0; pointer-events: none;
}
.ghostdemo::before { content: '✓ swipe → done'; left: 10px; color: var(--green, #3fa34d); animation: ghosthintL 2.6s; }
.ghostdemo::after { content: '✗ ← abandon'; right: 10px; color: #e5484d; animation: ghosthintR 2.6s; }
@keyframes ghosthintL { 6%, 20% { opacity: 1 } 28% { opacity: 0 } }
@keyframes ghosthintR { 42%, 56% { opacity: 1 } 62% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) {
  .ghostdemo, .ghostdemo::before, .ghostdemo::after { animation: none }
}

/* ---- desktop: the town deserves more than a phone column ---------------
 * ≥1000px: the bottom nav becomes a left rail and content breathes wider.
 * ≥1240px: the quest board flows into two columns; other screens stay at a
 * readable width. Pure CSS — the DOM never knows which world it is in. */
@media (min-width: 1000px) {
  #app { max-width: none; padding-left: 118px; padding-right: 24px; padding-bottom: 40px; }
  .screen, #banner { max-width: 720px; margin-left: auto; margin-right: auto; }
  #nav {
    left: 0; right: auto; top: 0; bottom: 0; max-width: none; width: 94px;
    grid-template-columns: 1fr; grid-auto-rows: min-content; align-content: center;
    gap: 6px; border-top: none; border-right: 1px solid var(--line);
    padding: 16px 8px;
  }
  .nav-item { min-height: 58px; border-radius: 14px; }
  .nav-item.active { background: color-mix(in srgb, var(--green) 12%, transparent); }
  .nav-item.nav-fab { order: 99; margin-top: 10px; }
  #toast { bottom: 28px; }
  #bard-chip { right: 28px; bottom: 28px; }
  .fpill { max-width: 420px; }
}
@media (min-width: 1240px) {
  .screen { max-width: 760px; }
  #screen-quests { max-width: 1180px; }
  /* everything above the board spans both columns; the cards flow in two */
  #screen-quests > .h-row, #screen-quests > .sortrow, #screen-quests > .mb,
  #screen-quests > .frog-head, #screen-quests > .frogwrap, #screen-quests > .qexpand {
    max-width: none;
  }
  #screen-quests { columns: 2; column-gap: 20px; }
  #screen-quests > * { break-inside: avoid; }
  #screen-quests > .h-row, #screen-quests > .sortrow, #screen-quests > .mb,
  #screen-quests > .inbox-head, #screen-quests > .frog-head, #screen-quests > .frogwrap {
    column-span: all;
  }
  .grp { break-after: avoid; }
}

/* ---- board de-clutter: fewer voices, quieter chrome -------------------- */
/* one giver, one block: the group never splits across columns */
.grpwrap { break-inside: avoid; }
/* the crier's line: present, but murmured — one line, softer, smaller */
.qflavor {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 12.5px; opacity: .75;
}
/* controls whisper until wanted */
.card .qact, .card [data-edit], .crow .qact {
  opacity: .55; border-color: transparent; background: transparent;
}
.card:hover .qact, .card:hover [data-edit], .crow:hover .qact,
.card .qact.on { opacity: 1; }
/* rarity says its name once — the gem bar shrinks to an accent */
.dbar i { width: 9px; height: 4px; }
.rar { font-size: 10px; letter-spacing: .06em; }
@media (min-width: 1240px) {
  .qflavor { -webkit-line-clamp: 1; }
  .card { padding: 14px 16px; }
}
