/* game-combat-equipment.css: equipment layout, bosses, tooltip, mastery badge, enemy affixes, fight status, skill outfits. Moved verbatim from css/game.css (TD-CONTENT-SPLIT-001); link order in index.html keeps the cascade. */

  /* UX-065: left column, free figure column (2 tracks), right column; combat row below. */
  .equipment-slot-grid {
    display: grid;
    position: relative;
    z-index: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "head . . amulet"
      "shoulder . . gloves"
      "cloak . . ring"
      "armor . . trinket"
      "bracers . . legs"
      "belt . . boots"
      "melee offhand ranged magic";
    gap: 8px;
    max-width: 920px; /* UX-081: use the panel width so slot hints aren't cut */
    margin: 0 auto;
  }

  .equipment-summary-row.off-hand-inactive {
    opacity: 0.5;
  }

  .equipment-paper-doll-layout {
    position: relative;
    isolation: isolate;
    width: 100%;
    max-width: 920px;
    margin: 0 0 var(--space-xl);
  }

  .equipment-paper-doll-figure {
    position: absolute;
    z-index: 0;
    /* UX-116: fill the two middle tracks (2 cols + 3 gaps = 50% + 12px, minus
       a 4px gutter each side) and the six body rows (6 x 76px + 5 x 8px). */
    left: 50%;
    width: calc(50% + 4px);
    height: calc(6 * 76px + 5 * 8px);
    object-fit: contain;
    object-position: center;
    transform: translateX(-50%);
    top: 0;
    opacity: 0.22;
    pointer-events: none;
  }

  .equipment-summary-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    min-width: 0;
    width: 100%;
    height: 76px; /* UX-093: room for a two-line hint */
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    overflow: hidden;
    background: var(--panel);
    position: relative;
    z-index: 1;
    white-space: normal;
    line-height: 1.3;
    cursor: pointer;
  }

  .equipment-summary-row.active {
    background: var(--panel);
    color: inherit;
    border-color: var(--green);
    box-shadow: inset 3px 0 0 var(--green);
  }

  .equipment-slot-label {
    font-size: 0.75em;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .equipment-slot-item {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
  }

  /* UX-116: one line per card; +N always directly after the name. */
  .equipment-slot-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .equipment-slot-upgrade {
    flex: none;
    color: var(--gold-light);
    font-variant-numeric: tabular-nums;
  }

  .equipment-slot-item.empty {
    opacity: 0.55;
  }

  .equipment-slot-placeholder {
    filter: grayscale(1);
  }

  /* UX-074: an empty slot's next step, and the totals line under the doll. */
  .equipment-slot-hint {
    font-size: 11px;
    color: var(--muted); /* UX-081: craft hints stay neutral (Gold Is Earned) */
    overflow: hidden;
    max-width: 100%;
    /* UX-093: wrap to two lines instead of cutting the recipe name */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .equipment-slot-hint.best-owned { color: var(--gold-light); }
  /* UX-081: Equip/Recipe sits in the tile's grid area, bottom-right. */
  button.action.equipment-slot-action {
    position: relative;
    z-index: 2;
    align-self: start;
    justify-self: end;
    margin: 16px 6px 0 0;
    padding: 1px 8px;
    font-size: 11px;
    line-height: 1.4;
  }

  @media (max-width: 600px) {
    /* one shared tile height (UX-057) with room for a two-line hint */
    /* UX-EQUIP-PHONE-001: taller tile, text above a bottom strip where Equip/Recipe sits */
    .equipment-summary-row { height: 118px; padding-bottom: 32px; }
    button.action.equipment-slot-action { align-self: end; margin: 0 6px 5px 0; }
    .equipment-summary-row.active { box-shadow: none; } /* UX-081: no side-tab on the phone tile */
  }

  /* AFFIX-008a: slots left, labelled stat panel right (stacked under the slots on phones). */
  .equipment-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 16px;
    align-items: start;
  }
  .equipment-layout .equipment-paper-doll-layout { margin: 0; }
  .equipment-stat-panel {
    padding: var(--space-md);
    background: var(--panel);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    position: sticky;
    top: 64px;
  }
  .equipment-stat-panel h3 { margin: 0 0 8px; }
  .equipment-stat-list { margin: 0 0 10px; }
  .equipment-stat-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-variant-numeric: tabular-nums; }
  .equipment-stat-row dd { margin: 0; color: var(--heading); }
  #equip-best-btn { width: 100%; min-height: 44px; }
  .equipment-slot-stat { flex: none; margin-left: auto; color: var(--gold-light); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .equipment-slot-stat.inactive { opacity: 0.5; }
  .tool-slot-card { padding: var(--space-sm) var(--space-md); background: var(--panel); border: 1px solid var(--border, rgba(255, 255, 255, 0.12)); }
  @media (max-width: 900px) {
    .equipment-layout { grid-template-columns: minmax(0, 1fr); }
    .equipment-stat-panel { position: static; }
    .equipment-stat-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  }

  @media (max-width: 600px) {
    .equipment-paper-doll-figure {
      display: none;
    }

    .equipment-slot-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-areas:
        "head amulet"
        "shoulder gloves"
        "cloak ring"
        "armor trinket"
        "bracers legs"
        "belt boots"
        "melee offhand"
        "ranged magic";
    }
  }

  .equipment-summary-row:focus-visible {
    outline: 3px solid var(--heading);
    outline-offset: 2px;
  }

  /* UX-064: Equipment cards (slots, profiles, sets) share VIS-001 spacing. */
  .combat-profiles-disclosure {
    margin: 0 0 var(--space-lg);
    padding: var(--space-lg);
    border: 1px solid var(--wood);
    border-radius: var(--radius-md);
    min-width: 0;
  }

  .combat-profiles-disclosure > summary {
    cursor: pointer;
    font-weight: bold;
    color: var(--heading);
    overflow-wrap: anywhere;
  }

  .combat-profiles-disclosure > summary:focus-visible {
    outline: 3px solid var(--heading);
    outline-offset: 3px;
  }

  .equipment-profile-card {
    border: 1px solid var(--wood);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-md) 0;
  }

  .equipment-profile-card input {
    display: block;
    margin: 6px 0;
    max-width: 100%;
  }

  .equipment-profile-card button {
    margin: 4px 6px 0 0;
  }

  /* Phase 48c: bosses need to read as visually distinct from the regular
     enemy ladder at a glance — a colored left border, same visual language
     as .skill-tab-btn.running's left-border marker from the tabbed-UI work. */
  .resource-btn.boss-btn {
    border-left: 4px solid var(--red);
  }

  .resource-name {
    display: block;
    font-weight: bold;
    overflow-wrap: anywhere;
  }

  /* UX-025: the cost/reward/time line directly under a resource button's
     name is the number a player actually decides on -- "important stat"
     tier (13-14px) from the 2026-09-25 typography audit, not secondary
     chrome. */
  .resource-meta {
    display: block;
    font-size: 13px;
    color: var(--muted);
  }

  /* UX-CARD-001: Details fold under the card core; the start label sits right of the name. */
  .resource-card > .resource-details { flex: 0 0 100%; min-width: 0; }
  .resource-variants { grid-column: 1 / -1; margin: 0 0 8px 12px; }
  /* CARDS-001: one disclosure per equipment tier; the body lays out cards like the list itself. */
  .resource-tier { grid-column: 1 / -1; }
  .resource-tier > summary { cursor: pointer; font-weight: bold; color: var(--heading); }
  .resource-tier-body, .resource-variants-body { margin-top: 8px; }
  .resource-variants > summary { cursor: pointer; font-size: 12px; color: var(--heading); }
  .resource-details > summary { cursor: pointer; font-size: 12px; color: var(--heading); }
  .resource-extras { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.35; }
  .resource-card > .resource-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .resource-start-label { flex: 0 0 auto; font-size: 12px; font-weight: bold; color: var(--color-active); white-space: nowrap; }

  /* CARD-LINE-001: consumer line and Aether source link on resource cards. */
  .resource-card > .resource-for:not([hidden]) { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.35; }
  .resource-card > .resource-aether-link { display: block; margin-top: 4px; min-height: 32px; padding: 2px 8px; font-size: 11px; background: none; border: 0; color: var(--color-active); text-decoration: underline; text-align: left; cursor: pointer; }
  .resource-card > .resource-aether-link[hidden] { display: none; }

  .resource-usage {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .resource-artifice-effect {
    display: block;
    font-size: 12px;
    line-height: 1.4;
    color: var(--heading);
    overflow-wrap: anywhere;
  }

  /* VIS-006: the game's first real, reusable tooltip component (attachTooltip()
     in js/render.js) -- replaces the browser's own native `title` tooltip
     (still kept as a redundant fallback, never removed) on two sites: the
     mastery badge, and a locked resource row's lock-reason text. Design per
     the visual-design-system audit section 7 (hover/tooltips) and section 21
     (accessibility -- tooltip info must be reachable without precise hover).
     `.tooltip-anchor` is a thin positioning wrapper JS inserts around the
     trigger element; `.tooltip-panel` is that trigger's sibling, never its
     child, so a caller that keeps re-assigning the trigger's own textContent
     every redraw (both call sites do) never wipes the panel back out. */
  .tooltip-anchor {
    position: relative;
  }

  .tooltip-trigger {
    cursor: help;
  }

  .tooltip-trigger:focus-visible {
    outline: 3px solid var(--heading);
    outline-offset: 2px;
  }

  .tooltip-panel {
    /* `display: none` (not opacity/visibility): a hidden-but-still-laid-out
       panel is an absolutely positioned box that can extend past the
       viewport edge near a right-aligned trigger, and unlike opacity/
       visibility, `display: none` fully removes it from layout, so it can
       never widen document.documentElement.scrollWidth while inactive
       (regression caught by tests/e2e/queue-ux.e2e.test.js's own unrelated
       "no horizontal scrollbar" check). It also can't be transitioned,
       which is exactly right here: audit section 21 calls for an instant
       show/hide, never an animated entrance -- there is nothing left for
       prefers-reduced-motion to need to disable. */
    display: none;
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: var(--space-xs);
    z-index: 20;
    min-width: 160px;
    max-width: 260px;
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-2);
    border: 1px solid var(--parchment-dark);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: var(--font-size-xs);
    font-weight: normal;
    line-height: 1.4;
    pointer-events: none;
  }

  .tooltip-anchor:hover .tooltip-panel,
  .tooltip-trigger:focus-visible + .tooltip-panel {
    display: block;
  }

  .resource-inputs {
    display: block;
    font-size: 11px;
    color: var(--heading);
    margin-top: 2px;
  }

  .resource-inputs.missing {
    color: var(--red-text);
  }

  .resource-potion-preview > span {
    display: block;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .resource-potion-preview [data-potion-part="change"] {
    color: var(--muted);
  }

  /* UX-016 / DEC-045 obs 5: what the crafted item gives (weapon power, armor
     mitigation), styled like .resource-inputs but in gold so "what you get"
     reads apart from "what you need" right below it. */
  .resource-stats {
    display: block;
    font-size: 11px;
    color: var(--gold);
    margin-top: 2px;
  }

  /* CG-028a: a discovered sea zone's permanent Fishing yield-chance
     contribution, styled like .resource-stats (read-only, no control). */
  .resource-zone-bonus {
    display: block;
    font-size: 11px;
    color: var(--gold);
    margin-top: 2px;
  }

  .recipe-qty-toggle-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;
    flex: 0 0 auto;
  }

  .recipe-qty-toggle-btn:hover,
  .recipe-qty-toggle-btn.active {
    background: var(--wood);
    color: var(--text);
  }

  .resource-quantity-label {
    font-size: 11px;
    color: var(--heading);
  }

  .resource-quantity-input {
    width: 60px;
    padding: 2px 4px;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid var(--wood);
    border-radius: 4px;
  }

  .resource-quantity-note {
    flex: 0 0 100%;
    font-size: 11px;
    color: var(--heading);
  }

  /* RR-001 (IDEA-0028): Rune Reserves quick-target stock controls */
  .rune-reserve-label {
    font-size: 11px;
    color: var(--heading);
    margin-left: 4px;
  }

  .rune-target-btn {
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 3px;
  }

  /* Phase 44 (Per-item mastery): a small badge on each resource row —
     reuses the existing row rather than a new UI surface, per the
     design doc's own recommended option. --wood-dark, not --gold: the
     active resource card uses the gold accent surface, so gold-on-gold text was invisible
     there — found via a real Playwright render, not just reading the CSS. */
  .mastery-badge {
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: var(--heading);
    margin-left: 6px;
  }

  .hp-block {
    margin-bottom: 10px;
  }

  /* UX-080 */
  .combat-low-hp-warning {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: bold;
    color: #e88a8a; /* readable Ember Red on slate, as .status-activity-label.blocked */
  }
  .combat-low-hp-stop[hidden], .combat-low-hp-warning[hidden] { display: none; }
  .active-skill-style { font-weight: normal; color: var(--muted); font-size: 15px; }
  .active-skill-levelxp { font-weight: normal; color: var(--muted); font-size: 13px; white-space: nowrap; }
  /* On a phone the skills grid pushed the fight below the fold; #skill-jump
     still switches skills, so the grid steps aside while Combat is viewed. */
  @media (max-width: 539px) {
    body.viewing-combat #panel-skills { display: none; }
  }

  .status-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
  }

  .status-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--parchment);
    border: 1px solid var(--wood-light);
    color: var(--heading);
    font-weight: bold;
  }

  .status-badge-enrage {
    background: #3a1a1c;
    border-color: #ff6b6b;
    color: #f28b82;
  }

  .status-badge-barrier {
    background: #17263c;
    border-color: #8ab4f8;
    color: #8ab4f8;
  }

  .status-badge-cursed {
    background: #2a1a2e;
    border-color: #c0508f;
    color: #e6a1c8;
  }

  .status-badge-resonance {
    background: #241a3a;
    border-color: #9061f9;
    color: #b9a4f5;
  }

  /* R-02: enemy-instance affixes (Hulking, Swift, Regenerating, Thieving). */
  .status-badge-affix {
    background: #2a2410;
    border-color: #d4a017;
    color: #e8c15a;
  }

  /* STYLE-001-1: enemy class badge (Encounter) and matchup chip (enemy list). */
  .status-badge-class {
    background: #1d2a22;
    border-color: #6fbf8a;
    color: #a8dcb8;
  }

  .enemy-matchup-chip {
    display: inline-block;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 4px;
    border: 1px solid currentColor;
    font-size: 0.8em;
    font-weight: bold;
    white-space: nowrap;
  }
  .enemy-matchup-chip.is-strong { color: var(--color-active); }
  .enemy-matchup-chip.is-resist { color: var(--red-text); }
  .style-best-vs { display: block; font-size: 0.8em; opacity: 0.8; margin-top: 2px; }

  .enemy-affix-toggle {
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.3;
    text-align: left;
  }

  .enemy-affix-details {
    box-sizing: border-box;
    flex: 0 0 100%;
    min-width: 0;
    padding: 4px 6px;
    color: var(--heading);
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .hp-label {
    font-size: 13px;
    font-weight: bold;
    color: var(--heading);
    margin-bottom: 4px;
  }

  .combat-stats {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
  }

  /* UX-069: fight status + Start/Stop first; target picker folds to the chosen enemy. */
  .combat-status-row,
  .combat-target-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
  }

  .combat-target-heading h3 { margin: 0; }

  .combat-status-text {
    font-weight: bold;
    color: var(--muted);
  }

  .combat-status-text.is-fighting { color: var(--color-active); }
  .combat-status-text.is-blocked { color: var(--red-text); }
  #combat-blocked-link[hidden] { display: none; }

  #enemy-list > [hidden],
  #enemy-change-target-btn[hidden] { display: none; }

  #enemy-list .enemy-list-heading,
  #enemy-list .enemy-locked-toggle { flex: 1 1 100%; }

  #enemy-list .enemy-locked-toggle { text-align: left; }
  #enemy-list .enemy-target-info { display: block; font-size: 0.8em; opacity: 0.8; margin-top: 2px; }
  .enemy-sort[hidden] { display: none; }

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

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

  #enemy-list .resource-btn.enemy-locked:disabled {
    opacity: 1;
    background: var(--color-locked);
    color: var(--muted);
  }

  /* UX-018: all-styles overview chips, same visual family as the
     status-badge-list above (small pill, parchment background). The
     active style's chip gets a stronger border/background so it reads as
     "this is what's training right now" without a legend. */
  .combat-styles-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
  }

  .rift-records {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--wood-light);
    color: var(--text);
    font-size: 13px;
  }

  .rift-history-list {
    display: grid;
    gap: 4px;
    margin: 6px 0 0;
    padding-left: 20px;
  }

  #rift-history-more {
    margin-top: 6px;
  }

  #rift-history-more summary {
    cursor: pointer;
    color: var(--heading);
  }

  .combat-style-chip {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--parchment);
    border: 1px solid var(--wood-light);
    color: var(--heading);
    font-weight: bold;
  }

  .combat-style-chip.active {
    background: #17263c;
    border-color: #8ab4f8;
    color: #8ab4f8;
  }

  #combat-panel,
  .combat-subview {
    min-width: 0;
  }

  #combat-panel {
    scroll-margin-top: 64px;
  }

  /* AFFIX-008a: the skill picker inside the Skill outfits tab, same on every width. */
  .equipment-outfit-select { display: flex; align-items: center; gap: 6px; margin: 8px 0 14px; }
  .equipment-outfit-select select { flex: 1; min-width: 0; max-width: 280px; min-height: 44px; }

  .combat-view-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    gap: 6px;
    margin: 8px 0 14px;
  }

  .combat-view-tab {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .combat-view-tab[aria-selected="true"] {
    border-color: var(--heading);
    color: var(--heading);
    box-shadow: inset 0 0 0 1px currentColor;
    background: color-mix(in srgb, var(--color-active) 22%, var(--parchment)); /* U-17: only the selected tab is filled */
  }

  button.combat-view-tab[aria-selected="false"]:hover {
    background: var(--wood); /* U-17: hover must not read as a second selected tab */
  }

  .combat-subview[hidden] {
    display: none !important;
  }

  .combat-setup-shortcut {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--wood-light);
    border-radius: 6px;
    background: var(--parchment);
    color: var(--text);
  }

  .combat-setup-shortcut h3 {
    margin: 0 0 5px;
  }

  .combat-setup-shortcut p {
    margin: 0 0 8px;
  }

  .combat-policy-controls {
    margin: 10px 0;
  }

  .combat-policy-controls h3 {
    margin: 0 0 4px;
  }

  .combat-priority-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    margin-bottom: 8px;
  }

  .combat-priority-row select {
    max-width: 100%;
  }

  #ability-status-list {
    box-sizing: border-box;
    margin: 4px 0 0;
    padding-left: 18px;
    width: 100%;
    font-size: 12px;
  }

  #ability-status-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
  }

  #ability-status-list .ability-status-text {
    flex: 1 1 180px;
    min-width: 0;
  }

  #ability-status-list .ability-condition-select {
    flex: 0 1 auto;
    min-width: min(100%, 190px);
  }

  .combat-log-disclosure {
    margin-top: 12px;
  }

  .combat-log-disclosure summary {
    cursor: pointer;
    color: var(--heading);
    margin-bottom: 6px;
  }

  .combat-preparation {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--wood-light);
    border-radius: 6px;
    background: var(--parchment);
    color: var(--text);
  }

  .combat-preparation h3 {
    margin: 0 0 6px;
  }

  .combat-preparation-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 4px 14px;
  }

  .combat-preparation-line {
    margin: 0;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .combat-preparation-line strong {
    color: var(--heading);
  }

  .combat-preparation-warning {
    color: var(--red-text); /* UI-A11Y-001: was 1.93:1 */
  }

  .combat-preparation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
  }

  .weapon-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
  }
