/* game-inventory-modals.css: drop table, quests, goals, journal, inventory, item details, settings, footer, modals, market. Moved verbatim from css/game.css (TD-CONTENT-SPLIT-001); link order in index.html keeps the cascade. */

  /* IDEA-0072 / DROP-001: Combat drop table */
  .enemy-drops { margin: 8px 0 12px; }
  .enemy-drops > summary {
    cursor: pointer;
    font-weight: bold;
    color: var(--heading);
    min-height: 44px;
    display: flex;
    align-items: center;
    overflow-wrap: anywhere;
  }
  .enemy-drops > summary:focus-visible { outline: 3px solid var(--heading); outline-offset: 3px; }
  .combat-advanced > summary { cursor: pointer; font-weight: bold; color: var(--heading); min-height: 44px; display: flex; align-items: center; }
  .enemy-drops-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
  .market-row.enemy-drop-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; width: 100%; }
  .enemy-drop-row .market-meta { overflow-wrap: anywhere; }
  .enemy-drop-badge { font-size: 0.85em; font-weight: normal; opacity: 0.85; }
  .enemy-drop-found .enemy-drop-badge { color: var(--heading); font-weight: bold; opacity: 1; }

  .market-row .bestiary-drops,
  .market-row .bestiary-drop-uses {
    overflow-wrap: anywhere;
  }

  .market-row button {
    font-family: inherit;
    background: var(--surface-2);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    flex: 0 0 auto;
  }

  .market-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .quest-info {
    flex: 1 1 auto;
    min-width: 0;
  }

  .claimable-quests-section {
    margin: 14px 0;
  }

  .claimable-quests-section h4 {
    margin: 0 0 8px;
    color: var(--heading);
  }

  .claim-all-quests-btn {
    margin-bottom: 8px;
  }

  .claim-all-quests-btn[hidden] {
    display: none;
  }

  .claimable-quest-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .claimable-quest-list[hidden] { display: none; } /* the flex rule above would otherwise override the hidden attribute (UX-084 fold) */

  #claimable-quest-list .market-row {
    border-left: 3px solid #8fd694;
  }

  .quest-status,
  .goal-status-badge {
    display: inline-flex;
    align-items: center;
    margin: 2px 6px 3px 0;
    padding: 2px 6px;
    border-radius: 10px;
    background: #303744;
    color: var(--heading);
    font-size: 11px;
    font-weight: bold;
    line-height: 1.35;
    white-space: nowrap;
  }

  .quest-status-claimable,
  .goal-status-claimable {
    background: #204b36;
    color: #b8f0c0;
  }

  .quest-status-working,
  .goal-status-working {
    background: #3d3524;
    color: #efd28c;
  }

  .quest-status-ready,
  .goal-status-ready {
    background: #293b4d;
    color: #c3e1ff;
  }

  .quest-status-completed,
  .goal-status-completed,
  .goal-status-done {
    background: #303a31;
    color: #b9d9ba;
  }

  .all-quests-details,
  .treasure-map-details {
    margin: 14px 0;
    border-top: 1px solid var(--wood);
    padding-top: 10px;
  }

  .all-quests-details > summary,
  .treasure-map-details > summary {
    cursor: pointer;
    color: var(--heading);
    font-size: 14px;
    font-weight: bold;
  }

  .all-quests-hint {
    margin: 8px 0;
  }

  .quest-search-label {
    display: block;
    margin: 10px 0 4px;
    color: var(--heading);
    font-size: 12px;
    font-weight: bold;
  }

  #quest-search {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 520px;
    margin-bottom: 8px;
  }

  .quest-show-completed-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin: 8px 0;
    cursor: pointer;
  }

  #quest-list .quest-search-hidden {
    display: none !important;
  }

  #quest-filter-empty {
    margin: 8px 0;
  }

  /* QA/UI audit: completed quests are hidden by default (see renderQuests()
     and the "Show completed quests too" checkbox) so a long-played save
     isn't mostly a wall of already-claimed rows. */
  #quest-list .quest-completed-row {
    display: none;
  }

  #quest-list.show-completed .quest-completed-row {
    display: flex;
  }

  /* GG-001: Pinned Goals and Possible Goals */
  .pinned-goals-card {
    background: #1b212a;
    border: 1px solid #39424f;
    border-radius: 6px;
    padding: 8px 10px;
  }
  .pinned-goals-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    color: var(--heading);
    margin-bottom: 6px;
  }
  .pinned-goals-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .pinned-goal-row {
    background: #1b212a;
    border: 1px solid #39424f;
    border-radius: 5px;
    padding: 6px 9px;
  }
  .pinned-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 8px;
  }
  .pinned-goal-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--heading);
  }
  .pinned-goal-desc {
    font-size: 11px;
    color: #9aa4b2;
  }
  .pinned-goal-progress {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .pinned-goal-bar-wrap {
    flex: 1;
    min-width: 60px;
  }
  /* UX-074: Collection's next goals -- closest locked achievements and per-category bars. */
  .collection-progress {
    appearance: none;
    width: 100%;
    height: 6px;
    border: 0;
    border-radius: 3px;
    background: #2a323d;
    overflow: hidden;
  }
  .collection-progress::-webkit-progress-bar { background: #2a323d; }
  .collection-progress::-webkit-progress-value { background: var(--gold); }
  .collection-progress::-moz-progress-bar { background: var(--gold); }
  .collection-closest { margin-top: 12px; }
  #panel-collection .collection-toolbar-field select { height: 44px; min-height: 44px; }
  .collection-toolbar-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
  /* UX-093: at phone width the two filters share one row (label above select) and the recent chips stay compact. */
  @media (max-width: 600px) {
    #collection-title-slot { display: contents; }
    #panel-collection .inventory-toolbar { flex-wrap: nowrap; }
    #panel-collection .collection-toolbar-field { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: stretch; gap: 2px; }
    #panel-collection .collection-toolbar-field select { width: 100%; min-width: 0; }
    /* UX-CARD-001: the toolbar's flex-basis 140px became a 140px height in this column layout. */
    #panel-collection .collection-toolbar-field select { flex: 0 0 auto; }
    #collection-recent { gap: 6px; }
    #collection-recent .market-row { padding: 4px 8px; }
    #collection-recent .market-meta { display: none; }
  }
  /* UX-093: the tagline is said once on the login screen; on a phone it only pushes every page down. */
  @media (max-width: 600px) { .game-tagline { display: none; } }

  .collection-closest h3 { margin: 0 0 6px; }
  .collection-closest-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 8px;
    padding: 6px 0;
    font-size: 13px;
  }
  .collection-closest-name { overflow-wrap: anywhere; }
  .collection-closest-count { color: var(--muted); font-variant-numeric: tabular-nums; }
  .collection-closest-row .collection-progress { grid-column: 1 / -1; }
  #collection-groups summary .collection-progress {
    display: block;
    max-width: 240px;
    margin-top: 4px;
  }
  #collection-groups .collection-group-complete > summary { opacity: 0.6; }
  #collection-groups .collection-group-complete .collection-progress::-webkit-progress-value { background: var(--green); }
  #collection-groups .collection-group-complete .collection-progress::-moz-progress-bar { background: var(--green); }
  .pinned-goal-pct {
    font-size: 11px;
    font-weight: bold;
    color: var(--heading);
    min-width: 34px;
    text-align: right;
  }
  .pinned-goal-unpin-btn {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid #39424f;
    background: #1b212a;
    color: var(--heading);
    cursor: pointer;
  }
  .pinned-goal-unpin-btn:hover {
    background: #3a1a1c;
    border-color: #e0a0a0;
  }
  .pinned-goal-completed-badge {
    font-size: 11px;
    font-weight: bold;
    color: #8fd694;
  }
  .possible-goals-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .possible-goal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    background: #1b212a;
    border: 1px solid #232a34;
    border-radius: 4px;
    font-size: 12px;
  }
  .possible-goal-title {
    font-weight: 500;
    color: var(--heading);
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .possible-goal-pin-btn, .pin-goal-btn {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #39424f;
    background: #1b212a;
    color: var(--heading);
    cursor: pointer;
  }
  .possible-goal-pin-btn:hover, .pin-goal-btn:hover {
    background: #1e242d;
    border-color: var(--muted);
  }
  .possible-goal-pin-btn:disabled, .pin-goal-btn:disabled {
    opacity: 0.5;
    cursor: default;
  }

  /* AJ-001 / IDEA-0057: Adventure Journal */
  .adventure-journal-section {
    background: #1b212a;
    border: 1px solid #39424f;
    border-radius: 6px;
    padding: 10px 12px;
  }
  .adventure-journal-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 480px;
    overflow-y: auto;
  }
  .journal-entry-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #1b212a;
    border: 1px solid #39424f;
    border-radius: 5px;
    padding: 8px 10px;
    transition: background 0.15s ease;
  }
  .journal-entry-row:hover {
    background: #1b212a;
  }
  .journal-icon {
    font-size: 18px;
    line-height: 1;
    flex: 0 0 24px;
    text-align: center;
    padding-top: 2px;
  }
  .journal-content {
    flex: 1 1 auto;
    min-width: 0;
  }
  .journal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
  }
  .journal-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--heading);
  }
  .journal-desc {
    font-size: 11px;
    color: #9aa4b2;
    line-height: 1.35;
  }
  /* UX-084: same-minute entries read as one group: no repeated time, tighter rows. */
  .journal-entry-row.journal-entry-grouped { margin-top: -4px; padding-top: 4px; padding-bottom: 4px; }
  .stats-headline {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px 16px;
    margin: 0 0 12px;
  }
  .stats-headline dt { font-size: 12px; color: var(--muted); }
  .stats-headline dd { margin: 0; font-size: 18px; font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; }
  .journal-time {

    font-size: 11px;
    color: #8b95a5;
    margin-top: 3px;
  }
  .journal-empty-note {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    text-align: center;
    padding: 16px 8px;
  }



  .inventory-group {
    margin-bottom: var(--space-lg);
  }

  .inventory-group:last-child {
    margin-bottom: 0;
  }

  .inventory-group h3 {
    margin: 0 0 var(--space-md) 0;
    font-size: var(--font-size-md);
    color: var(--heading);
  }

  /* UX-058: compact icon-tile grid, same auto-fill pattern as .skill-grid
     (line ~467), instead of a wide always-expanded flex row per item. */
  .inventory-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px;
  }

  .inv-item {
    min-width: 0;
  }

  .inv-item.is-selected .inv-tile-face {
    background: var(--parchment-dark);
    border-color: var(--heading);
    box-shadow: 0 0 0 2px var(--heading);
  }

  /* UX-INV-001: item info lives in a panel beside the grid (right column on
     wide screens, bottom sheet on phones), so selecting never moves the grid. */
  .inventory-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .inventory-detail-panel {
    box-sizing: border-box;
    min-width: 0;
    overflow-y: auto;
    padding: 10px 12px;
    background: var(--parchment);
    border: 1px solid var(--wood);
    border-radius: 6px;
  }

  .inventory-detail-close {
    display: none;
  }

  .inventory-detail-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .inventory-detail-head .item-detail-name {
    margin: 0;
    font-size: var(--font-size-md);
  }

  .inventory-detail-hint {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
  }

  @media (min-width: 900px) {
    .inventory-layout {
      grid-template-columns: minmax(0, 1fr) 300px;
    }

    .inventory-detail-panel {
      position: sticky;
      top: 96px;
      max-height: calc(100vh - 120px);
    }
  }

  @media (min-width: 900px) and (max-width: 1023px) {
    .inventory-detail-panel {
      top: 190px;
      max-height: calc(100vh - 210px);
    }
  }

  @media (max-width: 899px) {
    .inventory-detail-panel {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 120; /* above the status bar (100), below modals (150) */
      max-height: 55vh;
      border-radius: 10px 10px 0 0;
      box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.3);
      padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .inventory-detail-panel.is-empty {
      display: none;
    }

    .inventory-detail-close {
      display: block;
      min-width: 44px;
      min-height: 44px;
      margin: 0 0 6px auto;
    }

    /* Keep the last grid row reachable behind the open sheet. */
    #panel-inventory:has(.inventory-detail-panel:not(.is-empty)) {
      padding-bottom: 55vh;
    }
  }

  .inv-tile-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    background: var(--parchment);
    border: 1px solid var(--wood);
    border-radius: 6px;
    padding: 8px 4px;
    font-size: 13px;
    cursor: pointer;
    list-style: none;
    font-family: inherit;
    color: inherit;
  }

  .inv-tile-face::-webkit-details-marker {
    display: none;
  }

  /* R-21: rarity border, generic for any item tagged in ITEM_RARITY --
     reused as-is by the weapon-picker's .resource-btn rows below. */
  .item-rarity-rare .inv-tile-face,
  .resource-btn.item-rarity-rare {
    border-color: #3b82c4;
    box-shadow: 0 0 0 1px rgba(59, 130, 196, 0.35);
  }

  .item-rarity-epic .inv-tile-face,
  .resource-btn.item-rarity-epic {
    border-color: #a855f7;
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.4);
  }

  .inv-tile-face:focus-visible {
    outline: 2px solid var(--heading);
    outline-offset: 2px;
  }

  .inv-tile-icon {
    display: block;
    font-size: 22px;
    line-height: 1;
  }

  .inv-tile-name {
    display: block;
    width: 100%;
    font-size: 11px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .inv-item .count {
    font-weight: bold;
    color: var(--heading);
  }

  .inv-stack-best {
    font-size: 11px;
    color: var(--muted, inherit);
  }

  .gear-instance-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 4px 0;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  }

  .inv-equipped-mark {
    font-size: 10px;
    color: var(--heading);
    text-transform: uppercase;
  }

  .inv-item.is-equipped .inv-tile-face {
    border-color: var(--heading);
  }

  .item-action-note {
    font-size: 11px;
    color: var(--muted);
  }

  .item-detail-name {
    font-weight: 600;
    color: var(--heading);
  }

  .item-detail-content {
    display: grid;
    gap: 4px;
    min-width: 0;
    margin-top: 6px;
  }

  .item-detail-content .item-usage,
  .item-detail-content .item-flavor,
  .item-detail-content .recipe-consumers {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* UX-003: complete item-use description inside the selected item's details. */
  .item-usage {
    flex: 0 0 100%;
    font-size: 11px;
    color: var(--heading);
    opacity: 0.75;
  }

  /* UX-010 / ITM-001: authored lore remains a secondary, italic detail. */
  .item-flavor {
    flex: 0 0 100%;
    font-size: 11px;
    color: var(--heading);
    opacity: 0.6;
    font-style: italic;
  }

  .inventory-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
  }

  /* UX-088: inventory explainer, geode block and chest key reason. */
  .inventory-intro {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--muted);
    text-align: left;
  }

  /* UX-CHEST-001: chest/geode actions sit in the Inventory detail panel. */
  .loot-shop-row {
    margin-bottom: 10px;
  }

  .chest-detail {
    display: grid;
    gap: 8px;
  }

  .chest-keys {
    font-size: 12px;
    color: var(--muted);
  }

  .geode-controls {
    display: grid;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .geode-hint {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
  }

  .geode-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .geode-ore-label {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    font-size: 12px;
  }

  .chest-need-key {
    font-size: 11px;
    color: var(--muted);
  }

  .inventory-toolbar .inventory-filter-select,
  .inventory-toolbar .inventory-sort-select {
    flex: 1 1 140px;
    min-width: 0;
  }

  .inventory-toolbar .inventory-search-input {
    flex: 1 1 200px;
    margin-bottom: 0;
  }

  /* VIS-003: border/background/color kommer nu fra select-basisreglen; her
     bliver kun det tilbage der faktisk afviger. Den gamle `var(--card, ...)`
     pegede på en variabel der aldrig har eksisteret -- kun fallbacken virkede. */
  .inventory-filter-select,
  .inventory-sort-select {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    flex: 0 0 auto;
  }

  .inventory-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    margin-bottom: 10px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--wood);
    border-radius: 6px;
  }

  .favorite-toggle {
    font-family: inherit;
    background: none;
    border: none;
    padding: 0;
    margin-left: 6px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
    color: #e5a00d;
  }

  .reserve-wrap {
    font-size: 11px;
    color: var(--heading);
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
  }

  .reserve-input {
    width: 48px;
    font-size: 11px;
    font-family: inherit;
    padding: 2px 4px;
    border: 1px solid var(--wood);
    border-radius: 4px;
    background: var(--bg, #1b212a);
    text-align: right;
  }

  /* CG-030a: read-only recipe consumers are available in item details. */
  .recipe-consumers {
    flex: 0 0 100%;
    font-size: 11px;
    color: var(--heading);
    opacity: 0.75;
  }

  .reserve-estimate,
  .reserve-estimate-detail {
    flex: 0 0 100%;
    color: var(--heading);
    overflow-wrap: anywhere;
  }

  .reserve-estimate {
    font-size: 11px;
    font-weight: 600;
  }

  .reserve-estimate-detail {
    font-size: 11px;
    opacity: 0.7;
  }

  .lock-toggle {
    font-family: inherit;
    background: none;
    border: none;
    padding: 0;
    margin-left: 6px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
  }

  .salvage-btn {
    font-family: inherit;
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid var(--wood);
    border-radius: 4px;
    background: var(--parchment);
    color: var(--heading);
    cursor: pointer;
    margin-left: 4px;
    flex: 0 0 auto;
  }

  .salvage-btn:hover:not(:disabled) {
    background: var(--wood);
    color: var(--text);
  }

  .salvage-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .upgrade-btn {
    font-family: inherit;
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid var(--gold);
    border-radius: 4px;
    background: var(--parchment);
    color: var(--heading);
    cursor: pointer;
    margin-left: 4px;
    flex: 0 0 auto;
  }

  .upgrade-btn:hover:not(:disabled) {
    background: var(--gold);
    color: var(--on-accent);
  }

  .upgrade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .empty-note {
    font-size: 13px;
    color: var(--muted);
    font-style: italic;
  }

  .controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .settings-session-actions {
    margin-bottom: 12px;
  }

  .settings-groups {
    display: grid;
    gap: 12px;
    min-width: 0;
  }

  .settings-group {
    min-width: 0;
    padding: 12px;
    background: var(--parchment-dark);
    border: 1px solid var(--wood);
    border-radius: 6px;
  }

  .settings-group h3 {
    margin: 0 0 8px;
  }

  /* UX-085: helper text sits under left-aligned headings and controls. */
  #panel-controls .footer-note { text-align: left; }
  .settings-group h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
  .settings-group h3 + h4 { margin-top: 4px; }
  .settings-session-actions { align-items: center; }
  .pause-status { font-size: 13px; color: var(--muted); }
  .pause-status.is-paused { color: var(--gold-light); font-weight: 600; }
  .settings-group > .footer-note {

    margin-top: 0;
  }

  .settings-group .save-io {
    margin-top: 12px;
  }

  .settings-account .cloud-auth-box h4 {
    margin: 0 0 8px;
  }

  .settings-danger-zone {
    border-color: var(--red-text);
    border-left-width: 5px;
  }

  .settings-danger-zone h3 {
    color: var(--red-text);
  }

  #panel-controls button:focus-visible,
  #panel-controls a:focus-visible,
  #panel-controls input:focus-visible,
  #panel-controls textarea:focus-visible {
    outline: 3px solid var(--heading);
    outline-offset: 2px;
  }

  button.action, a.action {
    font-family: inherit;
    background: var(--wood);
    color: var(--text);
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    /* Phase 53: the "Download as file" link reuses this same class as
       every action button (a.action, alongside button.action) — an <a>
       is inline by default, so it needs these to actually look and sit
       like the buttons next to it instead of hugging its text. */
    display: inline-block;
    text-decoration: none;
    line-height: 1.2;
  }

  button.action:hover, a.action:hover {
    background: var(--surface-2);
  }

  /* UX audit fix: recruit-btn, monument-btn and queue-add-btn are all set
     to .disabled = true/false in JS depending on affordability/capacity,
     but this class previously had no :disabled rule at all — a disabled
     button rendered pixel-identical to an enabled one (only .market-row
     button had a disabled style). Same treatment as that existing rule. */
  button.action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--wood);
  }

  button.danger {
    background: var(--red-fill);
  }

  /* Phase 53 ("save export/import"): the export/import boxes share the
     same parchment-dark card look as an .offline-row, tucked inside the
     Game controls panel rather than a modal — export/import are optional
     tools someone reaches for occasionally, not an interruption like the
     offline-progress summary. */
  .save-io {
    margin-top: 12px;
    padding: 12px;
    background: var(--parchment-dark);
    border: 1px solid var(--wood);
    border-radius: 6px;
  }

  .cloud-auth-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    max-width: 420px;
  }

  /* FOUNDER-001: cosmetic Founder's Pack badge/title (display only). */
  .founder-badge {
    padding: 1px 6px;
    border: 1px solid var(--gold-dark);
    border-radius: 4px;
    color: var(--gold-light);
    font-weight: 600;
  }

  .founder-title {
    margin: 0 0 8px;
    color: var(--gold);
    font-style: italic;
  }

  .founder-title-toggle {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
  }

  .founder-badge[hidden], .founder-title[hidden], .founder-title-toggle[hidden] {
    display: none;
  }

  .cloud-auth-fields.panel-hidden {
    display: none;
  }

  .cloud-auth-fields input {
    box-sizing: border-box;
    width: 100%;
    padding: 8px;
    border: 1px solid var(--wood);
    border-radius: 4px;
    background: var(--parchment);
    color: var(--text);
    font: inherit;
  }

  .cloud-auth-fields .controls {
    margin-top: 4px;
  }

  .cloud-history-list {
    display: grid;
    gap: 6px;
    list-style: none;
    margin: 8px 0;
    padding: 0;
  }

  .cloud-history-list .action {
    text-align: left;
    width: 100%;
  }

  #cloud-history-preview {
    margin-top: 8px;
  }

  .save-io textarea {
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 8px;
    border: 1px solid var(--wood);
    border-radius: 4px;
    background: var(--parchment);
    color: var(--text);
    resize: vertical;
    box-sizing: border-box;
  }

  button.danger:hover {
    background: #8f2a27;
  }

  .history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
  }

  .history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--parchment);
    border: 1px solid var(--wood);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .history-row .meta {
    display: flex;
    flex-direction: column;
  }

  .history-row .label {
    font-weight: bold;
  }

  .history-row .date {
    color: var(--muted);
    font-size: 11px;
  }

  .history-row button {
    font-family: inherit;
    background: var(--green);
    color: var(--on-accent);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
  }

  .footer-note {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--muted);
    margin-top: var(--space-md);
  }

  /* UX-025: .footer-note covers two very different jobs -- static lore/
     "how this panel works" prose (stays 11px, per the audit's own intent
     that flavor text stay small) and live gameplay status/counters (Township
     villager status, mastery pool checkpoints, queue capacity, Prosperity
     tribute, offline-speed note, etc.) that a player actually reads as data.
     .footer-note-data is an additive modifier (combined with .footer-note,
     never a replacement) that raises just the data use-sites into the
     "secondary info" tier (12-13px) without touching the ~50 lore/
     instructional .footer-note use-sites left untouched across the game. */
  .footer-note-data {
    font-size: var(--font-size-sm);
  }

  /* UX-076: text-weight link inside a data note (Skilling's next-goal line). */
  .inline-link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--heading);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
  }
  .inline-link-button:focus-visible { outline: 2px solid var(--color-active); outline-offset: 2px; }

  /* UX-062: Rift/Horde's labeled stat fields, same "facts you scan, not
     prose you parse" shape as #horde-loadout-records' table. */
  .status-fields {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 14px;
  }

  .status-field {
    display: inline-flex;
    gap: 4px;
  }

  .status-field-label {
    color: var(--muted);
  }

  .status-field-value {
    font-weight: bold;
    color: var(--heading);
  }

  .status-fields-note {
    margin: 4px 0 0;
  }

  .companion-care-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 12px;
  }

  .companion-food-select {
    flex: 1 1 190px;
    min-width: min(100%, 150px);
  }

  .companion-feed-amount {
    flex: 0 0 auto;
  }

  .companion-feed-preview {
    flex: 1 0 100%;
    margin-top: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }

  /* Offline-progress modal */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150; /* AUD-014: above the fixed status bar (100) and sidebar (90) */
  }

  .modal-overlay.hidden {
    display: none;
  }

  .modal-box {
    background: var(--parchment);
    border: 3px solid var(--wood);
    border-radius: 10px;
    padding: 24px;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: center;
  }

  /* UX-CHEST-REWARDS-001: chest rewards dialog */
  .chest-rewards-box { width: min(420px, calc(100vw - 32px)); box-sizing: border-box; }
  .chest-rewards-box ul { list-style: none; margin: 8px 0; padding: 0; text-align: left; overflow-wrap: anywhere; }
  .chest-rewards-box li { padding: 4px 0; }
  #chest-rewards-items { max-height: 40vh; overflow-y: auto; } /* UX-CHEST-RESULT-LONG-001 */
  .chest-rewards-new { color: var(--heading); font-weight: bold; }
  #chest-rewards-each { font-size: 0.9em; border-top: 1px solid var(--wood); padding-top: 6px; }
  #chest-rewards-close-btn { min-height: 44px; min-width: 44px; }

  /* UX-CONFIRM-001: in-game confirm/prompt dialog (askConfirm/askText). */
  .confirm-box { width: min(460px, calc(100vw - 32px)); box-sizing: border-box; }
  #confirm-body { white-space: pre-line; overflow-wrap: anywhere; }
  #confirm-input { width: 100%; box-sizing: border-box; min-height: 44px; margin-bottom: 8px; }
  .confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
  .confirm-actions .action { min-height: 44px; min-width: 44px; }

  .modal-box h2 {
    margin-top: 0;
    color: var(--heading);
  }

  /* Phase 41 ("redesign the offline-progress modal"): replaces the old
     single blended <p> (built with literal \n line breaks and
     white-space: pre-line on .modal-box) with a real per-activity
     breakdown — one card per skill/combat/villager segment, each showing
     what was actually gained, xp and an implied xp/hr, and any level-up,
     instead of one run-on paragraph. See renderOfflineModal(). */
  #offline-summary {
    text-align: center;
    margin-bottom: 4px;
  }

  #offline-speed-note {
    text-align: center;
    margin-top: 0;
    margin-bottom: 14px;
  }

  #offline-breakdown {
    text-align: left;
  }

  .offline-row {
    background: var(--parchment-dark);
    border: 1px solid var(--wood);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
  }

  .offline-row-header {
    font-weight: bold;
    color: var(--heading);
    font-size: 13px;
  }

  .offline-row-detail {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
  }

  .offline-row-note {
    font-size: 12px;
    margin-top: 4px;
  }

  .offline-row-note.level-up {
    color: var(--green);
    font-weight: bold;
  }

  .offline-row-note.warning {
    color: var(--red-text);
    font-weight: bold;
  }

  /* Market flexible selling UI */
  .market-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .market-name {
    font-weight: 600;
    color: var(--heading);
  }

  .market-meta {
    font-size: 13px;
    color: var(--muted);
  }

  /* UX-010 / ITM-001: functional usage line + lore line on the Market buy
     rows, same pattern as .item-usage / .item-flavor in Inventory. */
  .market-usage {
    flex: 0 0 100%;
    font-size: 11px;
    color: var(--heading);
    opacity: 0.75;
  }

  .market-row.resource-codex-row {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  #resource-codex-list {
    display: grid;
    gap: 6px;
  }

  .resource-codex-source,
  .resource-codex-usage {
    overflow-wrap: anywhere;
  }

  .market-flavor {
    flex: 0 0 100%;
    font-size: 11px;
    color: var(--heading);
    opacity: 0.6;
    font-style: italic;
  }

  .market-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .market-custom-sell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .market-sell-qty-input {
    width: 50px;
    min-width: 5ch; /* UX-MARKET-004: room for 5 digits at 375 px */
    box-sizing: content-box;
    padding: 2px 4px;
    font-size: 11px;
    font-family: inherit;
    border: 1px solid var(--wood);
    border-radius: 4px;
  }

  .market-sell-1-btn,
  .market-sell-x-btn,
  .market-sell-all-btn,
  .market-sell-btn {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
  }

  /* UX-089: price under the name; Qty | Max | Sell in fixed columns on every row. */
  .market-sell-row { flex-wrap: nowrap; }
  .market-sell-row .market-name { flex: 1 1 auto; min-width: 0; }
  .market-sell-row .market-meta { display: block; font-weight: 400; font-size: 12px; }
  .market-sell-row .market-actions {
    display: grid;
    grid-template-columns: 7em 3.5em 12em;
    flex: 0 0 auto;
  }
  .market-sell-row .market-actions .market-sell-btn { grid-column: 3; }
  .market-sell-row .market-actions button { width: 100%; }
  .market-max-btn { font-size: 11px; padding: 2px 6px; border-radius: 4px; }
  .market-qty-label { font-size: 11px; color: var(--muted); }
  /* UX-MARKET-003: denser sell rows, category headers, tier selector. */
  #market-intro[hidden] { display: none; }
  #market-sell-list .market-row { padding: 3px 8px; margin-bottom: 2px; }
  .market-group-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    margin: 10px 0 4px; padding-bottom: 2px; border-bottom: 1px solid var(--wood);
  }
  .market-group-head h3 { margin: 0; font-size: 14px; }
  .market-group-sell-btn { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
  .market-group-sell-btn.market-sell-all-armed { border: 1px solid var(--red); background: var(--wood-dark); color: var(--heading); }
  .market-tier-select { margin-left: 6px; font-family: inherit; font-size: 13px; max-width: 100%; }
  .market-qty-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
  .market-qty-btn { min-height: 32px; padding: 2px 10px; }
  .market-qty-btn[aria-pressed="true"] { outline: 2px solid currentColor; font-weight: bold; }
  @media (max-width: 600px) {
    #market-sell-list .market-sell-row { flex-wrap: wrap; gap: 2px 8px; }
    #market-sell-list .market-sell-row .market-actions { grid-template-columns: 4.5em 3.2em 1fr; flex: 1 1 100%; }
    #market-sell-list .market-name { font-size: 13px; }
  }
  .market-sell-x-btn.market-sell-all-armed {
    border: 1px solid var(--red);
    color: var(--heading);
    background: var(--wood-dark);
  }
  @media (max-width: 539px) {
    .market-sell-row { flex-wrap: wrap; gap: 4px 8px; }
    .market-sell-row .market-name {
      flex: 1 1 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .market-sell-row .market-meta { display: inline; margin-left: 6px; }
    .market-sell-row .market-actions { flex: 1 1 100%; gap: 4px; grid-template-columns: auto auto 1fr; }
    .market-sell-row .market-actions button { padding: 6px 8px; }
    #market-category-filter, #market-sort-select { flex: 1 1 120px; min-width: 0; }
    .market-sell-qty-input { width: 6ch; }
  }
