/* game-shell.css: header, cards, skill grid, resource rows, activity panel, pickers, item card. Moved verbatim from css/game.css (TD-CONTENT-SPLIT-001); link order in index.html keeps the cascade. */

  /* UX-026: compact header. #gold-display (a pure duplicate of the
     always-visible #status-gold above) was removed entirely, and this
     block's own weight is cut — the title stays (it's the only place the
     game's name appears once the header is this small) but no longer
     needs to compete with the panels below it for vertical space. */
  h1 {
    text-align: center;
    color: var(--heading);
    margin: 0 0 2px;
    font-size: 18px;
  }

  .subtitle {
    text-align: center;
    color: var(--muted);
    margin-bottom: 8px;
    font-size: 12px;
    font-style: italic;
  }

  /* UX-026: the element this class was named for (#gold-display) is gone —
     only #potion-display still uses it, for the same centred/bold styling. */
  .gold-display {
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: var(--heading);
    margin-bottom: 16px;
  }

  .panel {
    background: var(--parchment-dark);
    border: 2px solid var(--wood);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
  }

  /* UX-060: a lighter, lower-padding sub-card for grouping Township's many
     subsystems -- same visual language as .panel, clearly a sub-section
     rather than a sibling panel. */
  .town-subsection {
    background: var(--parchment);
    border: 1px solid var(--wood);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .town-subsection h3 {
    margin-top: 0;
  }

  /* Bug fix found while working on Phase 53: this used to be scoped as
     `.panel.panel-hidden` (both classes on the SAME element), which only
     ever matched actual `.panel` divs. But `panel-hidden` is used
     everywhere as a generic "hide this" utility class on plenty of
     non-panel elements too (the Prestige button, the Slayer task button,
     the potion status readout, ...) — those elements had `panel-hidden`
     toggled onto them correctly by the JS, but the CSS never actually
     hid them, so e.g. a "Prestige" button sat visibly on every skill
     panel even at level 1, long before it was actually eligible. The
     utility stays unscoped and uses !important so component selectors
     such as button.action cannot override the hidden state. */
  .panel-hidden {
    display: none !important;
  }

  .panel h2 {
    margin: 0 0 var(--space-lg) 0;
    font-size: var(--font-size-lg);
    color: var(--heading);
    border-bottom: 1px solid var(--wood);
    padding-bottom: 6px;
  }

  .panel h3 {
    margin: var(--space-lg) 0 6px;
    font-size: var(--font-size-md);
    color: var(--heading);
  }

  .skill-tabs { display: grid; gap: 10px; }
  .skill-group { --c: #7fae68; min-width: 0; }
  .skill-group[data-category="production"] { --c: #d08a5e; }
  .skill-group[data-category="elite"] { --c: #9a8fd6; }
  .skill-group[data-category="township"] { --c: #c79a4a; }
  .skill-group[data-category="support"] { --c: #92a7bb; }
  .skill-group[data-category="combat"] { --c: #d4796a; }
  .panel .skill-tab-group-heading { margin: 0; padding: 6px 9px; border-left: 3px solid var(--c); font-size: 14px; font-weight: bold; color: var(--heading); cursor: pointer; }
  .skill-group[open] > .skill-tab-group-heading { margin-bottom: 9px; }
  .skill-group-hint { display: block; font-size: 11px; font-weight: normal; opacity: 0.75; white-space: normal; overflow-wrap: anywhere; }
  .skill-tab-group-heading:focus-visible { outline: 3px solid var(--heading); outline-offset: 2px; }
  .skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; }
  .skill-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 12px 7px 9px; border: 1px solid #39424f; border-radius: 5px; background: var(--parchment); color: var(--text); font: inherit; cursor: pointer; }
  .skill-tile:hover { border-color: var(--c); background: #222a35; }
  .skill-tile:focus-visible { outline: 3px solid var(--heading); outline-offset: 3px; z-index: 1; }
  .skill-tile.active { border: 2px solid var(--heading); padding: 11px 6px 8px; background: #2e2717; }
  .skill-tile.running { box-shadow: inset 0 3px var(--c); }
  .skill-tile.running .skill-tile-note { color: var(--c); font-weight: bold; }
  .skill-tile.running .skill-tile-note::before { content: '● '; }
  .skill-tile-icon { width: 39px; height: 39px; font-size: 30px; line-height: 39px; }
  .skill-tile-icon svg { width: 100%; height: 100%; }
  /* VIS-001: inline icon used wherever an enemy/skill id has a symbol in the shared sprite */
  .inline-icon { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }
  .skill-tile-name { font-size: 13px; font-weight: bold; overflow-wrap: anywhere; }
  .skill-tile-level { font-size: 11px; color: #9aa4b2; }
  .skill-tile-xp { display: block; width: 100%; height: 4px; margin-top: 3px; background: #2a323d; border-radius: 3px; overflow: hidden; }
  .skill-tile-xp > span { display: block; height: 100%; background: var(--c); }
  .skill-tile-note { font-size: 11px; line-height: 1.4; color: #9aa4b2; }
  .skill-tile.sub-skill { background: #1e242d; }
  .skill-tile.sub-skill .skill-tile-icon { width: 30px; height: 30px; margin: 4px 0 5px; }
  .skill-tile.locked { cursor: default; background: var(--color-locked); }
  .skill-tile.locked .skill-tile-icon { filter: grayscale(1); opacity: .65; }
  .skill-tile.locked .skill-tile-level::before { content: '◇ '; }
  .skill-tile.locked .skill-tile-xp { visibility: hidden; }
  .skill-grid-hint { font-size: 12px; line-height: 1.5; color: #9aa4b2; margin: -4px 0 14px; }
  /* ONB-002: one quiet Did you know? line under the skill title. */
  .did-you-know { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 6px 10px; border: 1px solid var(--wood); border-radius: 8px; font-size: var(--font-size-sm, 13px); }
  .did-you-know[hidden] { display: none; }
  .did-you-know p { flex: 1; margin: 0; line-height: 1.5; }
  .did-you-know strong { color: var(--heading); }
  .did-you-know .action { min-height: 32px; padding: 2px 10px; }
  @media (max-width: 539px) {
    .did-you-know { flex-wrap: wrap; }
    .did-you-know p { flex-basis: 100%; }
    .did-you-know .action { min-height: 44px; min-width: 44px; }
  }
  .level-up-flash { background-color: var(--gold-light) !important; color: var(--on-accent) !important; }
  @media (max-width: 480px) {
    .skill-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .skill-tile { padding-left: 4px; padding-right: 4px; }
    .skill-tile-name { font-size: 11px; }
    .skill-tile-note { font-size: 11px; }
  }


  .skill-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
  }

  .skill-level {
    font-size: 20px;
    font-weight: bold;
    color: var(--heading);
  }

  .xp-info {
    font-size: 12px;
    color: var(--muted);
  }

  .bar-outer {
    background: #2a323d;
    border: 1px solid var(--wood);
    border-radius: 6px;
    height: 16px;
    overflow: hidden;
    margin-bottom: 4px;
  }

  .bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    width: 0%;
    transition: width 0.15s linear;
  }

  .bar-inner.enemy-hp {
    background: linear-gradient(90deg, var(--red), #e08585);
  }

  .bar-inner.player-hp {
    background: linear-gradient(90deg, var(--green), #8cc077);
  }

  .action-bar-outer {
    background: #2a323d;
    border: 1px solid var(--wood);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
    margin-top: 10px;
  }

  .action-bar-inner {
    height: 100%;
    background: var(--green);
    width: 0%;
  }

  .action-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    text-align: center;
  }

  .action-label.blocked,
  .footer-note.blocked {
    color: var(--red-text);
    font-weight: bold;
  }

  /* IDLE-001 (DEC-089) */
  .skip-bank-label {
    display: block;
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 4px;
  }

  /* UX-024: visual hierarchy inside #panel-activity, per the UX/UI-audit's
     "Skill-dashboard og aktivitet" section. Every element these rules touch
     keeps its own existing id/class and is still written to by the exact
     same renderX() functions as before this task — only the surrounding
     wrapper's presentation changes. Layer 1 (current action) is the
     biggest/clearest; layer 2 (level/xp) is next; layer 3
     (mastery/prestige/tool/etc.) is deliberately smaller and quieter;
     layer 4 (flavor text) is dimmed. */
  .activity-layer-current {
    background: rgba(217, 180, 92, 0.08);
    border: 1px solid var(--wood);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 14px;
  }

  /* UX-069: Combat's idle state lives in Encounter; drop the empty frame. */
  .activity-layer-current:not(:has(> :not(.panel-hidden))) { display: none; }

  .activity-layer-current .action-bar-outer {
    height: 20px;
    margin-top: 0;
  }

  .activity-layer-current .action-label {
    font-size: 15px;
    font-weight: bold;
    color: var(--heading);
    margin-top: 8px;
  }

  .activity-layer-current .action-label.blocked {
    color: var(--red-text);
  }

  .activity-layer-progress {
    margin-bottom: 12px;
  }

  .activity-layer-disclosure {
    border-top: 1px solid var(--wood);
    margin-top: 10px;
  }

  .activity-layer-disclosure > summary {
    cursor: pointer;
    color: var(--heading);
    font-size: 13px;
    font-weight: bold;
    padding: 8px 0 4px;
  }

  .activity-layer-secondary {
    padding-top: 4px;
    font-size: 13px;
  }

  .activity-layer-secondary .skill-level {
    font-size: 14px;
  }

  .activity-layer-secondary .xp-info {
    font-size: 11px;
  }

  .activity-layer-secondary .bar-outer {
    height: 10px;
  }

  #panel-activity .lore-flavor {
    font-size: 11px;
    color: var(--muted);
    opacity: 0.75;
    margin-top: 14px;
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid var(--wood);
  }

  /* UX-RESOURCE-GRID-001: one grid so every card in a list has the same width. */
  .resource-list,
  .resource-tier-body,
  .resource-variants-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 8px;
    align-items: start;
  }

  #regions-overview {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--wood);
  }

  #regions-overview h3,
  #regions-bonus-totals h4 {
    margin: 0 0 6px;
  }

  .region-bonus-totals {
    margin: 6px 0 12px;
    padding-left: 22px;
  }

  .region-tree,
  .region-tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .region-tree-item {
    min-width: 0;
  }

  .region-tree > .region-tree-item + .region-tree-item,
  .region-tree-children > .region-tree-item + .region-tree-item {
    margin-top: 8px;
  }

  .region-tree-children {
    margin: 8px 0 0 12px;
    padding-left: 12px;
    border-left: 2px solid var(--wood);
  }

  .region-tree-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--wood);
    border-radius: var(--radius-md);
    background: var(--parchment);
  }

  .region-tree-details {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .region-tree-name {
    overflow-wrap: anywhere;
  }

  .region-tree-status,
  .region-tree-bonus {
    overflow-wrap: anywhere;
  }

  .region-view-button {
    flex: 0 0 auto;
    min-width: 56px;
  }

  .region-unknown-branches {
    margin: 5px 0 0 10px;
    overflow-wrap: anywhere;
  }

  .resource-btn.region-view-highlight {
    outline: 3px solid var(--heading);
    outline-offset: 2px;
    animation: region-view-pulse 0.6s ease-in-out 2 alternate;
  }

  @keyframes region-view-pulse {
    from { box-shadow: 0 0 0 0 transparent; }
    to { box-shadow: 0 0 0 5px var(--color-active); }
  }

  @media (max-width: 480px) {
    .region-tree-row {
      gap: 6px;
      padding: 8px;
    }

    .region-tree-children {
      margin-left: 6px;
      padding-left: 8px;
    }
  }

  .resource-section-heading {
    grid-column: 1 / -1;
    margin: 12px 0 0;
    color: var(--heading);
  }

  .resource-card {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    padding: 10px;
    border: 2px solid var(--wood);
    border-radius: var(--radius-md);
    background: var(--parchment);
    color: var(--text);
    overflow-wrap: anywhere;
  }

  /* UX-073 (DESIGN.md): selection is a green edge on a faint green tint,
     never a full green fill -- body text stays light and readable. */
  .resource-card:not(.locked):hover {
    background: var(--parchment-dark);
    border-color: var(--color-active);
    color: var(--text);
  }

  .resource-card.active {
    background: color-mix(in srgb, var(--color-active) 14%, var(--parchment));
    border-color: var(--color-active);
    color: var(--heading);
  }

  /* S-6: a text chip on the running card, so phones do not rely on the faint border. */
  .resource-card.active .resource-name::after {
    content: 'Running';
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--color-active);
    color: var(--parchment);
    font-size: 11px;
    font-weight: bold;
    vertical-align: middle;
  }

  .resource-card > .resource-btn {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    white-space: normal;
  }

  .resource-card > .resource-btn:hover:not(:disabled),
  .resource-card > .resource-btn.active {
    border-color: transparent;
    background: transparent;
    color: inherit;
  }

  .resource-card > .resource-btn.active {
    font-weight: bold;
  }

  .resource-card > .resource-meta,
  .resource-card > .resource-usage,
  .resource-card > .resource-stats,
  .resource-card > .resource-zone-bonus,
  .resource-card > .resource-artifice-effect,
  .resource-card > .resource-inputs,
  .resource-card > .resource-potion-preview,
  .resource-card > .tooltip-anchor,
  .resource-card > .resource-quantity-note {
    flex: 0 0 100%;
    min-width: 0;
  }

  .resource-card > [data-quantity-control].hidden {
    display: none;
  }

  .resource-btn {
    flex: 1 1 calc(33% - var(--space-md));
    min-width: 160px;
    padding: 10px;
    border: 2px solid var(--wood);
    border-radius: var(--radius-md);
    background: var(--parchment);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    font-size: var(--font-size-md);
    color: var(--text);
  }

  .resource-btn:hover:not(:disabled) {
    background: var(--parchment-dark);
    border-color: var(--color-active);
    color: var(--text);
  }

  .resource-btn.active {
    background: color-mix(in srgb, var(--color-active) 14%, var(--parchment));
    border-color: var(--color-active);
    color: var(--heading);
    font-weight: bold;
  }

  .resource-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  .equipment-comparison,
  .equipment-equipped-label {
    display: block;
    width: 100%;
    margin-top: 4px;
    font-size: 11px;
    font-weight: normal;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .equipment-comparison-against,
  .equipment-comparison-delta.neutral {
    color: var(--muted);
  }

  .equipment-comparison-delta.positive {
    color: var(--green);
  }

  .equipment-comparison-delta.negative {
    color: var(--red-text);
  }

  .equipment-equipped-label {
    color: var(--color-active); /* UX-073: active rows are a tint now, not a green fill */
  }

  /* UX-104: compact ↑/↓ verdict on each picker row; detail lives on the item card. */
  .equipment-verdict {
    display: block;
    width: 100%;
    margin-top: 2px;
    font-size: 11px;
    font-weight: normal;
  }
  .equipment-verdict.upgrade { color: var(--green); }
  .equipment-verdict.downgrade { color: var(--red-text); }
  .equipment-verdict.sidegrade { color: var(--muted); }
  .equipment-best { color: var(--gold); font-weight: bold; }

  /* UX-104: shared item card (Equipment, Inventory, Market). Fixed so scroll
     containers never clip it; two cards side by side, stacked on narrow screens. */
  .item-card-tooltip {
    position: fixed;
    z-index: 1000;
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    max-width: calc(100vw - 16px);
    pointer-events: none;
  }
  .item-card-tooltip[hidden] { display: none; }
  .item-card {
    width: 230px;
    max-width: calc(100vw - 16px);
    padding: 10px 12px;
    background: var(--wood-dark);
    border: 1px solid var(--wood);
    border-radius: var(--radius-md);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    font-size: var(--font-size-md);
    line-height: 1.4;
    color: var(--text);
  }
  .item-card-heading {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
  }
  .item-card-name { font-weight: 700; color: var(--heading); }
  .item-card-name.rarity-rare { color: #5b9bd8; }
  .item-card-name.rarity-epic { color: #b97df9; }
  .item-card-meta { font-size: 11px; color: var(--muted); }
  .item-card-verdict { margin-top: var(--space-sm); font-weight: 700; }
  .item-card-verdict.upgrade { color: var(--green); }
  .item-card-verdict.downgrade { color: var(--red-text); }
  .item-card-verdict.sidegrade { color: var(--gold); }
  .item-card-stats {
    margin: 6px 0 2px;
    font-size: var(--font-size-md);
    padding-top: 6px;
    border-top: 1px solid var(--wood);
  }
  .item-card-stat { display: flex; gap: var(--space-sm); }
  .item-card-stat .item-card-value { margin-left: auto; color: var(--heading); font-variant-numeric: tabular-nums; }
  .item-card-stat .item-card-delta { min-width: 6.5em; text-align: right; font-size: 11px; }
  .item-card-stat.positive .item-card-delta { color: var(--green); }
  .item-card-stat.negative .item-card-delta { color: var(--red-text); }
  .item-card-stat.neutral .item-card-delta { color: var(--muted); }
  .equip-req, .item-req, .item-card-req, .equipment-slot-req { display: block; font-size: 11px; color: var(--muted); }
  .equip-req.unmet, .item-req.unmet, .item-card-req.unmet, .equipment-slot-req.unmet { color: var(--red-text); }
  .equip-locked:disabled { opacity: 0.7; cursor: not-allowed; }
  .item-card-affix { margin-top: var(--space-sm); font-size: 11px; color: var(--gold-light); }
  @media (max-width: 520px) {
    .item-card-tooltip { flex-direction: column; gap: var(--space-sm); }
    .item-card { width: calc(100vw - 16px); }
  }
