  :root {
    --bg: #0b0d10; --surface: #121519; --raised: #171b20; --line: #1f242b; --line-strong: #2c333c;
    --text: #e9e7e2; --muted: #8b9099; --faint: #5b616a;
    --accent: #d8b46a; --accent-soft: rgba(216, 180, 106, .14);
    --profit: #4cc38a; --profit-soft: rgba(76, 195, 138, .12);
    --loss: #ef6b5f; --loss-soft: rgba(239, 107, 95, .12);
    /* One colour per way to make gold, used in the menu, home cards and panels. */
    --f-crafting: #d8b46a; --f-materials: #9ccc65; --f-deals: #f07fae; --f-flips: #5fb0f5; --f-guides: #b195f5;
    --gold: #f2c94c; --silver: #c9ced6; --copper: #d9875a;
    --gap: 12px; --pad: 16px; --h: 36px; --radius: 10px;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9099' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
  * { box-sizing: border-box; }
  /* `hidden` always hides, whatever display a class sets. */
  [hidden] { display: none !important; }
  body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 14px/1.4 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased;
  }
  /* Footer sits at the bottom even when the page is short. */
  body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
  body > main { flex: 1 0 auto; width: 100%; }
  .wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px; }

  /* Top bar */
  .top { position: sticky; top: 0; z-index: 2; background: rgba(11, 13, 16, .9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .brand { display: flex; align-items: center; gap: var(--gap); height: 68px; }
  .brand img { flex: none; display: block; width: 38px; height: 38px; }
  .wordmark {
    margin: 0; font-family: Cinzel, Georgia, serif; font-size: 19px; font-weight: 700; letter-spacing: .06em;
    background: linear-gradient(180deg, #fbe7a6 0%, #e2b75a 55%, #a87621 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  a.brand-link { display: flex; align-items: center; gap: var(--gap); text-decoration: none; }
  .nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
  .nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; transition: color .15s, background .15s; }
  .nav a:hover { color: var(--text); background: var(--surface); }
  .nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
  /* Feature colours: each way to make gold has its own, set on .f-<feature>. */
  .f-home { --fc: var(--text); --fc-soft: rgba(233, 231, 226, .09); }
  .f-crafting { --fc: var(--f-crafting); --fc-soft: rgba(216, 180, 106, .13); }
  .f-materials { --fc: var(--f-materials); --fc-soft: rgba(156, 204, 101, .12); }
  .f-deals { --fc: var(--f-deals); --fc-soft: rgba(240, 127, 174, .12); }
  .f-flips { --fc: var(--f-flips); --fc-soft: rgba(95, 176, 245, .12); }
  .f-guides { --fc: var(--f-guides); --fc-soft: rgba(177, 149, 245, .13); }
  .nav a.nf { display: inline-flex; align-items: center; gap: 7px; color: var(--fc); font-weight: 600; }
  .nav a.nf svg { flex: none; }
  .nav a.nf:hover, .nav a.nf[aria-current="page"] { color: var(--fc); background: var(--fc-soft); }
  .brand .menu-btn { display: none; margin-left: auto; }
  .status { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
  .status.err { color: var(--loss); }
  .status span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 8px; vertical-align: middle; }

  .controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap); margin-bottom: var(--gap); }
  select, input[type=search], .seg {
    height: var(--h); background-color: var(--surface); color: var(--text);
    border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13.5px; outline: none;
    transition: border-color .15s;
  }
  select:hover, input[type=search]:hover { border-color: #3a424c; }
  select:focus-visible, input[type=search]:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  select {
    appearance: none; -webkit-appearance: none; cursor: pointer; padding: 0 34px 0 12px; min-width: 160px;
    background-image: var(--chevron); background-repeat: no-repeat; background-position: right 12px center;
  }
  select option, select optgroup { background: var(--raised); color: var(--text); }

  .seg { display: inline-flex; padding: 3px; gap: 3px; }
  .seg button {
    all: unset; cursor: pointer; padding: 0 12px; border-radius: 5px; font-size: 12.5px; font-weight: 600;
    color: var(--muted); display: grid; place-items: center; letter-spacing: .04em;
  }
  .seg button:hover { color: var(--text); }
  .seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
  .seg button:focus-visible { box-shadow: 0 0 0 2px var(--accent); }

  .search { position: relative; flex: 1; min-width: 220px; }
  .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
  .search input { width: 100%; padding: 0 12px 0 36px; }
  .search input::placeholder { color: var(--faint); }


  /* List */
  main.wrap { padding-top: 24px; padding-bottom: 48px; }
  .list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
  table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  col.c-recipe { width: 22%; } col.c-reagents { width: 27%; } col.c-num { width: 9.5%; } col.c-margin { width: 8%; } col.c-sold { width: 7.5%; } col.c-ah { width: 7%; } col.c-act { width: 124px; }
  td.sold { color: var(--text); }
  table.mat col.c-item { width: 34%; } table.mat col.c-num { width: 12%; } table.mat col.c-act { width: 124px; }
  table.mat td.p .m { font-size: 11.5px; color: var(--muted); }
  /* Item quality colours, like the game's. */
  .title.q-poor a { color: #9d9d9d; } .title.q-uncommon a { color: #1eff00; } .title.q-rare a { color: #3d9bff; } .title.q-epic a { color: #b56cff; } .title.q-legendary a { color: #ff8000; }
  th {
    position: sticky; top: var(--top, 0px); z-index: 1; background: var(--raised);
    height: 40px; padding: 0 var(--pad); border-bottom: 1px solid var(--line-strong);
    font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint);
    text-align: left; white-space: nowrap; user-select: none;
  }
  th[data-key] { cursor: pointer; }
  th[data-key]:hover { color: var(--text); }
  th.on { color: var(--accent); }
  th .arrow { display: inline-block; width: 10px; height: 10px; margin: 0 3px; vertical-align: -1px; visibility: hidden; transition: transform .15s; }
  th.on .arrow { visibility: visible; }
  th.asc .arrow { transform: rotate(180deg); }
  th.num, td.num { text-align: right; }
  td { padding: 10px var(--pad); border-bottom: 1px solid var(--line); vertical-align: middle; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover td { background: #14181d; }
  tr.recipe { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  tr.recipe:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .name { min-width: 0; }

  .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .qty { color: var(--accent); font-weight: 700; font-size: 12px; margin-left: 4px; }
  .cat { font-size: 12px; color: var(--faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .warn { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 11.5px; color: #d9a54a; min-width: 0; }
  .warn svg { flex: none; }
  .warn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  tr.unpriced .title, tr.unpriced td.num, tr.unpriced .reagent { opacity: .55; }

  .reagent { display: grid; grid-template-columns: 30px 1fr auto 30px; align-items: center; gap: 8px; height: 22px; font-size: 12.5px; }
  .reagent .n { color: var(--muted); }
  .reagent .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cfccc6; }
  .reagent .src { font-size: 9.5px; font-weight: 700; letter-spacing: .05em; color: var(--faint); text-align: right; }
  .reagent.missing .nm { color: var(--loss); }

  td.profit { color: var(--profit); font-weight: 600; }
  td.loss { color: var(--loss); font-weight: 600; }
  .pill { display: inline-block; min-width: 52px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; text-align: center; }
  .pill.profit { background: var(--profit-soft); color: var(--profit); }
  .pill.loss { background: var(--loss-soft); color: var(--loss); }
  td.ah { color: var(--muted); }

  .money { display: inline-flex; gap: 6px; white-space: nowrap; }
  .coin { display: inline-flex; align-items: center; gap: 3px; }
  .coin::after { content: ""; width: 7px; height: 7px; border-radius: 50%; }
  .coin.g::after { background: var(--gold); }
  .coin.s::after { background: var(--silver); }
  .coin.c::after { background: var(--copper); }
  .na { color: var(--faint); }

  .empty { color: var(--muted); padding: 64px 16px; text-align: center; }
  footer { border-top: 1px solid var(--line); background: var(--surface); }
  .foot-main { display: flex; justify-content: space-between; gap: 48px; flex-wrap: wrap; padding: 40px 0 32px; }
  .foot-brand { max-width: 420px; }
  .foot-brand .brand-link img { width: 30px; height: 30px; }
  .foot-brand .wordmark { font-size: 16px; }
  .foot-brand p { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
  .foot-cols { display: flex; gap: 56px; }
  .foot-col { text-align: right; }
  .foot-col h3 { margin: 4px 0 14px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
  .foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
  footer a { color: var(--muted); text-decoration: none; font-size: 13px; transition: color .15s; }
  footer a:hover { color: var(--accent); }
  .foot-form { margin: 0; }
  .foot-form button { all: unset; cursor: pointer; color: var(--muted); font-size: 13px; transition: color .15s; }
  .foot-form button:hover { color: var(--accent); }
  .foot-form button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
  .foot-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 0 24px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--faint); }
  .foot-bottom a { font-size: 12.5px; color: var(--text); font-weight: 500; }

  /* Text pages (about, contact, privacy, terms, guides index): full width like the header. */
  .page { padding-top: 32px; padding-bottom: 72px; }
  .page-hero { position: relative; padding: 36px 40px; margin-bottom: 28px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
    background: radial-gradient(120% 140% at 100% 0%, rgba(216, 180, 106, .10), transparent 55%), var(--surface); }
  .kicker { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
  .page-hero h1, .g-hero h1 { margin: 10px 0 0; font-family: Cinzel, Georgia, serif; font-size: 32px; font-weight: 700; letter-spacing: .02em; line-height: 1.2; color: var(--text); }
  .page-hero .lead, .g-hero .lead { margin: 12px 0 0; max-width: 820px; color: var(--muted); font-size: 15.5px; line-height: 1.65; }
  .doc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
  .doc-card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
  .doc-card h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
  .doc-card .f-icon { margin-bottom: 14px; }
  .doc-card p, .doc-card li { color: #cfccc6; font-size: 14.5px; line-height: 1.7; }
  .doc-card p { margin: 0 0 10px; }
  .doc-card p:last-child { margin-bottom: 0; }
  .doc-card ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
  .page a, .doc-card a { color: var(--accent); }
  .page .updated { margin-top: 20px; color: var(--faint); font-size: 12.5px; }
  .contact-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
  .contact-side { display: grid; gap: var(--gap); }
  .form-card { padding: 28px; }
  .form { display: grid; gap: 16px; margin-top: 8px; }
  .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .form label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
  .form label em { font-style: normal; font-weight: 400; color: var(--faint); letter-spacing: 0; margin-left: 4px; }
  .form input, .form textarea {
    width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px;
    font: inherit; font-size: 14px; font-weight: 400; letter-spacing: 0; padding: 10px 12px; outline: none; transition: border-color .15s;
  }
  .form input { height: 40px; }
  .form textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
  .form input:focus-visible, .form textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .form textarea::placeholder { color: var(--faint); }
  .form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .form-status { margin: 0; font-size: 13px; color: var(--muted); }
  .form-status.ok { color: var(--profit); }
  .form-status.err { color: var(--loss); }
  .form .btn { height: 40px; padding: 0 20px; }
  .form .btn:disabled { opacity: .6; cursor: default; }

  /* Analytics consent */
  .consent { position: fixed; z-index: 10; right: 24px; bottom: 24px; width: 360px;
    display: flex; flex-direction: column; gap: 14px; padding: 16px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.45); }
  .consent[hidden] { display: none; }
  .consent p { margin: 0; flex: 1; color: var(--muted); font-size: 13px; line-height: 1.5; }
  .consent a { color: var(--accent); }
  .consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .btn { height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #17130b; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
  .btn.ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
  .btn.ghost:hover { border-color: var(--muted); }

  /* Page heading above the list and on recipe / item pages */
  .page-head { margin: 0 0 16px; }
  .page-head.with-status { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
  .page-head.with-status .status { padding-bottom: 2px; }
  .page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
  .page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
  .page-head p a { color: var(--accent); text-decoration: none; }
  .page-head p a:hover { text-decoration: underline; }
  /* In the list, links look like plain text: the whole row opens the dialog. */
  .list a { color: inherit; text-decoration: none; }
  a.nm { color: inherit; text-decoration: none; }
  th.act, td.act { text-align: right; }
  .history-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--text); white-space: nowrap; transition: border-color .15s, background .15s; }
  tr.recipe:hover .history-btn { border-color: var(--muted); }
  /* A name that opens its page: one link, the name and a small gold arrow together. */
  a.page-link { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--text); text-decoration: none; }
  a.page-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  a.page-link > svg { flex: none; width: .9em; height: .9em; color: var(--accent); }
  .modal-name a.page-link { gap: 6px; }
  .modal-name a.page-link > svg { width: .7em; height: .7em; }
  a.page-link:hover > span { text-decoration: underline; text-underline-offset: 3px; }
  a.page-link:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); border-radius: 4px; }

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

  /* Stat tiles */
  .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
  .tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
  .tile > span { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
  .tile > b { font-size: 18px; font-weight: 600; }
  .tile > b.profit { color: var(--profit); }
  .tile > b.loss { color: var(--loss); }
  .tile .pill { align-self: flex-start; min-width: 0; }
  .tile > em { font-style: normal; font-size: 12px; line-height: 20px; color: var(--muted); }

  /* Range toggle */
  .seg.range button { padding: 0 14px; letter-spacing: 0; }

  /* Recipe and item pages */
  .detail-page { padding-top: 20px; }
  .crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--faint); margin-bottom: 14px; }
  .crumbs a { color: var(--muted); text-decoration: none; }
  .crumbs a:hover { color: var(--accent); }
  .detail-controls { display: flex; gap: var(--gap); margin-bottom: var(--gap); }
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: var(--gap); min-width: 0; }
  .faq-panel { margin: var(--gap) 0 0; padding-bottom: 4px; }
  .panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); margin-bottom: 12px; }
  .panel h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
  .cols { display: grid; grid-template-columns: 1fr; gap: 0; }
  .reagent-list .reagent { height: 28px; font-size: 13.5px; }
  table.mini { width: 100%; border-collapse: collapse; table-layout: auto; }
  table.mini th { position: static; height: auto; padding: 0 0 8px; background: none; border-bottom: 1px solid var(--line); }
  table.mini td { padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
  table.mini td + td, table.mini th + th { padding-left: 12px; }
  table.mini tbody tr { cursor: pointer; }
  table.mini tbody tr:hover td { background: none; color: var(--text); }
  table.mini tr.sel td:first-child { color: var(--accent); font-weight: 600; }
  table.mini td.profit { color: var(--profit); font-weight: 600; }
  table.mini td.loss { color: var(--loss); font-weight: 600; }
  ul.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  details.more summary { cursor: pointer; width: max-content; margin-top: 10px; font-size: 13px; color: var(--accent); }
  /* Disclosure toggles: an SVG chevron instead of the browser's triangle. */
  details.more > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; }
  details.more > summary::-webkit-details-marker { display: none; }
  details.more > summary::before {
    content: ""; width: 10px; height: 10px; background: currentColor; transition: transform .15s;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  details.more[open] > summary::before { transform: rotate(90deg); }
  details.more[open] summary { margin-bottom: 0; }
  .panel-head + * + .panel-head, .links + .panel-head, details.more + .panel-head { margin-top: 18px; }
  ul.links li > a.page-link { flex: 1; }
  ul.links li { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
  ul.links li span { color: var(--faint); font-size: 12px; white-space: nowrap; }
  ul.links li.none { color: var(--faint); border: 0; }
  ul.links a { color: var(--text); text-decoration: none; }

  /* Price history chart */
  .chart { position: relative; }
  .chart-empty { padding: 48px 16px; text-align: center; color: var(--muted); font-size: 13px; }
  .chart-empty.small { padding: 18px 16px; font-size: 12.5px; }
  .sales-head { margin: 18px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
  .chart .bar { shape-rendering: geometricPrecision; }
  .chart-legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
  .chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
  .chart-legend i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
  .chart-frame { position: relative; }
  .chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
  .chart .grid { stroke: var(--line); stroke-width: 1; }
  .chart .tick { fill: var(--faint); font-size: 11px; font-family: Inter, system-ui, sans-serif; }
  .chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
  .chart .dot { stroke: var(--surface); stroke-width: 2; }
  .chart .cross { stroke: var(--muted); stroke-width: 1; }
  .chart-tip { position: absolute; top: 0; pointer-events: none; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; box-shadow: 0 10px 24px rgba(0,0,0,.45); display: grid; grid-template-columns: auto auto; column-gap: 20px; row-gap: 6px; white-space: nowrap; min-width: 180px; }
  .chart-tip[hidden] { display: none; }
  .tip-time { grid-column: 1 / -1; color: var(--text); font-size: 12px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .tip-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
  .tip-label i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
  .tip-val { text-align: right; font-weight: 600; color: var(--text); }
  .tip-sep { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .tip-val.profit { color: var(--profit); }
  .chart-legend { flex-wrap: wrap; row-gap: 6px; }
  .chart-legend i.dashed, .tip-label i.dashed { height: 0; background: none; border-top: 2px dashed; }
  .chart-legend i.band { height: 8px; border-radius: 2px; background: linear-gradient(90deg, rgba(76, 195, 138, .45) 50%, rgba(239, 107, 95, .45) 50%); }
  .chart-legend i.thin-key { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); background: var(--surface); border: 1.5px solid var(--accent); }
  .chart .band.gain { fill: var(--profit); fill-opacity: .14; }
  .chart .band.loss { fill: var(--loss); fill-opacity: .16; }
  .chart .line.dashed { stroke-width: 1.4; stroke-dasharray: 4 4; opacity: .85; }
  .chart .halo { opacity: .22; }
  .chart .clip { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .chart .thin-line { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 4; opacity: .45; }
  .chart .thin-mark { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
  .tip-note { grid-column: 1 / -1; max-width: 240px; white-space: normal; color: var(--accent); font-size: 12px; line-height: 1.45; padding-top: 6px; border-top: 1px solid var(--line); }
  .tip-val.loss { color: var(--loss); }

  /* Price history dialog on the list */
  dialog.modal { width: min(720px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 20px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0,0,0,.6); }
  dialog.modal::backdrop { background: rgba(5, 6, 8, .7); backdrop-filter: blur(2px); }
  .modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
  .modal-title { min-width: 0; }
  .modal-name { display: flex; align-items: center; min-width: 0; }
  .modal-name h2 { min-width: 0; }
  .modal-head h2 { margin: 0; font-size: 18px; outline: none; }
  .modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
  /* Header account button: gold outline when signed out (a call to sign in), quiet when signed in. */
  .account-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; margin-left: 8px; flex: none;
    border: 1px solid rgba(216, 180, 106, .55); border-radius: 8px; background: var(--accent-soft); color: var(--accent);
    font-size: 13.5px; font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s;
  }
  .account-btn:hover { border-color: var(--accent); }
  .account-btn.in { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
  .account-btn.in:hover, .account-btn[aria-current="page"] { border-color: var(--accent); }
  .account-btn span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Signed in: the name opens a small menu, on hover (pointer devices) and on click (phones). */
  .account-menu { position: relative; flex: none; margin-left: 8px; }
  .account-menu .account-btn { margin-left: 0; cursor: pointer; font-family: inherit; }
  .account-btn .chev { flex: none; color: var(--muted); }
  .account-list {
    display: none; position: absolute; right: 0; top: 100%; z-index: 5; min-width: 180px; padding: 6px; margin-top: 6px;
    border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 16px 40px rgba(0,0,0,.5);
  }
  /* An invisible bridge over the gap, so the menu stays open while the pointer moves down to it. */
  .account-list::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
  .account-menu.open .account-list { display: grid; }
  .account-menu.open .account-btn { border-color: var(--accent); }
  @media (hover: hover) { .account-menu:hover .account-list { display: grid; } .account-menu:hover .account-btn { border-color: var(--accent); } }
  .account-list a, .account-list button {
    all: unset; box-sizing: border-box; display: block; width: 100%; padding: 9px 12px; border-radius: 7px; cursor: pointer;
    color: var(--text); font-size: 13.5px; font-weight: 500; transition: background .15s;
  }
  .account-list a:hover, .account-list button:hover { background: var(--raised); }
  .account-list a:focus-visible, .account-list button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
  .account-list a[aria-current="page"] { color: var(--accent); }
  .account-list form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
  .account-list button { color: var(--muted); }

  /* Sign in */
  .auth-page { display: grid; place-items: start center; }
  .auth-card {
    width: 100%; max-width: 620px; padding: 36px 40px; border: 1px solid var(--line); border-radius: 14px;
    background: radial-gradient(120% 80% at 100% 0%, rgba(216, 180, 106, .08), transparent 60%), var(--surface);
  }
  .auth-card h1 { margin: 10px 0 0; font-family: Cinzel, Georgia, serif; font-size: 28px; line-height: 1.25; }
  .auth-card .lead { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
  .auth-perks { list-style: none; margin: 24px 0; padding: 0; display: grid; gap: 14px; }
  .auth-perks li { display: flex; gap: 14px; align-items: flex-start; }
  .auth-perks .fc-icon { width: 34px; height: 34px; border-radius: 9px; }
  .auth-perks b { display: block; font-size: 14.5px; color: var(--fc); }
  .auth-perks span:not(.fc-icon) { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
  .bnet-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; border-radius: 10px;
    background: #148eff; color: #fff; font-size: 15px; font-weight: 700; text-decoration: none; transition: background .15s;
  }
  .bnet-btn:hover { background: #0074e0; }
  .page a.bnet-btn { color: #fff; }
  .bnet-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  .auth-note { margin: 14px 0 0; color: var(--faint); font-size: 12.5px; line-height: 1.6; text-align: center; }
  .auth-note a { color: var(--muted); }
  .auth-error { margin: 16px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--loss-soft); color: var(--loss); font-size: 13.5px; }

  /* My account */
  /* Dashboard: character cards, tinted with the class colour */
  .chars { display: grid; gap: var(--gap); }
  .char {
    display: grid; grid-template-columns: 300px minmax(0, 1fr); min-width: 0; overflow: hidden;
    border: 1px solid var(--line); border-radius: 14px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--cc) 10%, transparent), transparent 45%), var(--surface);
  }
  .char-art { position: relative; min-height: 320px; overflow: hidden;
    background: radial-gradient(70% 60% at 50% 45%, color-mix(in srgb, var(--cc) 22%, transparent), transparent 70%); }
  /* Renders are 1600x1200 with the character small, its middle at about 47.7% across and 58.2% down
     (measured): scaled up and shifted so the character itself sits in the middle of the panel. */
  .char-art img { position: absolute; left: 50%; top: 50%; height: 205%; transform: translate(-47.7%, -58.2%); object-fit: contain; pointer-events: none; }
  .char-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
  .char-head h2 { margin: 0; font-family: Cinzel, Georgia, serif; font-size: 26px; color: var(--cc); line-height: 1.2; }
  .char-head h2 span { color: var(--muted); font-size: 18px; }
  .char-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
  .char-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
  .cs { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); min-width: 0; display: grid; gap: 4px; }
  .cs > span { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
  .cs > b { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cs > em { font-style: normal; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Professions: the two primary ones side by side, the (up to three) secondary ones in a compact row. */
  .char-profs { display: grid; gap: var(--gap); }
  .cp-row { display: grid; gap: var(--gap); }
  .cp-row.primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-row.secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cp.compact { padding: 12px 14px; gap: 8px; }
  .cp.unlearned { background: transparent; border-style: dashed; }
  .cp.unlearned .cp-icon { background: var(--raised); color: var(--faint); }
  .cp.unlearned .cp-head b { color: var(--muted); }
  .cp.unlearned .cp-skill { color: var(--faint); font-weight: 500; }
  .cp.compact .cp-icon { width: 26px; height: 26px; } .cp.compact .cp-icon svg { width: 16px; height: 16px; }
  .cp.compact .cp-head b { font-size: 13.5px; }
  .cp.compact .cp-pays { font-size: 12.5px; }
  .cp { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); display: grid; gap: 10px; align-content: start; min-width: 0; }
  .cp-head { display: flex; align-items: center; gap: 10px; }
  .cp-head b { flex: 1; font-size: 14.5px; }
  .cp-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); flex: none; }
  .cp-icon svg { width: 18px; height: 18px; }
  .cp-skill { color: var(--muted); font-size: 12.5px; font-weight: 600; }
  .cp-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
  .cp-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #f2d48a); }
  .cp-pays { display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
  .cp-pays b.profit { color: var(--profit); }
  .cp-pays ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .cp-pays li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-width: 0; font-size: 13px; color: var(--text); }
  .cp-pays li b { white-space: nowrap; font-weight: 600; }
  .cp-all { color: var(--accent); font-size: 12.5px; font-weight: 600; text-decoration: none; }
  button.cp-all, button.cp-count { all: unset; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); }
  button.cp-count { font-size: inherit; color: var(--profit); text-decoration: underline; text-decoration-color: rgba(76, 195, 138, .45); text-underline-offset: 3px; }
  button.cp-all:hover, a.cp-all:hover { text-decoration: underline; text-underline-offset: 3px; }
  button.cp-count:hover { text-decoration-color: currentColor; }
  button.cp-all:focus-visible, button.cp-count:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
  .cp-all.quiet { color: var(--muted); }
  .cp-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
  .cp-cap { color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: -2px; }
  .char-note { margin: 0; color: var(--faint); font-size: 13px; }
  .char.small { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 14px 18px; }
  .char.small h2 { margin: 0; font-family: Cinzel, Georgia, serif; font-size: 18px; color: var(--cc); }
  .char.small h2 span { color: var(--muted); font-size: 14px; }
  .char.small p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
  .char.small .char-note { margin-top: 6px; }
  .char-initial { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-family: Cinzel, Georgia, serif; font-size: 22px; font-weight: 700; color: var(--cc); background: color-mix(in srgb, var(--cc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--cc) 35%, transparent); }
  .account-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
  .account-actions form { margin: 0; }
  details.danger summary { cursor: pointer; color: var(--loss); font-size: 13px; font-weight: 600; height: 34px; display: flex; align-items: center; }
  details.danger p { margin: 4px 0 10px; color: var(--muted); font-size: 13px; }
  .btn.danger-btn { background: var(--loss); border-color: var(--loss); color: #fff; }

  /* Follow (watchlist) */
  .modal-actions { display: flex; align-items: center; gap: 8px; flex: none; }
  .head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .follow-btn {
    all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; flex: none;
    border: 1px solid var(--line-strong); border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 600; transition: border-color .15s, background .15s;
  }
  .follow-btn:hover { border-color: var(--accent); }
  .follow-btn:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
  .follow-btn[aria-pressed="true"] { color: var(--accent); border-color: rgba(216, 180, 106, .45); background: var(--accent-soft); }
  .follow-btn[aria-pressed="true"] svg { fill: currentColor; }

  /* Home: My watchlist */
  .wpanel { padding: 4px 18px; margin: 0; }
  .wlist { list-style: none; margin: 0; padding: 0; }
  .wlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto 120px 80px 32px; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
  .wlist li:last-child { border-bottom: 0; }
  .wlist li.w-empty { display: block; padding: 14px 0; color: var(--muted); font-size: 13.5px; }
  .w-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
  .w-value { text-align: right; font-weight: 600; }
  .w-value .profit { color: var(--profit); } .w-value .loss { color: var(--loss); }
  .w-change { text-align: right; font-size: 13px; font-weight: 600; color: var(--muted); }
  .w-change.profit { color: var(--profit); } .w-change.loss { color: var(--loss); }
  .w-deal { min-width: 0; }

  .icon-btn { all: unset; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); flex: none; }
  .icon-btn:hover { background: var(--raised); color: var(--text); }
  .icon-btn:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
  .modal .tile { background: var(--raised); }
  dialog.modal { overflow: auto; }
  .modal .tiles { grid-template-columns: repeat(4, 1fr); }
  .modal-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
  .modal-section h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

  /* Home */
  main.home { padding-top: 40px; }
  .hero { position: relative; padding: 8px 0 12px; margin-bottom: 36px; }
  .hero > *:not(.hero-bg) { position: relative; }
  .hero-bg { position: absolute; top: 8px; bottom: 8px; right: 0; width: 38%; pointer-events: none; color: var(--accent);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 35%); mask-image: linear-gradient(to right, transparent 0%, #000 35%); }
  .hero-bg::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(216, 180, 106, .045), transparent); }
  .hero-bg svg { position: absolute; animation: drift 7s ease-in-out infinite; }
  .hero-bg svg:nth-child(3n) { animation-duration: 9s; animation-delay: -3s; }
  .hero-bg svg:nth-child(3n+1) { animation-duration: 8s; animation-delay: -5s; }
  @keyframes drift { 50% { translate: 0 -7px; } }
  @media (prefers-reduced-motion: reduce) { .hero-bg svg, .live-dot { animation: none; } }
  .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 99px; color: var(--muted); font-size: 12.5px; font-weight: 500; background: var(--bg); }
  .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--profit); box-shadow: 0 0 0 3px var(--profit-soft); animation: live 2s ease-in-out infinite; }
  @keyframes live { 50% { box-shadow: 0 0 0 6px rgba(76, 195, 138, 0); } }
  .hero h1 { margin: 18px 0 0; font-size: 38px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
  .hero p { margin: 14px 0 24px; max-width: 640px; color: var(--muted); font-size: 16px; line-height: 1.6; }
  .hero-controls { display: flex; gap: var(--gap); }
  .hero .status { margin-top: 14px; }

  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: 44px; }
  .stat { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 4px; }
  .stat b { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
  .stat span { color: var(--muted); font-size: 13px; }

  .home-section { margin-bottom: 40px; }

  /* Home: the four ways to make gold */
  .fgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
  .fcard {
    display: flex; flex-direction: column; gap: 12px; padding: 18px; min-width: 0; text-decoration: none; color: var(--text);
    background: linear-gradient(180deg, var(--fc-soft), transparent 70%), var(--surface);
    border: 1px solid var(--line); border-top: 2px solid var(--fc); border-radius: var(--radius); transition: border-color .15s;
  }
  .fcard:hover { border-color: var(--fc); }
  .fcard:focus-visible { outline: 2px solid var(--fc); outline-offset: 2px; }
  .fc-head { display: flex; align-items: center; gap: 12px; }
  .fc-head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--fc); }
  .fc-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--fc-soft); color: var(--fc); }
  .fcard p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
  .fc-live { display: grid; gap: 4px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); min-width: 0; }
  .fc-live span { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
  .fc-live b { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14.5px; font-weight: 600; min-width: 0; }
  .fc-live b i { font-style: normal; color: var(--profit); white-space: nowrap; }
  .fc-cta { display: inline-flex; align-items: center; gap: 4px; color: var(--fc); font-size: 13px; font-weight: 600; }

  /* Home: live panels */
  .dash { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
  .dpanel { padding: 14px 18px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
  .dp-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .dp-head .fc-icon { width: 28px; height: 28px; border-radius: 8px; }
  .dp-head h3 { margin: 0; flex: 1; font-size: 14.5px; font-weight: 600; }
  .dp-all { display: inline-flex; align-items: center; gap: 3px; color: var(--fc); font-size: 12.5px; font-weight: 600; text-decoration: none; }
  .dpanel .toplist { padding: 0; background: none; border: 0; border-radius: 0; }
  .dpanel .toplist li { grid-template-columns: 22px minmax(0, 1fr) auto; padding: 10px 0; }
  .dpanel .tl-name { flex-direction: column; gap: 2px; font-size: 13.5px; }
  .dpanel .tl-prof { font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .dpanel .plain { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

  /* Deals and vendor flips tables */
  table.deals col.c-item, table.to-ah col.c-item { width: 27%; } table.to-vendor col.c-item { width: 40%; }
  table.deals col.c-num, table.to-ah col.c-num { width: 11%; } table.to-vendor col.c-num { width: 12%; }
  col.c-pill { width: 9%; } table.deals col.c-act, table.to-ah col.c-act { width: 124px; }
  table.deals td.p .m, table.to-ah td.p .m, table.to-vendor td.p .m { font-size: 11.5px; }
  table.to-vendor td.p .m { color: var(--muted); font-weight: 400; }
  .flip-section { margin-top: 28px; }
  .flip-section:first-of-type { margin-top: 8px; }
  .list-note { margin: 10px 2px 0; color: var(--faint); font-size: 12.5px; }
  .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
  .section-head h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .section-head p { margin: 0; color: var(--faint); font-size: 13px; }
  a.sh-link { color: var(--accent); text-decoration: none; font-weight: 600; }
  a.sh-link:hover { text-decoration: underline; text-underline-offset: 3px; }

  /* Guide cards (guides index and home) */
  .ggrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
  .ggrid.compact { grid-template-columns: repeat(4, 1fr); }
  .gcard { display: flex; flex-direction: column; gap: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s; min-width: 0; }
  .gcard:hover { border-color: var(--line-strong); }
  .gcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .gc-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .gc-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
  .gc-meta { display: flex; flex-wrap: wrap; gap: 0 10px; margin-top: 3px; color: var(--faint); font-size: 12.5px; }
  .gc-meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin-right: 10px; vertical-align: middle; }
  .gc-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; row-gap: 3px; align-items: end; }
  .gc-label { grid-column: 1; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
  .gc-cost { grid-column: 1; font-size: 14px; font-weight: 600; }
  .gc-cost.gc-text { font-weight: 500; color: var(--muted); font-size: 13px; }
  .gcard .pc-open { grid-column: 2; grid-row: 1 / span 2; align-self: end; font-size: 12.5px; }
  .ggrid.compact .gcard { padding: 16px; gap: 14px; }

  /* Leveling guide page */
  .guide-page { padding-top: 20px; }
  .g-hero { display: flex; gap: 22px; align-items: flex-start; padding: 32px 36px; margin-bottom: var(--gap); border: 1px solid var(--line); border-radius: 14px;
    background: radial-gradient(120% 140% at 100% 0%, rgba(216, 180, 106, .10), transparent 55%), var(--surface); }
  .g-icon { flex: none; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(216, 180, 106, .25); }
  .g-icon .prof-icon { width: 34px; height: 34px; }
  .g-hero-text { min-width: 0; }
  .g-hero h1 { margin-top: 8px; }
  .tile > b.tile-text { font-size: 16px; }
  .g-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 var(--gap); }
  .g-controls .detail-controls { margin: 0; }
  .g-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: start; }
  .g-side { display: grid; gap: 0; min-width: 0; }
  .callout { margin: 0 0 14px; padding: 12px 14px; border: 1px solid rgba(216, 180, 106, .3); border-radius: 8px; background: var(--accent-soft); color: #e6dcc6; font-size: 13.5px; line-height: 1.55; }
  .callout b { color: var(--accent); }

  ol.route { list-style: none; margin: 0; padding: 0; }
  .step { display: grid; grid-template-columns: 92px minmax(0, 1fr) 128px; gap: 16px; align-items: start; padding: 16px 0; border-top: 1px solid var(--line); }
  ol.route > li:first-child { border-top: 0; padding-top: 4px; }
  .st-range { display: flex; align-items: baseline; justify-content: center; gap: 4px; height: 34px; align-items: center; border-radius: 8px; background: var(--raised); border: 1px solid var(--line-strong); font-size: 13.5px; }
  .st-range b { font-weight: 700; color: var(--text); }
  .st-range span { color: var(--faint); }
  .st-body { min-width: 0; display: grid; gap: 6px; }
  .st-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 15px; font-weight: 600; }
  .st-title > span:not(.st-count), .st-title a { min-width: 0; }
  .st-count { flex: none; color: var(--accent); font-size: 13px; font-weight: 700; }
  .st-mats { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; }
  .st-mats a { color: #cfccc6; text-decoration: none; }
  .st-mats a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
  .st-src { color: var(--faint); font-size: 12.5px; }
  .st-src b { color: var(--muted); font-weight: 600; }
  .st-bar { position: relative; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
  .st-bar span { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: linear-gradient(90deg, #a87621, var(--accent)); }
  .st-cost { text-align: right; display: grid; gap: 4px; justify-items: end; font-weight: 600; font-size: 14px; white-space: nowrap; }
  .st-cost em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--faint); }
  .milestone { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin: 4px 0; border: 1px dashed rgba(216, 180, 106, .35); border-radius: 8px; background: rgba(216, 180, 106, .05); }
  .ms-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
  .milestone b { display: block; font-size: 13.5px; color: var(--accent); font-weight: 600; }
  .milestone em { font-style: normal; font-size: 12.5px; color: var(--muted); }
  .milestone + .step { border-top: 0; }

  .step.gather { grid-template-columns: 92px minmax(0, 1fr); }
  .nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
  .node { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
  .nd-name { font-weight: 600; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nd-skill { color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
  .nd-item { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); min-width: 0; }
  .nd-item a.page-link { color: var(--muted); font-size: 12.5px; }
  .nd-name a.page-link { color: var(--text); }
  .nd-price { flex: none; color: var(--text); font-weight: 600; }

  ul.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
  ul.tips li { position: relative; padding-left: 22px; color: #cfccc6; font-size: 14px; line-height: 1.65; }
  ul.tips li::before { content: ""; position: absolute; left: 4px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); }
  .faq { display: grid; }
  details.qa { border-top: 1px solid var(--line); }
  details.qa:first-child { border-top: 0; }
  details.qa > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; font-size: 14.5px; font-weight: 600; }
  details.qa > summary::-webkit-details-marker { display: none; }
  details.qa > summary::after { content: ""; flex: none; width: 12px; height: 12px; background: var(--muted); transition: transform .15s;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
  details.qa[open] > summary::after { transform: rotate(180deg); }
  details.qa p { margin: 0 0 14px; color: #cfccc6; font-size: 14px; line-height: 1.7; }
  .g-note { margin: 4px 2px 0; color: var(--faint); font-size: 12.5px; line-height: 1.6; }

  ul.ranks { list-style: none; margin: 0; padding: 0; }
  ul.ranks li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line); }
  ul.ranks li:first-child { border-top: 0; padding-top: 0; }
  ul.ranks b { font-size: 13.5px; font-weight: 600; }
  ul.ranks span { grid-column: 1; color: var(--muted); font-size: 12.5px; }
  ul.ranks em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; color: var(--accent); font-size: 12.5px; font-weight: 600; }
  ul.shopping { list-style: none; margin: 0; padding: 0; }
  ul.shopping li { display: grid; grid-template-columns: minmax(0, 1fr) 52px auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
  ul.shopping li.sl-head { border-top: 0; padding-top: 0; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
  ul.shopping li.sl-head span:not(:first-child) { text-align: right; }
  .sl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sl-name a { color: var(--text); text-decoration: none; }
  .sl-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
  .sl-qty { text-align: right; color: var(--muted); }
  .sl-cost { text-align: right; }
  .side-note { margin: 10px 0 0; color: var(--faint); font-size: 12px; }
  ul.other-guides { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  ul.other-guides a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13px; transition: background .15s, color .15s; }
  ul.other-guides a:hover { background: var(--raised); color: var(--text); }
  .og-icon { display: grid; place-items: center; color: var(--accent); }
  .og-icon .prof-icon { width: 16px; height: 16px; }

  .pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
  .pcard { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s; min-width: 0; }
  .pcard:hover { border-color: var(--line-strong); }
  .pcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .pc-head { display: flex; align-items: center; gap: 12px; }
  .pc-head h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
  .pc-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
  .pc-top { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 7px; align-items: baseline; }
  .pc-label { grid-column: 1 / -1; margin-bottom: 1px; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
  .pc-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .pc-profit { color: var(--profit); font-weight: 600; font-size: 14px; }
  .pc-none { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; }
  .pc-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .pc-open { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; white-space: nowrap; }

  .toplist { list-style: none; margin: 0; padding: 4px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .toplist li { display: grid; grid-template-columns: 28px 1fr auto 72px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .toplist li:last-child { border-bottom: 0; }
  .toplist.mat li { grid-template-columns: 28px 1fr auto 110px; }
  .toplist .tl-sold { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
  .toplist.mat .tl-profit { color: var(--text); text-align: right; }
  .toplist li.none { display: block; color: var(--muted); }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--gap); }
  .chip { padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; transition: border-color .15s; }
  .chip:hover { border-color: var(--accent); }
  .rank { color: var(--faint); font-size: 13px; font-weight: 600; }
  .tl-name { display: flex; align-items: baseline; gap: 12px; min-width: 0; font-size: 14px; }
  .tl-prof { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
  .tl-profit { font-weight: 600; text-align: right; }
  .tl-profit.profit { color: var(--profit); }
  .tl-margin { text-align: right; }
  .tl-margin .pill { min-width: 0; }

  .features { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
  .feature { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .f-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--raised); border: 1px solid var(--line-strong); color: var(--accent); margin-bottom: 14px; }
  .feature h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
  .feature p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

  /* Narrow desktops: the reagents column gives way (the dialog lists them). */
  @media (min-width: 721px) and (max-width: 1150px) {
    /* Keep the cell (fixed tables map cells to columns by position); just empty it. */
    .list th.r, .list td.r { padding: 0; border-left: 0; overflow: hidden; font-size: 0; }
    .list td.r > * { display: none; }
    col.c-reagents { width: 0; }
    col.c-recipe { width: 22%; } col.c-num { width: 12%; } col.c-margin { width: 10%; } col.c-sold { width: 12%; } col.c-ah { width: 10%; } col.c-act { width: 56px; }
    table.mat col.c-act, table.deals col.c-act, table.to-ah col.c-act { width: 56px; }
    table.to-vendor col.c-item { width: 30%; } table.to-vendor col.c-num { width: 14%; }
    /* "Profit / unit" reads "Profit" here; the header's tooltip says per unit. */
    th .u { display: none; }
    .list th, .list td { padding-left: 10px; padding-right: 10px; }
    .list th { letter-spacing: .03em; }
    .list th:not(.on) .arrow { display: none; }
    .history-btn { width: 30px; padding: 0; justify-content: center; }
    .hb-text { display: none; }
  }

  @media (max-width: 1150px) {
    .fgrid { grid-template-columns: repeat(2, 1fr); }
    .ggrid.compact { grid-template-columns: repeat(3, 1fr); }
    .g-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  }
  @media (max-width: 1000px) {
    .g-layout { grid-template-columns: 1fr; }
    .g-side { position: static; grid-template-columns: 1fr 1fr; column-gap: var(--gap); }
    .ggrid, .ggrid.compact { grid-template-columns: repeat(2, 1fr); }
    .features { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 900px) {
    .char { grid-template-columns: 1fr; } .char-art { min-height: 300px; }
  }
  @media (max-width: 820px) {
    .dash { grid-template-columns: 1fr; }
    .char-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cp-row.primary, .cp-row.secondary { grid-template-columns: 1fr; }
  }

  /* Mobile-only parts, hidden on desktop */
  .m { display: none; }

  /* Narrower than the whole menu: it moves behind the menu button. */
  @media (max-width: 1000px) {
    /* A fixed top padding (not a centred min-height): the logo row stays put when the menu opens below it. */
    .brand { flex-wrap: wrap; align-content: flex-start; height: auto; padding: 15px 0; row-gap: 6px; }
    .brand .menu-btn { display: grid; order: 3; margin-left: 4px; }
    .account-btn { order: 2; margin-left: auto; }
    .account-menu { order: 2; margin-left: auto; } .account-menu .account-btn { margin-left: 0; }
    .brand-link { order: 1; }
    .nav { display: none; order: 4; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 2px; margin: 4px 0 4px; }
    .top.nav-open .nav { display: flex; }
    .nav a { padding: 10px 12px; }
  }

  @media (max-width: 720px) {
    .wrap { padding: 0 16px; }
    .top { position: static; }
    .page-head.with-status { flex-direction: column; align-items: flex-start; gap: 8px; }
    .status { white-space: normal; font-size: 11.5px; }
    /* One full-width column: region, profession, house, search, sort. */
    .controls { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .controls .seg { display: grid; grid-template-columns: 1fr 1fr; }
    .controls select, .search { width: 100%; min-width: 0; }
    .controls .m { display: block; }
    main.wrap { padding-top: 16px; }
    /* A character card on a phone: the render is a small portrait next to the name (it used to fill a 260px
       band), then the stats and professions at the full card width. .char-body dissolves into the card's grid. */
    .char:not(.small) { grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "art head" "stats stats" "profs profs"; gap: 14px; padding: 16px; align-items: center; }
    .char:not(.small) .char-body { display: contents; }
    .char:not(.small) .char-art { grid-area: art; min-height: 0; width: 96px; height: 104px; border-radius: 12px; }
    .char:not(.small) .char-emblem { font-size: 44px; }
    .char:not(.small) .char-head { grid-area: head; min-width: 0; }
    .char:not(.small) .char-head h2 { font-size: 22px; } .char:not(.small) .char-head h2 span { font-size: 16px; }
    .char:not(.small) .char-stats { grid-area: stats; }
    .char:not(.small) .char-profs, .char:not(.small) > .char-body > .char-note { grid-area: profs; }
    .char-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-btn { height: 32px; padding: 0 10px; } .account-btn span { max-width: 90px; }
  }
  /* Small phones: the account button is its icon, so logo, account and menu stay on one row. */
  @media (max-width: 480px) {
    .account-btn { width: 32px; padding: 0; justify-content: center; }
    .account-btn span { display: none; }
    .account-btn .chev { display: none; }
    .auth-card { padding: 24px 18px; } .auth-card h1 { font-size: 22px; }
    .wpanel { padding: 2px 14px; }
    .wlist li { grid-template-columns: minmax(0, 1fr) auto 28px; grid-template-areas: 'name value x' 'name change x'; row-gap: 2px; }
    .w-name { grid-area: name; } .w-value { grid-area: value; } .w-change { grid-area: change; font-size: 12px; } .w-remove { grid-area: x; }
    .w-badge { display: none; }
    .head-row { align-items: flex-start; }
    .fgrid { grid-template-columns: 1fr; }
    .fcard { padding: 16px; gap: 10px; }
    .dpanel { padding: 12px 14px 4px; }

    .d { display: none; }
    table { table-layout: auto; }
    col { width: auto !important; }
    th { top: 0; padding: 0 12px; }
    td { padding: 12px; }
    td.p { width: 1%; white-space: nowrap; }
    td.act, th.act { width: 1%; padding-left: 4px; }
    .history-btn { height: 30px; width: 30px; padding: 0; justify-content: center; }
    .hb-text { display: none; }
    /* Let the name column shrink so long names ellipsize instead of pushing profit off screen. */
    tr.recipe td:first-child { width: 100%; max-width: 0; }
    td.p .m { display: block; margin-top: 4px; }
    td.p .pill { min-width: 0; font-size: 11px; padding: 1px 7px; }


    .foot-main { flex-direction: column; gap: 28px; padding: 32px 0 24px; }
    .foot-cols { gap: 40px; }
    .foot-col { text-align: left; }
    .foot-bottom { flex-direction: column; gap: 6px; }
    main.home { padding-top: 24px; }
    .hero { margin-bottom: 24px; }
    .hero-bg { display: none; }
    .hero h1 { font-size: 27px; margin-top: 14px; }
    .hero p { font-size: 14.5px; }
    .stats { gap: 8px; margin-bottom: 32px; }
    .stat { padding: 14px; }
    .stat b { font-size: 19px; }
    .hero-controls { flex-direction: column; }
    .hero-controls .seg { display: grid; grid-template-columns: 1fr 1fr; }
    .hero-controls select { width: 100%; }
    .pgrid, .features { grid-template-columns: 1fr; }
    .pcard { padding: 14px; gap: 8px; }
    .pc-head h3 { font-size: 15px; }
    .pc-foot { padding-top: 0; border-top: 0; font-size: 12px; }
    .feature { padding: 14px; display: grid; grid-template-columns: 38px 1fr; column-gap: 12px; align-items: start; }
    .f-icon { grid-row: span 2; margin: 0; }
    .feature h3 { margin: 2px 0 4px; }
    .section-head { flex-direction: column; gap: 4px; }
    .toplist { padding: 2px 14px; }
    .toplist li { grid-template-columns: 22px 1fr auto; }
    .toplist.mat li { grid-template-columns: 22px 1fr auto; }
    .toplist.mat .tl-sold { display: none; }
    .tl-margin { display: none; }
    .tl-name { flex-direction: column; gap: 2px; }
    .page-head h1 { font-size: 18px; }
    .detail-controls { flex-direction: column; }
    ul.links { grid-template-columns: 1fr; }
    .detail-controls .seg { display: grid; grid-template-columns: 1fr 1fr; }
    .detail-controls select { width: 100%; }
    .tiles { grid-template-columns: 1fr 1fr; }
    .modal .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
    .tiles.three { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
      .modal .tile, .tiles.three .tile { padding: 10px; }
    .modal .tile > b, .tiles.three .tile > b { font-size: 14px; }
    .tiles.three .tile > span { font-size: 10px; }
    dialog.modal { padding: 16px; }
    .page { padding-top: 16px; }
    .page-hero, .g-hero { padding: 22px 18px; }
    .page-hero h1, .g-hero h1 { font-size: 23px; }
    .page-hero .lead, .g-hero .lead { font-size: 14.5px; }
    .doc-grid, .contact-grid { grid-template-columns: 1fr; }
    .doc-card, .form-card { padding: 18px; }
    .ggrid, .ggrid.compact { grid-template-columns: 1fr; }
    .g-hero { flex-direction: column; gap: 14px; }
    .g-icon { width: 48px; height: 48px; border-radius: 12px; }
    .g-icon .prof-icon { width: 26px; height: 26px; }
    .g-controls { flex-direction: column; align-items: stretch; }
    .g-side { grid-template-columns: 1fr; }
    .step { grid-template-columns: minmax(0, 1fr) 96px; gap: 8px 12px; }
    .step .st-range { grid-column: 1 / -1; justify-self: start; padding: 0 12px; height: 28px; }
    .step .st-body { grid-column: 1; }
    .step .st-cost { grid-column: 2; grid-row: 2; }
    .step.gather { grid-template-columns: 1fr; }
    .nodes { grid-template-columns: 1fr; }
    .milestone { padding: 10px 12px; }
    .row2 { grid-template-columns: 1fr; }
    .form-foot { flex-direction: column-reverse; align-items: stretch; text-align: center; }
    .consent { left: 16px; right: 16px; bottom: 16px; width: auto; }
  }

  /* ---- Accounts ------------------------------------------------------------------------ */
  .btn.big { height: 42px; padding: 0 20px; font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; border-radius: 10px; }
  .hero-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
  .hero-cta span, .preview-cta span { color: var(--faint); font-size: 12.5px; }

  /* Home, signed out: the dashboard preview */
  .preview { display: grid; gap: var(--gap); }
  .preview-copy { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px;
    background: radial-gradient(80% 120% at 100% 0%, rgba(216, 180, 106, .08), transparent 60%), var(--surface); }
  .preview-copy .auth-perks { margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; flex: 1; }
  .preview-cta { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
  .preview-card { position: relative; }
  .preview-tag { position: absolute; top: 12px; left: 12px; z-index: 1; padding: 3px 9px; border-radius: 99px; background: rgba(0, 0, 0, .55); border: 1px solid var(--line-strong); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .char-emblem { position: absolute; inset: 0; display: grid; place-items: center; font-family: Cinzel, Georgia, serif; font-size: 120px; font-weight: 700; color: color-mix(in srgb, var(--cc) 55%, transparent); }

  /* Sign-up dialog (Follow while signed out) */
  dialog.signup { width: min(460px, calc(100% - 32px)); padding: 26px 26px 22px; }
  dialog.signup h2 { margin: 8px 0 0; font-family: Cinzel, Georgia, serif; font-size: 22px; line-height: 1.3; }
  dialog.signup p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
  dialog.signup ul { margin: 12px 0 18px; padding-left: 18px; color: var(--text); font-size: 13.5px; line-height: 1.7; }
  .signup-close { position: absolute; top: 12px; right: 12px; }
  dialog.signup .bnet-btn { color: #fff; }

  /* Dashboard */
  .me-page .page-head p a { color: var(--accent); }
  .me-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
  .me-grid .home-section { margin-bottom: 40px; }
  .panel.tool { padding: 14px 18px 4px; margin: 0; }
  .tool-form { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .tool-form input[type=number], .tool-form select, .w-house input[type=url] {
    height: var(--h); padding: 0 10px; background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13.5px; outline: none; }
  .tool-form input[type=number] { width: 110px; }
  .tool-form input:focus-visible, .w-house input:focus-visible { border-color: var(--accent); }
  .tool-form .btn { height: var(--h); }
  .picker { position: relative; flex: 1; min-width: 180px; }
  .picker-q { width: 100%; height: var(--h); padding: 0 12px; background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13.5px; outline: none; }
  .picker-q:focus-visible { border-color: var(--accent); }
  .picker-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); max-height: 260px; overflow: auto; }
  .picker-list button { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
  .picker-list button:hover, .picker-list button:focus-visible { background: var(--surface); }
  .picker-list .none { padding: 8px 10px; color: var(--faint); font-size: 13px; }
  .tlist { list-style: none; margin: 0; padding: 0; }
  .tlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .tlist li:last-child { border-bottom: 0; }
  .tlist li.w-empty { display: block; padding: 14px 0; color: var(--muted); font-size: 13.5px; }
  .ledger-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .inbox { margin-bottom: 28px; }
  .inbox ul { list-style: none; margin: 0; padding: 4px 18px; border: 1px solid rgba(240, 127, 174, .35); border-radius: var(--radius); background: rgba(240, 127, 174, .06); }
  .inbox li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
  .inbox li:last-child { border-bottom: 0; }
  .inbox .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--f-deals); }
  .inbox em { font-style: normal; color: var(--faint); font-size: 12px; }

  /* Welcome and settings */
  .welcome h1 { font-size: 26px; }
  .w-step { display: flex; align-items: center; gap: 10px; margin: 26px 0 6px; font-size: 15px; font-weight: 700; }
  .w-step i { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-style: normal; font-size: 12.5px; }
  .w-hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.55; }
  .w-house { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .w-house select { flex: 1; min-width: 180px; }
  .w-house input[type=url] { flex: 1; min-width: 240px; }
  .goals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .goal { position: relative; display: grid; justify-items: start; gap: 4px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
  .goal input { position: absolute; opacity: 0; }
  .goal:has(input:checked) { border-color: var(--fc); background: var(--fc-soft); }
  .goal:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--fc); }
  .goal .fc-icon { width: 32px; height: 32px; border-radius: 9px; margin-bottom: 6px; }
  .goal b { font-size: 14px; color: var(--fc); } .goal em { font-style: normal; font-size: 12.5px; color: var(--muted); }
  .suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
  .sg { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
  .sg:has(input:checked) { border-color: rgba(216, 180, 106, .5); background: var(--accent-soft); }
  .sg input { margin-top: 3px; accent-color: var(--accent); }
  .sg b { display: block; font-size: 13.5px; } .sg em { font-style: normal; color: var(--muted); font-size: 12px; }
  .gold-btn { margin-top: 26px; background: var(--accent); color: #17130b; border: 0; width: 100%; cursor: pointer; font: inherit; font-size: 15px; font-weight: 700; }
  .gold-btn:hover { background: #e6c47c; }
  .page button.gold-btn { color: #17130b; }
  .saved { color: var(--profit); font-size: 13px; font-weight: 600; }
  .settings-page .panel { margin-bottom: var(--gap); }
  .discord-test-row { margin-top: 10px; }

  /* Guide progress */
  .step.done { opacity: .45; }
  .step.here { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border-radius: 8px; }
  .here-badge { grid-column: 1 / -1; justify-self: start; padding: 3px 10px; border-radius: 99px; background: var(--accent); color: #17130b; font-size: 11.5px; font-weight: 700; }
  .callout.mine { border-color: rgba(76, 195, 138, .35); background: var(--profit-soft); }
  .callout.mine b { color: var(--profit); }
  .callout.cta a { color: var(--accent); font-weight: 600; }

  @media (max-width: 1000px) {
    .preview-copy { flex-direction: column; align-items: stretch; }
    .me-grid { grid-template-columns: 1fr; }
    .ledger-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 720px) {
    .preview-copy .auth-perks { grid-template-columns: 1fr; }
    .goals { grid-template-columns: 1fr; }
    .tool-form input[type=number] { width: calc(50% - 4px); }
  }

  /* Sign-in nudges (signed out) and personal notes (signed in) under page titles */
  .cta-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 var(--gap); padding: 10px 12px 10px 16px;
    border: 1px solid rgba(216, 180, 106, .3); border-radius: var(--radius); background: var(--accent-soft); color: #e6dcc6; font-size: 13.5px; }
  .cta-strip .btn { flex: none; display: inline-flex; align-items: center; text-decoration: none; }
  .cta-strip.mine { border-color: rgba(76, 195, 138, .3); background: var(--profit-soft); padding: 10px 16px; }
  .cta-strip a:not(.btn) { color: var(--accent); }
  .cta-strip b.profit { color: var(--profit); }
  @media (max-width: 720px) { .cta-strip { flex-direction: column; align-items: stretch; } .cta-strip .btn { justify-content: center; } }

  /* Signed in, on an item page: alert and inventory forms */
  .item-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; width: 100%; }
  .it-form { display: flex; align-items: center; gap: 8px; margin: 0; color: #d9e9df; font-size: 13.5px; }
  .it-form select, .it-form input { height: 32px; padding: 0 8px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13px; outline: none; }
  .it-form select { min-width: 0; padding-right: 28px; background-position: right 8px center; }
  .it-form input { width: 90px; }
  .it-form input:focus-visible, .it-form select:focus-visible { border-color: var(--accent); }
  .it-form .btn { height: 32px; }
  .it-unit { color: var(--gold); font-weight: 700; margin-left: -4px; }
  .it-worth { color: var(--muted); }
  .it-alerts { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
  .chip-alert { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line-strong); font-size: 12px; color: var(--muted); }
  .chip-alert button { all: unset; cursor: pointer; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--faint); }
  .chip-alert button:hover { color: var(--text); background: var(--raised); }
  @media (max-width: 720px) { .it-form { flex-wrap: wrap; } }

  /* Settings rows: a title and a line of explanation, the action on the right */
  .set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
  .panel-head + .set-row { border-top: 0; padding-top: 2px; }
  .set-row b { display: block; font-size: 14px; }
  .set-row span { color: var(--muted); font-size: 13px; }
  /* Links styled as buttons: dark text on gold, light text on ghost and danger buttons. */
  .page a.btn, a.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; color: #17130b; flex: none; }
  .page a.btn.ghost, a.btn.ghost { color: var(--text); }
  details.set-row { display: block; }
  details.set-row > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; list-style: none; cursor: pointer; }
  details.set-row > summary::-webkit-details-marker { display: none; }
  .btn.danger-ghost { display: inline-flex; align-items: center; height: 34px; color: var(--loss); border-color: rgba(239, 107, 95, .45); flex: none; }
  details.set-row:hover .danger-ghost { border-color: var(--loss); }
  details.set-row .confirm { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--loss-soft); }
  details.set-row .confirm span { color: var(--loss); }
  @media (max-width: 720px) { .set-row, details.set-row > summary, details.set-row .confirm { flex-direction: column; align-items: stretch; } }

  /* Home: alerts on Discord */
  .dc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--gap); }
  .dc-copy { padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(90% 120% at 0% 0%, rgba(88, 101, 242, .12), transparent 60%), var(--surface); display: flex; flex-direction: column; gap: 16px; }
  .dc-copy h3 { margin: 0; font-family: Cinzel, Georgia, serif; font-size: 22px; line-height: 1.25; }
  .dc-steps { margin: 0; padding: 0; list-style: none; counter-reset: dc; display: grid; gap: 14px; }
  .dc-steps li { counter-increment: dc; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 12px; }
  .dc-steps li::before { content: counter(dc); grid-row: span 2; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(88, 101, 242, .18); color: #a5b0ff; font-size: 12.5px; font-weight: 700; }
  .dc-steps b { font-size: 14.5px; } .dc-steps span { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
  .dc-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: auto; }
  .dc-cta span { color: var(--faint); font-size: 12.5px; }
  .dc-chat { border: 1px solid var(--line); border-radius: 14px; background: #1e1f24; padding: 0 0 10px; overflow: hidden; font-family: Inter, system-ui, sans-serif; }
  .dc-chan { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid #2b2d33; color: #f2f3f5; font-size: 14px; font-weight: 600; }
  .dc-chan span { color: #80848e; font-size: 20px; font-weight: 400; }
  .dc-msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 12px 16px 4px; }
  .dc-msg img { width: 40px; height: 40px; border-radius: 50%; background: #2b2d33; padding: 4px; }
  .dc-who { display: flex; align-items: center; gap: 6px; }
  .dc-who b { color: #f2c94c; font-size: 14.5px; }
  .dc-who i { font-style: normal; padding: 0 5px; border-radius: 4px; background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; }
  .dc-who em { font-style: normal; color: #949ba4; font-size: 12px; }
  .dc-msg p { margin: 3px 0 0; color: #dbdee1; font-size: 14px; line-height: 1.45; }
  .dc-msg p a { color: #00a8fc; text-decoration: none; }
  @media (max-width: 1000px) { .dc { grid-template-columns: 1fr; } }

  /* Dashboard: Discord card (until connected or closed) */
  .dcard { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: stretch; margin-bottom: 28px; padding: 22px 24px;
    border: 1px solid rgba(88, 101, 242, .45); border-radius: 14px; background: radial-gradient(90% 140% at 0% 0%, rgba(88, 101, 242, .18), transparent 60%), var(--surface); }
  .dcard-copy { display: flex; flex-direction: column; justify-content: center; }
  .dcard .kicker { color: #a5b0ff; align-self: flex-start; }
  .dcard h2 { margin: 8px 0 0; font-family: Cinzel, Georgia, serif; font-size: 22px; line-height: 1.25; }
  .dcard p { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
  .dcard p b { color: var(--text); font-weight: 600; }
  .dcard-form { display: flex; gap: 8px; margin-top: 16px; }
  .dcard-form input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13.5px; outline: none; }
  .dcard-form input:focus-visible { border-color: #5865f2; }
  .dcard-form .btn { height: 38px; background: #5865f2; border-color: #5865f2; color: #fff; padding: 0 18px; }
  .dcard-form .btn:hover { background: #4752c4; }
  .dcard-done { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding: 10px 12px; border-radius: 8px; background: var(--profit-soft); color: #cfe9da; font-size: 13.5px; }
  .dcard-done b { color: var(--profit); }
  .dcard-later { all: unset; align-self: flex-start; margin-top: 10px; color: var(--faint); font-size: 12.5px; cursor: pointer; }
  .dcard-later:hover { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
  .dcard-later:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; border-radius: 3px; }
  .dcard-chat { display: flex; flex-direction: column; padding-bottom: 14px; }
  .dcard-chat .dc-msg { padding-top: 14px; }
  @media (max-width: 1000px) { .dcard { grid-template-columns: 1fr; } .dcard-chat { display: none; } }

  /* Dashboard: the window behind the chips under My watchlist (public/known.js) */
  dialog.pick { width: min(640px, calc(100% - 32px)); }
  .pick-bar { display: flex; align-items: center; gap: 12px; }
  .pick-bar .search input { height: 38px; background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13.5px; outline: none; box-sizing: border-box; }
  .pick-bar .search input:focus-visible { border-color: var(--accent); }
  .pick-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
  .pick-bar .seg { flex: none; height: 38px; box-sizing: border-box; } .pick-bar .seg[hidden] { display: none; }
  .pick-cols, .klist li { display: grid; grid-template-columns: minmax(0, 1fr) 110px 112px; align-items: center; gap: 12px; }
  .pick-cols { margin-top: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
  .pick-cols span:nth-child(2) { text-align: right; }
  .klist { list-style: none; margin: 0; padding: 0; }
  .klist li { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .klist li:last-child { border-bottom: 0; }
  .klist li > * { grid-area: auto; }
  .klist li.w-empty { display: block; padding: 14px 0; color: var(--muted); font-size: 13.5px; }
  .klist li.later .w-name > a, .klist li.later .w-value { opacity: .6; }
  .klist .w-value .profit { color: var(--profit); } .klist .w-value .loss { color: var(--loss); }
  .klist .follow-btn { justify-content: center; }
  @media (max-width: 480px) {
    .pick-bar { flex-direction: column; align-items: stretch; gap: 8px; }
    .pick-cols, .klist li { grid-template-columns: minmax(0, 1fr) auto 40px; gap: 10px; }
    .pick-cols span:last-child { display: none; }
    .klist .follow-btn { width: 40px; padding: 0; } .klist .follow-btn span { display: none; }
  }
  /* Dashboard: chips under "My watchlist" that open the same windows */
  .wpicks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 12px; }
  .wpicks + .wpicks { margin-top: -4px; }
  .wpicks > span { color: var(--muted); font-size: 13px; margin-right: 2px; }
  .wpicks > span b { color: var(--text); font-weight: 600; }
  .wpick {
    all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
    border: 1px solid var(--line-strong); border-radius: 99px; color: var(--text); font-size: 12.5px; font-weight: 600; transition: border-color .15s, background .15s;
  }
  .wpick svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
  .wpick b { color: var(--accent); }
  .wpick:hover { border-color: var(--accent); background: var(--accent-soft); }
  .wpick:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
  /* My watchlist: how many are followed sits right next to the heading */
  .section-head.watch-head { justify-content: flex-start; gap: 10px; }
  @media (max-width: 480px) { .section-head.watch-head { flex-direction: row; } }


  /* The addon bar above every page's header: full width, gold, the text on the left and the download on the right,
     lined up with the header's logo and account button (partials/header.html) */
  .addon-strip { display: block; background: linear-gradient(90deg, #c9a253, #e2c17a 50%, #c9a253); color: #17130b; text-decoration: none; border-bottom: 1px solid #9c7a33; transition: filter .15s; }
  .addon-strip:hover { filter: brightness(1.06); }
  .addon-strip:focus-visible { outline: 2px solid #17130b; outline-offset: -4px; }
  .addon-strip .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; font-size: 13.5px; }
  .addon-strip .as-text { display: flex; align-items: center; gap: 9px; min-width: 0; white-space: nowrap; overflow: hidden; }
  .addon-strip .as-text b { flex: none; font-weight: 700; }
  .addon-strip .as-long, .addon-strip .as-short { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .addon-strip .as-long::before, .addon-strip .as-short::before { content: ''; display: inline-block; width: 1px; height: 12px; margin-right: 9px; background: rgba(23, 19, 11, .35); vertical-align: -1px; }
  .addon-strip .as-short { display: none; }
  .addon-strip .as-go svg { margin-right: 2px; }
  .addon-strip .as-go { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; white-space: nowrap; border-radius: 7px; background: #17130b; color: #f0d28a; font-size: 12.5px; font-weight: 700; }
  @media (max-width: 860px) {
    .addon-strip .as-long { display: none; }
    .addon-strip .as-short { display: inline; }
  }
  @media (max-width: 480px) {
    .addon-strip .wrap { gap: 10px; }
    .addon-strip .as-cf, .addon-strip .as-short { display: none; }
  }
