﻿:root {
      --bg: #0f1115;
      --panel: #171a21;
      --text: #e6e6e6;
      --muted: #9aa4b2;
      --accent: #34d399;
      --border: #2a2f3a;
      --row-alt: #151a24;
      --header-bg: #111827;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
      background: radial-gradient(1200px 600px at 20% -10%, #1e293b, transparent),
                  radial-gradient(900px 500px at 90% 10%, #111827, transparent),
                  var(--bg);
      color: var(--text);
    }
    header {
      padding: 20px 24px;
      border-bottom: 1px solid var(--border);
      background: rgba(15, 17, 21, 0.9);
      backdrop-filter: blur(8px);
      position: sticky;
      top: 0;
      z-index: 10;
    }
    .header-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      align-items: center;
      gap: 12px;
    }
    .header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .site-brand {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
    }
    .site-brand-mark {
      width: 56px;
      height: 56px;
      flex: 0 0 auto;
      filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
    }
    h1 {
      margin: 0;
      font-weight: 600;
      letter-spacing: 0.2px;
    }
    h1 a {
      color: inherit;
      text-decoration: none;
    }
    h1 a:hover {
      color: var(--accent);
    }
    .site-brand-text { display: flex; flex-direction: column; min-width: 0; }
    .market-status {
      white-space: nowrap;
      font-size: 12px;
      opacity: .8;
    }
    .sub { color: var(--muted); font-size: 13px; }
    .container { padding: 20px 24px; }
    .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
    .tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
    .header-tabs {
      align-items: center;
      justify-content: center;
      gap: 6px;
      margin: 0;
    }
    .tab-btn {
      padding: 8px 12px;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--text);
      border-radius: 8px;
      cursor: pointer;
      font-size: 14px;
    }
    .tab-btn.active {
      border-color: var(--accent);
      color: var(--accent);
    }
    .tab-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .panel {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px;
      overflow: hidden;
    }
    /* Tables are part of the page: no box and no inner scrollbar. */
    .table-wrap {
      overflow: visible;
    }
    .merchant-filters .merchant-search { flex: 0 1 260px; min-width: 180px; padding: 6px 10px; }
    .icon-picker { position: relative; }
    input.qty-input.table-qty { width: 40px; padding: 4px 6px; }
    #table th, #table td { padding: 7px 3px; }
    th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
    td.muted-empty { color: var(--muted); }
    td.discipline-cell { white-space: nowrap; }
    .discipline-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px 4px; max-width: 110px; }
    .discipline-line .discipline img { display: block; }
    .discipline-level { color: var(--muted); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
    .ingredients-chips { display: flex; flex-wrap: wrap; gap: 3px; min-width: 104px; max-width: 210px; }
    .ingredient-chip { position: relative; display: inline-flex; border-radius: 4px; }
    .ingredient-chip img { display: block; width: 22px; height: 22px; border-radius: 4px; }
    .ingredient-chip-qty {
      position: absolute;
      right: -2px;
      bottom: -3px;
      padding: 0 2px;
      border-radius: 3px;
      background: rgba(0, 0, 0, 0.75);
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      line-height: 1.2;
    }
    .shopping-recipe { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 12px; }
    .shopping-recipe li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
    .shopping-recipe img { display: block; flex: 0 0 auto; border-radius: 3px; }
    .shopping-recipe-total { color: var(--muted); font-variant-numeric: tabular-nums; }
    .shopping-recipe-qty { min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
    td.name-cell { white-space: normal; min-width: 170px; max-width: 280px; }
    .column-picker summary { gap: 6px; }
    .column-picker-menu { left: auto; right: 0; min-width: 210px; max-height: 70vh; overflow-y: auto; }
    .column-picker-menu label {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 8px;
      border-radius: 5px;
      white-space: nowrap;
      cursor: pointer;
    }
    .column-picker-menu label:hover { background: rgba(242, 196, 109, 0.12); }
    .column-picker-menu .column-picker-reset {
      margin-top: 4px;
      border-top: 1px solid var(--border);
      border-radius: 0;
      justify-content: center;
      color: var(--muted);
    }
    .discipline-multi { display: flex; flex-wrap: wrap; gap: 6px; }
    .level-picker .icon-picker-menu { display: grid; grid-template-columns: repeat(7, minmax(48px, 1fr)); gap: 2px; left: 50%; transform: translateX(-50%); }
    .level-picker .icon-picker-menu button { justify-content: center; font-variant-numeric: tabular-nums; }
    .level-picker .icon-picker-menu button:first-child { grid-column: 1 / -1; }
    .icon-picker summary {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      padding: 6px 10px;
      cursor: pointer;
      list-style: none;
    }
    .icon-picker summary::-webkit-details-marker { display: none; }
    .icon-picker summary::after { content: "▾"; color: var(--muted); margin-left: 4px; }
    .icon-picker-menu {
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      z-index: 20;
      display: flex;
      flex-direction: column;
      min-width: 100%;
      padding: 4px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    }
    .icon-picker-menu button {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 8px;
      border: 0;
      border-radius: 5px;
      background: transparent;
      color: var(--text);
      font: inherit;
      white-space: nowrap;
      text-align: left;
      cursor: pointer;
    }
    .icon-picker-menu button:hover { background: rgba(242, 196, 109, 0.12); }
    .merchant-table td { vertical-align: middle; }
    .merchant-table tbody tr:nth-child(even) td { background: transparent; }
    /* No row hover here: an item spans several rows, so highlighting the first
       one also lit up its rowspan cells (icon, name, prices). */
    .merchant-table tbody tr:hover td { background-color: transparent; }
    .merchant-table tbody.merchant-group:nth-of-type(even) td { background: var(--row-alt); }
    .merchant-table tbody.merchant-group tr:not(:last-child) td:not([rowspan]) { border-bottom-style: dashed; }
    .merchant-price-head { font-size: 11px; line-height: 1.2; text-align: right; }
    .merchant-price { font-size: 12px; }
    .merchant-empty { color: var(--muted); }
    .merchant-cost { font-family: "IBM Plex Mono", "Consolas", monospace; }
    .merchant-bundle { display: flex; align-items: center; gap: 4px; }
    .merchant-unit { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; opacity: 0.55; }
    .merchant-cost-plus { color: var(--muted); margin: 0 2px; }
    .merchant-currency { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
    .merchant-currency-icon { width: 16px; height: 16px; object-fit: contain; }
    .merchant-currency-name { color: var(--muted); font-family: "IBM Plex Sans", "Segoe UI", sans-serif; font-size: 12px; }
    .merchant-vendor { white-space: normal; min-width: 220px; }
    .merchant-note { color: var(--muted); font-size: 12px; margin-top: 2px; }
    .merchant-link { color: var(--accent); }
    .merchant-location { color: var(--muted); }
    .merchant-daily { color: var(--muted); margin-left: 4px; }
    .merchant-wp {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      border: 0;
      background: transparent;
      color: var(--text);
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 12px;
      padding: 0;
      cursor: pointer;
      white-space: nowrap;
    }
    .merchant-wp:hover { color: var(--accent); }
    .merchant-table .mini-actions { width: 30px; min-width: 30px; gap: 3px; }
    .merchant-table .mini-actions-bottom { gap: 3px; }
    .merchant-table .mini-action-wiki { width: 15px; height: 15px; font-size: 13px; }
    .merchant-table .mini-action-small { height: 13px; font-size: 10px; }
    .merchant-req-ok { color: var(--accent); }
    .merchant-req-missing { color: #f87171; }
    table {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0;
      font-size: 13px;
      table-layout: auto;
    }
    th, td {
      padding: 8px 10px;
      border-bottom: 1px solid var(--border);
      text-align: left;
      white-space: nowrap;
    }
    th {
      cursor: pointer;
      position: sticky;
      top: var(--header-height, 0px);
      background: var(--header-bg);
      z-index: 5;
      user-select: none;
      font-weight: 600;
    }
    tbody tr:nth-child(even) td { background: var(--row-alt); }
    tbody tr:hover td { background-color: rgba(52, 211, 153, 0.08); }
    td.coin {
      text-align: right;
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-variant-numeric: tabular-nums;
    }
    .coin-g { color: #facc15; font-weight: 700; }
    .coin-s { color: #cbd5e1; font-weight: 700; }
    .coin-c { color: #b87333; font-weight: 700; }
    .coin-sign { color: #fca5a5; font-weight: 700; }
    .coin-icon { width: 1em; height: 1em; margin-left: 2px; vertical-align: -0.15em; }
    .discipline { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
    .discipline img { flex: 0 0 auto; }
    /* Inline-flex sits on the text baseline; centre the icon on the line instead. */
    .item-title-copy .discipline { vertical-align: middle; }
    .qty-input {
      width: 78px;
      padding: 6px 8px;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--text);
      text-align: right;
      font-family: "IBM Plex Mono", "Consolas", monospace;
    }
    .search {
      flex: 1;
      min-width: 260px;
      padding: 8px 10px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--text);
    }
    .filters-builder {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 8px;
    }
    .filter-row {
      margin: 0;
      gap: 8px;
    }
    .filter-select, .filter-value {
      padding: 8px 10px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--text);
      font-size: 14px;
    }
    .filter-select {
      min-width: 180px;
    }
    .filter-value {
      min-width: 220px;
      flex: 1;
    }
    .filter-value-slot {
      min-width: 220px;
      flex: 1;
      display: flex;
    }
    /* Discipline pickers take only their width so the level sits next to them. */
    .filter-value-slot:has(.discipline-multi) {
      flex: 0 1 auto;
      min-width: 0;
    }
    .filter-level-slot {
      min-width: 170px;
      display: none;
    }
    .filter-remove {
      border-color: #7f1d1d;
      color: #fca5a5;
    }
    div.icon-cell {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    /* A flex <td> stops behaving as a table cell and does not stretch to tall
       rows (e.g. many ingredients): keep it a cell and line its content up. */
    td.icon-cell { white-space: nowrap; vertical-align: middle; }
    td.icon-cell > * { display: inline-flex; vertical-align: middle; }
    td.icon-cell > * + * { margin-left: 6px; }
    .name-with-icon {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .name-inline-actions {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .name-copy-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 0;
      background: transparent;
      color: inherit;
      cursor: pointer;
      padding: 0;
      font-size: 10px;
      line-height: 1;
    }
    .name-copy-btn:hover:not(:disabled) {
      opacity: 0.85;
    }
    .name-copy-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .ingredients-list {
      display: inline-flex;
      flex-direction: column;
      gap: 2px;
      align-items: flex-start;
    }
    .ingredient-entry {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      white-space: nowrap;
      line-height: 1.15;
    }
    .ingredient-entry img {
      flex: 0 0 auto;
    }
    .mini-actions {
      display: flex;
      flex-direction: column;
      gap: 2px;
      width: 24px;
      min-width: 24px;
    }
    .mini-actions-top {
      display: flex;
      justify-content: center;
    }
    .mini-actions-bottom {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 2px;
    }
    .mini-action {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--border);
      border-radius: 4px;
      background: #111827;
      color: var(--text);
      text-decoration: none;
      font-size: 9px;
      font-family: "IBM Plex Mono", "Consolas", monospace;
      line-height: 1;
      padding: 0;
      cursor: pointer;
    }
    .mini-action-wiki {
      width: 12px;
      height: 12px;
      font-size: 11px;
      border-radius: 999px;
    }
    .mini-action-small {
      width: 100%;
      height: 10px;
      font-size: 8px;
    }
    .mini-action-link {
      color: var(--accent);
    }
    .mini-action:hover:not(:disabled) {
      border-color: var(--accent);
      background: rgba(52, 211, 153, 0.12);
    }
    .mini-action:disabled,
    .mini-action-disabled {
      opacity: 0.45;
      cursor: not-allowed;
      pointer-events: none;
    }
    .wiki-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      border: 1px solid var(--border);
      color: var(--accent);
      text-decoration: none;
      font-size: 10px;
      font-weight: 700;
      line-height: 1;
    }
    .wiki-link:hover {
      border-color: var(--accent);
      background: rgba(52, 211, 153, 0.12);
    }
    .fav-star {
      border: 0;
      background: transparent;
      color: #6b7280;
      font-size: 16px;
      line-height: 1;
      cursor: pointer;
      padding: 0;
    }
    .fav-star.active {
      color: #facc15;
      text-shadow: 0 0 8px rgba(250, 204, 21, 0.45);
    }
    .rarity-text {
      font-weight: 600;
    }
    .rarity-junk { color: #9ca3af; }
    .rarity-basic { color: #f3f4f6; }
    .rarity-fine { color: #60a5fa; }
    .rarity-masterwork { color: #4ade80; }
    .rarity-rare { color: #fde047; }
    .rarity-exotic { color: #fb923c; }
    .rarity-ascended { color: #f472b6; }
    .rarity-legendary { color: #c084fc; }
    .roi-positive { color: #4ade80; font-weight: 600; }
    .roi-negative { color: #f87171; font-weight: 600; }
    .missing-prices { color: #fbbf24; }
    .empty { color: var(--muted); padding: 12px; }
    .item-link {
      color: inherit;
      text-decoration: none;
    }
    .item-link:hover,
    .item-link:focus-visible { color: var(--accent); }
    .item-panel {
      max-width: 1280px;
      padding: clamp(16px, 3vw, 32px);
      margin-inline: auto;
    }
    .item-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }
    .item-title-main {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      flex: 1 1 auto;
    }
    .item-title img { border-radius: 8px; }
    .item-title-copy {
      min-width: 0;
      flex: 0 1 auto;
    }
    .item-title h2 {
      margin: 0;
      font-size: clamp(22px, 3vw, 32px);
      overflow-wrap: anywhere;
    }
    .item-title p { margin: 4px 0 0; }
    .item-title .mini-actions {
      width: 78px;
      min-width: 78px;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }
    .item-title .mini-actions-bottom {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 4px;
    }
    .item-title .mini-action-wiki {
      width: 26px;
      height: 26px;
      font-size: 15px;
    }
    .item-title .mini-action-small {
      width: 22px;
      height: 22px;
      font-size: 12px;
    }
    .item-title .mini-action {
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--muted);
      box-shadow: none;
    }
    .item-title .mini-action-wiki,
    .item-title .mini-action-link { color: var(--accent); }
    .item-title .mini-action:hover:not(:disabled) {
      border: 0;
      background: transparent;
      color: var(--text);
    }
    .item-header-favorite {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      padding: 0;
      border: 1px solid transparent;
      border-radius: 6px;
      background: transparent;
      color: #6b7280;
      cursor: pointer;
      font-size: 19px;
      margin-left: auto;
    }
    .item-header-favorite:hover,
    .item-header-favorite.active {
      border-color: rgba(250, 204, 21, .35);
      color: #facc15;
      background: rgba(250, 204, 21, .08);
      text-shadow: 0 0 8px rgba(250, 204, 21, .45);
    }
    .item-title-market {
      min-width: 360px;
      flex: 0 0 auto;
      padding-left: 24px;
      border-left: 1px solid var(--border);
    }
    .item-title-market-values {
      display: flex;
      gap: 36px;
    }
    .item-title-market-value {
      display: grid;
      gap: 4px;
      min-width: 150px;
    }
    .item-title-market-value .sub { font-size: 13px; }
    .item-title-market-value strong {
      font-size: 31px;
      line-height: 1.05;
      white-space: nowrap;
    }
    .item-section {
      margin-top: 24px;
      padding-top: 20px;
      border-top: 1px solid var(--border);
    }
    .item-section h2 { margin: 0 0 8px; font-size: 19px; }
    .item-section h3 { margin: 0 0 8px; font-size: 14px; }
    .item-section p { margin: 0 0 12px; }
    .item-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
      gap: 16px;
    }
    .item-market-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr);
      gap: 18px;
    }
    .item-market-card {
      min-width: 0;
      padding: 0;
      background: transparent;
    }
    .item-market-card h3 {
      display: flex;
      align-items: baseline;
      gap: 7px;
      margin: 0 0 9px;
      font-size: 14px;
    }
    .item-market-card h3 .sub { font-weight: 400; }
    .item-market-card .table-wrap {
      border: 0;
      border-radius: 0;
      background: transparent;
    }
    .item-market-card th,
    .item-market-card td,
    .item-market-card tbody tr:nth-child(even) td { background: transparent; }
    .item-strategy-table { font-size: 12px; }
    .item-strategy-table thead th {
      padding-top: 9px;
      padding-bottom: 10px;
      color: var(--text);
      font-size: 13px;
      font-weight: 700;
    }
    .item-strategy-table th,
    .item-strategy-table td { padding: 7px 8px; }
    .item-strategy-table thead th:nth-child(n + 2),
    .item-strategy-table tbody td:nth-child(n + 2) { text-align: right; }
    .item-sort-button {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 0;
      border: 0;
      background: transparent;
      color: inherit;
      cursor: pointer;
      font: inherit;
      font-weight: 700;
      text-align: inherit;
    }
    .item-sort-button:hover,
    .item-sort-button:focus-visible { color: var(--accent); }
    .item-sort-button span {
      color: var(--muted);
      font-size: 11px;
    }
    .item-strategy-table .coin-negative,
    .item-strategy-table .coin-negative .coin-g,
    .item-strategy-table .coin-negative .coin-s,
    .item-strategy-table .coin-negative .coin-c,
    .item-strategy-table .coin-negative .coin-sign { color: #ff6b7a !important; }
    .item-strategy-table .roi-negative { color: #ff6b7a; font-weight: 700; }
    .item-volume-card { align-self: start; }
    .item-volume-card table { font-size: 12px; }
    .item-volume-number {
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-variant-numeric: tabular-nums;
    }
    .item-merchant-options {
      display: grid;
      gap: 5px;
    }
    .item-merchant-option {
      display: grid;
      grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
      align-items: center;
      gap: 12px;
      padding: 7px 0;
      border-bottom: 1px solid rgba(148, 163, 184, .12);
      font-size: 12px;
    }
    .item-merchant-option:last-child { border-bottom: 0; }
    .item-merchant-cost {
      color: var(--text);
      font-family: "IBM Plex Mono", "Consolas", monospace;
    }
    .item-merchant-cost strong {
      margin-right: 5px;
      font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
      font-weight: 600;
    }
    .item-merchant-vendor {
      color: var(--muted);
      overflow-wrap: anywhere;
    }
    .item-merchant-vendor-entry {
      display: inline-flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 4px;
    }
    .item-merchant-vendor .merchant-wp { margin-left: 4px; }
    .merchant-inline-unit {
      color: var(--muted);
      font-size: 11px;
    }
    .merchant-inline-price { white-space: nowrap; }
    .item-panel th { position: static; cursor: default; }
    .item-panel th[scope="row"] { background: transparent; }
    .item-recipe + .item-recipe { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
    .item-craft-qty-panel {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      width: 100%;
      margin: 0 0 12px;
      padding: 4px 0 16px;
      border-bottom: 1px solid rgba(148, 163, 184, .16);
    }
    .item-craft-qty-label {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      justify-content: space-between;
      width: 100%;
      color: var(--text);
      font-size: 20px;
      letter-spacing: .01em;
      font-weight: 600;
    }
    .item-craft-qty {
      width: 88px;
      min-height: 42px;
      padding: 4px 2px 3px;
      border: 0;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
      color: var(--accent);
      font-size: 20px;
      font-weight: 700;
      text-align: center;
      appearance: auto;
    }
    .item-craft-qty:focus {
      outline: 0;
      box-shadow: none;
    }
    .item-missing { white-space: normal; max-width: 30ch; }
    .item-ingredients { margin: 0; padding: 0; list-style: none; }
    .item-ingredients li,
    .item-ingredient-name { display: flex; align-items: center; gap: 8px; }
    .item-ingredients li {
      justify-content: space-between;
      padding: 6px 0;
      border-bottom: 1px solid var(--border);
    }
    .item-ingredient-name { min-width: 0; overflow-wrap: anywhere; }
    .item-ingredient-name img { border-radius: 4px; }
    .item-quantity { color: var(--muted); white-space: nowrap; }
    .item-crafting-layout {
      display: grid;
      grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr);
      gap: 18px;
      align-items: start;
    }
    .item-crafting-summary {
      position: sticky;
      top: 112px;
    }
    .craft-tree {
      overflow-x: auto;
      padding: 4px 2px 8px;
    }
    .craft-tree-toolbar {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin: 0 0 9px;
    }
    .craft-tree-recommendation {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      color: var(--accent);
      font-size: 12px;
      font-weight: 700;
    }
    .craft-tree-cost-toggle {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      margin-left: auto;
      padding: 2px;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: rgba(15, 23, 42, .42);
    }
    .craft-tree-cost-label {
      padding: 0 5px;
      color: var(--muted);
      font-size: 11px;
    }
    .craft-tree-cost-button {
      padding: 4px 7px;
      border: 0;
      border-radius: 5px;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      font-size: 11px;
    }
    .craft-tree-cost-button.active {
      background: var(--accent);
      color: #07130f;
      font-weight: 700;
    }
    .craft-tree-help { width: 100%; }
    .craft-tree ul {
      list-style: none;
      margin: 0;
      padding: 0;
    }
    .craft-tree-root > .craft-tree-entry > .craft-node {
      border-color: var(--accent-gold);
      box-shadow: 0 0 0 1px rgba(255, 211, 90, .12), 0 12px 24px rgba(0, 0, 0, .18);
    }
    .craft-tree-children {
      margin: 8px 0 0 24px !important;
      padding-left: 0 !important;
    }
    .craft-tree-entry {
      position: relative;
      min-width: 0;
    }
    .craft-tree-children > .craft-tree-entry::before {
      display: none;
    }
    .craft-node {
      position: relative;
      padding: 9px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: rgba(25, 15, 27, .7);
    }
    .craft-node-craft { background: rgba(56, 42, 18, .42); }
    .craft-node-buy { background: rgba(13, 45, 37, .34); }
    .craft-node-vendor { background: rgba(58, 38, 70, .34); }
    .craft-node-row {
      display: grid;
      grid-template-columns: 24px 40px minmax(0, 1fr) 24px;
      align-items: start;
      gap: 9px;
      min-width: 0;
    }
    .craft-node-quantity {
      padding-top: 10px;
      color: var(--text);
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 13px;
      font-weight: 700;
      text-align: center;
      white-space: nowrap;
    }
    .craft-node-row > img {
      flex: 0 0 auto;
      border-radius: 6px;
    }
    .craft-node-main {
      min-width: 0;
      flex: 1 1 auto;
    }
    .craft-node-name {
      display: flex;
      align-items: center;
      gap: 7px;
      min-width: 0;
      overflow-wrap: anywhere;
      font-weight: 700;
    }
    .craft-node-name > .item-link { min-width: 0; overflow-wrap: anywhere; }
    .craft-node .mini-actions {
      display: inline-flex;
      flex-direction: row;
      align-items: center;
      gap: 3px;
      width: auto;
      min-width: 0;
      flex: 0 0 auto;
    }
    .craft-node .mini-actions-top,
    .craft-node .mini-actions-bottom {
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .craft-node .mini-action-wiki,
    .craft-node .mini-action-small {
      width: 18px;
      height: 18px;
      font-size: 10px;
    }
    .craft-node .mini-action {
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--muted);
      box-shadow: none;
    }
    .craft-node .mini-action-wiki,
    .craft-node .mini-action-link { color: var(--accent); }
    .craft-node .mini-action:hover:not(:disabled) {
      border: 0;
      background: transparent;
      color: var(--text);
    }
    .craft-node-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
    }
    .craft-node-source {
      color: var(--accent);
      font-weight: 700;
    }
    .craft-node-craft .craft-node-source { color: var(--accent-gold); }
    .craft-node-vendor .craft-node-source { color: #c4b5fd; }
    .craft-node-cycle .craft-node-source,
    .craft-node-warning { color: #ff8f9a; }
    .craft-node-prices {
      flex: 0 0 auto;
      white-space: nowrap;
      font-size: 12px;
    }
    .craft-node-cost {
      color: var(--accent-gold);
    }
    .craft-tree[data-cost-mode="order"] .craft-node-cost-instant,
    .craft-tree[data-cost-mode="instant"] .craft-node-cost-order { display: none; }
    .craft-tree[data-cost-mode="both"] .craft-node-cost {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-left: 8px;
    }
    .craft-tree[data-cost-mode="both"] .craft-node-cost-instant {
      padding-left: 8px;
      border-left: 1px solid var(--border);
      color: #93c5fd;
    }
    .craft-node-price-missing { color: #fca5a5; }
    .craft-node-options {
      display: grid;
      gap: 3px;
      margin-top: 7px;
      min-width: 0;
    }
    .craft-option {
      display: grid;
      grid-template-columns: 78px minmax(0, 1fr);
      align-items: center;
      gap: 8px;
      min-width: 0;
      padding: 3px 6px;
      border-radius: 3px;
      font-size: 12px;
    }
    .craft-option-source { font-weight: 700; }
    .craft-option-craft { grid-template-columns: minmax(78px, auto) minmax(0, 1fr); }
    .craft-option-craft .craft-option-source { display: flex; align-items: center; }
    .craft-option-recipe {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-left: 8px;
      font-weight: 400;
      color: rgba(226, 232, 240, .8);
    }
    .craft-option-recipe .discipline img { display: block; }
    .craft-option-recipe .recipe-flag { font-size: 12px; }
    .craft-option-value {
      min-width: 0;
      overflow-wrap: anywhere;
      text-align: right;
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-variant-numeric: tabular-nums;
    }
    .craft-option-unit {
      color: rgba(226, 232, 240, .7);
      font-size: 11px;
    }
    .craft-option-sell { background: rgba(96, 165, 250, .15); color: #bfdbfe; }
    .craft-option-buy { background: rgba(127, 29, 29, .3); color: #fecaca; }
    .craft-option-craft { background: rgba(6, 78, 59, .34); color: #a7f3d0; }
    .craft-option-vendor { background: rgba(113, 63, 18, .32); color: #fde68a; }
    .craft-option.is-recommended { box-shadow: inset 3px 0 0 currentColor; }
    .craft-option-vendor-name {
      color: rgba(254, 243, 199, .72);
      font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
      font-size: 11px;
    }
    .craft-node-toggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
      width: 24px;
      height: 24px;
      padding: 0;
      border: 1px solid rgba(148, 163, 184, .24);
      border-radius: 6px;
      background: rgba(15, 23, 42, .42);
      color: var(--muted);
      cursor: pointer;
      font-size: 12px;
    }
    .craft-node-toggle:hover {
      border-color: var(--accent);
      color: var(--accent);
    }
    .craft-node-toggle-icon {
      color: var(--accent);
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 15px;
      line-height: 1;
    }
    .craft-tree-entry.is-collapsed > .craft-tree-children { display: none; }
    .crafting-recommendation {
      margin: 0;
      padding: 9px 0 0;
      border: 0;
      border-top: 1px solid rgba(148, 163, 184, .12);
      border-radius: 0;
      background: transparent;
      opacity: .78;
    }
    .crafting-recommendation-pending {
      border-color: rgba(148, 163, 184, .12);
      background: transparent;
    }
    .crafting-recommendation h3 {
      margin: 0 0 6px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }
    .crafting-recommendation p {
      margin: 4px 0 6px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.45;
    }
    .crafting-plan-actions {
      display: grid;
      gap: 5px;
    }
    .crafting-plan-action {
      display: grid;
      grid-template-columns: 72px minmax(0, 1fr) auto;
      align-items: center;
      gap: 7px;
      min-width: 0;
      padding: 3px 0;
      border: 0;
      border-radius: 0;
      background: transparent;
      font-size: 11px;
    }
    .crafting-plan-action-source {
      font-size: 11px;
      font-weight: 700;
    }
    .crafting-plan-action-craft .crafting-plan-action-source { color: var(--accent-gold); }
    .crafting-plan-action-buy .crafting-plan-action-source { color: var(--accent); }
    .crafting-plan-action-vendor .crafting-plan-action-source { color: #c4b5fd; }
    .crafting-plan-action-name { overflow-wrap: anywhere; }
    .crafting-plan-action-item {
      display: flex;
      align-items: center;
      gap: 5px;
      min-width: 0;
    }
    .crafting-plan-action-item img {
      flex: 0 0 auto;
      border-radius: 3px;
    }
    .crafting-plan-action-quantity {
      display: grid;
      justify-items: end;
      gap: 2px;
      color: var(--muted);
      font-family: "IBM Plex Mono", "Consolas", monospace;
      white-space: nowrap;
    }
    .crafting-plan-action-price {
      color: #fde68a;
      font-size: 10px;
    }
    .crafting-recommendation-total {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      gap: 8px;
      margin-top: 10px;
      padding-top: 9px;
      border-top: 1px solid rgba(148, 163, 184, .1);
      color: var(--muted);
      font-size: 11px;
    }
    .craft-node-warning {
      margin: 7px 0 0;
      font-size: 12px;
    }
    @media (min-width: 1000px) {
      .item-recipe-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
    }
    @media (max-width: 900px) {
      .item-crafting-layout { grid-template-columns: 1fr; }
      .item-crafting-summary { position: static; }
      .item-title { flex-wrap: wrap; }
      .item-title-main { flex: 1 1 100%; }
      .item-title-market {
        flex: 1 1 100%;
        min-width: 0;
        justify-content: flex-start;
        padding: 14px 0 0;
        border-top: 1px solid var(--border);
        border-left: 0;
      }
      .item-market-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 520px) {
      .item-title-market-values { gap: 18px; flex-wrap: wrap; }
      .item-title-market-value { min-width: 125px; }
    }
    .pagination {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-top: 10px;
      flex-wrap: wrap;
    }
    .pagination-info {
      color: var(--muted);
      font-size: 12px;
      font-family: "IBM Plex Mono", "Consolas", monospace;
    }
    .overview-panel {
      margin-top: 12px;
    }
    .landing-panel {
      /* Full-bleed: break out of .container and fill the viewport under the header. */
      width: 100vw;
      margin: -20px 0 -20px calc(50% - 50vw);
      padding: 0;
      border: 0;
      background: transparent;
    }
    body:has(#overview-panel[style*="block"]) { overflow-x: clip; }
    .landing-hero {
      position: relative;
      min-height: calc(100svh - var(--header-height, 0px));
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding: clamp(32px, 7vw, 120px);
      overflow: hidden;
      isolation: isolate;
    }
    .landing-hero::before,
    .landing-hero::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -1;
      pointer-events: none;
    }
    .landing-hero::before {
      background: var(--landing-bg) center 46% / cover;
      animation: landing-zoom 24s ease-out both;
    }
    .landing-hero::after {
      background:
        linear-gradient(90deg, rgba(14, 9, 16, 0.94) 0%, rgba(14, 9, 16, 0.7) 38%, rgba(14, 9, 16, 0.1) 75%),
        linear-gradient(0deg, var(--bg) 0%, transparent 30%);
    }
    /* Bottom-right arrow inviting to scroll to the guide. */
    .landing-scroll {
      position: absolute;
      right: clamp(24px, 5vw, 80px);
      bottom: clamp(24px, 5vh, 48px);
      display: grid;
      place-items: center;
      width: 40px;
      height: 64px;
      border: 1px solid rgba(255, 248, 236, 0.25);
      border-radius: 999px;
      background: rgba(20, 12, 20, 0.2);
      color: rgba(255, 248, 236, 0.5);
      text-decoration: none;
      transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
    }
    .landing-scroll svg { animation: landing-bounce 3s ease-in-out infinite; }
    .landing-scroll:hover {
      border-color: rgba(255, 248, 236, 0.6);
      background: rgba(255, 248, 236, 0.1);
      color: #fff8ec;
    }
    @keyframes landing-bounce {
      0%, 100% { transform: translateY(-4px); }
      50% { transform: translateY(4px); }
    }
    @media (prefers-reduced-motion: reduce) {
      .landing-scroll svg { animation: none; }
    }
    /* Leaves the guide title below the sticky header when scrolled to. */
    #guide-title { scroll-margin-top: calc(var(--header-height, 0px) + 24px); }
    @keyframes landing-zoom {
      from { transform: scale(1.1); }
    }
    .landing-hero-content {
      position: relative;
      max-width: 960px;
      animation: landing-rise 700ms ease-out both;
    }
    @keyframes landing-rise {
      from { opacity: 0; transform: translateY(18px); }
    }
    .landing-hero h2 {
      margin: 20px 0 22px;
      color: #fff8ec;
      font-family: Georgia, "Times New Roman", serif;
      font-size: clamp(46px, 7.5vw, 104px);
      font-weight: 700;
      letter-spacing: -0.03em;
      line-height: 0.98;
      text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
    }
    .landing-highlight {
      color: var(--accent-gold, var(--accent));
    }
    .landing-lead {
      margin: 0;
      color: #eadfd2;
      font-size: clamp(18px, 2vw, 24px);
      line-height: 1.5;
      text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    }
    /* One idea per line; the last one closes in gold. */
    .landing-lead-line { display: block; }
    .landing-lead-line:last-child {
      margin-top: 6px;
      color: var(--accent-gold, var(--accent));
      font-family: Georgia, "Times New Roman", serif;
      font-size: 1.25em;
      font-style: italic;
      font-weight: 700;
    }
    .landing-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 14px;
      margin-top: 36px;
    }
    .landing-cta {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      min-height: 52px;
      padding: 0 26px;
      border: 1px solid rgba(255, 248, 236, 0.45);
      border-radius: 999px;
      background: rgba(20, 12, 20, 0.35);
      backdrop-filter: blur(6px);
      color: #fff8ec;
      font: 600 16px var(--font-ui, sans-serif);
      text-decoration: none;
      cursor: pointer;
      transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
    }
    .landing-cta[hidden] { display: none; }
    .landing-cta:hover {
      transform: translateY(-2px);
      background: rgba(255, 248, 236, 0.12);
    }
    .landing-cta-primary {
      border-color: transparent;
      background: var(--accent-gold, var(--accent));
      color: #1a1008;
      font-weight: 700;
      box-shadow: 0 10px 34px rgba(255, 211, 90, 0.35);
    }
    .landing-cta-primary:hover {
      background: #ffe08a;
      box-shadow: 0 14px 40px rgba(255, 211, 90, 0.5);
    }
    .landing-cta-primary .fa { transition: transform 140ms ease; }
    .landing-cta-primary:hover .fa { transform: translateX(4px); }
    @media (max-width: 720px) {
      .landing-hero {
        justify-content: flex-start;
        padding-top: 48px;
      }
      .landing-hero::before { background-position: 62% center; }
      .landing-hero { padding-bottom: 32px; }
      .landing-cta { width: 100%; justify-content: center; }
      /* Below the buttons instead of over them. */
      .landing-scroll { position: static; align-self: center; margin-top: 24px; }
    }
    /* Text sections under the hero and the methodology page: square tiles. */
    .guide {
      padding: clamp(40px, 6vw, 96px) clamp(32px, 7vw, 120px);
      border-top: 1px solid var(--border);
    }
    .guide-head {
      max-width: 780px;
      margin-bottom: 32px;
    }
    .guide-kicker {
      margin: 0;
      color: var(--accent-gold, var(--accent));
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0.22em;
      text-transform: uppercase;
    }
    .guide-head h2 {
      margin: 14px 0 16px;
      color: #fff8ec;
      font-family: Georgia, "Times New Roman", serif;
      font-size: clamp(28px, 3.6vw, 46px);
      line-height: 1.1;
      letter-spacing: -0.02em;
    }
    .guide-head p:not(.guide-kicker),
    .doc-section p,
    .doc-section li {
      color: #d6dbe3;
      font-size: 16px;
      line-height: 1.65;
    }
    .guide a:not(.guide-row-link):not(.landing-cta) { color: var(--accent-gold, var(--accent)); }
    .guide-title {
      display: table;
      margin: 0 auto 20px;
      padding-bottom: 6px;
      border-bottom: 3px solid var(--accent-gold, var(--accent));
      color: #fff8ec;
      font-size: clamp(32px, 4vw, 52px);
      font-weight: 400;
      text-align: center;
    }
    .guide-intro {
      max-width: 780px;
      margin: 0 auto 40px;
      color: #d6dbe3;
      font-size: 16px;
      line-height: 1.65;
      text-align: center;
    }
    /* Square rows: image and text side by side, swapping sides every row. */
    .guide-rows {
      max-width: 1240px;
      margin: 0 auto;
    }
    .guide-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      min-height: 320px;
    }
    .guide-row-img {
      width: 100%;
      height: 100%;
      min-height: 280px;
      object-fit: cover;
      display: block;
    }
    .guide-row:nth-child(even) .guide-row-img { order: 2; }
    .guide-row-text {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 14px;
      padding: clamp(24px, 3vw, 44px);
      background: rgba(255, 255, 255, 0.06);
    }
    .guide-row-text h3 {
      margin: 0;
      color: #fff8ec;
      font-size: clamp(22px, 2.2vw, 30px);
      font-weight: 400;
      text-align: center;
    }
    .guide-row-text p {
      margin: 0;
      color: #d6dbe3;
      font-size: 16px;
      line-height: 1.65;
      text-align: justify;
    }
    .guide-row-link {
      align-self: center;
      color: var(--accent-gold, var(--accent));
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      text-decoration: none;
    }
    .guide-row-link .fa { margin-left: 6px; transition: transform 140ms ease; }
    .guide-row-link:hover .fa { transform: translateX(4px); }
    @media (max-width: 760px) {
      .guide-row { grid-template-columns: minmax(0, 1fr); }
      .guide-row:nth-child(even) .guide-row-img { order: 0; }
      .guide-row-img { aspect-ratio: 16 / 10; min-height: 0; }
    }
    /* FAQ: one line per question, one per answer. */
    .faq {
      max-width: 900px;
      margin: 0 auto;
    }
    .faq dt {
      margin-top: 14px;
      color: #fff8ec;
      font-weight: 600;
    }
    .faq dt:first-child { margin-top: 0; }
    .faq dd {
      margin: 4px 0 0;
      color: var(--muted);
      line-height: 1.55;
    }
    .guide-credit {
      max-width: 900px;
      margin: 40px auto 0;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
    }
    .doc { border-top: 0; }
    .doc-section {
      max-width: 860px;
      padding: 24px 0;
      border-top: 1px solid var(--border);
    }
    .doc-section h3 {
      margin: 0 0 12px;
      color: #fff8ec;
      font-size: 20px;
    }
    .doc-section ul { margin: 0; padding-left: 20px; }
    .doc-section strong { color: #fff8ec; }
    .doc-table-wrap { overflow-x: auto; }
    .doc-table {
      width: 100%;
      border-collapse: collapse;
      background: var(--panel);
    }
    .doc-table th,
    .doc-table td {
      padding: 12px 14px;
      border: 1px solid var(--border);
      text-align: left;
      vertical-align: top;
      line-height: 1.5;
    }
    .doc-table thead th {
      color: var(--accent-gold, var(--accent));
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 12px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }
    .doc-footer { margin: 32px 0 0; }
    .overview-head {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
    }
    .overview-head h2 {
      margin: 0 0 4px 0;
      font-size: 20px;
      font-weight: 700;
      letter-spacing: 0;
    }
    .overview-head p {
      margin: 0;
    }
    .overview-metrics {
      display: grid;
      grid-template-columns: repeat(6, minmax(140px, 1fr));
      gap: 10px;
      margin-bottom: 12px;
    }
    .overview-metric {
      min-height: 86px;
      padding: 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #121722;
    }
    .overview-label {
      color: var(--muted);
      font-size: 12px;
      margin-bottom: 8px;
      font-weight: 600;
    }
    .overview-value {
      font-size: 20px;
      font-weight: 750;
      line-height: 1.2;
      overflow-wrap: anywhere;
    }
    .overview-value.coin,
    .overview-item-meta .coin {
      font-family: "IBM Plex Mono", "Consolas", monospace;
    }
    .overview-best {
      font-size: 14px;
    }
    .overview-best-card {
      display: grid;
      grid-template-columns: 34px minmax(0, 1fr);
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .overview-best-card > div {
      min-width: 0;
    }
    .overview-best-icon {
      width: 34px;
      height: 34px;
      border-radius: 6px;
      object-fit: cover;
      background: #0f1115;
      border: 1px solid var(--border);
    }
    .overview-best-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin-bottom: 3px;
      font-size: 13px;
      line-height: 1.2;
    }
    .overview-muted {
      color: var(--muted);
      font-size: 13px;
      font-weight: 600;
    }
    .overview-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(240px, 1fr));
      gap: 12px;
    }
    .overview-section {
      min-width: 0;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #121722;
      padding: 12px;
    }
    .overview-section h2 {
      margin: 0 0 10px 0;
      font-size: 15px;
      font-weight: 700;
      letter-spacing: 0;
    }
    .overview-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .overview-item {
      display: grid;
      grid-template-columns: 24px 40px minmax(0, 1fr);
      align-items: center;
      gap: 8px;
      min-height: 56px;
      padding: 7px;
      border: 1px solid rgba(42, 47, 58, 0.7);
      border-radius: 8px;
      background: #151a24;
    }
    .overview-rank {
      color: var(--muted);
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 12px;
      text-align: right;
    }
    .overview-item-icon {
      width: 40px;
      height: 40px;
      border-radius: 6px;
      object-fit: cover;
      background: #0f1115;
      border: 1px solid var(--border);
    }
    .overview-item-icon-empty {
      display: block;
    }
    .overview-item-body {
      min-width: 0;
    }
    .overview-item-name {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      margin-bottom: 5px;
      font-size: 13px;
      font-weight: 700;
      line-height: 1.2;
    }
    .overview-item-name .mini-actions {
      flex: 0 0 auto;
    }
    .overview-item-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .overview-item-meta {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.25;
    }
    @media (max-width: 1100px) {
      .overview-metrics,
      .overview-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
      }
    }
    @media (max-width: 720px) {
      .overview-metrics,
      .overview-grid {
        grid-template-columns: 1fr;
      }
      .overview-metric-wide {
        grid-column: auto;
      }
    }
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 10px;
      margin-bottom: 12px;
    }
    .stats-subtabs {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 12px;
    }
    .stats-controls {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 12px;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #1a111b;
    }
    .stats-control-label {
      color: var(--muted);
      font-size: 13px;
      font-weight: 600;
    }
    .stats-number-input {
      width: 130px;
    }
    .coin-filter {
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .coin-filter-input {
      width: 58px;
    }
    .stat-card {
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #1a111b;
      padding: 12px;
      min-height: 76px;
    }
    .stat-label {
      color: var(--muted);
      font-size: 12px;
      margin-bottom: 8px;
    }
    .stat-value {
      font-size: 22px;
      font-weight: 700;
      line-height: 1.2;
    }
    .stat-value.coin {
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 16px;
    }
    .best-profit-card {
      display: grid;
      grid-template-columns: 34px minmax(0, 1fr);
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .best-profit-card img {
      border-radius: 4px;
      flex: 0 0 auto;
    }
    .best-profit-body {
      min-width: 0;
    }
    .best-profit-name {
      font-size: 13px;
      font-weight: 600;
      line-height: 1.2;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin-bottom: 4px;
    }
    .best-profit-value {
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 14px;
      line-height: 1.2;
    }
    .stats-layout {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 12px;
      margin-bottom: 12px;
    }
    .stats-overlap-layout {
      display: grid;
      grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
      grid-auto-rows: 1fr;
      gap: 12px;
      margin-top: 12px;
      align-items: stretch;
    }
    .stats-section {
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #1a111b;
      padding: 12px;
      min-width: 0;
    }
    .stats-overlap-layout > .stats-section {
      height: 100%;
      align-self: stretch;
    }
    .stats-overlap-layout > .stats-table-section {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }
    .stats-section h2 {
      margin: 0 0 10px 0;
      font-size: 15px;
      font-weight: 600;
      letter-spacing: 0;
    }
    .stats-section-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }
    .stats-section-head h2 {
      margin: 0;
    }
    .market-chart-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .market-reset-zoom {
      padding: 5px 8px;
      font-size: 12px;
    }
    .stats-section canvas {
      display: block;
      width: 100%;
      border-radius: 6px;
    }
    .market-scatter-section {
      position: relative;
      margin-bottom: 12px;
      min-height: 640px;
    }
    .market-chart-tooltip {
      position: absolute;
      z-index: 4;
      width: 260px;
      flex-direction: column;
      gap: 4px;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: rgba(26, 17, 27, 0.97);
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
      pointer-events: none;
      font-size: 12px;
      line-height: 1.25;
    }
    .market-tooltip-head {
      display: grid;
      grid-template-columns: 40px minmax(0, 1fr);
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
      min-width: 0;
    }
    .market-tooltip-icon {
      width: 40px;
      height: 40px;
      border: 1px solid var(--border);
      border-radius: 6px;
      object-fit: cover;
      background: #1a111b;
    }
    .market-tooltip-icon-empty {
      display: block;
    }
    .market-chart-tooltip strong {
      font-size: 13px;
      margin-bottom: 2px;
      overflow-wrap: anywhere;
    }
    .market-chart-tooltip .coin {
      font-family: "IBM Plex Mono", "Consolas", monospace;
    }
    .stats-mini-table {
      max-height: 220px;
      margin-top: 10px;
    }
    .stats-overlap-table {
      flex: 1 1 auto;
      min-height: 0;
      max-height: none;
      height: 420px;
      padding-bottom: 12px;
      overflow-x: hidden;
      overflow-y: auto;
      scrollbar-gutter: stable;
    }
    .stats-overlap-table table {
      width: 100%;
      min-width: 0;
    }
    .stats-overlap-table th { top: 0; }
    .stats-overlap-table td,
    .stats-overlap-table th {
      padding: 7px 8px;
      white-space: normal;
      overflow-wrap: anywhere;
      font-size: 12px;
    }
    .stats-overlap-table .combination-cell { white-space: nowrap; }
    .stats-overlap-table .combination-cell .discipline { vertical-align: middle; }
    .stats-overlap-table .combination-cell .discipline img { width: 20px; height: 20px; }
    .heatmap-label .discipline { white-space: normal; }
    /* Number columns fit their header; the combination takes the rest. */
    .stats-overlap-table th:not(:first-child),
    .stats-overlap-table td:not(:first-child) {
      width: 1%;
      white-space: nowrap;
      overflow-wrap: normal;
      text-align: right;
    }
    .stats-heatmap-section {
      overflow: auto;
    }
    .stats-heatmap {
      display: grid;
      grid-template-columns: minmax(120px, 1.2fr) repeat(var(--heatmap-cols), minmax(92px, 1fr));
      gap: 1px;
      min-width: 760px;
      border: 1px solid var(--border);
      border-radius: 8px;
      overflow: hidden;
      background: var(--border);
    }
    .heatmap-corner,
    .heatmap-head,
    .heatmap-label,
    .heatmap-cell {
      background: #1a111b;
      min-height: 42px;
      padding: 8px;
      display: flex;
      align-items: center;
      min-width: 0;
    }
    .heatmap-head {
      justify-content: center;
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }
    /* Name read bottom-up; the icon below it stays upright. */
    .heatmap-head-vertical {
      flex-direction: column;
      justify-content: flex-end;
      gap: 6px;
      min-height: 96px;
      line-height: 1;
    }
    .heatmap-head-text {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
    }
    .heatmap-label {
      color: var(--text);
      font-size: 13px;
      font-weight: 600;
      position: sticky;
      left: 0;
      z-index: 1;
    }
    .heatmap-cell {
      flex-direction: column;
      justify-content: center;
      gap: 2px;
      text-align: center;
      font-family: "IBM Plex Mono", "Consolas", monospace;
      font-size: 11px;
    }
    .heatmap-empty {
      color: var(--muted);
      background: #1a111b;
    }
    .heatmap-profit {
      white-space: nowrap;
      font-size: 11px;
      line-height: 1.1;
    }
    .heatmap-count {
      color: var(--muted);
      font-size: 10px;
      line-height: 1.1;
    }
    .stats-matrix-heatmap {
      grid-template-columns: minmax(120px, 1.2fr) repeat(var(--heatmap-cols), minmax(54px, 1fr));
    }
    @media (max-width: 980px) {
      .stats-overlap-layout {
        grid-template-columns: 1fr;
      }
    }
    /* Horizontal bar charts of the stats pages (HTML, so labels carry icons). */
    .bar-chart {
      padding: 12px;
      border-radius: 6px;
      background: #1a111b;
      font-size: 12px;
    }
    .bar-list { display: grid; gap: 6px; }
    .bar-row {
      display: grid;
      grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) auto;
      align-items: center;
      gap: 10px;
    }
    .bar-label { min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bar-label .discipline { display: inline-flex; align-items: center; gap: 5px; }
    .bar-track { display: flex; height: 13px; min-width: 0; }
    .bar-fill { display: block; height: 100%; min-width: 2px; opacity: .85; }
    .bar-fill:first-child { border-radius: 3px 0 0 3px; }
    .bar-fill:last-child { border-radius: 0 3px 3px 0; }
    .bar-fill:only-child { border-radius: 3px; }
    .bar-value { min-width: 64px; text-align: right; font-family: var(--font-mono); white-space: nowrap; }
    .bar-legend { display: flex; gap: 14px; margin-bottom: 8px; color: var(--muted); }
    .bar-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
    .bar-empty { color: var(--muted); }
    .coin-filter-icon { width: 16px; height: 16px; margin: 0; }
    /* Small "?" that reveals the API key help on hover or keyboard focus. */
    .help-tip {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      border: 1px solid var(--border);
      border-radius: 50%;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      cursor: help;
    }
    .help-tip:hover,
    .help-tip:focus-within { color: var(--accent-gold); border-color: var(--accent-gold); }
    .help-tip-body {
      position: absolute;
      top: 100%;
      right: -8px;
      z-index: 30;
      display: none;
      width: 320px;
      margin-top: 0;
      padding: 14px 12px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel);
      background-clip: padding-box;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
      color: var(--text);
      font-size: 12px;
      font-weight: 400;
      line-height: 1.45;
      cursor: auto;
    }
    .help-tip:hover .help-tip-body,
    .help-tip:focus-within .help-tip-body { display: block; }
    .help-tip-body a { color: var(--accent); }
    .permissions-warning {
      color: #fbbf24;
    }
    .can-craft {
      font-weight: 700;
      white-space: nowrap;
    }
    .can-craft.yes { color: var(--accent); }
    .can-craft.no { color: #fca5a5; }
    .can-craft.unknown { color: var(--muted); }


    /* Final direction: Forge of Tyria. */
    :root {
      --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
      --font-mono: "IBM Plex Mono", "Consolas", monospace;
      --bg: #160f18;
      --panel: #211621;
      --text: #f5eadb;
      --muted: #b6a49c;
      --accent: #63e6be;
      --accent-gold: #ffd35a;
      --border: #49313a;
      --row-alt: #1c121d;
      --header-bg: #2a1b27;
    }
    body {
      min-height: 100vh;
      font-family: var(--font-ui);
      background:
        radial-gradient(800px 500px at 90% -10%, #5b2b31, transparent 60%),
        radial-gradient(700px 440px at 0% 50%, #30233e, transparent 65%),
        var(--bg);
      color: var(--text);
      transition: background 180ms ease, color 180ms ease;
    }
    header {
      background: rgba(22, 15, 24, .9);
      border-bottom-color: #74503b;
      transition: background 180ms ease, border-color 180ms ease;
    }
    .header-actions {
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    h1,
    h2,
    h3 {
      font-family: Georgia, "Times New Roman", serif;
      letter-spacing: .01em;
    }
    .site-brand h1 {
      font-size: clamp(22px, 3vw, 30px);
    }
    header {
      width: calc(100% - 80px);
      max-width: 1600px;
      margin: 8px auto 0;
      padding: 12px 30px 0;
      border: 1px solid #49313a;
      border-top: 0;
      border-radius: 0 0 26px 26px;
      background: rgba(23, 16, 32, 0.97);
      box-shadow: 0 18px 36px rgba(0, 0, 0, 0.3);
      transition: transform 220ms ease, box-shadow 220ms ease;
      will-change: transform;
    }
    header.header-hidden {
      transform: translateY(calc(-100% - 14px));
    }
    .header-tabs {
      justify-content: center;
      margin: 0;
      padding: 0;
    }
    /* Top navigation: icon with the name below (Ravworks-style), muted until
       hovered and gold with an underline when active (AlbionUtil-style). */
    .header-tabs { gap: 2px; align-items: stretch; }
    .header-tabs .nav-tab {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      width: 112px;
      padding: 4px 6px 14px;
      border: 0;
      border-radius: 0;
      background: transparent;
      color: #9d8fa6;
      font-family: Georgia, "Times New Roman", serif;
      font-size: 14px;
      font-weight: 700;
      line-height: 1.15;
      text-align: center;
      transition: color 140ms ease, transform 140ms ease;
    }
    .header-tabs .nav-tab:hover { color: #fff; transform: translateY(-2px); }
    .header-tabs .nav-tab.active { color: var(--accent-gold); background: transparent; }
    .header-tabs .nav-tab.active::after {
      content: "";
      position: absolute;
      left: 28%;
      right: 28%;
      bottom: 3px;
      height: 3px;
      border-radius: 3px;
      background: var(--accent-gold);
      box-shadow: 0 0 10px rgba(255, 211, 90, 0.55);
    }
    .nav-tab-icon {
      display: block;
      width: 42px;
      height: 42px;
      filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
    }
    .nav-tab-icon svg {
      display: block;
      width: 100%;
      height: 100%;
      fill: none;
      stroke: currentColor;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-width: 3.5;
    }
    .nav-tab-label { display: block; }
    .panel,
    .overview-section,
    .stats-section,
    .stat-card,
    .overview-metric {
      border-color: #5a3d42;
      border-radius: 10px;
      background: linear-gradient(145deg, rgba(45, 28, 42, .96), rgba(29, 19, 30, .98));
      box-shadow: 0 12px 30px rgba(0,0,0,.2);
    }
    .tab-btn {
      border-color: #73513b;
      background: #281a27;
      color: #f5eadb;
      border-radius: 999px;
    }
    .tab-btn.active {
      color: #211621;
      background: var(--accent-gold);
      border-color: var(--accent-gold);
    }
    th {
      background: #2e1d2b;
    }
    tbody tr:hover td {
      background-color: rgba(242, 196, 109, .1);
    }
    .coin-g,
    .overview-value,
    .stat-value {
      color: var(--accent-gold);
    }
    .roi-positive {
      color: #4ade80;
      text-shadow: 0 0 8px rgba(74, 222, 128, .18);
    }
    .roi-negative {
      color: #ff8f9a;
    }
    .coin-g {
      text-shadow: 0 0 9px rgba(255, 211, 90, .22);
    }
    input,
    select,
    .filter-select,
    .filter-value {
      background: #1d121e;
      color: var(--text);
      border-color: #5a3d42;
    }
    select {
      appearance: none;
      background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
      background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%;
      background-size: 5px 5px, 5px 5px;
      background-repeat: no-repeat;
    }
    @media (max-width: 720px) {
      header {
        padding: 16px;
      }
      .site-brand {
        gap: 8px;
      }
      .site-brand-mark {
        width: 40px;
        height: 40px;
      }
      .market-status { white-space: normal; font-size: 11px; }
      .header-actions {
        align-items: flex-end;
        flex-direction: column;
      }
      .header-row {
        grid-template-columns: minmax(0, 1fr) auto;
      }
      .header-tabs {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 7px 0 3px;
      }
      header {
        width: calc(100% - 16px);
        margin-top: 8px;
        padding: 12px 16px 0;
        border-radius: 0 0 20px 20px;
      }
    }

    /* Content aligned with the header bar, leaving room on both sides. */
    .container {
      width: min(1600px, calc(100% - 80px));
      margin-inline: auto;
      padding: 20px 0;
    }
    @media (max-width: 760px) {
      .container { width: calc(100% - 24px); }
    }
    /* Sticky table headers slide with the site header when it hides. */
    th { transition: top 220ms ease; }
    html.header-collapsed th { top: 0; }
    td.recipe-flag-cell { text-align: center; }
    .recipe-flag { color: var(--muted); font-size: 14px; cursor: help; }
    /* Bazar: how ingredients are bought / the output is sold, and the flip toggle. */
    .segmented {
      display: inline-flex;
      align-items: stretch;
      border: 1px solid #5a3d42;
      border-radius: 8px;
      overflow: hidden;
      background: #1d121e;
    }
    .segmented label { position: relative; display: inline-flex; cursor: pointer; }
    .segmented input { position: absolute; opacity: 0; pointer-events: none; }
    .segmented label span { padding: 8px 12px; font-size: 14px; color: var(--muted); }
    .segmented label + label span { border-left: 1px solid #3a272e; }
    .segmented input:checked + span { background: #3a2530; color: var(--accent-gold); font-weight: 600; }
    .segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
    /* Profit of the option (crafting or flip) that earns more in that row. */
    .win-chip {
      display: inline-block;
      padding: 0 4px;
      border: 1px solid rgba(255, 211, 90, .55);
      border-radius: 6px;
      background: rgba(255, 211, 90, .08);
    }
    #table td.name-cell { padding-left: 8px; }
    /* Recipe table: the whole two-row header sticks (group titles + columns). */
    #table th { position: static; }
    #table thead { position: sticky; top: var(--header-height, 0px); z-index: 5; transition: top 220ms ease; }
    html.header-collapsed #table thead { top: 0; }
    #table th.group-title {
      cursor: default;
      padding: 5px 6px 2px;
      text-align: center;
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: .12em;
      text-transform: uppercase;
      color: var(--muted);
    }
    #table .group-start { border-left: 1px solid #5a3d42; }
    .column-picker-group { margin: 6px 0 2px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
    .column-picker-group:first-child { margin-top: 0; }
    /* Column titles may wrap ("Vend." / "1d") so narrow numeric columns stay narrow. */
    #table thead tr:not(.group-row) th { white-space: normal; line-height: 1.2; vertical-align: bottom; }
    #table td.coin { font-size: 12px; }
    #table td.name-cell { min-width: 115px; }
    #table .ingredients-chips { min-width: 78px; }
    #table { font-size: 12.5px; }
    /* Breathing room on both sides of each group separator. */
    #table td.group-end, #table thead tr:not(.group-row) th.group-end { padding-right: 9px; }
    #table td.group-start, #table thead tr:not(.group-row) th.group-start { padding-left: 9px; }
    /* Bazar controls: one card per purpose (strategy / filters), the column
       picker in a toolbar right above the table. */
    /* Strategy + filters across the width; the column picker below them, on the right. */
    .controls-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
    .controls-panel {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      gap: 12px;
      flex: 1 1 auto;
      align-items: start;
    }
    @media (max-width: 1000px) {
      .controls-panel { grid-template-columns: 1fr; }
    }
    .control-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 10px 12px 12px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: rgba(255, 255, 255, .02);
    }
    .control-group-title {
      margin: 0;
      font-family: var(--font-ui);
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: .12em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .control-group-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
    .control-group-filters .search { flex: 1 1 220px; min-width: 0; }
    .control-group-filters .filters-builder { margin: 0; }
    .control-group-filters .filters-builder:empty { display: none; }
    .table-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-left: auto; }
    #shopping-panel .table-toolbar { margin-bottom: 8px; }
    /* Strategy: plain-text row labels so only the options look clickable. */
    .trade-grid { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: start; gap: 6px 10px; }
    .trade-label { font-size: 13px; color: var(--muted); }
    .quiet-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; align-self: flex-start; }
    .quiet-check input { accent-color: var(--accent-gold); margin: 0; }
    .quiet-check:has(input:checked) { color: var(--text); }
    /* Filter rows: the operator only needs room for < and >. */
    .filter-row select.filter-op { min-width: 0; width: 56px; padding-right: 22px; }
    /* Numeric filters: compact inputs (coins, %, units). */
    .filter-number-control { display: inline-flex; align-items: center; gap: 5px; }
    .filter-number-label { color: var(--muted); font-size: 13px; }
    .filter-row .filter-number { width: 80px; }
    .filter-row .filter-number.filter-coin { width: 56px; }
    .filter-row select[data-filter-col] { min-width: 150px; }
    .filter-row .filter-value-slot { flex: 0 1 auto; min-width: 0; }
    /* Two-option switches: the chosen option is filled, the other one plain. */
    .segmented input:checked + span { background: var(--accent-gold); color: #1d121e; }
    .segmented label:not(:has(input:checked)):hover span { color: var(--text); }
    /* Column picker: wide enough for its descriptive labels. */
    .column-picker .column-picker-menu { min-width: 270px; left: auto; right: 0; }
    /* Amounts wrap (gold / silver / copper) only when the table would not fit,
       so it never needs a horizontal scrollbar. */
    #table td.coin { white-space: normal; min-width: 72px; }
    #table td.coin > span, #table td.coin .win-chip > span { white-space: nowrap; }
    /* "?" next to a card title: the tooltip opens to the right and reads as normal text. */
    .control-group-title { display: flex; align-items: center; gap: 6px; }
    .help-tip-left .help-tip-body { left: -8px; right: auto; }
    .control-group-title .help-tip-body {
      width: 340px;
      font-size: 13px;
      font-weight: 400;
      letter-spacing: normal;
      text-transform: none;
      line-height: 1.45;
      color: var(--text);
    }
    .help-tip-item { display: block; margin: 2px 0 2px 10px; }
    .help-tip-line { display: block; margin-top: 6px; }
    .help-tip-line:first-child { margin-top: 0; }
    .controls-panel { align-items: stretch; }

    /* Account page (/cuenta). */
    .account-link {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      text-decoration: none;
    }
    .account-link.active { border-color: var(--accent-gold); background: transparent; color: var(--accent-gold); }
    .account-page {
      display: grid;
      gap: 40px;
      max-width: 1100px;
      margin: 4px auto 24px;
    }
    .account-intro h2 {
      display: table;
      margin: 28px auto 34px;
      padding-bottom: 6px;
      border-bottom: 3px solid var(--accent-gold, var(--accent));
      color: #fff8ec;
      font-family: Georgia, "Times New Roman", serif;
      font-size: clamp(28px, 3vw, 40px);
      font-weight: 400;
      line-height: 1.1;
      text-align: center;
    }
    .account-lead {
      max-width: 760px;
      margin: 0;
      color: var(--muted);
      font-size: 15px;
      line-height: 1.5;
    }
    .account-notice {
      display: inline-block;
      margin: 12px 0 0;
      padding: 10px 14px;
      border: 1px solid rgba(255, 211, 90, 0.45);
      border-radius: 8px;
      background: rgba(255, 211, 90, 0.08);
      color: var(--accent-gold);
    }
    .account-card {
      padding: 14px 18px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--panel);
    }
    .account-card h3 { margin: 0 0 10px; color: #fff8ec; font-size: 17px; }
    .account-benefits {
      display: grid;
      grid-template-columns: repeat(4, auto);
      justify-content: space-between;
      gap: 8px 24px;
      margin: 10px 0 0;
      padding: 0;
      list-style: none;
      color: #fff8ec;
      font-size: clamp(18px, 2vw, 26px);
      font-weight: 600;
    }
    .account-benefits .fa { width: 1.3em; color: var(--accent-gold); }
    .account-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
      gap: 12px;
      align-items: stretch;
    }
    .account-steps { margin: 0; padding-left: 20px; line-height: 1.5; }
    .account-steps > li + li { margin-top: 8px; }
    .account-steps a { color: var(--accent-gold); font-weight: 700; }
    .account-permissions { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
    .account-permissions-grid {
      display: grid;
      grid-template-columns: repeat(2, max-content);
      gap: 4px 40px;
      font-size: 14px;
      line-height: 1.4;
    }
    .login-prompt {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      padding: 60px 16px 40px;
      text-align: center;
    }
    .login-prompt p { margin: 0; color: #fff8ec; font-size: 20px; font-weight: 600; }
    .account-permissions code { color: var(--text); font-family: var(--font-mono); }
    .account-connect form { display: grid; gap: 12px; }
    .account-key-input { width: 100%; min-height: 44px; text-align: left; font-family: var(--font-mono); }
    .account-connect .landing-cta { justify-content: center; }
    .account-status { min-height: 1.4em; margin: 10px 0 0; color: var(--accent-gold); }
    .account-privacy { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
    .account-privacy .fa { color: var(--accent); }
    @media (max-width: 900px) {
      .account-grid { grid-template-columns: 1fr; }
      .account-benefits { grid-template-columns: repeat(2, auto); }
    }
    @media (max-width: 520px) {
      .account-permissions-grid { grid-template-columns: 1fr; }
    }

    /* ES/EN language switch in the header. */
    /* The language switch floats above the account link so the link stays centered. */
    .account-stack { position: relative; }
    .header-mini { position: absolute; right: 0; bottom: calc(100% + 3px); display: inline-flex; align-items: center; gap: 10px; }
    .lang-switch { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
    .feedback-btn { background: none; border: 0; padding: 0 2px; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; opacity: .7; }
    .feedback-btn:hover, .feedback-btn:focus-visible { color: var(--accent-gold); opacity: 1; }
    .lang-switch button { background: none; border: 0; padding: 0 2px; color: inherit; font: inherit; cursor: pointer; opacity: .6; }
    .lang-switch button:hover { opacity: 1; }
    .lang-switch button.active { color: var(--accent-gold); font-weight: 700; opacity: 1; cursor: default; }

    /* Suggestions and bug reports dialog. */
    .feedback-dialog { width: min(520px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); }
    .feedback-dialog::backdrop { background: rgba(0, 0, 0, .6); }
    .feedback-dialog h2 { margin: 0 0 4px; font-size: 18px; }
    .feedback-dialog form { display: flex; flex-direction: column; gap: 12px; }
    .feedback-dialog .segmented { align-self: flex-start; }
    .feedback-dialog textarea, .feedback-dialog input[type="text"] { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
    .feedback-dialog textarea { resize: vertical; min-height: 120px; }
    .feedback-hp { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
    .feedback-actions { display: flex; align-items: center; gap: 8px; }
    .feedback-actions .sub { flex: 1; }
    .feedback-status-error { color: #ff8a8a; }

    /* Materials page, "Where to spend" view. */
    .spend-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
    .spend-materials { display: flex; flex-direction: column; gap: 8px; }
    .spend-search { padding: 6px 10px; }
    .spend-material-list {
      display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto;
      padding-right: 4px; scrollbar-width: thin; scrollbar-color: #5a3d42 transparent;
    }
    .spend-material-list::-webkit-scrollbar { width: 8px; }
    .spend-material-list::-webkit-scrollbar-track { background: transparent; }
    .spend-material-list::-webkit-scrollbar-thumb { background: #5a3d42; border-radius: 999px; }
    .spend-material-list::-webkit-scrollbar-thumb:hover { background: var(--accent-gold); }
    .spend-material-row { display: flex; align-items: center; gap: 4px; }
    .spend-material-row .spend-material { flex: 1; min-width: 0; }
    .spend-material-wiki { padding: 4px 6px; color: var(--accent); font-size: 13px; text-decoration: none; }
    .spend-material-wiki:hover { color: var(--text); }
    .spend-material { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid transparent; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
    .spend-material:hover { background: var(--row-alt); }
    .spend-material.active { border-color: var(--accent-gold); }
    .spend-material-name { flex: 1; min-width: 0; }
    .spend-owned { font-variant-numeric: tabular-nums; font-weight: 600; }
    .spend-uses { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
    .spend-table th.spend-sortable { cursor: pointer; user-select: none; }
    .spend-table th.spend-sortable:hover { color: var(--accent-gold); }
    .spend-sort-arrow { margin-left: 4px; font-size: 10px; color: var(--accent-gold); }
    .spend-options { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
    .spend-strategy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
    .spend-strategy .segmented + .trade-label { margin-left: 8px; }
    @media (max-width: 720px) {
      .spend-layout { grid-template-columns: 1fr; }
      .spend-material-list { max-height: 40vh; }
    }

    /* "Add filter": a small "+" right under the last filter row. */
    .add-filter-btn {
      align-self: flex-start;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 26px;
      height: 26px;
      padding: 0;
      border-radius: 8px;
      font-size: 12px;
    }
