/* Forever Goldcraft (once GoldScout): a merchant's ledger for the WoW Forever auction house.
   Dark and warm, like a ledger read by candlelight: every visitor gets this, whatever their system
   is set to. The light look is parchment, for those who pick it (theme.js applies a saved choice). */

:root {
  color-scheme: dark;
  --page: #0d0b08;
  --side: #0a0806;
  --surface: #15120d;
  --raised: #1c1812;
  --sunken: #0a0806;
  --hair: #2b2419;
  --hair-strong: #3a3123;
  --brass: #4a3e2b;
  --corner: #6b5530;
  --ink: #f2eadb;
  --ink-2: #c9bba0;
  --ink-3: #8f8371;
  --accent: #e3b450;
  --accent-deep: #b8872a;
  --accent-ink: #1a1309;
  --accent-wash: rgba(227, 180, 80, 0.1);
  --accent-glow: rgba(227, 180, 80, 0.32);
  --seal: #7e261f;
  --seal-ring: #a8443a;
  --seal-ink: #f3d9cf;
  /* chart series: validated as a set for the dark surface (dataviz validate_palette.js) */
  --series-1: #bd8115;
  --series-2: #3987e5;
  --series-3: #199e70;
  --series-4: #9085e9;
  --grid: #2a251c;
  --axis: #3d3629;
  --up: #8fd39a;
  --down: #f09a8e;
  --good: #5bb866;
  --critical: #d03b3b;
  --coin-g: #e3b450;
  --coin-s: #c9ced6;
  --coin-c: #d58a4e;
  --q0: #9d9d9d;
  --q1: #f2eadb;
  --q2: #1eff00;
  --q3: #3d97f2;
  --q4: #b25cf5;
  --q5: #ff8000;
  --sk-orange: #f28b3b;
  --sk-yellow: #e8cc4d;
  --sk-green: #5bb866;
  --paper: #e9dcc0;
  --paper-ink: #2a2216;
  --paper-ink-2: #5a4a30;
  --paper-ink-3: #6b5a40;
  --paper-line: #cdbb98;
  --paper-line-strong: #b9a47e;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --lift: 0 10px 30px rgba(0, 0, 0, 0.35);
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --brand: "Geist", "Segoe UI", system-ui, sans-serif;
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --side-w: 264px;
  --top-h: 60px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #eee5d1;
  --side: #e5d9bf;
  --surface: #f7f0e1;
  --raised: #fffbf2;
  --sunken: #e8ddc6;
  --hair: #dccdb0;
  --hair-strong: #c9b892;
  --brass: #b9a47e;
  --corner: #a88a52;
  --ink: #2a2216;
  --ink-2: #5c4d35;
  --ink-3: #6e604a;
  --accent: #8c6210;
  --accent-deep: #6e4c08;
  --accent-ink: #fffaf0;
  --accent-wash: rgba(140, 98, 16, 0.1);
  --accent-glow: rgba(176, 124, 20, 0.28);
  --seal: #8e2b23;
  --seal-ring: #b5473c;
  --seal-ink: #f8e3db;
  --series-1: #a8700a;
  --series-2: #2a78d6;
  --series-3: #16a06f;
  --series-4: #6250d6;
  --grid: #e3d8c2;
  --axis: #c9b892;
  --up: #1d7d2c;
  --down: #b23a3a;
  --good: #2f8a3d;
  --coin-g: #8c6210;
  --coin-s: #5e6470;
  --coin-c: #8a4e22;
  --q0: #6e6e6e;
  --q1: #2a2216;
  --q2: #1a7a00;
  --q3: #0062c4;
  --q4: #8a2bd0;
  --q5: #b55800;
  --sk-orange: #d9661a;
  --sk-yellow: #c49c10;
  --sk-green: #3f9e4d;
  --paper: #fffdf6;
  --paper-line: #e2d5ba;
  --paper-line-strong: #cdbb98;
  --shadow: 0 24px 60px rgba(60, 40, 10, 0.2);
  --lift: 0 10px 30px rgba(60, 40, 10, 0.14);
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }
/* Hidden means hidden, whatever display a class gives the element. */
[hidden] { display: none !important; }

html { background: var(--page); scroll-padding-top: calc(var(--top-h) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  font: 400 15px/1.5 var(--sans);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Grain over everything, like worn leather or old paper under candlelight. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("grain.png") repeat;
  background-size: 256px 256px;
  opacity: 0.9;
}
:root[data-theme="light"] body::before { opacity: 0.5; filter: invert(1) sepia(0.4); }

a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--accent-glow); color: var(--ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: fixed;
  left: 16px; top: -48px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}
.skip:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

kbd {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--hair-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--ink-2);
  font: 500 11px/1.6 var(--sans);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ the app shell */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--hair-strong) transparent;
  background: var(--side) url("grain.png");
  background-size: 256px 256px;
  border-right: 1px solid var(--hair);
  box-shadow: inset -3px 0 0 var(--page), inset -4px 0 0 var(--hair-strong);
}

.side-top { display: flex; align-items: center; gap: 8px; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-right: auto;
  padding: 2px 4px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}
/* The mark: logo B, a gold anvil. Its two gleams glint in when the page opens and turn when you
   point at it. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.brand-mark { width: 42px; height: 42px; margin: -2px 0; flex: none; overflow: visible; filter: drop-shadow(0 3px 10px var(--accent-glow)); }
.brand-mark .anvil { fill: url(#anvilGold); }
.brand-mark .anvil-shine { fill: none; stroke: #fff3cf; stroke-width: 1; stroke-opacity: 0.7; stroke-linecap: round; }
.brand-mark .anvil-shade { fill: none; stroke: #8f6115; stroke-width: 1; stroke-opacity: 0.5; }
.brand-mark .gleam {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.7s var(--spring);
  animation: glint 0.9s var(--spring) 0.25s backwards;
}
.brand-mark .gleam-big { fill: #fff1c7; }
.brand-mark .gleam-small { fill: #f8dc95; animation-delay: 0.45s; }
:is(.brand, .top-brand):is(:hover, :focus-visible) .gleam-big { transform: rotate(90deg) scale(1.3); }
:is(.brand, .top-brand):is(:hover, :focus-visible) .gleam-small { transform: rotate(-90deg) scale(1.45); }
@keyframes glint { from { opacity: 0; transform: rotate(-90deg) scale(0); } }
:root[data-theme="light"] .brand-mark .anvil { stroke: #a4721c; stroke-width: 0.9; stroke-opacity: 0.55; }
:root[data-theme="light"] .brand-mark .gleam-big { fill: #b8872a; }
:root[data-theme="light"] .brand-mark .gleam-small { fill: #c9952e; }
/* The wordmark: Geist, "Forever" medium, then "Goldcraft" bold with "Gold" in gold. */
.wordmark { font: 700 19.5px/1 var(--brand); letter-spacing: -0.025em; white-space: nowrap; }
.wm-forever { font-weight: 500; }
.wm-gold { color: var(--accent); }
/* On a phone the sidebar is a drawer, so the top bar carries the mark. */
.top-brand { display: none; }
@media (max-width: 1040px) {
  .top-brand { display: grid; place-items: center; flex: none; width: 36px; height: 36px; margin-left: -6px; border-radius: 10px; }
  .top-brand .brand-mark { width: 30px; height: 30px; }
  .wordmark { font-size: clamp(16px, 5.4vw, 19.5px); }
}
.side-top .side-close { display: none; }

.house-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.seal { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35)); }
.seal path { fill: var(--seal); }
.seal circle { fill: none; stroke: var(--seal-ring); stroke-width: 1; }
.seal text { fill: var(--seal-ink); font: 600 12px var(--display); }
.house-text { display: grid; min-width: 0; line-height: 1.3; }
.house-text b, .house-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.house-text b { font-weight: 600; }
.house-text span { color: var(--ink-3); font-size: 12px; }

.jump {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--hair);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--ink-3);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.jump svg { width: 16px; height: 16px; flex: none; }
.jump span { flex: 1; min-width: 0; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.jump kbd { flex: none; }
.jump:hover { border-color: var(--hair-strong); color: var(--ink-2); background: var(--surface); }

.side-nav { position: relative; display: grid; gap: 2px; }
.side-nav ul { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.nav-group { margin: 12px 10px 4px; color: var(--ink-3); font: italic 400 13.5px var(--display); }
.side-nav a, .soon-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.side-nav svg {
  width: 17px; height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s var(--spring);
}
.side-nav a > span:first-of-type, .soon-item > span:first-of-type { flex: 1; min-width: 0; }
.side-nav a:hover { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--ink); }
.side-nav a:hover svg { transform: translateX(1px) scale(1.06); }
.side-nav a[aria-current="page"] { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair-strong); }
.side-nav a[aria-current="page"] svg { color: var(--accent); }
.soon-item { color: var(--ink-3); cursor: default; }
.soon-item svg { opacity: 0.7; }
.soon {
  padding: 0 7px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 10.5px;
  line-height: 17px;
  letter-spacing: 0.02em;
}
.count { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.count:empty { display: none; }

/* The bookmark ribbon slides to whichever page is open. */
.ribbon {
  position: absolute;
  left: -14px;
  top: 0;
  width: 10px;
  height: 30px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  opacity: 0;
  transform: translateY(0);
  transition: transform 0.45s var(--spring), height 0.3s var(--ease), opacity 0.2s;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.ribbon.on { opacity: 1; }

.side-foot { display: grid; gap: 10px; margin-top: auto; padding: 12px 6px 2px; border-top: 1px solid var(--hair); }
.side-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; }
.side-links a, .text-button { color: var(--ink-2); text-decoration: none; }
.side-links a:hover, .text-button:hover { color: var(--accent); }
.text-button { padding: 0; border: 0; background: none; cursor: pointer; font-size: 12.5px; }

.freshness { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; }
.freshness .dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--ink-3); }
.freshness[data-state="fresh"] .dot { background: var(--good); box-shadow: 0 0 0 4px rgba(91, 184, 102, 0.16); animation: pulse 2.4s ease-in-out infinite; }
.freshness[data-state="aging"] .dot { background: #fab219; }
.freshness[data-state="stale"] .dot { background: var(--critical); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(91, 184, 102, 0); } }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--top-h);
  padding: 0 32px;
  background: color-mix(in srgb, var(--page) 84%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.topbar.scrolled { border-bottom-color: var(--hair); }
.topbar .menu, .topbar .jump-top { display: none; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; margin-right: auto; color: var(--ink-3); font-size: 14px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--ink); }
.crumbs .sep { width: 7px; height: 7px; flex: none; background: var(--corner); transform: rotate(45deg) scale(0.8); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions:empty { display: none; }

#content {
  position: relative;
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 22px 32px 48px;
  outline: none;
}

/* One column that never grows past the page: wide tables scroll inside their own box. */
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.view[hidden] { display: none; }
.view.entering > * { animation: rise 0.5s var(--ease) both; }
.view.entering > *:nth-child(2) { animation-delay: 0.05s; }
.view.entering > *:nth-child(3) { animation-delay: 0.1s; }
.view.entering > *:nth-child(4) { animation-delay: 0.15s; }
.view.entering > *:nth-child(n + 5) { animation-delay: 0.2s; }

.site-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
  color: var(--ink-3);
  font-size: 12.5px;
}

/* ------------------------------------------------------------------ shared pieces */

/* Small corner brackets on a card, like the frame of an old ledger. */
.framed { position: relative; }
.framed::before {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  background:
    linear-gradient(var(--corner), var(--corner)) top left / 12px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top left / 1px 12px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top right / 12px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top right / 1px 12px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom left / 12px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom left / 1px 12px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom right / 12px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom right / 1px 12px no-repeat;
}

.card, .framed:not(.receipt) {
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--surface);
}
.card { padding: 18px 20px; }

.section-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 12px; }
.section-head h2 { margin: 0; font: 500 26px/1.15 var(--display); font-variation-settings: "opsz" 60; letter-spacing: -0.01em; }
/* A rule with a diamond in the middle. */
.flourish {
  position: relative;
  flex: 1;
  max-width: 240px;
  height: 9px;
  background: linear-gradient(var(--hair-strong), var(--hair-strong)) left center / calc(50% - 10px) 1px no-repeat,
    linear-gradient(var(--hair-strong), var(--hair-strong)) right center / calc(50% - 10px) 1px no-repeat;
}
.flourish::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 7px; height: 7px;
  background: var(--corner);
  transform: translate(-50%, -50%) rotate(45deg);
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px; }
.eyebrow { margin: 0 0 2px; color: var(--accent); font: italic 500 15px var(--display); }
.page-title { margin: 0; font: 560 40px/1.05 var(--display); font-variation-settings: "opsz" 96; letter-spacing: -0.02em; }
.lede { margin: 6px 0 0; max-width: 62ch; color: var(--ink-2); font: italic 400 17px/1.45 var(--display); }
.lede:empty { display: none; }

.headline { display: grid; gap: 2px; min-width: 260px; padding: 18px 22px; }
.headline .label, .card-kicker { color: var(--ink-3); font: italic 400 14px var(--display); }
.headline .value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; font: 560 40px/1.1 var(--display); font-variation-settings: "opsz" 96; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.headline .value .unit.per-favor { color: var(--ink-3); font: 400 15px var(--sans); letter-spacing: 0; }
.part { display: inline-flex; align-items: baseline; gap: 0.04em; }
.headline .note { max-width: 40ch; color: var(--ink-2); font-size: 13px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--hair-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.12s;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.button:active, .goal-button:active, .mini:active, .chip:active, .seg button:active { transform: scale(0.97); }
.button.primary { border-color: var(--accent-deep); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.button.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }

.icon-button {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex: none;
  border: 1px solid var(--hair);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.icon-button:hover { border-color: var(--hair-strong); background: var(--raised); }
.icon-button svg { width: 18px; height: 18px; }

/* "Save as a goal": a bookmark that fills in. */
.goal-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  margin-left: auto;
  padding: 0 12px 0 10px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.12s;
}
.goal-button:empty { display: none; }
.goal-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; transition: transform 0.3s var(--spring), fill 0.2s; }
.goal-button:hover { border-color: var(--accent); color: var(--accent); }
.goal-button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 60%, var(--hair)); background: var(--accent-wash); color: var(--accent); }
.goal-button[aria-pressed="true"] svg { fill: currentColor; transform: scale(1.1); }

.chips { display: flex; gap: 6px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
}
.chip:hover { color: var(--ink); border-color: var(--hair-strong); }
.chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); }
.chip.feature[aria-checked="false"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--hair)); }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money .g { color: var(--coin-g); } .money .s { color: var(--coin-s); } .money .c { color: var(--coin-c); }
.money i { font-style: normal; font-size: 0.86em; margin-left: 1px; }
.muted { color: var(--ink-3); }
.ahead { color: var(--up); }

/* Money as the game writes it: a number and its coin's letter, the letter in the coin's colour. */
.big-money {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  margin: 16px 0 6px;
  font: 520 66px/1 var(--display);
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.big-money .part { display: inline-flex; align-items: baseline; gap: 0.04em; }
.coin { color: var(--coin-g); font: italic 500 0.52em/1 var(--display); font-variation-settings: "opsz" 72; letter-spacing: 0; }
.coin.s { color: var(--coin-s); }
.coin.c { color: var(--coin-c); }
.big-money .ahead-word { color: var(--up); font: 500 0.3em var(--sans); letter-spacing: 0; }

.icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  overflow: hidden;
  border: 1px solid var(--q, var(--hair-strong));
  border-radius: 6px;
  background: var(--raised);
  color: var(--q, var(--ink-3));
  font: 600 13px var(--display);
}
.icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.icon.big { width: 52px; height: 52px; border-width: 2px; border-radius: 10px; font-size: 22px; }
.icon.small { width: 22px; height: 22px; border-radius: 5px; font-size: 11px; }
.q0 { --q: var(--q0); } .q1 { --q: var(--q1); } .q2 { --q: var(--q2); }
.q3 { --q: var(--q3); } .q4 { --q: var(--q4); } .q5 { --q: var(--q5); }
.icon.q1 { --q: var(--brass); }
.qname { color: var(--q, var(--ink)); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge.short { color: var(--good); background: rgba(91, 184, 102, 0.14); }
.badge.flooded { color: var(--down); background: rgba(240, 154, 142, 0.12); }
.badge.soldout, .badge.guess { color: var(--coin-g); background: var(--accent-wash); }
.badge.guess { margin-right: 7px; }
.supply { display: inline-flex; align-items: center; gap: 6px; }
.trend.up { color: var(--up); }
.trend.down { color: var(--down); }

a.link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
  text-underline-offset: 3px;
}
a.link:hover { text-decoration-color: currentColor; }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 6px;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: none;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 400;
  vertical-align: 1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.12s;
}
.copy svg { width: 12px; height: 12px; flex: none; }
.copy:hover { border-color: var(--hair-strong); color: var(--ink); }
.copy.done { border-color: color-mix(in srgb, var(--up) 55%, transparent); color: var(--up); animation: pop 0.35s var(--spring); }
.parchment .copy span, #viewProfessions .copy span { display: none; }

.empty { padding: 48px 24px; color: var(--ink-2); text-align: center; }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font: 600 20px var(--display); }

.mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--hair-strong);
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.12s;
}
.mini .glyph { width: 13px; height: 13px; }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.glyph { flex: none; width: 15px; height: 15px; }

/* A tick box drawn as a little ledger check. */
.tickbox {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  flex: none;
  padding: 0;
  border: 1.5px solid var(--brass);
  border-radius: 6px;
  background: var(--sunken);
  color: var(--accent-ink);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s var(--spring);
}
/* A bigger target than it looks, for fingers. */
.tickbox::after { content: ""; position: absolute; inset: -8px; }
.tickbox svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 0.3s var(--ease); }
.tickbox:hover { border-color: var(--accent); transform: scale(1.08); }
.tickbox[aria-pressed="true"] { border-color: var(--accent-deep); background: var(--accent); }
.tickbox[aria-pressed="true"] svg { stroke-dashoffset: 0; }
.tickbox.pop { animation: pop 0.35s var(--spring); }

/* ------------------------------------------------------------------ home */

.welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  padding: 28px 30px;
  overflow: hidden;
}
.welcome::after {
  content: "";
  position: absolute;
  right: -60px; top: -80px;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  opacity: 0.45;
  pointer-events: none;
}
.welcome-text { position: relative; flex: 1 1 380px; }
.welcome .page-title { font-size: 42px; }
.vitals { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; flex: 0 1 540px; margin: 0; }
.vitals div { padding: 12px 14px; border: 1px solid var(--hair); border-radius: 12px; background: color-mix(in srgb, var(--page) 70%, transparent); }
.vitals dt { color: var(--ink-3); font-size: 12px; }
.vitals dd { margin: 2px 0 0; font: 500 22px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.vitals dd .coin { margin-left: 2px; font-size: 0.64em; }

.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.goal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 186px;
  padding: 18px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.goal-card:not(.add):hover { transform: translateY(-3px); border-color: var(--hair-strong); box-shadow: var(--lift); }
.goal-card.leaving { opacity: 0; transform: scale(0.96); transition: opacity 0.2s, transform 0.2s var(--ease); }
.goal-top { display: flex; align-items: center; gap: 10px; padding-right: 22px; }
.goal-top .icon { width: 40px; height: 40px; border-radius: 9px; border-color: var(--corner); }
.goal-glyph { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 1px solid var(--corner); border-radius: 9px; background: var(--raised); color: var(--accent); }
.goal-glyph svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.goal-name { display: grid; min-width: 0; line-height: 1.3; }
.goal-link { color: var(--ink); font-weight: 600; text-decoration: none; }
/* The whole card opens the goal; the remove button sits above that. */
.goal-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 16px; }
.goal-link:focus-visible { outline: none; }
.goal-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.goal-name span { color: var(--ink-3); font-size: 12.5px; }
.goal-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin: 2px 0 0; font: 520 31px/1.1 var(--display); font-variation-settings: "opsz" 96; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.goal-value .part { display: inline-flex; align-items: baseline; gap: 0.04em; }
.goal-value .ahead-word { color: var(--up); font: 500 14px var(--sans); letter-spacing: 0; }
.goal-note { margin: 0; color: var(--ink-2); font-size: 13px; }
.goal-note b { color: var(--ink); font-weight: 600; }
.goal-card .skeleton { display: inline-block; line-height: 1.1; }
.goal-card.add .goal-note a { position: relative; z-index: 1; }
a.goal-card.starter { gap: 8px; text-decoration: none; transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease); }
a.goal-card.starter:hover { border-color: var(--accent); background: var(--accent-wash); transform: translateY(-3px); }
.starter .goal-glyph { width: 46px; height: 46px; border-radius: 50%; }
.starter b { font: 600 18px var(--display); }
.starter-go { margin-top: 2px; color: var(--accent); font-size: 13px; font-weight: 600; }
.starter-go::after { content: "→"; display: inline-block; margin-left: 5px; transition: transform 0.25s var(--spring); }
.starter:hover .starter-go::after { transform: translateX(4px); }
.goal-remove {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
}
.goal-remove svg { width: 15px; height: 15px; }
.goal-card:hover .goal-remove, .goal-remove:focus-visible { opacity: 1; }
@media (hover: none) { .goal-remove { opacity: 0.7; } } /* no hover on a touch screen: always there */
.goal-remove:hover { color: var(--down); background: var(--raised); }
.goal-card.add {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  border-color: var(--brass);
  background: transparent;
  color: var(--ink-2);
  text-align: center;
}
.goal-card.add b { color: var(--ink); }
.goal-card.add > svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; transition: transform 0.35s var(--spring); }
.goal-card.add:hover > svg { transform: rotate(90deg) scale(1.1); }

.meter { display: block; height: 7px; overflow: hidden; border: 1px solid var(--hair); border-radius: 4px; background: var(--sunken); }
.meter span { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); transition: width 0.8s var(--ease); }
.goal-card .meter { margin-top: auto; }

.skeleton { position: relative; overflow: hidden; border-radius: 6px; background: var(--raised); color: transparent !important; }
.items tbody tr.skeleton-row { cursor: default; }
.items tbody tr.skeleton-row:hover { background: none; }
.skeleton-row .skeleton { display: inline-block; line-height: 1.2; }
.skeleton-row .icon.skeleton { border-color: transparent; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.4s; }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--ink) 7%, transparent) 50%, transparent 80%);
  animation: shimmer 1.4s infinite;
}

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; font: 500 21px var(--display); }
.card-note { color: var(--ink-3); font-size: 12px; }
.card-link { font-size: 13px; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.card p { color: var(--ink-2); }
.card-actions { margin: 12px 0 0; }
/* Rising beside falling when the card is wide enough, else one above the other. */
.movers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 22px; }
.mover-head { margin: 0 0 4px; font: italic 400 15px var(--display); }
.mover-head.up { color: var(--up); }
.mover-head.down { color: var(--down); }
.mini-list { display: grid; margin: 0; padding: 0; list-style: none; }
.mini-list li { border-bottom: 1px solid var(--hair); }
.mini-list li:last-child { border-bottom: 0; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.mini-row:hover { background: var(--accent-wash); }
.mini-row .icon { width: 28px; height: 28px; }
.mini-row .what { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.mini-row .what b { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .what span { color: var(--ink-3); font-size: 12px; }
.mini-row .price { font: 500 15px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-row .change { min-width: 52px; font-size: 13px; font-weight: 600; text-align: right; }
.mini-row .change.up { color: var(--up); }
.mini-row .change.down { color: var(--down); }
.mini-empty { padding: 14px 4px; color: var(--ink-3); font-size: 13.5px; }

/* ------------------------------------------------------------------ market */

.controls {
  position: sticky;
  top: var(--top-h);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 0 12px;
  background: linear-gradient(var(--page) 80%, transparent);
}
.search { position: relative; flex: 0 1 320px; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; color: var(--ink-3); transform: translateY(-50%); pointer-events: none; }
.search input {
  width: 100%;
  height: 40px;
  padding: 0 36px;
  border: 1px solid var(--hair-strong);
  border-radius: 10px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.controls .chips { flex: 1 1 400px; min-width: 0; }
/* The chips scroll sideways; a soft edge says there are more. */
.controls .chips { -webkit-mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 24px; }

.view-note { margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; }
.view-note:empty { display: none; }

.ledger { overflow: hidden; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface); }
.table-scroll { overflow-x: auto; }
table.items { width: 100%; border-collapse: collapse; }
.items th {
  position: sticky;
  top: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hair-strong);
  background: var(--raised);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.items th button { all: unset; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.items th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.items th button:hover { color: var(--ink); }
.items th[aria-sort] button { color: var(--accent); }
.items th .arrow { font-size: 10px; }
.items th.num { text-align: right; }
.items th.num button { flex-direction: row-reverse; }
.items td { padding: 9px 14px; border-bottom: 1px solid var(--hair); white-space: nowrap; vertical-align: middle; }
.items td.num { text-align: right; font-variant-numeric: tabular-nums; }
.items tbody tr { cursor: pointer; transition: background 0.14s; }
.items tbody tr:hover, .items tbody tr:focus-visible { background: var(--accent-wash); outline: none; }
.items tbody tr:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.items tbody tr:last-child td { border-bottom: 0; }
.items tbody tr.rowin { animation: rowIn 0.35s var(--ease) both; }
.items td.per { font-weight: 600; }

.item-cell { display: flex; align-items: center; gap: 11px; min-width: 220px; max-width: 380px; }
.item-cell > div { min-width: 0; }
.item-cell .name { display: block; overflow: hidden; font-weight: 500; text-overflow: ellipsis; }
.item-cell .meta { display: block; color: var(--ink-3); font-size: 12px; font-weight: 400; }
.item-cell .meta-fill { display: none; }
.watch-dot { display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--hair); color: var(--ink-3); font-size: 13px; }
.loading .ledger { opacity: 0.6; transition: opacity 0.2s; }

.about { border-top: 1px solid var(--hair); }
.about summary { display: inline-flex; align-items: center; gap: 7px; padding: 14px 2px 6px; color: var(--ink-3); font-size: 13px; list-style: none; cursor: pointer; }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: "›"; font-size: 16px; line-height: 1; transition: transform 0.2s var(--ease); }
.about[open] summary::after { transform: rotate(90deg); }
.about summary:hover { color: var(--ink); }
.explain { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; margin-top: 10px; }
.explain h2 { margin: 0 0 5px; font: 600 16px var(--display); }
.explain p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

/* ------------------------------------------------------------------ crates and cloth */

.how {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.how li {
  counter-increment: step;
  position: relative;
  padding: 14px 16px 14px 56px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: var(--surface);
}
.how li::before {
  content: counter(step);
  position: absolute;
  left: 15px; top: 14px;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 1px solid var(--corner);
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  font: 600 14px var(--display);
}
.how b { display: block; font-weight: 600; }
.how span { display: block; margin-top: 2px; color: var(--ink-2); font-size: 13px; }

.planner { display: grid; gap: 0; }
.ask { display: grid; gap: 12px; padding: 16px 18px; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface); }
.ask-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ask .chips { flex: 0 1 auto; flex-wrap: wrap; }
.ask-label { color: var(--ink-2); font-size: 14px; }
.field { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.field.big { font-size: 17px; font-weight: 500; }
.field input, .favor-grid input, .ask-input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--hair-strong);
  border-radius: 9px;
  background: var(--sunken);
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field.big input { width: 120px; height: 46px; font: 600 21px var(--display); text-align: center; }
.field input:focus, .favor-grid input:focus, .ask-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
select.ask-input { padding-right: 6px; cursor: pointer; }
.ask-input.points { width: 104px; }

.plan-summary { max-width: 80ch; margin: 16px 2px 14px; font-size: 16px; }
.plan-summary b { font-weight: 600; }
.plan-summary.warn, .plan-summary .shortfall { color: var(--down); }
.plan-then { max-width: 80ch; margin: 14px 2px 0; color: var(--ink-2); font-size: 13.5px; }

/* The shopping list, on a slip of parchment. */
.receipt { overflow: hidden; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface); }
.parchment {
  --surface: var(--paper);
  --raised: color-mix(in srgb, var(--paper) 88%, #fff);
  --sunken: color-mix(in srgb, var(--paper) 92%, #000);
  --hair: var(--paper-line);
  --hair-strong: var(--paper-line-strong);
  --brass: var(--paper-line-strong);
  --ink: var(--paper-ink);
  --ink-2: var(--paper-ink-2);
  --ink-3: var(--paper-ink-3);
  --accent: #7a5714;
  --accent-deep: #5c400c;
  --accent-ink: #fffaf0;
  --accent-wash: rgba(122, 87, 20, 0.1);
  --coin-g: #8c6210;
  --coin-s: #5e6470;
  --coin-c: #8a4e22;
  --q1: var(--paper-ink);
  --q2: #1a7a00;
  --q3: #0062c4;
  --q4: #8a2bd0;
  --q5: #b55800;
  --up: #1d7d2c;
  --down: #b23a3a;
  color: var(--paper-ink);
  background: var(--paper) url("grain.png");
  background-size: 256px 256px;
  border-color: var(--paper-line-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}
.group + .group { border-top: 1px dashed var(--hair-strong); }
.group-head, .receipt-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 13px 18px 4px; }
.group-head h3 { margin: 0; font: 600 17px var(--display); }
.group-gets { color: var(--ink-3); font-size: 13px; font-weight: 400; }
.group-head .cost, .receipt-total .cost { margin-left: auto; font-weight: 600; }
.buys { display: grid; margin: 0; padding: 2px 18px 12px; list-style: none; }
.buys li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 96px; align-items: center; gap: 4px 10px; padding: 5px 0; transition: opacity 0.25s; }
.buys .why { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.buys .why:empty { display: none; }
.buys .cost { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.receipt-total { padding: 13px 18px; border-top: 1px solid var(--hair-strong); background: color-mix(in srgb, var(--surface) 80%, var(--hair)); font: 600 16px var(--display); }
.receipt-total.plain { padding-top: 9px; padding-bottom: 9px; border-top-color: var(--hair); background: none; color: var(--ink-2); font: 400 14px var(--sans); }
.receipt-total.plain .cost { font-weight: 500; }
.receipt-total.plain + .receipt-total.plain { border-top: 0; padding-top: 0; }

.compare tr.done-row td { opacity: 0.5; }
.items.compare tbody tr:not(.crate-row) { cursor: default; }
.items.compare tbody tr:not(.crate-row):hover { background: none; }
.compare th, .compare td { padding-left: 10px; padding-right: 10px; }
.compare th:first-child, .compare td:first-child { padding-left: 16px; }
.compare th:last-child, .compare td:last-child { padding-right: 16px; }
.compare .item-cell { max-width: none; min-width: 170px; }
.compare .sub { display: block; margin-top: 1px; color: var(--ink-3); font-size: 12px; font-weight: 400; }
.compare .more { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.crate-row:hover .more { color: var(--ink); }
.fill-cell { display: flex; align-items: center; gap: 9px; }
.chev { flex: none; width: 10px; margin-right: -2px; color: var(--ink-3); font-size: 18px; line-height: 1; text-align: center; transition: transform 0.2s var(--ease); }
tr[aria-expanded="true"] .chev { transform: rotate(90deg); }
tr[aria-expanded="true"] td { border-bottom-color: transparent; }
.items tbody tr.bundle-row { cursor: default; }
.items tbody tr.bundle-row:hover { background: none; }
.bundle-row td { padding: 0 14px 16px 76px; white-space: normal; }
.bundle-row .bundles { animation: rise 0.3s var(--ease) both; }
.bundle-intro, .bundle-foot { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.bundles { display: grid; gap: 7px; margin: 8px 0 10px; padding: 0; list-style: none; }
.bundles li { display: grid; grid-template-columns: 22px minmax(200px, 340px) 96px auto auto; align-items: center; justify-content: start; gap: 10px; }
.bundles .cost { text-align: right; font-variant-numeric: tabular-nums; }
.bundles .listed { font-size: 12.5px; }
.bundles li.unavailable .what, .bundles li.unavailable .cost { color: var(--ink-3); }
.guess-mark { display: none; color: var(--coin-g); font-weight: 600; }

.favor-settings { margin-top: 16px; padding: 0 18px; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface); }
.favor-settings summary { padding: 13px 0; font-weight: 500; cursor: pointer; }
.favor-settings p { max-width: 74ch; margin: 10px 0 14px; color: var(--ink-2); font-size: 13.5px; }
.favor-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding-top: 2px; }
.favor-grid label { display: grid; gap: 6px; color: var(--ink-2); font-size: 13px; }
.favor-grid input { width: 100%; }

/* ------------------------------------------------------------------ professions */

/* The professions, as an action bar: a slot each, with its key. */
.slots {
  display: flex;
  gap: 10px;
  padding: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: color-mix(in srgb, var(--sunken) 70%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--page), inset 0 0 0 2px var(--hair-strong);
}
.slots::-webkit-scrollbar { display: none; }
.prof-tile {
  position: relative;
  display: grid;
  flex: 1 0 74px;
  justify-items: center;
  gap: 7px;
  min-width: 74px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
}
.prof-tile .icon {
  width: 54px; height: 54px;
  padding: 3px;
  border: 1px solid var(--brass);
  border-radius: 10px;
  background: var(--sunken);
  box-shadow: inset 0 0 0 1px #000;
  transition: transform 0.25s var(--spring), border-color 0.2s, box-shadow 0.3s;
}
.prof-tile .icon img { border-radius: 7px; }
.prof-tile .slot-key {
  position: absolute;
  left: calc(50% - 25px); top: 3px;
  z-index: 1;
  color: #f2eadb;
  font: 600 11px var(--sans);
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
  pointer-events: none;
}
.prof-tile > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.2s; }
.prof-tile:hover .icon { transform: translateY(-3px); border-color: var(--corner); }
.prof-tile:hover { color: var(--ink-2); }
.prof-tile[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.prof-tile[aria-checked="true"] .icon {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--corner), 0 0 18px var(--accent-glow), inset 0 0 0 1px #000;
  animation: glow 3.2s ease-in-out infinite;
}
@keyframes glow { 50% { box-shadow: 0 0 0 1px var(--corner), 0 0 26px var(--accent-glow), inset 0 0 0 1px #000; } }

.prof-hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; }
.answer { padding: 22px 26px 22px; }
.answer-head { display: flex; align-items: center; gap: 14px; }
.answer-head .icon.big { border-color: var(--corner); }
.answer-title { min-width: 0; }
.answer .page-title { font-size: 32px; }
.answer .lede { margin-top: 2px; font-size: 16px; }
.answer-line { max-width: 70ch; margin: 0; color: var(--ink-2); }
.answer-line b { color: var(--ink); font-weight: 600; }
.answer-line .back { color: var(--up); }
.answer-stats { display: none; }

.progress-card { display: grid; align-content: start; gap: 10px; padding: 20px 22px; }
.card-kicker { margin: 0; }
.progress-at { margin: 0; font: 520 36px/1 var(--display); font-variant-numeric: tabular-nums; }
.progress-at .of { color: var(--ink-3); font-size: 18px; }
.progress-text { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.progress-text b { color: var(--ink); font-weight: 600; }
.progress-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 0; }
.progress-actions:empty { display: none; }

.deck { display: grid; gap: 14px; padding: 18px 20px 16px; border: 1px solid var(--hair); border-radius: 16px; background: var(--surface); }
.skill { --thumb: 24px; display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px; align-items: end; gap: 6px 14px; }
.skill-end { display: grid; gap: 3px; color: var(--ink-3); font-size: 11.5px; text-align: center; }
.skill-num {
  width: 100%; height: 42px;
  padding: 0 4px;
  border: 1px solid var(--hair-strong);
  border-radius: 10px;
  background: var(--sunken);
  font: 600 20px var(--display);
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.skill-num::-webkit-outer-spin-button, .skill-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.skill-num:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }

/* From 1 to 300: a brass-framed bar painted with the plan, and a coin at each end of your stretch. */
.skill-track { position: relative; height: 42px; }
.skill-rail, .skill-route {
  position: absolute;
  left: calc(var(--thumb) / 2); right: calc(var(--thumb) / 2);
  top: 50%;
  height: 18px;
  margin-top: -9px;
  border-radius: 7px;
}
.skill-rail { background: var(--sunken); box-shadow: inset 0 0 0 1px var(--brass), inset 0 0 0 2px #000, 0 1px 0 color-mix(in srgb, var(--ink) 6%, transparent); }
.skill-route { left: calc(var(--thumb) / 2 + 3px); right: calc(var(--thumb) / 2 + 3px); height: 12px; margin-top: -6px; }
.leg {
  position: absolute;
  top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--sk-orange) 0 var(--o), var(--sk-yellow) var(--o) var(--y), var(--sk-green) var(--y) 100%);
  box-shadow: inset 1px 0 0 var(--sunken);
  transform-origin: left center;
  cursor: pointer;
  transition: filter 0.15s;
}
/* The plan paints itself in when a profession is opened; not while a handle is being dragged. */
.skill-route.animate .leg { animation: grow 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.leg:first-child { border-radius: 4px 0 0 4px; box-shadow: none; }
.leg:last-of-type { border-radius: 0 4px 4px 0; }
.leg:hover { filter: brightness(1.2); }
.leg.gap { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--down) 60%, transparent) 0 4px, transparent 4px 8px); cursor: default; }
.rank-tick { position: absolute; top: -9px; width: 8px; height: 8px; margin-left: -4px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.you {
  position: absolute;
  top: -16px;
  z-index: 2;
  display: grid;
  justify-items: center;
  margin-left: calc(var(--thumb) / 2);
  transform: translateX(-50%);
  pointer-events: none;
  transition: left 0.6s var(--spring);
}
.you b { padding: 0 6px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 600; line-height: 16px; white-space: nowrap; }
.you::after { content: ""; width: 2px; height: 34px; background: var(--accent); border-radius: 1px; }
.skill-track input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0;
  background: none;
  outline: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.skill-track input[type="range"]::-webkit-slider-runnable-track { height: 100%; border: 0; background: none; }
.skill-track input[type="range"]::-moz-range-track { height: 100%; border: 0; background: none; }
.skill-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: var(--thumb); height: var(--thumb);
  margin-top: calc((42px - var(--thumb)) / 2);
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff3c4 0 14%, transparent 15%), radial-gradient(circle, #e8b84a 0 58%, #9c7420 60% 100%);
  box-shadow: 0 0 0 2px var(--surface), 0 4px 10px rgba(0, 0, 0, 0.5);
  cursor: grab;
  pointer-events: auto;
  transition: transform 0.18s var(--spring);
}
.skill-track input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb); height: var(--thumb);
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff3c4 0 14%, transparent 15%), radial-gradient(circle, #e8b84a 0 58%, #9c7420 60% 100%);
  box-shadow: 0 0 0 2px var(--surface), 0 4px 10px rgba(0, 0, 0, 0.5);
  cursor: grab;
  pointer-events: auto;
}
.skill-track input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.1); }
.skill-track input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.18) rotate(20deg); }
.skill-track input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px var(--accent-glow); }
.skill-track input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px var(--accent-glow); }

.skill-ranks { grid-column: 2; display: grid; grid-template-columns: 74fr 75fr 75fr 75fr; margin: 0 calc(var(--thumb) / 2); }
.skill-rank {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 2px 0 2px 7px;
  border: 0;
  border-left: 1px solid var(--hair-strong);
  background: none;
  color: var(--ink-3);
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
  transition: color 0.18s;
}
.skill-rank b { color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; transition: color 0.18s; }
.skill-rank span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-rank:hover, .skill-rank:hover b, .skill-rank[aria-pressed="true"], .skill-rank[aria-pressed="true"] b { color: var(--accent); }
.skill-all {
  grid-column: 3;
  justify-self: center;
  padding: 1px 10px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: none;
  color: var(--ink-3);
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}
.skill-all:hover, .skill-all[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 45%, var(--hair)); color: var(--accent); }

.prof-opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-top: 14px; border-top: 1px dashed var(--hair-strong); }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--hair); border-radius: 11px; background: var(--sunken); }
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.12s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.skill-key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; color: var(--ink-3); font-size: 12px; }
.skill-key li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.skill-key li::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--sk-orange); }
.skill-key .y::before { background: var(--sk-yellow); }
.skill-key .g::before { background: var(--sk-green); }

.prof-alert { display: flex; align-items: flex-start; gap: 9px; margin: 0; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--down) 40%, var(--hair)); border-radius: 12px; background: color-mix(in srgb, var(--down) 6%, transparent); color: var(--down); font-size: 13.5px; }
.prof-alert .glyph { margin-top: 3px; }

.prof-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(310px, 1fr); gap: 0 26px; align-items: start; }
.prof-changes { display: flex; align-items: center; gap: 9px; margin: -4px 0 10px; color: var(--ink-3); font-size: 12.5px; }
.prof-shop { position: sticky; top: calc(var(--top-h) + 12px); display: grid; gap: 14px; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.35)); }
:root[data-theme="light"] .prof-shop { filter: drop-shadow(0 12px 18px rgba(60, 40, 10, 0.16)); }

/* The route, as lines in a ledger. */
.steps { display: grid; gap: 0; margin: 0; padding: 4px 0; list-style: none; border-top: 1px solid var(--hair-strong); }
.step { border-bottom: 1px solid var(--hair); transition: background 0.2s, opacity 0.3s; }
.steps.animate .step { animation: rise 0.45s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 30ms); }
.step.short .step-head { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--down) 70%, transparent); }
.step.next { margin: 6px 0; border: 1px solid var(--corner); border-radius: 12px; background: var(--raised); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.step.done .step-what b, .step.done .step-range .nums { color: var(--ink-3); }
.step.done .step-what .name { background-size: 100% 1.5px; }
.step.done .step-head .icon { opacity: 0.5; filter: saturate(0.5); }
.step-head {
  display: grid;
  grid-template-columns: 22px 74px 34px minmax(0, 1fr) auto 12px;
  grid-template-areas: "tick range icon what cost fold";
  align-items: center;
  gap: 2px 12px;
  padding: 10px 12px;
  list-style: none;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
}
.step-head::-webkit-details-marker { display: none; }
summary.step-head:hover { background: var(--accent-wash); }
.step-head .tickbox { grid-area: tick; }
.step-head .icon { grid-area: icon; width: 34px; height: 34px; border-color: var(--brass); transition: opacity 0.3s, filter 0.3s; }
.step-head .icon.warn { border-color: color-mix(in srgb, var(--down) 50%, var(--hair)); color: var(--down); }
.step-range { grid-area: range; display: grid; gap: 6px; }
.step-range .nums { font: 600 15.5px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; transition: color 0.3s; }
.step-range .nums i { margin: 0 4px; color: var(--ink-3); font: 400 12px var(--sans); }
.odds { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--sk-orange) 0 var(--o), var(--sk-yellow) var(--o) var(--y), var(--sk-green) var(--y) 100%); }
.odds.none { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--down) 60%, transparent) 0 3px, transparent 3px 6px); }
.step-what { grid-area: what; min-width: 0; }
/* The name, a dotted leader, then the price in its own column. */
.step-what b { display: flex; align-items: baseline; gap: 8px; font-weight: 600; line-height: 1.3; }
.step-what .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(currentColor, currentColor) left 58% / 0 1.5px no-repeat;
  transition: background-size 0.4s var(--ease), color 0.3s;
}
.step-what b::after { content: ""; flex: 1 1 24px; min-width: 16px; border-bottom: 1px dotted var(--brass); transform: translateY(-4px); }
.next-badge { flex: none; padding: 0 6px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font: 600 10.5px/17px var(--sans); }
.step-tags { display: flex; flex-wrap: wrap; gap: 1px 11px; margin-top: 2px; color: var(--ink-3); font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tag .glyph { width: 13px; height: 13px; }
.tag.ok { color: var(--up); }
.tag.pick { color: var(--accent); }
.tag.warn { color: var(--down); }
.tag.shop { margin-left: 8px; color: var(--ink-3); font-size: 12px; font-weight: 400; vertical-align: -1px; }
.step-cost { grid-area: cost; position: relative; min-width: 82px; padding-bottom: 6px; font: 600 16px var(--display); text-align: right; white-space: nowrap; }
/* Under each cost, a bar as long as the step's share of the dearest step: where the gold goes. */
.step-cost::after {
  content: "";
  position: absolute;
  right: 0; bottom: 0;
  width: var(--share, 0%);
  min-width: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.7;
  transform-origin: right;
}
.steps.animate .step-cost::after { animation: grow 0.8s var(--ease) both; animation-delay: 0.2s; }
.fold { grid-area: fold; color: var(--ink-3); font-size: 18px; line-height: 1; text-align: center; transition: transform 0.25s var(--ease); }
details[open] > .step-head .fold { transform: rotate(90deg); }
.step-body { padding: 4px 14px 14px 154px; animation: rise 0.3s var(--ease) both; }
.step-body .buys { padding: 0; }
.step-body .buys li { grid-template-columns: 22px minmax(0, 1fr) auto; }
.step-body .buys .why { grid-column: 2; grid-row: 2; white-space: normal; }
.step-body .buys .cost { grid-column: 3; grid-row: 1; }
.buys li.part { margin-left: 24px; }
.buys li.stock .what, .buys li.make .what { color: var(--ink-2); }
.buys li.short .what, .buys li.short .why { color: var(--down); }
.buys li.plain > .glyph { justify-self: center; color: var(--ink-3); }
.facts { display: grid; gap: 2px; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--hair-strong); list-style: none; }
.facts li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 4px 10px; min-height: 28px; color: var(--ink-2); font-size: 13px; }
.facts li > .glyph { justify-self: center; color: var(--ink-3); }
.facts li > span:empty { display: none; }
.facts .cost { text-align: right; }
.facts small, .choices small, .step-rank small { color: var(--ink-3); font-size: 12px; }
.fact-text small { display: inline-block; margin-left: 6px; }
.step-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.choices { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 10px; background: var(--sunken); animation: rise 0.3s var(--ease) both; }
.choices p { margin: 0 0 8px; color: var(--ink-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.choices ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.choices li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 92px auto; align-items: center; gap: 4px 10px; font-size: 13.5px; }
.choices .why { color: var(--ink-3); font-size: 12px; }
.choices .cost { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.choices .less { color: var(--up); }
.step-rank { display: flex; align-items: center; gap: 12px; padding: 6px 4px; color: var(--ink-3); font-size: 12.5px; border-bottom: 1px solid var(--hair); }
.step-rank::before, .step-rank::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--hair-strong), transparent); }
.rank-line { display: inline-flex; align-items: center; gap: 7px; }
.rank-line .glyph { color: var(--accent); }
.rank-line b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-line > span { color: var(--ink-2); }
.step.gap { margin: 6px 0; border: 1px dashed color-mix(in srgb, var(--down) 45%, var(--hair)); border-radius: 12px; }
.step.gap .step-head { cursor: default; }
.step.gap .step-what b { color: var(--down); }
.step.gap .step-what b::after { display: none; }
.step.gap .step-tags { color: var(--ink-2); }
.step.gap .step-cost::after { display: none; }

/* The shopping list, a torn slip of parchment. */
.receipt.torn {
  --zig: 14px;
  padding: calc(var(--zig) / 2 + 4px) 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--zig) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--zig) 51% repeat-x;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--zig) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--zig) 51% repeat-x;
  animation: unroll 0.6s var(--ease) both;
}
.prof-shop .receipt { max-height: calc(100vh - var(--top-h) - 40px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--paper-line-strong) transparent; }
.receipt-head { padding: 8px 18px 6px; }
.receipt-head h2 { margin: 0; font: 600 22px var(--display); }
.receipt-head p { margin: 1px 0 0; color: var(--ink-3); font: italic 400 13px var(--display); }
.receipt-head p:empty { display: none; }
.prof-shop .group-head { padding: 11px 18px 2px; }
.prof-shop .group-head h3 { font-size: 15.5px; }
.prof-shop .buys { padding: 2px 18px 10px; }
/* Every line of this list has a box to tick when it's bought. */
.prof-shop .buys li { grid-template-columns: 18px 22px minmax(0, 1fr) auto; column-gap: 9px; }
.prof-shop .buys li > .tickbox { grid-column: 1; grid-row: 1; width: 18px; height: 18px; border-radius: 5px; }
.prof-shop .buys li > .tickbox svg { width: 11px; height: 11px; }
.prof-shop .buys li > .icon, .prof-shop .buys li > .glyph { grid-column: 2; grid-row: 1; justify-self: center; }
.prof-shop .buys .what { grid-column: 3; grid-row: 1; }
.prof-shop .buys .why { grid-column: 3; grid-row: 2; white-space: normal; }
.prof-shop .buys .cost { grid-column: 4; grid-row: 1; }
.buys li.bought > :not(.tickbox) { opacity: 0.5; transition: opacity 0.3s; }
.buys li.bought .what { text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 60%, transparent); }
.receipt-head { position: relative; }
.addon-copy {
  position: absolute;
  top: 10px; right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px 0 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font: 600 12.5px var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.addon-copy:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.addon-copy:active { transform: translateY(1px); }
.addon-copy svg { width: 14px; height: 14px; }
.receipt-head .clear { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-style: normal; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.prof-shop .receipt-total { padding: 11px 18px; }
/* What you make and sell: money coming back, so its sums are green. */
.prof-shop .group.sold .group-head .cost, .prof-shop .buys li.sold .cost { color: var(--up); }
.prof-shop .buys li.sold > .icon { grid-column: 2; }

.market-tip { display: flex; gap: 12px; margin: 0; padding: 14px 16px; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface); color: var(--ink-2); font-size: 13.5px; animation: rise 0.5s var(--ease) both 0.2s; }
.market-tip .icon { width: 36px; height: 36px; border-color: var(--brass); }
.market-tip b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ crafting profit */

.all-face { color: var(--accent); }
.all-face svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon.big.all-face svg { width: 30px; height: 30px; }
.answer-title .eyebrow { margin: 0; font-size: 14px; }
.big-money .per { margin-left: 4px; color: var(--ink-3); font: 400 16px var(--sans); letter-spacing: 0; }
.gain { color: var(--up); }
.loss { color: var(--down); }
.mini-row .price.loss { color: var(--down); }
.mini-row .price.stacked { display: grid; justify-items: end; line-height: 1.2; }
.mini-row .price.stacked small { color: var(--ink-3); font: 400 11.5px var(--sans); }
.profit-hero { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
.profit-opts { padding-top: 0; border-top: 0; }
.profit-skill { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13.5px; }
.profit-skill .skill-num { width: 78px; height: 38px; font-size: 18px; }
.section-count { margin-left: auto; color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.mini[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }

/* Every craft as a line of the ledger: what it is, what it sells for and costs, and the gold a day. */
.deal-head, .deal-row {
  display: grid;
  grid-template-columns: 24px 34px minmax(0, 1fr) 84px 84px 96px 116px 12px;
  grid-template-areas: "rank icon what sells costs profit day fold";
  align-items: center;
  gap: 2px 12px;
  padding: 9px 12px;
}
.deal-head { padding-top: 0; padding-bottom: 8px; color: var(--ink-3); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.deal-head span:nth-child(n + 4) { text-align: right; }
.deals { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--hair-strong); }
.deal { border-bottom: 1px solid var(--hair); }
.deals.animate .deal { animation: rise 0.45s var(--ease) both; animation-delay: calc(min(var(--i, 0), 16) * 22ms); }
.deal-row { list-style: none; cursor: pointer; border-radius: 10px; transition: background 0.15s; }
.deal-row::-webkit-details-marker { display: none; }
.deal-row:hover { background: var(--accent-wash); }
.deal-rank { grid-area: rank; color: var(--ink-3); font: 600 13px var(--display); font-variant-numeric: tabular-nums; text-align: center; }
.deal.top .deal-rank { color: var(--accent); }
.deal-row > .icon { grid-area: icon; width: 34px; height: 34px; }
.deal-what { grid-area: what; min-width: 0; }
.deal-what > b { display: block; overflow: hidden; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.deal-what .step-tags .badge { margin-left: 2px; }
.tag.prof { color: var(--ink-2); }
.deal-sells, .deal-costs, .deal-profit, .deal-day { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deal-sells { grid-area: sells; color: var(--ink-2); font-size: 14px; }
.deal-costs { grid-area: costs; color: var(--ink-2); font-size: 14px; }
.deal-profit { grid-area: profit; font-size: 14px; font-weight: 600; }
.deal-day { grid-area: day; position: relative; padding-bottom: 6px; font: 600 16px var(--display); }
/* Under the gold a day, a bar as long as its share of the best line's. */
.deal-day::after { content: ""; position: absolute; right: 0; bottom: 0; width: var(--share, 0%); height: 2px; border-radius: 2px; background: var(--accent); opacity: 0.7; transform-origin: right; }
.deals.animate .deal-day::after { animation: grow 0.8s var(--ease) both; animation-delay: 0.2s; }
.deal-row .fold { grid-area: fold; }
details[open] > .deal-row .fold { transform: rotate(90deg); }
.deal-body { padding: 2px 14px 16px 82px; animation: rise 0.3s var(--ease) both; }
.deal-body:empty { display: none; }
.deal-batch { margin: 4px 0 6px; color: var(--ink-2); font-size: 13px; }
.deal-batch b { color: var(--ink); font-weight: 600; }
.deal-body .buys { padding: 0; }
.deal-break { padding: 20px 12px 8px; border-bottom: 1px solid var(--hair-strong); color: var(--down); font: italic 400 15px var(--display); }
.profit-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 4px 0; color: var(--ink-3); font-size: 13px; }
.profit-foot > span { margin-right: auto; }

/* ------------------------------------------------------------------ craftsman's writs */

.writ-hero { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
.big-money > .glyph { width: 0.6em; height: 0.6em; color: var(--up); }
.stand-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.stand-row .ask-input { height: 38px; }
.stand-row .of { color: var(--ink-3); font-size: 13.5px; }
.progress-text .glyph { width: 14px; height: 14px; margin-right: 2px; color: var(--up); vertical-align: -2px; }
/* Your reputation as the game draws it: a bar per standing, filled as far as you've come. */
.rep-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }
.rep-seg { display: grid; gap: 6px; min-width: 0; transition: opacity 0.3s; }
.rep-seg i {
  display: block;
  height: 9px;
  border: 1px solid var(--hair-strong);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent)) no-repeat var(--sunken);
  background-size: var(--fill, 0%) 100%;
  transition: background-size 0.8s var(--ease);
}
.rep-seg small { overflow: hidden; color: var(--ink-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rep-seg.here small { color: var(--ink); font-weight: 600; }
.rep-seg.beyond { opacity: 0.35; }
.progress-text .unlock { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; color: var(--accent); white-space: nowrap; }
.progress-text .unlock .glyph { margin: 0; color: inherit; }
.progress-tip { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 0; padding: 9px 11px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--hair)); border-radius: 10px; color: var(--ink-2); font-size: 13px; }
.progress-tip .glyph { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
.progress-tip b { color: var(--ink); }
.progress-tip a { color: var(--accent); }
.link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.seg button .unlock-mark { width: 13px; height: 13px; margin-left: -2px; opacity: 0.75; }
.receipt-foot { margin: 0; padding: 10px 18px 14px; color: var(--ink-3); font: italic 400 13px/1.45 var(--display); }

.writ-ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.writ-target { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.seg button.reached { color: var(--ink-3); }
.seg button.reached .glyph { width: 13px; height: 13px; color: var(--up); }
.seg button.reached[aria-checked="true"] { color: var(--accent-ink); }
.seg button.reached[aria-checked="true"] .glyph { color: inherit; }

/* The pace: four small cards, each with what it costs and how long it takes. */
.pace { display: grid; flex: 1 1 440px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 620px; }
.pace button {
  display: grid;
  justify-items: start;
  gap: 1px;
  min-width: 0;
  padding: 8px 12px 9px;
  border: 1px solid var(--hair);
  border-radius: 11px;
  background: var(--sunken);
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
}
.pace button:hover { border-color: var(--hair-strong); }
.pace button:active { transform: translateY(1px); }
.pace button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent); }
.pace-name { color: var(--ink-3); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.pace button[aria-checked="true"] .pace-name { color: var(--accent); }
.pace-cost { max-width: 100%; overflow: hidden; color: var(--ink); font: 600 16px var(--display); text-overflow: ellipsis; }
.pace-days { color: var(--ink-3); font-size: 12px; }

.writ-crafts { justify-content: flex-start; }
.pouch-field { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.pouch-field .glyph { color: var(--coin-g, var(--accent)); }
.pouch-field .ask-input { width: 64px; height: 34px; padding: 0 8px; text-align: right; }
.glyph-face { color: var(--accent); }
.glyph-face svg { width: 60%; height: 60%; }
.receipt-card { gap: 8px; padding: 16px 18px; }
.receipt-count { margin: 0; color: var(--ink-2); font: 500 15px var(--display); }
.receipt-count b { color: var(--ink); font-size: 22px; font-weight: 600; }
.receipt-card .mini-row { padding-left: 4px; padding-right: 4px; }
.receipt-card .favor-price { color: var(--ink-2); font: 500 13.5px var(--sans); }
.receipt-sum { display: flex; align-items: baseline; gap: 10px; margin: 0; padding-top: 8px; border-top: 1px solid var(--hair-strong); font: 600 16px var(--display); }
.receipt-sum .cost { margin-left: auto; }
.receipt-sum .group-gets { font-family: var(--sans); }
.receipt-card .progress-text a { color: var(--accent); }
.deal.receipt-line { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.deal.receipt-line .deal-row { cursor: default; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
.deal.receipt-line .deal-row:hover { background: none; }
.deal.receipt-line .deal-what > b { color: var(--accent); }
.deal-row > .glyph-face { grid-area: icon; width: 34px; height: 34px; }
.writ-crafts .chips { flex-wrap: wrap; }
.chip.craft { display: inline-flex; align-items: center; gap: 7px; padding-left: 5px; }
.chip.craft .icon.small { width: 22px; height: 22px; border-radius: 999px; }
.chip.craft .icon.small img { border-radius: 999px; }
.chip.craft[aria-pressed="true"] .icon.small { border-color: var(--accent); }
#writCrafts.busy { opacity: 0.7; pointer-events: none; }

/* What to buy today sits right of the list on a wide screen, and above it on a narrow one. */
.writ-cols > .writ-shop { grid-column: 2; grid-row: 1; }
/* Three cards in this column: it scrolls with the page, so the receipts and sealed writs stay in reach. */
.writ-shop { position: static; }
.writ-shop .receipt { max-height: none; overflow: visible; }
.writ-cols > .writ-list { grid-column: 1; grid-row: 1; }
.writ-shop .buys li { grid-template-columns: 22px minmax(0, 1fr) auto; }
.writ-shop .buys li > .icon { grid-column: 1; grid-row: 1; }
.writ-shop .buys .what { grid-column: 2; grid-row: 1; }
.writ-shop .buys .why { grid-column: 2; grid-row: 2; }
.writ-shop .buys .cost { grid-column: 3; grid-row: 1; }
.writ-shop .buys li.made .why { color: var(--up); }
.writ-shop .buys li.more-line .what { grid-column: 2; color: var(--ink-3); font: italic 400 13.5px var(--display); }
.show-all { display: block; margin: 0 18px 12px; padding: 0; border: 0; background: none; color: var(--accent); font: italic 400 14px var(--display); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.sealed-card { gap: 6px; padding: 16px 18px; }
.sealed-card .mini-row { padding-left: 4px; padding-right: 4px; }
.mini-row.static { cursor: default; }
.mini-row.static:hover { background: none; }
.mini-row .price.muted { color: var(--ink-3); font: 400 13px var(--sans); }

/* Every writ as a line of the ledger: what it asks for, the writ, the item, the reputation and a point's cost. */
.writ-row {
  grid-template-columns: 24px 34px minmax(0, 1fr) 72px 80px 36px 92px 12px;
  grid-template-areas: "rank icon what writ item rep point fold";
}
.writ-cost, .item-cost, .writ-rep, .writ-point { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.writ-cost { grid-area: writ; color: var(--ink-2); font-size: 14px; }
.item-cost { grid-area: item; display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--ink-2); font-size: 14px; }
.item-cost .glyph { width: 13px; height: 13px; color: var(--up); }
.writ-rep { grid-area: rep; color: var(--ink-3); font-size: 13px; }
.writ-point { grid-area: point; position: relative; padding-bottom: 6px; font: 600 16px var(--display); }
/* Under a point's cost, a bar as long as the cheapest writ's share of it: the cheapest fills it. */
.writ-point::after { content: ""; position: absolute; right: 0; bottom: 0; width: var(--share, 0%); height: 2px; border-radius: 2px; background: var(--accent); opacity: 0.7; transform-origin: right; }
.deals.animate .writ-point::after { animation: grow 0.8s var(--ease) both; animation-delay: 0.2s; }
.deal.in-plan > details > .deal-row { box-shadow: inset 3px 0 0 var(--accent); }
.deal.in-plan .deal-rank { color: var(--accent); }
.deal.cannot .writ-point, .deal.cannot .deal-what > b { color: var(--ink-3); }
.writ-total { display: none; }
.tag.tier { color: var(--ink-2); }

/* ------------------------------------------------------------------ the item drawer */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(6, 5, 3, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s;
}
.scrim.open { opacity: 1; }
body.drawer-open { overflow: hidden; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 40;
  width: min(760px, 100vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface) url("grain.png");
  background-size: 256px 256px;
  border-left: 1px solid var(--hair-strong);
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform 0.38s var(--ease);
}
.drawer.open { transform: none; }
.drawer-inner { padding: 26px 30px 40px; }
.d-head { display: flex; align-items: center; gap: 16px; padding-right: 44px; }
.d-head h2 { margin: 0; font: 600 28px/1.1 var(--display); letter-spacing: -0.01em; }
.d-head p { margin: 5px 0 0; color: var(--ink-3); font-size: 13px; }
.close { position: absolute; top: 22px; right: 24px; }
.d-actions { margin: 16px 0 0; }
.watch-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.12s;
}
.watch-button svg { width: 17px; height: 17px; transition: transform 0.35s var(--spring); }
.watch-button:hover { border-color: var(--accent); color: var(--accent); }
.watch-button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.watch-button[aria-pressed="true"] svg { transform: scale(1.12); }
.d-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 18px 0 8px; overflow: hidden; border: 1px solid var(--hair); border-radius: 14px; background: var(--hair); }
.tile { padding: 12px 14px; background: var(--surface); }
.tile dt { color: var(--ink-3); font-size: 12px; }
.tile dd { margin: 4px 0 0; font: 500 19px/1.15 var(--display); }
.tile .sub { display: block; margin-top: 3px; color: var(--ink-3); font: 400 12px var(--sans); }
.range { display: flex; gap: 6px; margin: 22px 0 6px; }
.chart { margin: 22px 0 0; }
.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.chart figcaption b { font: 600 16px var(--display); }
.chart figcaption span { color: var(--ink-3); font-size: 12.5px; }
.legend { display: flex; gap: 16px; margin: -2px 0 8px; color: var(--ink-2); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.key { display: inline-block; width: 16px; height: 2px; border-radius: 2px; }
.plot { position: relative; border: 1px solid var(--hair); border-radius: 12px; background: var(--sunken); outline: none; }
.plot:focus-visible { border-color: var(--accent); }
.plot svg { display: block; width: 100%; overflow: visible; }
.plot .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.plot .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.plot .tick { fill: var(--ink-3); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
/* Each line draws itself in: the path is given a length of 1, so one dash covers all of it. */
.plot .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) forwards; }
.plot .wash { opacity: 0.1; }
.plot .cross { stroke: var(--ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.plot .dot { stroke: var(--sunken); stroke-width: 2; }
.plot .bar { transition: opacity 0.12s; }
.plot .bar.dim { opacity: 0.45; }
.plot .endlabel { fill: var(--ink-2); font: 500 11.5px var(--sans); }
.plot .nodata { fill: var(--ink-3); font: 13px var(--sans); }
.tip { position: absolute; z-index: 3; min-width: 150px; padding: 9px 11px; border: 1px solid var(--hair-strong); border-radius: 9px; background: var(--raised); box-shadow: var(--lift); font-size: 12.5px; pointer-events: none; }
.tip .when { margin-bottom: 4px; color: var(--ink-3); }
.tip .row { display: flex; align-items: center; gap: 8px; }
.tip .row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .row span:last-child { color: var(--ink-2); }

/* A label with a note on how it is worked out: a dotted underline, and the note on hover, focus or a tap. */
[data-tip] {
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
}
[data-tip]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.help-tip {
  position: fixed;
  z-index: 90;
  max-width: min(300px, calc(100vw - 16px));
  padding: 9px 12px;
  border: 1px solid var(--hair-strong);
  border-radius: 10px;
  background: var(--raised);
  box-shadow: var(--lift);
  color: var(--ink-2);
  font: 400 12.5px/1.5 var(--sans);
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.help-tip.below { transform: translateY(-4px); }
.help-tip.on { opacity: 1; transform: none; }
.help-tip::after {
  content: "";
  position: absolute;
  left: calc(var(--arrow, 50%) - 5px);
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--hair-strong);
  border-bottom: 1px solid var(--hair-strong);
  background: var(--raised);
  transform: rotate(45deg);
}
.help-tip.below::after { top: -6px; bottom: auto; transform: rotate(225deg); }
.d-table { margin-top: 26px; }
.d-table summary { color: var(--ink-2); font-size: 13.5px; cursor: pointer; }
.d-table table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
.d-table th, .d-table td { padding: 6px 8px; border-bottom: 1px solid var(--hair); text-align: right; white-space: nowrap; }
.d-table th:first-child, .d-table td:first-child { text-align: left; }
.d-table th { color: var(--ink-3); font-weight: 500; }
.d-table td { font-variant-numeric: tabular-nums; }
.d-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; font-size: 13.5px; }

/* ------------------------------------------------------------------ jump to anything */

.palette { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 11vh 16px 24px; }
.palette[hidden] { display: none; }
.palette-scrim { position: absolute; inset: 0; background: rgba(6, 5, 3, 0.66); backdrop-filter: blur(3px); animation: fade 0.2s both; }
.palette-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 660px;
  max-height: 76vh;
  border: 1px solid var(--brass);
  border-radius: 18px;
  background: var(--surface) url("grain.png");
  background-size: 256px 256px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 0 1px var(--sunken);
  animation: paletteIn 0.26s var(--spring) both;
}
.palette.closing .palette-panel { animation: paletteOut 0.16s var(--ease) both; }
.palette.closing .palette-scrim { animation: fade 0.16s reverse both; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--hair); }
.palette-input svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.palette-input input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); font: 500 20px var(--display); }
.palette-input input::placeholder { color: var(--ink-3); font-style: italic; }
.palette-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px 4px; }
.palette-filters .chip { height: 28px; padding: 0 11px; font-size: 12.5px; }
.palette-list { flex: 1; min-height: 120px; overflow-y: auto; padding: 4px 10px 10px; scrollbar-width: thin; scrollbar-color: var(--hair-strong) transparent; }
.palette-group { margin: 10px 12px 4px; color: var(--ink-3); font: italic 400 13.5px var(--display); }
.palette-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
}
.palette-option[aria-selected="true"] { background: var(--raised); box-shadow: inset 0 0 0 1px var(--corner); }
.palette-option .icon { width: 32px; height: 32px; border-color: var(--brass); }
.palette-option .pal-glyph { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 1px solid var(--hair-strong); border-radius: 7px; color: var(--accent); }
.palette-option .pal-glyph svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.palette-option .text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.palette-option .text b { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.palette-option .text span { overflow: hidden; color: var(--ink-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.palette-option .side { color: var(--ink-2); font: 500 15px var(--display); white-space: nowrap; }
.palette-option .enter { display: none; }
.palette-option[aria-selected="true"] .enter { display: inline-block; }
.palette-option mark { border-radius: 3px; background: var(--accent-glow); color: inherit; }
.palette-none { padding: 26px 12px; color: var(--ink-3); text-align: center; }
.palette-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 11px 20px; border-top: 1px solid var(--hair); color: var(--ink-3); font-size: 12px; }
.palette-hint { margin-left: auto; }

/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 70; display: grid; justify-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border: 1px solid var(--brass);
  border-radius: 999px;
  background: var(--raised);
  box-shadow: var(--lift);
  color: var(--ink);
  font-size: 14px;
  animation: toastIn 0.4s var(--spring) both;
}
.toast svg { width: 16px; height: 16px; flex: none; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast button { margin-left: 4px; padding: 2px 8px; border: 1px solid var(--hair-strong); border-radius: 999px; background: none; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; pointer-events: auto; }
.toast button:hover { border-color: var(--accent); }
.toast.leaving { animation: toastOut 0.3s var(--ease) both; }

/* ------------------------------------------------------------------ motion */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 40% { transform: scale(1.12); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes unroll { from { opacity: 0; transform: translateY(-8px) scaleY(0.96); transform-origin: top; } }
@keyframes paletteIn { from { opacity: 0; transform: translateY(-10px) scale(0.97); } }
@keyframes paletteOut { to { opacity: 0; transform: translateY(-6px) scale(0.98); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .plot .series { stroke-dashoffset: 0; }
}

/* ------------------------------------------------------------------ narrower screens */

@media (max-width: 1180px) {
  .prof-cols { grid-template-columns: minmax(0, 1fr); }
  .prof-shop { position: static; }
  .prof-shop .receipt { max-height: none; }
  .writ-cols { row-gap: 22px; }
  .writ-cols > .writ-shop, .writ-cols > .writ-list { grid-column: auto; grid-row: auto; }
}

/* The sidebar slides in from the left. */
@media (max-width: 1040px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(300px, 86vw);
    height: 100%;
    transform: translateX(-104%);
    transition: transform 0.35s var(--ease);
    box-shadow: var(--shadow), inset -3px 0 0 var(--page), inset -4px 0 0 var(--hair-strong);
  }
  .app.nav-open .sidebar { transform: none; }
  .side-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(6, 5, 3, 0.6); opacity: 0; transition: opacity 0.3s; }
  .app.nav-open .side-scrim { opacity: 1; }
  .side-top .side-close { display: grid; }
  .topbar { padding: 0 16px; }
  .topbar .menu, .topbar .jump-top { display: grid; }
  #content { padding: 18px 20px 40px; }
}

@media (max-width: 860px) {
  .prof-hero { grid-template-columns: minmax(0, 1fr); }
  .deal-head { display: none; }
  .deal-row { grid-template-columns: 34px minmax(0, 1fr) auto 12px; grid-template-areas: "icon what day fold" "icon what profit fold"; gap: 0 10px; padding: 10px 8px; }
  .deal-rank, .deal-sells, .deal-costs { display: none; }
  .deal-profit { padding-top: 2px; font-size: 12.5px; }
  .deal-body { padding: 4px 8px 14px; }
  .deal-row.writ-row { grid-template-columns: 34px minmax(0, 1fr) auto 12px; grid-template-areas: "icon what point fold" "icon what total fold"; }
  .writ-row .writ-cost, .writ-row .item-cost, .writ-row .writ-rep { display: none; }
  .writ-row .writ-total { display: block; grid-area: total; padding-top: 2px; color: var(--ink-3); font-size: 12px; text-align: right; white-space: nowrap; }
  .d-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .col-total { display: none; }
}

@media (max-width: 720px) {
  :root { --top-h: 56px; }
  #content { padding: 14px 14px 36px; }
  .view { gap: 18px; }
  .page-title { font-size: 31px; }
  .welcome { padding: 22px 20px; }
  .welcome .page-title { font-size: 32px; }
  .vitals { flex: 1 1 100%; }
  .vitals div { padding: 10px; }
  .vitals dd { font-size: 18px; }
  .lede { font-size: 15.5px; }
  .headline { flex: 1 1 100%; min-width: 0; }
  .headline .value { font-size: 32px; }
  .section-head h2 { font-size: 22px; }
  .movers { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .big-money { font-size: 48px; }
  .answer { padding: 18px; }
  .answer .page-title { font-size: 26px; }
  .goal-button { margin-left: 0; }
  .answer-head { flex-wrap: wrap; }
  .deck { padding: 14px 12px; }
  .skill { grid-template-columns: 54px minmax(0, 1fr) 54px; gap: 6px 8px; }
  .skill-num { height: 38px; font-size: 17px; }
  .skill-rank span { display: none; }
  .opt-row { width: 100%; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; justify-content: center; padding: 0 6px; }
  .addon-copy { position: static; margin-top: 8px; }
  .writ-target { width: 100%; }
  .pace { flex-basis: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
  .slots { gap: 6px; padding: 10px; }
  .prof-tile { flex: 0 0 66px; min-width: 66px; }
  .prof-tile .icon { width: 48px; height: 48px; }
  .prof-tile .slot-key { left: calc(50% - 22px); }
  .step-head {
    grid-template-columns: 22px 34px minmax(0, 1fr) auto 12px;
    grid-template-areas: "tick range range cost fold" ". icon what what what";
    gap: 7px 10px;
    padding: 10px;
  }
  .step-range { grid-template-columns: auto minmax(0, 90px); align-items: center; gap: 10px; }
  .step-body { padding: 4px 10px 12px; }
  .buys li.part { margin-left: 14px; }
  .facts li { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .facts li > :nth-child(4) { grid-column: 2 / 4; justify-self: start; }
  .choices li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .choices .why { grid-column: 2; grid-row: 2; }
  .choices .cost { grid-column: 3; grid-row: 1; }
  .choices .mini { grid-column: 3; grid-row: 2; justify-self: end; }
  .col-low, .col-qty, .col-trend, .col-fill { display: none; }
  .items th, .items td { padding-left: 10px; padding-right: 10px; }
  .item-cell { min-width: 130px; max-width: 210px; gap: 8px; }
  .item-cell .meta { display: none; }
  .compare .item-cell { min-width: 0; max-width: 240px; }
  .compare .item-cell .meta-fill { display: block; white-space: normal; }
  .compare .item-cell .name, .compare .item-cell .sub { white-space: normal; }
  .bundle-row td { padding-left: 12px; }
  .bundles li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .bundles .listed, .bundles .badge { display: none; }
  .buys li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .buys .why { grid-column: 2; grid-row: 2; white-space: normal; }
  .buys .cost { grid-column: 3; grid-row: 1; }
  .favor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { flex: 1 1 100%; }
  .drawer-inner { padding: 20px 16px 32px; }
  .d-head h2 { font-size: 22px; }
  .palette { padding-top: 6vh; }
  .palette-hint { display: none; }
}

@media (max-width: 480px) {
  .col-sold { display: none; }
  .items th, .items td { padding-left: 8px; padding-right: 8px; }
  .item-cell { max-width: 150px; }
  .badge { display: none; }
  .guess-mark { display: inline; }
  .chev { display: none; }
  .field.big { font-size: 16px; }
  .field.big input { width: 104px; }
  .vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .vitals dt { font-size: 11px; }
  .crumbs { flex-wrap: nowrap; overflow: hidden; font-size: 13px; white-space: nowrap; }
  /* On a phone the trail drops its first part: the sidebar's group is one tap away anyway. */
  .crumbs > :nth-child(-n + 2):not(:last-child) { display: none; }
  .crumbs > * { overflow: hidden; text-overflow: ellipsis; }
}
