/* The Forest — new design.
   A hearth in the deep wood: ink-green surfaces, ember accents, cream type.
   Grenze Gotisch for titles, Jersey 20 (pixel) for numbers and controls, Figtree for reading.
   Frames are drawn with stepped box-shadows so every corner is a pixel notch (1 UI pixel = 2px). */
@font-face { font-family: 'Figtree'; src: url('../fonts/Figtree.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Jersey 20'; src: url('../fonts/Jersey20.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Grenze Gotisch'; src: url('../fonts/GrenzeGotisch.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }

:root {
  --ink-950: #060c0b;
  --ink-900: #0b1513;
  --ink-850: #0f1b18;
  --ink-800: #13231f;
  --ink-750: #172a25;
  --ink-700: #1c322c;
  --ink-600: #254239;
  --ink-500: #33584c;
  --line: #2a463d;
  --line-hi: #437060;
  --cream: #f8efd8;
  --text: #e8e1cb;
  --text-2: #a7b8a6;
  --text-3: #6f8577;
  --ember: #ff8f3c;
  --ember-hi: #ffc466;
  --ember-lo: #b9481a;
  --gold: #f4cb62;
  --gold-lo: #8a6a1c;
  --moss: #93d46c;
  --moss-lo: #3d7a3a;
  --berry: #f47a66;
  --berry-lo: #8c2f26;
  --sky: #86cfe6;
  --violet: #c9a6f4;
  --panel-w: 344px;
  --top-h: 56px;
  --gap: 12px;
  --font: 'Figtree', 'Segoe UI', system-ui, sans-serif;
  --font-px: 'Jersey 20', 'Figtree', sans-serif;
  --font-title: 'Grenze Gotisch', 'Georgia', serif;
  --shadow: 0 10px 28px rgba(0, 0, 0, .5);
  --surface: rgba(10, 19, 17, .965);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1513; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.38;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: none;
  -webkit-font-smoothing: antialiased;
}
img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
button { font-family: inherit; color: inherit; font-size: inherit; }
b, strong { font-weight: 800; color: var(--cream); }
.hidden { display: none !important; }
::selection { background: var(--ember); color: #1a0e04; }

/* the pixel frame: four 2px shadows leave the corners open */
.px, .res, .goal, .goal-m, .icon-btn, .tab, .feat, .btn, .btile, .ucard, .nrow, .store-item, .note, .status-box,
.slot, .toast, .vtab, .tnode, .card, .limit, .gain, .sc-status, .sc-card, .sc-msg, .pond-tab, .pond-btn, .goal-row,
.feast, .trophy, .floor, .relic-slot, .crew-n, .portrait, .fs-icon, .fs-eff, .uicon, .tree-bar, .mb-btn, #modebar,
#tooltip, #spotlight, .frame, #panel, .tw-tree, .forge-tree, .tw-side, .forge-side, .shard-bar, .skydial {
  --bd: var(--ink-950);
  border: 0;
  border-radius: 0;
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd);
}

#app { position: fixed; inset: 0; }

/* ------------------------------------------------------------------ top bar */
#topbar {
  position: absolute; left: var(--gap); right: var(--gap); top: 10px; height: 46px; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  min-width: 0; pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { flex: none; width: var(--panel-w); height: 46px; display: flex; align-items: center; gap: 9px; padding-left: 2px; margin-right: 2px; }
.brand canvas { height: 44px; width: auto; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .45)); }
.brand .title {
  font-family: var(--font-title); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: .01em;
  color: var(--cream); white-space: nowrap;
  text-shadow: 0 2px 0 #1a0c04, 0 0 18px rgba(255, 143, 60, .55);
}
.brand .title i { font-style: normal; color: var(--ember-hi); }
.resources { display: flex; gap: 8px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; margin: -4px 0; }
.resources::-webkit-scrollbar { display: none; }
.res {
  --bd: var(--ink-950);
  display: flex; align-items: center; gap: 7px;
  min-width: 96px; height: 42px;
  padding: 0 11px 0 6px;
  background: var(--surface);
  flex: none;
}
.res .ico { width: 30px; height: 30px; flex: none; }
.res-text { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.res .val { font-family: var(--font-px); font-size: 23px; line-height: .86; color: var(--cream); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.res .rate { font-size: 11.5px; font-weight: 700; color: var(--moss); white-space: nowrap; margin-top: 2px; }
.res .rate.zero { color: var(--text-3); }
.res .rate.bad { color: var(--berry); }
.res.flash .val { animation: flash .5s steps(3); }
@keyframes flash { 0%, 100% { color: var(--cream); } 50% { color: var(--ember-hi); } }
.res.short { animation: shake .3s steps(4); }
.res.short .val { color: var(--berry); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.res.fresh-chip { animation: freshChip 1s ease-in-out 3; }
@keyframes freshChip { 50% { --bd: var(--gold); } }
.res.diamond-chip, .res.ember-chip { cursor: pointer; }
.res.diamond-chip:hover, .res.ember-chip:hover { background: var(--ink-750); }
.ember-chip .rate { color: var(--ember-hi); }
.ember-chip.glow { animation: emberGlow 2.4s ease-in-out infinite; }
@keyframes emberGlow { 50% { --bd: var(--ember); background: #2a1a10; } }

.goal {
  --bd: var(--ink-950);
  position: fixed; right: var(--gap); top: 68px; width: 300px; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 6px 12px 7px 12px;
  background: var(--surface);
  color: var(--text); text-align: left;
  cursor: pointer; opacity: .88;
}
.goal:hover { background: var(--ink-750); opacity: 1; }
.goal-ch {
  flex: none; min-width: 30px; height: 30px; padding: 0 5px;
  display: grid; place-items: center;
  font-family: var(--font-px); font-size: 21px; line-height: 1; color: #2a1204;
  background: var(--ember); box-shadow: inset 0 2px 0 var(--ember-hi), inset 0 -2px 0 var(--ember-lo);
}
.goal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.goal-body::before { content: 'Hint'; font: 400 14px/1 var(--font-px); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.goal-text { font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.goal-m .goal-body::before { display: none; }
.goal-m .goal-text { display: block; white-space: nowrap; text-overflow: ellipsis; }
.goal-bar { height: 4px; margin-top: 6px; background: var(--ink-600); overflow: hidden; }
.goal-bar i { display: block; height: 100%; width: 0; background: var(--ember); transition: width .3s; }


.sys { display: flex; gap: 8px; flex: none; margin-left: auto; }
.icon-btn {
  --bd: var(--ink-950);
  width: 42px; height: 42px; padding: 0;
  display: grid; place-items: center;
  background: var(--surface);
  cursor: pointer;
}
.icon-btn img { width: 28px; height: 28px; }
.icon-btn:hover { background: var(--ink-700); --bd: var(--line-hi); }
.icon-btn:active img, .icon-btn:active canvas { transform: translateY(1px); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small img { width: 16px; height: 16px; }
.icon-btn.on { background: #33220f; --bd: var(--ember); }
.skydial { width: 42px; height: 42px; padding: 0; background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.skydial canvas { width: 36px; height: 36px; }
.skydial:hover { --bd: var(--line-hi); }

/* ------------------------------------------------------------------ left panel */
#panel {
  --bd: var(--ink-950);
  position: absolute; left: var(--gap); top: 68px; bottom: var(--gap); width: var(--panel-w); z-index: 5;
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--ink-900);
  padding: 8px 8px 0;
  gap: 8px;
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), var(--shadow);
}
#tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 2px; }
.tab {
  --bd: var(--ink-950);
  height: 36px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-px); font-size: 20px; letter-spacing: .02em; color: var(--text-2);
  background: var(--ink-750);
  cursor: pointer; position: relative;
}
.tab img { width: 22px; height: 22px; opacity: .8; }
.tab:hover { color: var(--cream); background: var(--ink-700); }
.tab.on { color: #2a1204; background: var(--ember); box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), inset 0 2px 0 var(--ember-hi), inset 0 -2px 0 var(--ember-lo); }
.tab.on img { opacity: 1; }
#features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 2px; }
.feat {
  --bd: var(--ink-950);
  height: 56px; padding: 4px 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  font-family: var(--font-px); font-size: 16.5px; line-height: 1; color: var(--text);
  background: var(--ink-750);
  cursor: pointer; position: relative;
}
.feat img { width: 30px; height: 30px; }
.feat:hover { background: var(--ink-600); color: var(--cream); --bd: var(--line-hi); }
.feat:active { transform: translateY(1px); }
/* the next window to open: only a lock, in a quiet dashed frame (hover or tap for what it takes) */
.feat-lock { display: none; }
.feat.locked {
  cursor: help; background: transparent; box-shadow: none;
  outline: 2px dashed var(--ink-600); outline-offset: -2px; padding: 0;
}
.feat.locked:hover { background: var(--ink-800); outline-color: var(--line-hi); }
.feat.locked:active { transform: none; }
.feat.locked .feat-ic, .feat.locked .feat-name { display: none; }
.feat.locked .feat-lock { display: block; width: 32px; height: 32px; opacity: .55; }
.feat.locked:hover .feat-lock { opacity: .9; }
.feat.fresh { animation: featGlow 1.4s ease-in-out infinite; }
@keyframes featGlow { 50% { --bd: var(--gold); background: #33290f; } }
.badge {
  position: absolute; top: -7px; right: -5px; z-index: 1;
  min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center;
  font-family: var(--font-px); font-size: 16px; line-height: 1; color: #fff;
  background: var(--berry-lo); box-shadow: 0 -2px 0 0 #1a0806, 0 2px 0 0 #1a0806, -2px 0 0 0 #1a0806, 2px 0 0 0 #1a0806;
}
.badge.green { background: var(--moss-lo); }
.badge.blue { background: #2c6488; }
.badge.gold { background: #b07818; }

#panel-body {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent;
  padding: 12px 4px 18px 6px;
  margin: 0 -2px;
  color: var(--text);
  border-top: 2px solid var(--ink-950);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .03);
}
#panel-body::-webkit-scrollbar, .modal-body::-webkit-scrollbar, .tw-side::-webkit-scrollbar, .cards-grid::-webkit-scrollbar, .tw-tree::-webkit-scrollbar, .sc-card::-webkit-scrollbar { width: 8px; height: 8px; }
#panel-body::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb, .tw-side::-webkit-scrollbar-thumb, .cards-grid::-webkit-scrollbar-thumb, .tw-tree::-webkit-scrollbar-thumb, .sc-card::-webkit-scrollbar-thumb { background: var(--ink-500); }
.tw-tree::-webkit-scrollbar-corner { background: transparent; }

/* panel content */
.ph {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 9px; font-family: var(--font-px); font-size: 18px; line-height: 1;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ember-hi);
}
.ph:first-child { margin-top: 0; }
.ph::after { content: ''; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px); }
.ph .ph-r { order: 2; font-family: var(--font); font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text-2); font-size: 12.5px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.good { color: var(--moss); }
.warn { color: var(--berry); }
.desc { font-size: 14px; line-height: 1.5; margin: 4px 0 10px; color: var(--text-2); }

.note {
  --bd: var(--line);
  margin: 12px 2px; padding: 9px 11px;
  font-size: 13.5px; line-height: 1.45; color: var(--text-2);
  background: var(--ink-800);
}
.note.warn { background: #2a1512; --bd: var(--berry-lo); color: #f6b8ac; }
.note.good { background: #142a17; --bd: var(--moss-lo); color: #c4e8ac; }
.note b { color: var(--cream); }

.btn {
  --bd: var(--ink-950);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 3px 13px 4px;
  font-family: var(--font-px); font-size: 19px; line-height: 1; letter-spacing: .02em; color: var(--cream);
  background: var(--ink-600);
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), inset 0 2px 0 rgba(255, 255, 255, .1), inset 0 -2px 0 rgba(0, 0, 0, .28);
  cursor: pointer;
  white-space: nowrap;
}
.btn img { width: 16px; height: 16px; }
.btn:hover { filter: brightness(1.14); }
.btn:active { transform: translateY(2px); }
.btn:disabled, .btn.cant { filter: saturate(.25) brightness(.72); cursor: default; }
.btn:disabled:active, .btn.cant:active { transform: none; }
.btn.primary { background: #3f8a3c; color: #f2ffe6; }
.btn.gold { background: var(--ember); color: #2a1204; box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), inset 0 2px 0 var(--ember-hi), inset 0 -2px 0 var(--ember-lo); }
.btn.danger { background: #a03a2e; }
.btn.small { min-height: 28px; padding: 1px 9px 2px; font-size: 17px; }
.btn.wide { width: calc(100% - 4px); margin: 10px 2px 0; }
.btn.toggle.on { background: #3f8a3c; color: #f2ffe6; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 2px 0; }
.btn-row .btn { flex: 1; }
.btn-row .btn img, .btn img { vertical-align: -3px; }

.cost { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-px); font-size: 18px; line-height: 1; color: var(--cream); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost img { width: 16px; height: 16px; }
.cost.no { color: var(--berry); }
.btn .cost { color: inherit; }
.btn .cost.no { color: #ffd0c4; }
.btn.gold .cost.no { color: #7a1608; }
.costs { display: inline-flex; flex-wrap: wrap; gap: 2px 9px; }

/* build grid */
.bgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 2px; }
.btile {
  --bd: var(--line);
  position: relative; min-height: 98px; padding: 8px 4px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text); text-align: center;
  background: var(--ink-800);
  cursor: pointer;
  transition: transform .08s;
}
.btile:hover { background: var(--ink-700); --bd: var(--ember); transform: translateY(-2px); }
.btile:active { transform: translateY(0); }
.btile img.bi { width: 32px; height: 32px; }
.btile .bt-name { font-weight: 800; font-size: 13px; line-height: 1.1; color: var(--cream); }
.btile .bt-cost { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.btile .bt-cost .cost { font-size: 17px; }
.btile kbd { position: absolute; top: 3px; left: 5px; font: 400 14px/1 var(--font-px); color: var(--text-3); }
.btile .bt-count { position: absolute; top: 3px; right: 5px; font: 400 16px/1 var(--font-px); color: var(--text-2); }
.btile.cant { background: var(--ink-850); }
.btile.cant img.bi { filter: grayscale(.7) brightness(.7); }
.btile.cant .bt-name { color: var(--text-2); }
.btile.active { --bd: var(--ember-hi); background: #33220f; }
.btile.fresh { animation: tileGlow 1.4s ease-in-out infinite; }
@keyframes tileGlow { 50% { --bd: var(--gold); background: #2c2710; } }
.btile .new { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); padding: 1px 6px; font: 400 14px/1 var(--font-px); letter-spacing: .06em; color: #2a1204; background: var(--ember-hi); display: none; }
.btile.new .new { display: block; }
.tool-btn { width: 100%; margin-top: 8px; justify-content: flex-start; }
.tool-btn kbd { margin-left: auto; font: 400 14px/1 var(--font-px); opacity: .6; }
.tool-btn.on { background: var(--ember); color: #2a1204; }
.tool-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 2px 0; }
.tool-row .tool-btn { margin-top: 0; justify-content: center; font-size: 17px; padding: 3px 4px; }
.tool-row .tool-btn kbd { margin-left: 4px; }

/* stats */
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 2px; border-bottom: 2px dotted var(--line); font-size: 14px; }
.stat:last-child { border-bottom: 0; }
.stat .k { color: var(--text-2); }
.stat b { text-align: right; font-family: var(--font-px); font-weight: 400; font-size: 18px; line-height: 1; color: var(--cream); font-variant-numeric: tabular-nums; }
.stat b.bad { color: var(--berry); }
.aura-stat b { text-align: right; }

/* info head */
.info-head { display: flex; gap: 12px; align-items: center; margin: 2px 2px 10px; }
.portrait {
  --bd: var(--line-hi);
  width: 64px; height: 64px; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 60%, #7cae4c, #3e7a3a 70%);
}
.portrait canvas, .portrait img { max-width: 100%; max-height: 100%; }
.info-title { font-family: var(--font-title); font-weight: 700; font-size: 25px; line-height: 1.02; color: var(--cream); }
.info-sub { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-top: 3px; }
.back-btn { font-size: 12.5px; font-weight: 700; color: var(--text-2); background: none; border: 0; padding: 0 0 8px; cursor: pointer; }
.back-btn:hover { color: var(--ember-hi); }

/* workers */
.workers { display: flex; align-items: center; gap: 8px; margin: 10px 2px; }
.workers .slots { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.slot { --bd: var(--line); width: 26px; height: 26px; display: grid; place-items: center; background: var(--ink-850); }
.slot.on { background: var(--ink-600); --bd: var(--moss-lo); }
.slot.away { opacity: .5; }
.slot img { width: 16px; height: 16px; }
.workers .btn { min-width: 34px; padding: 2px 6px; }

/* upgrade cards */
.ucards { display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.ucard {
  --bd: var(--line);
  display: grid; grid-template-columns: 32px 1fr; gap: 2px 9px;
  padding: 7px 8px;
  background: var(--ink-800);
}
.ucard.maxed { background: #17301c; --bd: var(--moss-lo); }
.ucard.ready { --bd: var(--gold); }
.ucard .uicon { --bd: var(--ink-950); grid-row: span 2; width: 32px; height: 32px; display: grid; place-items: center; background: var(--ink-600); }
.ucard .uicon img { width: 24px; height: 24px; }
.ucard .uhead { display: flex; align-items: center; gap: 5px; min-width: 0; }
.ucard .uname { font-weight: 800; font-size: 13.5px; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucard .ulvl { margin-left: auto; font: 400 16px/1 var(--font-px); color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ucard .ueff { font-size: 12.5px; font-weight: 600; color: var(--text-2); line-height: 1.3; }
.ucard .ueff .up { color: var(--moss); }
.ucard .ueff .up.ms { color: var(--gold); }
.ucard .ubuy { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; }
.ucard .ubuy .btn { flex: 1; min-height: 30px; padding: 2px 8px; justify-content: center; flex-wrap: wrap; white-space: normal; }
.ucard .ubuy .btn.max { flex: 0 0 auto; }
.info-i {
  flex: none; display: inline-grid; place-items: center; width: 15px; height: 15px; margin: 0 2px;
  font: italic 800 10.5px/1 Georgia, serif; color: var(--ink-900); background: var(--text-3); border-radius: 50%;
  cursor: help; vertical-align: middle; letter-spacing: 0; text-transform: none;
}
.info-i:hover { background: var(--ember-hi); }
.ph .info-i { margin-left: -2px; }

/* jobs table */
.jobs { display: flex; flex-direction: column; }
.job-row { display: grid; grid-template-columns: 24px 1fr auto auto auto; align-items: center; gap: 8px; padding: 5px 2px; border-bottom: 2px dotted var(--line); }
.job-row img { width: 24px; height: 24px; }
.job-row .job-name { font-weight: 700; color: var(--cream); }
.job-row .job-n { font: 400 18px/1 var(--font-px); color: var(--cream); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.job-row .btn { min-height: 26px; min-width: 30px; padding: 0 6px 1px; }
.job-pad { width: 68px; }

/* stores */
.store-group { margin-bottom: 4px; }
.store-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 2px; }
.store-item {
  --bd: var(--line);
  display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 0 8px;
  padding: 5px 7px; min-height: 46px;
  background: var(--ink-800);
}
.store-item img { width: 30px; height: 30px; grid-row: span 2; }
.store-item .si-name { font-size: 12px; font-weight: 700; color: var(--text-2); line-height: 1.1; }
.store-item .si-rate { font-weight: 700; color: var(--moss); margin-left: 4px; }
.store-item .si-val { font: 400 20px/1 var(--font-px); color: var(--cream); font-variant-numeric: tabular-nums; }
.store-item.unknown { opacity: .45; }
.store-item.unknown img { filter: brightness(0) invert(.35); }
.store-item.flash { animation: storeFlash .8s ease-out; }
@keyframes storeFlash { 0% { background: #4a3a14; } 100% { background: var(--ink-800); } }

/* mini status bar */
.status-box { --bd: var(--ember-lo); margin: 10px 2px; padding: 9px 11px; background: #1f1710; color: var(--cream); }
.status-box .st-line { font-weight: 800; font-size: 14px; }
.status-box .st-sub { font-size: 12.5px; color: var(--text-2); }
.pbar { height: 8px; margin-top: 7px; background: var(--ink-950); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--moss); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); }
.pbar.red i { background: var(--berry); }
.pbar.blue i { background: var(--sky); }
.pbar.gold i { background: var(--ember-hi); }

/* ------------------------------------------------------------------ stage */
#stage { position: absolute; inset: 0; overflow: hidden; min-width: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 10, 9, .62), rgba(4, 10, 9, 0) 110px),
    radial-gradient(ellipse at 55% 50%, rgba(0, 0, 0, 0) 52%, rgba(3, 10, 14, .5) 100%);
}
#mapframe {
  position: absolute; right: var(--gap); bottom: var(--gap); z-index: 3;
  padding: 4px; background: var(--surface);
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), var(--shadow);
  isolation: isolate;
}
#minimap { display: block; width: 176px; height: 176px; cursor: pointer; }
.map-btns { position: absolute; right: calc(100% + 10px); bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.frame { position: relative; background: var(--surface); }
#modebar {
  --bd: var(--ember-lo);
  position: absolute; left: calc(50% + (var(--panel-w) + var(--gap)) / 2); bottom: 16px; transform: translateX(-50%); z-index: 4;
  max-width: calc(100% - var(--panel-w) - 260px);
  padding: 9px 15px; font-size: 13.5px; color: var(--text);
  background: var(--surface);
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), var(--shadow);
}
#modebar b { color: var(--ember-hi); }
#modebar kbd, .modal-box .controls kbd, kbd.k {
  font: 400 15px/1 var(--font-px); padding: 1px 6px 2px; color: var(--cream);
  background: var(--ink-600); box-shadow: 0 2px 0 var(--ink-950);
}
#modebar .warn { color: var(--berry); }
#modebar .touch { display: none; }
.mb-btn { min-height: 36px; padding: 0 14px; font: 400 19px var(--font-px); color: var(--cream); background: var(--ink-600); }
.mb-btn.ok { background: #3f8a3c; }
.mb-btn:disabled { opacity: .5; }

#toasts { position: absolute; left: calc(var(--panel-w) + var(--gap) * 2 + 4px); top: 72px; z-index: 4; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: min(440px, calc(100% - var(--panel-w) - 380px)); }
/* with the Forest / Mine tabs showing, toasts start below them */
#views:not(.hidden) ~ #toasts { top: 114px; }
.toast {
  --bd: var(--line-hi);
  display: flex; align-items: center; gap: 9px;
  padding: 6px 13px 6px 7px; font-size: 13.5px; font-weight: 600; line-height: 1.3;
  color: var(--text);
  background: var(--surface);
  animation: toastIn .25s cubic-bezier(.2, 1.4, .4, 1), toastOut .4s ease-in calc(var(--life, 3s)) forwards;
}
.toast img { width: 30px; height: 30px; flex: none; }
.toast em { font-style: normal; color: var(--moss); font-weight: 800; }
.toast.gold { --bd: var(--ember); background: #241a10; color: var(--cream); }
.toast.err { --bd: var(--berry-lo); background: #2a1512; color: #f6c4ba; }
.toast .toast-n { color: var(--ember-hi); }
@keyframes toastIn { from { transform: translateX(-18px); opacity: 0; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

#spotlight {
  --bd: var(--ember);
  position: absolute; left: calc(50% + (var(--panel-w) + var(--gap)) / 2); top: 17%; transform: translateX(-50%); z-index: 5;
  min-width: 360px; max-width: calc(100% - 40px);
  padding: 16px 30px 18px; text-align: center; pointer-events: none;
  color: var(--text);
  background: radial-gradient(ellipse at 50% 0%, #3a2410, #17110c 70%);
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), 0 0 60px rgba(255, 143, 60, .35), var(--shadow);
}
#spotlight.show { animation: spotIn .45s cubic-bezier(.2,1.6,.4,1), spotOut .5s ease-in 3.2s forwards; }
#spotlight .sp-kicker { font: 400 17px/1 var(--font-px); letter-spacing: .16em; text-transform: uppercase; color: var(--ember-hi); }
#spotlight .sp-title { font-family: var(--font-title); font-weight: 800; font-size: 42px; line-height: 1.05; color: var(--cream); margin: 4px 0; text-shadow: 0 3px 0 #1a0c04; }
#spotlight .sp-text { font-weight: 700; font-size: 15px; color: var(--moss); }
#spotlight .sp-icon { width: 64px; height: 64px; margin: 0 auto 2px; display: block; }
@keyframes spotIn { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
@keyframes spotOut { to { transform: translateX(-50%) translateY(-12px); opacity: 0; } }

#tooltip {
  --bd: var(--line-hi);
  position: fixed; z-index: 60; max-width: 320px;
  padding: 9px 12px; font-size: 13.5px; line-height: 1.42;
  color: var(--text); background: rgba(6, 12, 11, .97);
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), 0 8px 20px rgba(0, 0, 0, .55);
  pointer-events: none;
}
#tooltip .tt-title { color: var(--ember-hi); font-weight: 800; font-size: 14.5px; }
#tooltip .tt-sub { color: var(--text-2); font-size: 12.5px; }
#tooltip .tt-sub.warn { color: var(--berry); }
#tooltip .tt-sub.good { color: var(--moss); }
#tooltip .tt-row { display: flex; justify-content: space-between; gap: 12px; }
#tooltip .bar { height: 5px; background: var(--ink-600); margin-top: 5px; }
#tooltip .bar i { display: block; height: 100%; background: var(--moss); }
#tooltip .cost-line { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 2px 9px; }
#tooltip .cost.no { color: var(--berry); }

.goal-m { display: none; }

/* ------------------------------------------------------------------ windows (modal) */
#modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(3, 8, 8, .7); animation: fadeIn .15s ease-out; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-box {
  --bd: var(--ink-950);
  width: min(560px, calc(100vw - 28px)); max-height: calc(100vh - 28px);
  display: flex; flex-direction: column;
  padding: 18px 18px 18px;
  color: var(--text);
  background: var(--ink-850);
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), 0 0 0 4px var(--line), 0 24px 60px rgba(0, 0, 0, .65);
  isolation: isolate;
  animation: boxIn .2s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes boxIn { from { transform: translateY(10px) scale(.985); opacity: 0; } }
.modal-box.wide { width: min(1180px, calc(100vw - 28px)); height: min(820px, calc(100vh - 28px)); }
.modal-box.mid { width: min(860px, calc(100vw - 28px)); max-height: min(820px, calc(100vh - 28px)); }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent; padding: 2px 4px 2px 2px; }
.modal-box.wide .modal-body { overflow: hidden; display: flex; flex-direction: column; }
.modal-x {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; padding: 0 0 3px; font-family: var(--font); font-size: 22px; font-weight: 800; line-height: 1;
  color: var(--text-2); background: var(--ink-700); border: 0;
  box-shadow: 0 -2px 0 0 var(--ink-950), 0 2px 0 0 var(--ink-950), -2px 0 0 0 var(--ink-950), 2px 0 0 0 var(--ink-950);
  cursor: pointer;
}
.modal-x:hover { background: var(--berry-lo); color: #fff; }
.modal-box h1 { margin: 0 0 2px; font-family: var(--font-title); font-weight: 800; font-size: 46px; line-height: 1; text-align: center; color: var(--cream); text-shadow: 0 3px 0 #05090a; }
.modal-box h1.h-mid { font-size: 36px; }
.modal-box h3 { margin: 6px 0 8px; font: 400 18px/1 var(--font-px); letter-spacing: .16em; text-align: center; color: var(--ember-hi); text-transform: uppercase; }
.modal-box h4 { font: 400 17px/1 var(--font-px); letter-spacing: .1em; text-transform: uppercase; color: var(--ember-hi); }
.modal-box p { font-size: 14.5px; line-height: 1.55; margin: 9px 2px; color: var(--text); }
.modal-box .divider { height: 2px; margin: 12px 0; background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px); }
.modal-box .controls { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 8px 4px; color: var(--text-2); }
.modal-box .controls kbd { white-space: nowrap; justify-self: start; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; padding-bottom: 4px; }
.big-btn { min-height: 44px; padding: 0 26px 2px; font-size: 24px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 12px auto; }
.menu-list .btn { justify-content: space-between; }
.menu-list .btn .mv { color: var(--ember-hi); }
.faders { display: flex; flex-direction: column; gap: 14px; max-width: 320px; margin: 16px auto 18px; }
.fader { display: grid; grid-template-columns: 1fr 34px; grid-template-areas: 'name val' 'bar bar'; gap: 6px 8px; align-items: end; }
.fader .f-name { grid-area: name; font: 400 21px/1 var(--font-px); letter-spacing: .04em; color: var(--cream); }
.fader .f-name small { display: block; margin-top: 3px; font: 400 12.5px/1.2 var(--font); letter-spacing: 0; color: var(--text-3); }
.fader .f-val { grid-area: val; text-align: right; font: 400 21px/1 var(--font-px); color: var(--ember-hi); }
.fader input[type=range] { grid-area: bar; -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 0; background: transparent; cursor: inherit; touch-action: pan-y; }
.fader input[type=range]::-webkit-slider-runnable-track { height: 8px; background: linear-gradient(90deg, var(--ember) var(--fill, 50%), var(--ink-950) var(--fill, 50%)); box-shadow: 0 0 0 2px var(--line); }
.fader input[type=range]::-moz-range-track { height: 8px; background: linear-gradient(90deg, var(--ember) var(--fill, 50%), var(--ink-950) var(--fill, 50%)); box-shadow: 0 0 0 2px var(--line); }
.fader input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 22px; margin-top: -7px; background: var(--cream); box-shadow: 0 0 0 2px var(--ink-950), 0 2px 0 2px var(--gold-lo); border: 0; border-radius: 0; }
.fader input[type=range]::-moz-range-thumb { width: 14px; height: 22px; background: var(--cream); box-shadow: 0 0 0 2px var(--ink-950), 0 2px 0 2px var(--gold-lo); border: 0; border-radius: 0; }
.fader input[type=range]:focus-visible { outline: 2px solid var(--ember-hi); outline-offset: 3px; }
.save-box { width: 100%; height: 110px; font: 12px monospace; color: var(--text); background: var(--ink-950); border: 2px solid var(--line); user-select: text; -webkit-user-select: text; }
.gains { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 4px; }
.gain { --bd: var(--line); display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; font: 400 21px/1 var(--font-px); color: var(--cream); background: var(--ink-800); }
.gain img { width: 30px; height: 30px; }
.relic-big { display: grid; place-items: center; margin: 10px 0; }
.relic-big img { width: 80px; height: 80px; image-rendering: pixelated; filter: drop-shadow(0 0 18px rgba(255, 143, 60, .5)); }
.chapter-card .ch-num { text-align: center; font: 400 17px/1 var(--font-px); letter-spacing: .16em; text-transform: uppercase; color: var(--ember-hi); }
.stats-grid { display: grid; grid-template-columns: 1fr auto; gap: 5px 16px; max-width: 360px; margin: 10px auto; }

.win-head { display: flex; align-items: center; gap: 14px; padding: 0 44px 12px 4px; border-bottom: 2px solid var(--ink-950); box-shadow: 0 2px 0 rgba(255, 255, 255, .04); flex: none; }
.win-head img.wh-icon { width: 48px; height: 48px; }
.win-head .wh-title { font-family: var(--font-title); font-weight: 800; font-size: 38px; line-height: .95; color: var(--cream); text-shadow: 0 3px 0 #05090a; }
.win-head .wh-sub { font-weight: 600; font-size: 13px; color: var(--text-2); margin-top: 3px; }
.win-head .wh-sub b { color: var(--ember-hi); }
.win-head .wh-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.win-tabs { display: flex; gap: 6px; margin-left: 12px; }
.win-tabs .btn.on { background: var(--ember); color: #2a1204; }

/* ------------------------------------------------------------------ legacy tree layouts (older node style, still used by some views) */
.forge-wrap { display: flex; gap: 14px; flex: 1; min-height: 0; padding: 12px 2px 2px; }
.forge-tree {
  --bd: var(--ink-950);
  flex: 1; min-width: 0; position: relative; overflow: auto;
  background: var(--ink-950);
  scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent;
  cursor: grab;
}
.forge-tree.dragging { cursor: grabbing; }
.forge-canvas { position: relative; }
.forge-canvas svg { position: absolute; inset: 0; pointer-events: none; }
.age-col { position: absolute; top: 0; bottom: 0; border-right: 1px dashed rgba(255, 196, 102, .12); }
.age-col.cur { background: linear-gradient(rgba(255, 196, 102, .07), rgba(255, 196, 102, .02)); }
.age-label { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-family: var(--font-px); font-size: 24px; color: var(--ember-hi); letter-spacing: .05em; }
.age-label small { display: block; font-family: var(--font); font-size: 11.5px; font-weight: 800; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }
.lane-row { position: absolute; left: 0; right: 0; border-top: 1px solid rgba(255, 196, 102, .1); }
.lane-label { position: sticky; left: 0; width: 92px; padding: 6px 6px 0 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-weight: 800; font-size: 12.5px; color: var(--ember-hi); text-transform: uppercase; letter-spacing: .06em; z-index: 2; background: linear-gradient(90deg, var(--ink-950) 70%, transparent); height: 100%; }
.lane-label img { width: 32px; height: 32px; }
.fnode {
  position: absolute; width: 176px; height: 70px;
  display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; align-content: center; align-items: center; gap: 1px 8px;
  padding: 4px 8px; text-align: left; overflow: hidden;
  color: var(--text);
  background: var(--ink-750);
  border: 2px solid var(--ink-950);
  cursor: pointer; z-index: 1;
}
.fnode img { width: 40px; height: 40px; grid-row: span 2; }
.fnode .fn-name { font-weight: 800; font-size: 13px; line-height: 1.1; color: var(--cream); }
.fnode .fn-eff { font-size: 11.5px; font-weight: 600; color: var(--text-2); line-height: 1.12; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fnode:hover { filter: brightness(1.15); }
.fnode.done { background: #33290f; border-color: var(--gold-lo); }
.fnode.done .fn-eff { color: var(--gold); }
.fnode.ready { border-color: var(--moss); animation: readyPulse 1.6s ease-in-out infinite; }
@keyframes readyPulse { 50% { box-shadow: 0 0 18px rgba(147, 212, 108, .6); } }
.fnode.locked { opacity: .45; }
.fnode.locked img { filter: grayscale(.8) brightness(.8); }
.fnode.mystery { opacity: .3; }
.fnode.mystery img { filter: brightness(0) invert(.4); }
.fnode.sel { outline: 2px solid var(--ember-hi); outline-offset: 2px; }
.fnode .fn-lvl { position: absolute; right: 5px; top: 2px; font: 400 15px/1 var(--font-px); color: var(--gold); }
.fnode .fn-lvl:empty { display: none; }
.fnode:has(.fn-lvl:not(:empty)) .fn-name { padding-right: 34px; }
.fnode.lore { opacity: .7; border-color: var(--violet); }
.fnode.lore img { filter: saturate(.4); }
.forge-side, .tw-side {
  --bd: var(--line);
  width: 320px; flex: none; display: flex; flex-direction: column; gap: 9px;
  padding: 14px; overflow-y: auto;
  background: var(--ink-800);
  scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent;
}
.fs-head { display: flex; gap: 12px; align-items: center; }
.fs-head .fs-icon { --bd: var(--line-hi); width: 64px; height: 64px; flex: none; display: grid; place-items: center; background: var(--ink-950); }
.fs-head .fs-icon img { width: 48px; height: 48px; }
.fs-name { font-family: var(--font-title); font-weight: 700; font-size: 26px; line-height: 1.02; color: var(--cream); }
.fs-age { font: 400 16px/1 var(--font-px); color: var(--ember-hi); text-transform: uppercase; letter-spacing: .1em; margin-top: 5px; }
.fs-eff { --bd: var(--moss-lo); padding: 9px 11px; font-weight: 800; font-size: 14.5px; color: #cdf0b4; background: #142a17; }
.fs-eff.off { color: var(--text-2); background: var(--ink-850); --bd: var(--line); }
.fs-next { margin-top: 5px; font-size: 12.5px; font-weight: 700; color: var(--gold); }
.fs-costs { display: flex; flex-direction: column; gap: 0; }
.fs-cost { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; padding: 5px 4px; border-bottom: 2px dotted var(--line); font-size: 14px; }
.fs-cost img { width: 24px; height: 24px; }
.fs-cost b { font: 400 19px/1 var(--font-px); color: var(--cream); font-variant-numeric: tabular-nums; }
.fs-cost.no b { color: var(--berry); }
.fs-cost .fs-have { font-size: 12px; color: var(--text-3); font-weight: 600; }
.fs-req { font-size: 13px; color: var(--text-2); }
.fs-req .no { color: var(--berry); font-weight: 800; }
.fs-req.good { color: var(--moss); font-weight: 700; }

/* ------------------------------------------------------------------ the trees (dense grid, levels) */
.tw-wrap { display: flex; gap: 14px; flex: 1; min-height: 0; padding: 12px 2px 2px; }
.tw-tree {
  --bd: var(--ink-950);
  flex: 1; min-width: 0; position: relative; overflow: auto;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 143, 60, .10), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 4px),
    var(--ink-950);
  scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent;
  cursor: grab;
}
.tw-rites .tw-tree, .forge-wrap.rites .forge-tree { background: radial-gradient(ellipse at 30% 0%, rgba(244, 203, 98, .13), transparent 60%), var(--ink-950); }
.tw-legacy .tw-tree, .forge-wrap.legacy .forge-tree { background: radial-gradient(ellipse at 50% 100%, rgba(255, 110, 40, .16), transparent 60%), var(--ink-950); }
.tw-tree.dragging { cursor: grabbing; }
.tw-canvas { position: relative; margin: 0 auto; }
.tw-canvas svg { position: absolute; inset: 0; pointer-events: none; }
.tw-row { position: absolute; font: 400 16px/1 var(--font-px); letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 196, 102, .5); white-space: nowrap; pointer-events: none; }
.tnode {
  --bd: var(--ink-500);
  position: absolute; width: 46px; height: 46px; padding: 0;
  display: grid; place-items: center;
  background: var(--ink-750);
  box-shadow: 0 -3px 0 0 var(--bd), 0 3px 0 0 var(--bd), -3px 0 0 0 var(--bd), 3px 0 0 0 var(--bd);
  cursor: pointer; z-index: 1;
}
.tnode img { width: 32px; height: 32px; }
.tnode .tn-lv {
  position: absolute; left: 50%; top: 51px; transform: translateX(-50%);
  padding: 0 4px 1px; min-width: 32px; text-align: center;
  font: 400 15px/14px var(--font-px); color: var(--text); white-space: nowrap;
  background: var(--ink-950);
  font-variant-numeric: tabular-nums;
}
.tnode:hover { filter: brightness(1.25); }
.tnode.locked { background: var(--ink-900); --bd: var(--ink-700); }
.tnode.locked img { filter: grayscale(1) brightness(.4); }
.tnode.locked .tn-lv { color: var(--text-3); }
.tnode.open { --bd: var(--line-hi); }
.tnode.part { --bd: var(--ember); }
.tnode.part .tn-lv { color: var(--ember-hi); }
.tnode.max { --bd: var(--moss); background: #17301c; }
.tnode.max .tn-lv { color: var(--moss); }
.tnode.ready { --bd: var(--gold); animation: nodeReady 1.6s ease-in-out infinite; }
@keyframes nodeReady { 50% { box-shadow: 0 -3px 0 0 var(--bd), 0 3px 0 0 var(--bd), -3px 0 0 0 var(--bd), 3px 0 0 0 var(--bd), 0 0 20px 4px rgba(244, 203, 98, .55); } }
.tnode.sel { outline: 2px solid var(--cream); outline-offset: 5px; }
.tw-side .fs-icon.locked img { filter: grayscale(1) brightness(.5); }
.tw-side .fs-icon.max { --bd: var(--moss); }
.tw-buy { display: flex; gap: 8px; margin-top: 10px; padding: 2px; }
.tw-buy .btn:first-child { flex: 1; }
.tw-crafts .wh-right .btn, .tw-rites .wh-right .btn { white-space: nowrap; }

/* rows of crafts in a building's panel */
.nrows { display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.nrow { --bd: var(--line); display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; background: var(--ink-800); }
.nrow.maxed { background: #17301c; --bd: var(--moss-lo); }
.nrow .nr-ic { width: 28px; height: 28px; }
.nrow .nr-name { font-weight: 800; font-size: 13px; color: var(--cream); line-height: 1.15; }
.nrow .nr-lv { font: 400 15px/1 var(--font-px); color: var(--text-2); }
.nrow .nr-eff { font-size: 12px; font-weight: 600; line-height: 1.25; color: var(--text-2); }
.nrow .nr-eff .up { color: var(--moss); }
.nrow .nr-buy { min-width: 64px; padding: 2px 7px; justify-content: center; flex-wrap: wrap; white-space: normal; }
.nrow .nr-buy .costs { display: flex; flex-direction: column; align-items: flex-end; }
.link-btn { background: none; border: 0; padding: 0; font: 700 12px var(--font); color: var(--ember-hi); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.recipe-row .btn.on, .mine-tabs .btn.on { background: var(--ember); color: #2a1204; }
.mine-tabs { flex-wrap: wrap; margin-bottom: 10px; }
.diamond-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 12px 2px 5px; font: 400 24px/1 var(--font-px); color: #d8f6ff; background: #12303a; box-shadow: 0 -2px 0 0 #2c6a7c, 0 2px 0 0 #2c6a7c, -2px 0 0 0 #2c6a7c, 2px 0 0 0 #2c6a7c; cursor: default; }
.diamond-chip img { width: 30px; height: 30px; }
.res.diamond-chip { display: flex; font: inherit; color: inherit; background: var(--surface); padding: 0 11px 0 6px; box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd); }

/* ------------------------------------------------------------------ mine */
.card { --bd: var(--line); padding: 11px 13px; background: var(--ink-800); margin: 2px; }
.card h4 { margin: 0 0 8px; font: 400 17px/1 var(--font-px); letter-spacing: .1em; text-transform: uppercase; color: var(--ember-hi); }
.big-status { font-weight: 800; font-size: 17px; color: var(--cream); }
.limits { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 2px; }
.limit { --bd: var(--line); padding: 7px 6px; background: var(--ink-800); text-align: center; }
.limit .l-k { font: 400 15px/1 var(--font-px); letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.limit .l-v { font: 400 30px/1 var(--font-px); color: var(--cream); margin: 3px 0 2px; }
.limit .l-s { font-size: 11.5px; font-weight: 600; color: var(--text-3); line-height: 1.2; }
.limit.binding { --bd: var(--berry-lo); background: #2a1512; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper .val { min-width: 68px; text-align: center; font: 400 24px/1 var(--font-px); color: var(--cream); }
.drop-table { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.drop { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; border-bottom: 2px dotted var(--line); }
.drop img { width: 24px; height: 24px; }
.drop b { font: 400 17px/1 var(--font-px); color: var(--cream); font-variant-numeric: tabular-nums; }
.drop.rare .d-name { color: var(--violet); font-weight: 800; }
.drop.unknown img { filter: brightness(0) invert(.35); }
.loot-list { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.loot-list .cost img { width: 20px; height: 20px; }

/* ------------------------------------------------------------------ fishing (dormant in V6, kept styled) */
.pond-btn { --bd: var(--line); display: grid; grid-template-columns: 1fr auto; gap: 0 6px; padding: 8px 10px; text-align: left; color: var(--text); background: var(--ink-800); cursor: pointer; }
.pond-btn .pb-name { font-weight: 800; font-size: 15px; color: var(--cream); }
.pond-btn .pb-sub { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.pond-btn.sel { --bd: var(--ember); background: #33220f; }
.pond-btn.none { opacity: .7; }
.rar-common { color: var(--text-2); } .rar-uncommon { color: var(--moss); } .rar-scarce { color: var(--sky); } .rar-rare { color: var(--violet); } .rar-legendary { color: var(--ember-hi); }

/* ------------------------------------------------------------------ views: forest / mine */
#views {
  position: absolute; left: calc(50% + (var(--panel-w) + var(--gap)) / 2); top: 68px; transform: translateX(-50%); z-index: 6;
  display: flex; gap: 8px; padding: 2px;
}
.vtab {
  --bd: var(--ink-950);
  position: relative; display: flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 16px 1px 10px;
  font-family: var(--font-px); font-size: 21px; color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
}
.vtab img { width: 22px; height: 22px; }
.vtab:hover { color: var(--cream); --bd: var(--line-hi); }
.vtab.on { background: var(--ember); color: #2a1204; box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), inset 0 2px 0 var(--ember-hi), inset 0 -2px 0 var(--ember-lo); }
.vtab.locked img { filter: grayscale(.8) brightness(.8); }
.vtab.fresh { animation: featGlow 1.4s ease-in-out infinite; }
.vtab .badge { top: -8px; right: -8px; }
body.in-scene #mapframe, body.in-scene #vignette, body.in-scene #modebar, body.in-scene .skydial, body.in-scene #btn-photo { display: none; }

#scene { position: absolute; inset: 0; z-index: 2; background: var(--ink-900); overflow: hidden; }
#scene .sc-cv { position: absolute; left: calc(var(--panel-w) + var(--gap) + 2px); top: 0; width: calc(100% - var(--panel-w) - var(--gap) - 2px); height: 100%; display: block; touch-action: none; cursor: grab; }
.sc-status {
  --bd: var(--ember-lo);
  position: absolute; left: calc(var(--panel-w) + var(--gap) * 2 + 4px); bottom: 14px; z-index: 3; width: min(360px, calc(100% - 24px));
  padding: 9px 11px; color: var(--cream); background: var(--surface);
}
.sc-status .st-line { font-weight: 800; font-size: 14.5px; }
.sc-status .st-sub { font-size: 12.5px; color: var(--text-2); }
.sc-card {
  --bd: var(--line-hi);
  position: absolute; right: 14px; top: 136px; z-index: 3; width: 300px; max-height: calc(100% - 210px); overflow-y: auto;
  padding: 11px 13px; color: var(--text); background: var(--surface);
  scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent;
}
.sc-card h4 { margin: 0 0 8px; font: 400 17px/1 var(--font-px); letter-spacing: .08em; text-transform: uppercase; color: var(--ember-hi); }
.sc-card .drop-table { grid-template-columns: 1fr; }
.sc-card .fc-foot { margin-top: 9px; color: var(--text-2); }
.fish-card { width: 330px; }
.sc-btns { position: absolute; right: 14px; bottom: 14px; z-index: 3; display: flex; gap: 8px; }
.sc-btns .btn.on { background: #3f8a3c; color: #f2ffe6; }
.pond-tabs { position: absolute; left: calc(var(--panel-w) + var(--gap) * 2 + 4px); bottom: 14px; z-index: 3; display: flex; gap: 8px; max-width: calc(100% - 24px); overflow-x: auto; }
.pond-tab { --bd: var(--ink-950); display: flex; flex-direction: column; align-items: flex-start; padding: 5px 9px; text-align: left; color: var(--text); background: var(--surface); cursor: pointer; }
.pond-tab .pt-name { font-weight: 800; font-size: 14px; }
.pond-tab .pt-sub { font-size: 12px; color: var(--text-2); font-weight: 600; }
.pond-tab.empty { opacity: .78; }
.pond-tab.on { --bd: var(--ember); background: #33220f; opacity: 1; }
.sc-msg {
  --bd: var(--line-hi);
  position: absolute; left: calc(50% + (var(--panel-w) + var(--gap)) / 2); top: 46%; transform: translate(-50%, -50%); z-index: 4; width: min(440px, calc(100% - 40px));
  padding: 16px 20px; text-align: center; color: var(--text); background: var(--ink-850);
  box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), var(--shadow);
}
.sc-msg .msg-title { font-family: var(--font-title); font-weight: 800; font-size: 30px; line-height: 1.05; color: var(--cream); margin-bottom: 6px; }
.sc-msg p { margin: 6px 0; font-size: 14px; }
.sc-msg .msg-cost { display: flex; justify-content: center; margin: 8px 0; }
.sc-msg .msg-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.pfish { display: grid; grid-template-columns: 34px 1fr 48px 56px 48px; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 2px dotted var(--line); font-size: 13px; }
.pfish img { width: 32px; height: 32px; }
.pfish .pf-name { font-weight: 800; font-size: 13.5px; }
.pfish .pf-sub { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.pfish .pf-v { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.pfish .pf-v small { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--text-3); }
.pfish.unknown img, .find.unknown img { filter: brightness(0) invert(.35); }
.pfish.unknown .pf-name, .find.unknown .f-name { color: var(--text-3); }
.pf-card { color: var(--gold); font-size: 14px; }

/* crews */
.crew { display: flex; align-items: center; gap: 8px; margin: 10px 2px 4px; }
.crew .btn { min-width: 38px; padding: 2px 6px; }
.crew-n { --bd: var(--line-hi); flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; height: 34px; background: var(--ink-800); }
.crew-n img { width: 24px; height: 24px; }
.crew-n b { font: 400 26px/1 var(--font-px); font-variant-numeric: tabular-nums; }
.crew-sub { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin: 0 2px 8px; color: var(--text-2); font-weight: 600; }
.dive-plan { display: flex; flex-direction: column; gap: 8px; }
.dock-row { display: flex; justify-content: space-between; margin-top: 4px; }
.dock-row.on { box-shadow: 0 0 0 2px var(--ember); }
.finds { display: flex; flex-direction: column; }
.find { display: grid; grid-template-columns: 28px 1fr auto; gap: 9px; align-items: center; padding: 5px 0; border-bottom: 2px dotted var(--line); }
.find img { width: 28px; height: 28px; }
.find .f-name { font-weight: 800; font-size: 13.5px; color: var(--cream); }
.find .f-sub { font-size: 12px; color: var(--text-2); font-weight: 600; }
.find .f-v { font: 400 18px/1 var(--font-px); color: var(--cream); font-variant-numeric: tabular-nums; }

/* feasts, fish, trophies (dormant) */
.feasts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.feast { --bd: var(--line); display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; background: var(--ink-800); }
.feast img { width: 32px; height: 32px; }
.feast .fe-name { font-weight: 800; font-size: 14px; }
.feast .fe-eff { font-size: 12.5px; font-weight: 700; color: var(--moss); }
.feast .fe-cost { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.feast .fe-left { font-weight: 800; color: var(--gold); }
.feast .pbar { height: 5px; margin-top: 3px; }
.feast.on { --bd: var(--gold-lo); background: #33290f; }
.feast.unknown { opacity: .6; }
.feast.unknown img { filter: brightness(0) invert(.35); }
.keep { display: flex; flex-direction: column; margin-top: 6px; }
.krow { display: grid; grid-template-columns: 32px 1fr auto auto; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 2px dotted var(--line); }
.krow img { width: 32px; height: 32px; }
.krow .k-name { font-weight: 800; font-size: 13.5px; }
.krow .k-name span { font-size: 11px; font-weight: 800; }
.krow .k-n { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.krow .btn { flex-direction: column; gap: 0; line-height: 1.1; padding: 2px 6px; }
.krow .btn .small { font-size: 11px; opacity: .9; }
.trophies { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.trophy { --bd: var(--line); padding: 6px; text-align: center; background: var(--ink-800); }
.trophy img { width: 40px; height: 40px; }
.trophy .t-name { font-weight: 800; font-size: 13px; }
.trophy .t-eff { font-size: 12px; font-weight: 700; color: var(--moss); }
.trophy .t-done { font-size: 12px; font-weight: 800; color: var(--gold); }
.trophy .btn { margin-top: 4px; width: 100%; flex-wrap: wrap; }
.trophy.done { --bd: var(--gold-lo); background: #33290f; }
.trophy.unknown img { filter: brightness(0) invert(.35); }
.trophy.unknown .t-eff { color: var(--text-3); text-transform: capitalize; }

/* ------------------------------------------------------------------ cards */
.cards-wrap { display: flex; gap: 18px; flex: 1; min-height: 0; padding: 10px 2px 2px; }
.cards-grid { flex: 1; min-width: 0; overflow-y: auto; padding: 2px 8px 8px 2px; scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent; }
.card-row { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px; }
.gcard { padding: 0; border: 0; background: none; cursor: pointer; }
.gc-face {
  --bd: var(--ink-950);
  position: relative; width: 84px; height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 -3px 0 0 var(--bd), 0 3px 0 0 var(--bd), -3px 0 0 0 var(--bd), 3px 0 0 0 var(--bd), 0 7px 0 0 rgba(0, 0, 0, .35);
  transition: transform .1s;
}
.gc-face img { width: 32px; height: 32px; }
.gc-face img.dim { filter: brightness(0) invert(.28); }
.gc-face .gc-name { font-weight: 800; font-size: 11.5px; line-height: 1.1; text-align: center; padding: 0 4px; }
.gc-face .gc-tier { position: absolute; top: 3px; right: 6px; font: 400 17px/1 var(--font-px); color: var(--ember-lo); }
.gc-face.back { background: repeating-linear-gradient(45deg, var(--ink-750) 0 6px, var(--ink-800) 6px 12px); color: var(--text-3); --bd: var(--ink-600); }
.gc-face.back::after { content: '?'; position: absolute; top: 4px; right: 8px; font: 400 17px/1 var(--font-px); color: var(--text-3); }
.gc-face.back .gc-sh { opacity: .8; }
.gc-face.found { background: linear-gradient(#fbf1d6, #ead9aa); color: #2e1c0e; --bd: #6a4a22; }
.gc-face.gold { background: linear-gradient(135deg, #fff2a8, #f0b638 45%, #fff6c8 55%, #d0901c); color: #3a2206; --bd: #8a5a0c; box-shadow: 0 -3px 0 0 var(--bd), 0 3px 0 0 var(--bd), -3px 0 0 0 var(--bd), 3px 0 0 0 var(--bd), 0 0 22px rgba(255, 196, 80, .65); }
.gc-face.gold .gc-tier { color: #3a2206; }
.gc-sh { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; background: rgba(40, 20, 6, .28); overflow: hidden; }
.gc-face.back .gc-sh { background: var(--ink-950); }
.gc-sh i { display: block; height: 100%; background: var(--ember); }
.gcard.sel .gc-face { outline: 2px solid var(--ember-hi); outline-offset: 5px; }
.gcard.ready .gc-face { animation: cardReady 1.4s ease-in-out infinite; }
@keyframes cardReady { 50% { transform: translateY(-4px); filter: brightness(1.12); } }
.gcard:hover .gc-face { transform: translateY(-4px); }
.gc-face.big { width: 140px; height: 186px; margin: 6px auto 0; }
.gc-face.big img { width: 64px; height: 64px; }
.gc-face.big .gc-name { font-size: 16px; }
.gc-face.big .gc-tier { font-size: 24px; top: 6px; right: 9px; }
.card-side { width: 290px; flex: none; overflow-y: auto; padding: 8px 6px; }
.card-side .cs-name { text-align: center; font-family: var(--font-title); font-weight: 700; font-size: 28px; color: var(--cream); margin: 14px 0 6px; }
.card-side p { margin: 8px 0; font-size: 13.5px; color: var(--text-2); }
.cs-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 2px dotted var(--line); font-size: 14px; color: var(--text-2); }
.cs-row b { color: var(--moss); }
.shard-bar { --bd: var(--gold-lo); position: relative; height: 22px; margin: 12px 2px 6px; background: var(--ink-950); overflow: hidden; }
.shard-bar i { position: absolute; inset: 0 auto 0 0; background: var(--ember); box-shadow: inset 0 2px 0 var(--ember-hi), inset 0 -2px 0 var(--ember-lo); }
.shard-bar span { position: relative; display: block; text-align: center; font: 400 18px/21px var(--font-px); color: var(--cream); text-shadow: 0 1px 0 rgba(0, 0, 0, .6); }

/* ------------------------------------------------------------------ shrines (dormant) */
.shrine-wrap { display: flex; gap: 12px; flex: 1; min-height: 0; padding-top: 10px; }
.shrine-list { width: 230px; flex: none; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.shrine-main { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.floors { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.floor { --bd: var(--line); position: relative; height: 34px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--text-2); background: var(--ink-800); }
.floor.cleared { background: #17301c; --bd: var(--moss-lo); color: var(--moss); }
.floor.boss { --bd: var(--berry-lo); }
.floor img { position: absolute; width: 20px; height: 20px; top: -9px; right: -7px; }
.floor.cur { background: #33290f; --bd: var(--gold); color: var(--cream); }
.fight { display: grid; grid-template-columns: 1fr 64px 1fr; gap: 10px; align-items: center; }
.fight .side .k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.fight .vs { width: 64px; height: 64px; display: grid; place-items: center; background: var(--ink-950); }
.fight .vs img { width: 48px; height: 48px; }
.event-log { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; max-height: 150px; overflow-y: auto; }
.relic-row { display: flex; flex-wrap: wrap; gap: 8px; }
.relic-slot { --bd: var(--line); width: 44px; height: 44px; display: grid; place-items: center; background: var(--ink-800); }
.relic-slot img { width: 32px; height: 32px; }
.relic-slot.have { background: #33290f; --bd: var(--gold-lo); }
.relic-slot.missing img { filter: brightness(0) invert(.3); }

/* goals */
.goal-list { display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 4px; }
.goal-row { --bd: var(--line); display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px 8px 10px; background: var(--ink-800); font-size: 14px; }
.goal-row .gr-check { width: 20px; height: 20px; display: grid; place-items: center; font-weight: 900; font-size: 12px; color: var(--ink-900); background: var(--ink-600); }
.goal-row.done { opacity: .55; }
.goal-row.done .gr-check { background: var(--moss); }
.goal-row.cur { --bd: var(--ember); background: #2a1c0e; }
.goal-row.cur .gr-check { background: var(--ember); }
.goal-row .gr-text { font-weight: 700; color: var(--cream); }
.goal-row .gr-hint { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.goal-row .gr-rw { font: 400 17px/1 var(--font-px); color: var(--moss); text-align: right; }

/* ------------------------------------------------------------------ loading & title */
#loading { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(ellipse at 50% 40%, #16302a, #060c0b 75%); transition: opacity .7s; }
#loading.fade { opacity: 0; pointer-events: none; }
.loading-title { font-family: var(--font-title); font-weight: 800; font-size: 76px; line-height: 1; color: var(--cream); text-shadow: 0 4px 0 #05090a, 0 0 40px rgba(255, 143, 60, .5); }
.loading-sub { font: 400 21px/1 var(--font-px); letter-spacing: .14em; text-transform: uppercase; color: var(--ember-hi); }
#devbadge { position: absolute; left: calc(var(--panel-w) + var(--gap) * 2 + 4px); bottom: 14px; z-index: 4; padding: 4px 10px; font: 400 16px var(--font-px); color: var(--ember-hi); background: rgba(0, 0, 0, .65); }

#title {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 46%, rgba(4, 9, 10, 0) 0, rgba(4, 9, 10, .25) 42%, rgba(3, 7, 9, .86) 100%);
  transition: opacity 1.1s ease;
  text-align: center; padding: 20px;
}
#title.leave { opacity: 0; pointer-events: none; }
#title .t-logo { width: min(640px, 86vw); height: auto; margin-top: -40vh; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .5)) drop-shadow(0 0 46px rgba(255, 143, 60, .45)); animation: logoIn 1.4s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes logoIn { from { opacity: 0; transform: translateY(14px); } }
#title .t-tag { margin-top: 10px; font: 400 23px/1.1 var(--font-px); letter-spacing: .2em; text-transform: uppercase; color: var(--ember-hi); text-shadow: 0 2px 0 #05090a; animation: logoIn 1.4s .25s cubic-bezier(.2, .9, .3, 1) both; }
#title .t-foot { position: absolute; left: 0; right: 0; bottom: 8vh; display: flex; flex-direction: column; align-items: center; gap: 16px; animation: logoIn 1.2s .7s cubic-bezier(.2, .9, .3, 1) both; }
#title .t-lede { max-width: 520px; font-size: 15.5px; line-height: 1.55; color: #e9e2cc; text-shadow: 0 2px 6px rgba(0, 0, 0, .9); padding: 0 16px; }
#title .t-lede b { color: var(--ember-hi); }
#title .t-begin { min-height: 54px; padding: 0 44px 3px; font-size: 30px; letter-spacing: .08em; animation: beginPulse 2.2s ease-in-out infinite; }
@keyframes beginPulse { 50% { filter: brightness(1.15); box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), inset 0 2px 0 var(--ember-hi), inset 0 -2px 0 var(--ember-lo), 0 0 34px rgba(255, 143, 60, .6); } }
#title .t-hint { font-size: 12.5px; color: var(--text-2); text-shadow: 0 1px 4px #000; }
body.titled #topbar, body.titled #panel, body.titled #mapframe, body.titled #toasts, body.titled #views, body.titled #modebar, body.titled .goal { opacity: 0; pointer-events: none; }
#topbar, #panel, #mapframe, #toasts, #views, .goal { transition: opacity .9s ease; }

/* how-to cards on the first morning */
.howto { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 2px 6px; }
.howto > div { --bd: var(--line); padding: 12px 10px; background: var(--ink-800); text-align: center; box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd); }
.howto img { width: 48px; height: 48px; }
.howto h5 { margin: 6px 0 4px; font: 400 20px/1 var(--font-px); letter-spacing: .06em; color: var(--ember-hi); }
.howto p { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
details.keys { margin: 10px 2px 0; }
details.keys summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--text-2); list-style: none; text-align: center; }
details.keys summary::after { content: ' ▾'; }
details.keys[open] summary::after { content: ' ▴'; }
details.keys summary:hover { color: var(--ember-hi); }

/* photo mode: nothing but the forest */
body.photo .goal, body.photo #topbar, body.photo #panel, body.photo #mapframe, body.photo #toasts, body.photo #views, body.photo #modebar, body.photo #spotlight, body.photo #tooltip, body.photo #devbadge, body.photo .goal-m { display: none !important; }
#photo-bar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 7; display: none; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); --bd: var(--ink-950); box-shadow: 0 -2px 0 0 var(--bd), 0 2px 0 0 var(--bd), -2px 0 0 0 var(--bd), 2px 0 0 0 var(--bd), var(--shadow); transition: opacity .5s; }
body.photo #photo-bar { display: flex; }
body.photo.idle #photo-bar { opacity: 0; }
body.photo.idle { cursor: none !important; }
#photo-bar span { font-size: 12.5px; color: var(--text-2); }

/* ------------------------------------------------------------------ faith & the pilgrimage */
.steward-tag { font: 700 11px var(--font); text-transform: none; letter-spacing: 0; padding: 2px 7px; border: 0; background: var(--ink-600); color: var(--text-2); cursor: pointer; }
.steward-tag.on { background: var(--moss-lo); color: #e6ffd6; }
.tree-bar { --bd: var(--ember-lo); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 14px; margin: 12px 2px 0; background: radial-gradient(ellipse at 0% 50%, #3a2010, #1a120c 70%); color: var(--cream); flex: none; }
.tree-bar .pb-stat { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.tree-bar .pb-stat span { font: 400 15px/1 var(--font-px); color: var(--text-2); text-transform: uppercase; letter-spacing: .1em; }
.tree-bar .pb-stat b { font: 400 28px/1 var(--font-px); color: var(--cream); font-variant-numeric: tabular-nums; }
.tree-bar .pb-stat b.ember-n { color: var(--ember-hi); }
.tree-bar .pb-go { margin-left: auto; }
.tree-bar .pb-why { flex-basis: 100%; color: var(--text-2); }
.pilgrim-gain { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 12px 0; }
.pilgrim-gain img { width: 64px; height: 64px; filter: drop-shadow(0 0 16px rgba(255, 143, 60, .6)); }
.pilgrim-gain b { display: block; font: 400 38px/1 var(--font-px); color: var(--ember-hi); }
.pilgrim-gain span { font-weight: 600; color: var(--text-2); }
.pilgrim-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 2px; }
.pilgrim-cols > div { padding: 10px 12px; background: var(--ink-800); box-shadow: 0 -2px 0 0 var(--line), 0 2px 0 0 var(--line), -2px 0 0 0 var(--line), 2px 0 0 0 var(--line); }
.pilgrim-cols h4 { margin: 0 0 4px; }
.pilgrim-cols p { margin: 0; font-size: 13.5px; color: var(--text-2); }

/* ------------------------------------------------------------------ narrower screens */
@media (max-width: 1400px) {
  .brand { width: auto; }
  .brand .title { display: none; }
}
@media (max-width: 1280px) {
  .res { min-width: 0; padding: 0 9px 0 5px; gap: 5px; }
  .res .ico { width: 26px; height: 26px; }
  .res .val { font-size: 21px; }
  .goal { width: 240px; }
  /* the Forest / Mine tabs move next to the panel so they clear the goal card */
  #views { left: calc(var(--panel-w) + var(--gap) * 2 + 4px); transform: none; }
}
@media (max-width: 1100px) {
  :root { --panel-w: 316px; }
  .forge-side, .tw-side { width: 270px; }
  .brand { display: none; }
}
@media (max-width: 820px) {
  :root { --top-h: 48px; --panel-w: 0px; --gap: 8px; }
  #app { display: grid; grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr auto; grid-template-areas: "top" "stage" "panel"; }
  #topbar { position: relative; grid-area: top; left: 0; right: 0; top: 0; height: auto; padding: 0 8px; gap: 8px; background: var(--ink-900); border-bottom: 2px solid var(--ink-950); pointer-events: auto; }
  #stage { position: relative; grid-area: stage; inset: auto; }
  #panel { position: relative; grid-area: panel; left: 0; top: 0; bottom: 0; width: auto; max-height: 46vh; padding: 8px 8px 0; box-shadow: 0 -2px 0 0 var(--ink-950); background: var(--ink-900); }
  #panel.collapsed #panel-body, #panel.collapsed #features { display: none; }
  #panel.collapsed { padding-bottom: 8px; }
  #features .feat { height: 48px; font-size: 15px; }
  #features .feat img { width: 24px; height: 24px; }
  .brand, .goal, .skydial { display: none; }
  .goal-m { --bd: var(--ink-950); display: flex; position: absolute; left: 10px; right: 10px; top: 10px; z-index: 4; height: 38px; align-items: center; gap: 8px; padding: 0 10px 0 5px; color: var(--text); background: var(--surface); }
  .goal-m .goal-ch { min-width: 26px; height: 26px; font-size: 19px; }
  #toasts { left: 10px; top: 58px; max-width: calc(100% - 20px); }
  #views:not(.hidden) ~ #toasts { top: 100px; }
  /* the title takes the whole screen: the stage comes out from between the bars */
  body.titled #stage { position: fixed; inset: 0; z-index: 1; }
  body.titled .goal-m { display: none; }
  #mapframe { display: none; }
  #vignette { background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(3, 10, 14, .45) 100%); }
  .res { min-width: 0; height: 36px; padding: 0 8px 0 4px; background: var(--ink-800); }
  .resources { flex: 1 1 auto; -webkit-overflow-scrolling: touch; padding: 6px 2px; margin: 0; }
  .res .val { font-size: 21px; line-height: 1; }
  .res .rate { display: none; }
  .res .ico { width: 24px; height: 24px; }
  .icon-btn { width: 36px; height: 36px; background: var(--ink-800); }
  .icon-btn img { width: 24px; height: 24px; }
  .modal-box { padding: 14px 12px; }
  .modal-box.wide { height: calc(100vh - 20px); width: calc(100vw - 20px); }
  .forge-wrap, .shrine-wrap, .cards-wrap, .tw-wrap { flex-direction: column; overflow-y: auto; }
  .forge-tree, .tw-tree { min-height: 320px; flex: none; height: 52vh; }
  .tw-treebox { flex: none; height: 52vh; min-height: 320px; }
  .tw-treebox .tw-tree { height: auto; min-height: 0; flex: 1; }
  .forge-side, .shrine-list, .card-side, .tw-side { width: auto; }
  #modebar { left: 50%; max-width: calc(100% - 24px); }
  #modebar .keys { display: none; }
  #modebar .touch { display: inline; }
  #spotlight { left: 50%; min-width: 0; width: calc(100% - 32px); }
  .win-head .wh-title { font-size: 30px; }
  .win-head img.wh-icon { width: 36px; height: 36px; }
  #views { left: 50%; top: 56px; transform: translateX(-50%); }
  body.in-scene #toasts { top: 100px; }
  .vtab { height: 32px; padding: 0 12px 1px 8px; font-size: 19px; }
  .vtab img { width: 20px; height: 20px; }
  #scene .sc-cv { left: 0; width: 100%; }
  .pond-tabs { bottom: 8px; left: 8px; right: 8px; }
  .pond-tab { flex: none; padding: 3px 7px; }
  .pond-tab .pt-sub { display: none; }
  .sc-status { bottom: 8px; left: 8px; width: calc(100% - 16px); padding: 6px 9px; }
  .sc-btns { top: 100px; bottom: auto; right: 8px; }
  .sc-card { top: 100px; right: 8px; width: calc(100% - 16px); max-height: 50%; }
  .sc-msg { left: 50%; top: 55%; }
  .gc-face { width: 70px; height: 94px; }
  .tree-bar .pb-stat b { font-size: 22px; }
  .tree-bar .pb-go { margin-left: 0; }
  .pilgrim-cols { grid-template-columns: 1fr; }
  .howto { grid-template-columns: 1fr; gap: 8px; }
  .howto > div { display: grid; grid-template-columns: 40px 1fr; gap: 0 10px; text-align: left; padding: 8px 10px; }
  .howto img { width: 40px; height: 40px; grid-row: span 2; }
  .howto h5 { margin: 0 0 2px; }
  #title .t-logo { margin-top: -44vh; }
  #title .t-tag { font-size: 17px; }
  #title .t-lede { font-size: 14px; }
  #devbadge { left: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------------ V7: the trees as maps */
.tw-tree { --sec: #ffc466; }
/* the map sits in a box with its zoom and centre buttons floating over it */
.tw-treebox { flex: 1; min-width: 0; position: relative; display: flex; }
.tw-treebox .tw-tree { flex: 1; touch-action: none; overscroll-behavior: contain; }
.tw-zoom { position: relative; }
.tw-canvas { margin: 0; transform-origin: 0 0; }
.tw-ctrl { position: absolute; left: 12px; top: 12px; z-index: 5; display: flex; flex-direction: column; gap: 6px; }
.tw-ctrl .btn { min-width: 34px; height: 32px; justify-content: center; padding: 0; font-size: 18px; line-height: 1; }
.tnode { box-shadow: 0 -3px 0 0 var(--bd), 0 3px 0 0 var(--bd), -3px 0 0 0 var(--bd), 3px 0 0 0 var(--bd), inset 0 -4px 0 0 color-mix(in srgb, var(--sec) 45%, transparent); }
.tnode.key {
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--sec) 26%, var(--ink-750)), var(--ink-900) 72%);
  box-shadow: 0 0 0 3px var(--bd), 0 0 0 6px var(--ink-950), 0 0 0 8px color-mix(in srgb, var(--sec) 55%, transparent);
}
.tnode.key img { width: 48px; height: 48px; }
.tnode.key .tn-lv { top: auto; bottom: -4px; left: auto; right: -6px; transform: none; min-width: 0; padding: 1px 4px; color: var(--moss); background: var(--ink-950); }
.tnode.key .tn-name {
  position: absolute; left: 50%; top: 76px; transform: translateX(-50%);
  font: 700 12px/1.1 var(--font); color: var(--cream); white-space: nowrap; text-shadow: 0 1px 0 #000, 0 0 6px #000;
  pointer-events: none;
}
.tnode.key.locked { background: var(--ink-900); }
.tnode.key.locked .tn-name { color: var(--text-3); }
.tnode.key.max { background: radial-gradient(circle at 50% 38%, #2a5a30, #12261a 72%); }
.tnode.key.ready { animation: keyReady 1.6s ease-in-out infinite; }
@keyframes keyReady { 50% { box-shadow: 0 0 0 3px var(--bd), 0 0 0 6px var(--ink-950), 0 0 0 8px var(--gold), 0 0 28px 10px rgba(244, 203, 98, .5); } }
.tnode.key.sel { outline-offset: 10px; border-radius: 50%; }
.tw-sec {
  position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px;
  font: 400 24px/1 var(--font-px); letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
  color: color-mix(in srgb, var(--sec) 70%, transparent); pointer-events: none;
  text-shadow: 0 0 14px rgba(0, 0, 0, .9);
}
.tw-sec img { width: 32px; height: 32px; opacity: .7; }
.tw-fog {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 46%; pointer-events: none; text-align: center;
  background: radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--sec) 16%, rgba(8, 14, 12, .96)) 0%, rgba(8, 14, 12, .85) 50%, transparent 72%);
  filter: drop-shadow(0 0 18px rgba(0, 0, 0, .6));
}
.tw-fog .tf-q { font: 400 64px/1 var(--font-px); color: color-mix(in srgb, var(--sec) 60%, transparent); animation: fogPulse 3.2s ease-in-out infinite; }
.tw-fog .tf-name { font: 400 22px/1 var(--font-px); letter-spacing: .16em; text-transform: uppercase; color: color-mix(in srgb, var(--sec) 75%, transparent); }
.tw-fog .tf-hint { max-width: 220px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
@keyframes fogPulse { 50% { opacity: .45; transform: scale(.94); } }
.tw-side .fs-icon.key { border-radius: 50%; }

/* rations in the Village tab */
.ration-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; padding: 2px; margin: 2px 0 6px; }
.ration-row .btn.ration { flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 9px; line-height: 1.05; }
.ration-row .btn.ration span { font-size: 11px; font-weight: 700; color: var(--text-2); }
.ration-row .btn.ration.on span { color: inherit; opacity: .8; }
.ration-row .btn.ration.eff { outline: 2px dashed var(--berry); outline-offset: 2px; }
.ration-note { margin: 0 2px 6px; }
.ration-note.warn { color: var(--berry); font-weight: 700; }
.tw-fog.small .tf-q { font-size: 40px; }

/* ------------------------------------------------------------------ V7: cards */
.card-row { gap: 14px; padding: 6px 4px 10px; perspective: 900px; }
.gcard { perspective: 700px; }
.gcard.sel .ccard { outline: 3px solid var(--ember-hi); outline-offset: 5px; }
.gcard.ready .ccard { animation: cardReady 1.4s ease-in-out infinite; }
.ccard {
  --rim: #6a5a46; --rim-hi: #a8927a; --rim-lo: #3a3026; --art: #1d2a22; --art-hi: #2e4636; --glow: transparent;
  --rx: 0deg; --ry: 0deg; --mx: 50%;
  position: relative; width: 92px; height: 128px;
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d;
  transition: transform .18s ease-out, box-shadow .3s;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .55), 0 0 18px var(--glow);
  border-radius: 7px;
}
.ccard.big { width: 168px; height: 236px; border-radius: 11px; }
.cs-card { display: grid; place-items: center; padding: 10px 0 4px; perspective: 900px; }
.cs-card .ccard { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.cc-frame {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  display: grid; grid-template-rows: 1fr auto auto auto; justify-items: center;
  padding: 7px 7px 6px;
  background: linear-gradient(160deg, var(--rim-hi), var(--rim) 30%, var(--rim-lo) 100%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55), inset 0 0 0 4px var(--rim-hi);
}
.ccard.big .cc-frame { padding: 11px 11px 9px; }
.cc-art {
  position: relative; width: 100%; border-radius: 4px; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, var(--art-hi), var(--art) 70%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 0 18px rgba(0, 0, 0, .7);
}
.cc-art img { position: relative; width: 48px; height: 48px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .45)); z-index: 1; }
.ccard.big .cc-art img { width: 96px; height: 96px; }
.cc-rays {
  position: absolute; left: 50%; top: 45%; width: 220%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 240, 200, .16) 0 7deg, transparent 7deg 20deg);
  animation: rays 24s linear infinite;
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 60%); mask: radial-gradient(circle, #000 18%, transparent 60%);
}
@keyframes rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.cc-name { margin-top: 4px; font-family: var(--font-title); font-weight: 700; font-size: 15px; line-height: 1; color: #fff6dc; text-shadow: 0 2px 0 rgba(0, 0, 0, .6); white-space: nowrap; }
.ccard.big .cc-name { font-size: 26px; margin-top: 6px; }
.cc-stat { margin-top: 2px; font-size: 9.5px; font-weight: 800; line-height: 1.1; text-align: center; color: rgba(255, 246, 220, .86); text-shadow: 0 1px 0 rgba(0, 0, 0, .6); }
.ccard.big .cc-stat { font-size: 13px; margin-top: 4px; }
.cc-tier {
  position: absolute; top: 3px; right: 3px; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px;
  display: grid; place-items: center; font: 400 17px/1 var(--font-px); color: #fff6dc;
  background: radial-gradient(circle at 35% 30%, var(--rim-hi), var(--rim-lo)); box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 2px 4px rgba(0, 0, 0, .5);
  z-index: 2;
}
.ccard.big .cc-tier { min-width: 34px; height: 34px; border-radius: 17px; font-size: 26px; top: 5px; right: 5px; }
.cc-shards { display: flex; gap: 3px; margin-top: 4px; }
.cc-shards i { width: 9px; height: 5px; border-radius: 2px; background: rgba(0, 0, 0, .55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.cc-shards i.on { background: var(--ember-hi); box-shadow: 0 0 5px var(--ember); }
.ccard.big .cc-shards i { width: 16px; height: 7px; }
.cc-foil {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; mix-blend-mode: overlay;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .5) 45%, transparent 60%) no-repeat;
  background-size: 250% 100%; background-position: var(--mx) 0; opacity: .5;
  animation: foil 5s ease-in-out infinite;
}
@keyframes foil { 0%, 100% { background-position: 120% 0; } 50% { background-position: -20% 0; } }
/* rarities */
.ccard.r-bronze { --rim: #9a5e2e; --rim-hi: #e0a060; --rim-lo: #4e2a12; --glow: rgba(224, 140, 70, .25); }
.ccard.r-silver { --rim: #8a96a4; --rim-hi: #eef4fa; --rim-lo: #3e4650; --glow: rgba(200, 220, 240, .35); }
.ccard.r-gold { --rim: #c8901c; --rim-hi: #fff2a8; --rim-lo: #6a4206; --glow: rgba(255, 200, 80, .6); }
.ccard.r-gold .cc-foil { opacity: .85; }
.ccard.r-prism { --rim: #8a5ac8; --rim-hi: #f0d8ff; --rim-lo: #2a1a4a; --glow: rgba(200, 140, 255, .7); }
.ccard.r-prism .cc-frame::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; opacity: .45; mix-blend-mode: color-dodge;
  background: conic-gradient(from 0deg, #ff6a8a, #ffd36a, #7aff9a, #6ad8ff, #c08aff, #ff6a8a); animation: prism 6s linear infinite;
}
@keyframes prism { to { filter: hue-rotate(360deg); } }
/* what the material is: the art behind it */
.ccard.g-village { --art: #183420; --art-hi: #3e7a3a; }
.ccard.g-made { --art: #2e2014; --art-hi: #7a5a34; }
.ccard.g-ore { --art: #1c2230; --art-hi: #4e5e7a; }
.ccard.g-gem { --art: #24163a; --art-hi: #6a4aa8; }
/* the back of a card */
.ccard.back { --rim: #2e4a3e; --rim-hi: #5a8a70; --rim-lo: #10201a; box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }
.ccard.back .cc-frame { grid-template-rows: 1fr auto; }
.cc-backart {
  width: 100%; height: 100%; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 196, 102, .14), transparent 45%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .035) 0 4px, transparent 4px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .035) 0 4px, transparent 4px 9px),
    #0e1c17;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 0 0 5px rgba(90, 138, 112, .25);
}
.cc-backart img { width: 40px; height: 40px; opacity: .6; filter: grayscale(1) sepia(1) saturate(3) hue-rotate(5deg) brightness(1.05); }
.ccard.big .cc-backart img { width: 80px; height: 80px; }
.cc-backart span { font: 400 14px/1 var(--font-px); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.ccard.big .cc-backart span { font-size: 20px; }
.gcard:hover .ccard { box-shadow: 0 10px 20px rgba(0, 0, 0, .6), 0 0 26px var(--glow); }

/* the reveal: a card turning over in the dark */
#reveal { position: fixed; inset: 0; z-index: 400; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(circle at 50% 45%, rgba(30, 24, 12, .82), rgba(2, 4, 4, .96) 60%); }
#reveal.show, #reveal.gone { display: flex; }
#reveal.show { animation: rvIn .5s ease-out both; }
#reveal.gone { animation: rvOut .38s ease-in both; }
@keyframes rvIn { from { opacity: 0; } }
@keyframes rvOut { to { opacity: 0; } }
#reveal { --glow: rgba(224, 140, 70, .55); }
#reveal.r-silver { --glow: rgba(210, 230, 255, .6); }
#reveal.r-gold { --glow: rgba(255, 205, 90, .8); }
#reveal.r-prism { --glow: rgba(200, 140, 255, .85); }
.rv-rays {
  position: absolute; left: 50%; top: 45%; width: 1400px; height: 1400px; transform: translate(-50%, -50%) scale(.4); opacity: 0;
  background: repeating-conic-gradient(from 0deg, var(--glow) 0 4deg, transparent 4deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 5%, transparent 55%); mask: radial-gradient(circle, #000 5%, transparent 55%);
  transition: opacity 1s .9s, transform 1.6s .9s cubic-bezier(.2, .8, .2, 1);
  animation: rays 40s linear infinite;
}
#reveal.flip .rv-rays { opacity: .55; transform: translate(-50%, -50%) scale(1); }
.rv-glow { position: absolute; left: 50%; top: 45%; width: 420px; height: 420px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, var(--glow), transparent 65%); opacity: 0; transition: opacity .8s .95s; }
#reveal.flip .rv-glow { opacity: .9; }
.rv-kicker { position: relative; font: 400 22px/1 var(--font-px); letter-spacing: .3em; text-transform: uppercase; color: var(--ember-hi); opacity: 0; animation: rvUp .6s .2s ease-out forwards; }
.rv-flip { position: relative; width: 168px; height: 236px; perspective: 1000px; margin: 14px 0 8px; animation: rvDrop .8s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes rvDrop { from { transform: translateY(-60px) scale(.6) rotate(-8deg); opacity: 0; } }
.rv-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.3, 1.5, .5, 1); }
#reveal.flip .rv-inner { transform: rotateY(180deg); }
.rv-back, .rv-front { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rv-front { transform: rotateY(180deg); }
.rv-back .ccard { animation: rvShake .9s ease-in-out; }
@keyframes rvShake { 30%, 70% { transform: rotate(-3deg) scale(1.03); } 50%, 90% { transform: rotate(3deg) scale(1.05); } }
.rv-sparks { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.rv-sparks i { position: absolute; width: 6px; height: 6px; margin: -3px; background: #fff3c0; box-shadow: 0 0 10px var(--glow), 0 0 4px #fff; opacity: 0; transform: rotate(var(--a)) translateY(0) scale(var(--s)); }
#reveal.flip .rv-sparks i { animation: spark 1.1s .15s cubic-bezier(.1, .8, .3, 1) both; }
@keyframes spark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(var(--s)); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(0); } }
.rv-title, .rv-stat, .rv-sub, #reveal .rv-ok { position: relative; opacity: 0; }
#reveal.flip .rv-title { animation: rvUp .5s .55s ease-out forwards; }
#reveal.flip .rv-stat { animation: rvUp .5s .75s ease-out forwards; }
#reveal.flip .rv-sub { animation: rvUp .5s .9s ease-out forwards; }
#reveal.flip .rv-ok { animation: rvUp .5s 1.1s ease-out forwards; }
@keyframes rvUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.rv-title { font-family: var(--font-title); font-weight: 700; font-size: 44px; line-height: 1; color: var(--cream); text-shadow: 0 3px 0 rgba(0, 0, 0, .6), 0 0 24px var(--glow); }
.rv-stat { font: 400 28px/1 var(--font-px); color: var(--moss); text-shadow: 0 2px 0 rgba(0, 0, 0, .6); }
.rv-stat span { color: var(--text-3); font-size: 20px; }
.rv-sub { font-size: 14px; font-weight: 600; color: var(--text-2); }
#reveal .rv-ok { margin-top: 12px; min-width: 180px; justify-content: center; }
.toast.shard { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(244, 203, 98, .45); }
@media (max-width: 820px) { .ccard { width: 76px; height: 106px; } .cc-art img { width: 36px; height: 36px; } .cc-stat { font-size: 8.5px; } .rv-title { font-size: 34px; } }

/* ------------------------------------------------------------------ V7: the top bar holds every resource */
.resources.two { display: grid; grid-auto-flow: column; grid-template-rows: 21px 21px; gap: 4px 6px; padding: 0 2px; margin: 0; align-content: center; }
.resources.two .res { height: 21px; min-width: 98px; padding: 0 7px 0 3px; gap: 5px; box-shadow: 0 -1px 0 0 var(--bd), 0 1px 0 0 var(--bd), -1px 0 0 0 var(--bd), 1px 0 0 0 var(--bd); }
.resources.two .res .ico { width: 18px; height: 18px; }
.resources.two .res-text { flex-direction: row; align-items: baseline; gap: 6px; }
.resources.two .res .val { font-size: 18px; line-height: 1; }
.resources.two .res .rate { font-size: 10.5px; margin-top: 0; }
.res.more-chip { cursor: pointer; }
.res.more-chip:hover { background: var(--ink-750); }
.store-item { position: relative; }
.si-pin { position: absolute; top: 2px; right: 3px; padding: 0 3px; border: 0; background: none; color: var(--text-3); font-size: 15px; line-height: 1; cursor: pointer; }
.si-pin.on { color: var(--gold); }
.si-pin:hover { color: var(--ember-hi); }
.store-item:has(.si-pin) .si-name { padding-right: 14px; }
/* the flip must not depend on backface-visibility alone (nested 3D breaks it on some browsers) */
.rv-flip .ccard { transform-style: flat; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rv-front .ccard { transform: none; }
#reveal.flip .rv-back { opacity: 0; transition: opacity 0s linear .32s; }
.rv-front { opacity: 0; }
#reveal.flip .rv-front { opacity: 1; transition: opacity 0s linear .32s; }

/* ------------------------------------------------------------------ V7: the trees as lists */
.tw-views { display: inline-flex; gap: 4px; margin-right: 8px; }
.tw-views .btn { min-width: 56px; justify-content: center; }
.tw-list {
  flex: 1; min-width: 0; overflow-y: auto; padding: 6px 10px 10px;
  display: flex; flex-direction: column; gap: 0;
  background: var(--ink-950);
  scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent;
}
.tl-sum { font-size: 12.5px; color: var(--text-2); padding: 2px 2px 2px; }
.tl-sum b { color: var(--gold); font-weight: 800; }
.tw-list .ph.tl-sec { margin: 8px 0 2px; font-size: 14px; color: color-mix(in srgb, var(--sec) 80%, white); }
/* one line per node: icon · name · next effect · price · buy */
.tl-row {
  display: grid; grid-template-columns: 20px minmax(110px, 170px) minmax(0, 1fr) auto 62px; align-items: center; gap: 8px;
  min-height: 30px; padding: 2px 4px 2px 6px; cursor: pointer;
  border-bottom: 1px solid var(--ink-800);
  box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--sec) 45%, transparent);
}
.tl-row:hover { background: var(--ink-850); }
.tl-row.ready { background: #1e190b; box-shadow: inset 3px 0 0 0 var(--gold); }
.tl-row.ready:hover { background: #28200e; }
.tl-ic { width: 20px; height: 20px; }
.tl-name { min-width: 0; font-weight: 800; font-size: 13px; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lv { font: 400 14px/1 var(--font-px); color: var(--text-3); margin-left: 6px; }
.tl-row.key .tl-lv { color: var(--gold); }
.tl-eff { min-width: 0; font-size: 12px; font-weight: 600; color: var(--moss); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-costs { display: flex; gap: 4px; justify-content: flex-end; }
.tl-cost { display: inline-flex; align-items: center; gap: 3px; padding: 0 5px 0 2px; height: 20px; background: var(--ink-900); font-size: 11px; white-space: nowrap; }
.tl-cost img { width: 16px; height: 16px; }
.tl-cost b { font: 400 15px/1 var(--font-px); font-variant-numeric: tabular-nums; }
.tl-cost.ok b { color: var(--moss); }
.tl-cost.no b { color: var(--berry); }
.tl-buy { height: 24px; min-height: 0; padding: 0 6px; justify-content: center; font-size: 13px; }
/* each price fills up as that resource comes in */
.tl-cost { position: relative; overflow: hidden; }
.tl-cost::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: var(--berry); }
.tl-cost.ok::after { background: var(--moss); }
@media (max-width: 820px) {
  .tw-list { flex: none; height: 52vh; min-height: 320px; }
  .tw-views .btn { min-width: 44px; }
  .tl-row { grid-template-columns: 20px minmax(0, 1fr) auto 56px; }
  .tl-eff { display: none; }
}
