/* loot.html - the Loot Map (radial graph + side list), on the tokens */
.loot-wrap { max-width: var(--content-max); margin: 0 auto; }
.loot-head .loot-fresh { font-family: var(--body-font); font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }

.loot-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); margin-bottom: var(--space-3); }
.loot-search { flex: 1 1 320px; max-width: 520px; }
.loot-search .input { padding-left: 38px; }
.loot-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 4px; list-style: none;
  background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: var(--radius-md); box-shadow: var(--shadow-md); max-height: 320px; overflow: auto; }
.loot-suggest li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--body-font); font-size: var(--fs-md); }
.loot-suggest li:hover, .loot-suggest li[aria-selected="true"] { background: var(--accent-soft); }
.loot-suggest li .sub { font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; }
.loot-suggest li .sub::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--accent); vertical-align: middle; }
.loot-suggest li[data-kind="source"] .sub::before { background: var(--info); }
.loot-suggest .empty { color: var(--text-faint); cursor: default; }
.loot-browse-pick { display: block; width: 100%; }
.loot-browse-pick select { width: 100%; font-family: var(--body-font); font-size: var(--fs-sm); }
.loot-browse { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.loot-browse .ui-card-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: 100%; padding: var(--space-3) var(--space-4); }
.loot-browse-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.loot-browse-head h3 { margin: 2px 0 0; font-size: var(--fs-lg); }
.loot-browse .loot-kind { font-family: var(--body-font); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.loot-browse p { margin: 6px 0 8px; font-family: var(--body-font); }
.loot-browse-list { list-style: none; margin: 0; padding: 0; overflow: auto; min-height: 0; font-family: var(--body-font); font-size: var(--fs-sm); border-top: 1px solid var(--border-faint); }
.loot-browse-list li { border-bottom: 1px solid var(--border-faint); }
.loot-browse-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 4px; background: none; border: 0; color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; }
.loot-browse-list button:hover { color: var(--accent); }
.loot-browse-list img, .loot-browse-list .loot-browse-glyph { width: 30px; height: 30px; border-radius: 8px; object-fit: contain; background: var(--surface-2); flex: none; display: inline-flex; align-items: center; justify-content: center; }
.loot-browse-list .sub { margin-left: auto; font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; }
.loot-toggle { display: inline-flex; align-items: center; gap: 8px; font-family: var(--body-font); font-size: var(--fs-sm); cursor: pointer; }
.loot-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.loot-toggle .hint { color: var(--text-faint); font-size: var(--fs-xs); }

.loot-trail { min-height: 1.4em; }
.loot-trail a { cursor: pointer; }
.loot-trail .back { font-family: var(--body-font); font-size: var(--fs-sm); margin-right: 10px; }
/* x markers on the lines of an open group (collapse on click, hover shows what folds together) */
.loot-collapse-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.loot-collapse-x { position: absolute; left: 0; top: 0; margin: -9px 0 0 -9px; width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--text-muted); font: 600 13px/16px var(--body-font); cursor: pointer; pointer-events: auto; opacity: .7; transform-origin: center; transition: background var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast); }
.loot-collapse-x:hover, .loot-collapse-x.will-collapse { opacity: 1; color: #1c2e3a; background: #e0b84a; border-color: #e0b84a; }
.loot-back-x { width: 22px; height: 22px; margin: -11px 0 0 -11px; font-size: 15px; line-height: 20px; opacity: .85; border-color: var(--accent); }
.loot-legend .x { display: inline-block; width: 14px; height: 14px; line-height: 12px; text-align: center; border-radius: 50%; border: 1px solid var(--text-muted); font-size: 11px; vertical-align: middle; margin-right: 6px; }

.loot-stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-4); align-items: start; }
.loot-graph-wrap { position: relative; background: var(--surface-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); overflow: hidden; }
.loot-graph { width: 100%; height: min(72vh, 720px); min-height: 480px; touch-action: none; }
.loot-legend { position: absolute; left: 12px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--body-font); font-size: var(--fs-xs); color: var(--text-muted); pointer-events: none; }
.loot-legend .line { display: inline-block; width: 26px; height: 0; border-top: 2px solid var(--accent); vertical-align: middle; margin-right: 6px; }
.loot-legend .shape { display: inline-block; width: 11px; height: 11px; border: 1.5px solid var(--text-muted); vertical-align: middle; margin-right: 6px; }
.loot-legend .shape.circle { border-radius: 50%; }
.loot-legend .shape.square { border-radius: 3px; }
.loot-legend .shape.card { width: 16px; height: 11px; border-radius: 2px; }
.loot-legend .shape.card.limited { border-color: #e0b84a; }
.loot-list .loot-limited { font-size: var(--fs-xs); margin-left: 0; }
.loot-only-at { background: color-mix(in srgb, #d13a2e 18%, transparent); color: var(--text-strong); border: 1px solid color-mix(in srgb, #d13a2e 55%, transparent); }
.loot-list .badge + .loot-only-at { margin-left: 4px; }
.loot-center .loot-glyph.shape-card { width: 64px; height: 36px; border-radius: 6px; }
.loot-legend .shape.diamond { transform: rotate(45deg) scale(0.85); border-radius: 1px; }
.loot-legend .shape.enemysq { width: 13px; height: 13px; border-radius: 0; border-color: #8e44ad; }
.loot-center .loot-glyph.shape-enemysq { border-radius: 0; width: 48px; height: 48px; border-color: #8e44ad; }
.loot-legend .shape.place { border: 0; width: 13px; height: 13px; background: #d13a2e; clip-path: polygon(29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%); }
.loot-center .loot-glyph.shape-place { border: 0; clip-path: polygon(29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%); background: color-mix(in srgb, #27ae60 40%, var(--surface-2)); }
.loot-legend .line.dashed { border-top-style: dashed; }
.loot-legend .line.faded { opacity: 0.35; }
.loot-legend-hint { color: var(--text-faint); }
.loot-legend-note { flex-basis: 100%; color: var(--text-faint); }
.loot-legend-factions { flex-basis: 100%; }
.loot-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin: 0 4px 0 10px; }
.loot-legend .dot:first-child { margin-left: 0; }
.loot-list li.unseen { opacity: 0.5; }
.loot-list li.unseen .badge { border-style: dashed; }

.loot-side { display: flex; flex-direction: column; gap: var(--space-3); max-height: min(72vh, 720px); min-height: 480px; }
.loot-center .ui-card-body { padding: var(--space-4) var(--space-5); }
.loot-center .loot-kind, .loot-detail .loot-kind { font-family: var(--body-font); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.loot-center h2 { margin: 2px 0 6px; font-size: var(--fs-xl); line-height: var(--lh-tight); display: flex; align-items: center; gap: 10px; }
.loot-center .loot-glyph { flex: none; width: 44px; height: 44px; border: 1.5px solid var(--border-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; overflow: hidden; }
.loot-center .loot-glyph.shape-circle { border-radius: 50%; }
.loot-center .loot-glyph.shape-square { border-radius: 10px; }
.loot-center .loot-glyph.shape-diamond { border-radius: 6px; transform: rotate(45deg) scale(0.82); }
.loot-center .loot-glyph.shape-diamond > * { transform: rotate(-45deg) scale(1.2); }
.loot-center .loot-glyph img { width: 100%; height: 100%; object-fit: contain; }
.loot-center .loot-stats { font-family: var(--body-font); font-size: var(--fs-sm); color: var(--text-muted); margin: 0 0 var(--space-3); }
.loot-center .cluster { margin-top: var(--space-2); }

.loot-detail .ui-card-body { padding: var(--space-3) var(--space-5); font-family: var(--body-font); font-size: var(--fs-sm); }
.loot-detail h3 { margin: 2px 0 6px; font-size: var(--fs-lg); }
.loot-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: var(--space-2) 0 0; }
.loot-detail dt { color: var(--text-faint); }
.loot-detail dd { margin: 0; }

.loot-list-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.loot-list-title { margin: 0 0 var(--space-2); font-size: var(--fs-lg); }
.loot-list { list-style: none; margin: 0; padding: 0; overflow: auto; font-family: var(--body-font); font-size: var(--fs-sm); border-top: 1px solid var(--border-faint); }
.loot-list > li, .loot-list .loot-group > ul > li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 4px; border-bottom: 1px solid var(--border-faint); }
.loot-list li.inactive { opacity: .55; }
.loot-list a, .loot-list button.link { color: var(--text-strong); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-align: left; }
.loot-list a:hover, .loot-list button.link:hover { color: var(--accent); text-decoration: underline; }
.loot-list .badge { font-size: var(--fs-xs); margin-left: auto; }
.loot-list .loot-group { display: block; padding: 0; }
.loot-list .loot-group-head { display: flex; align-items: center; gap: 8px; padding: 10px 4px 6px; font-family: var(--primary-font); font-size: var(--fs-md); cursor: pointer; }
.loot-list .loot-group-head .count { font-family: var(--body-font); font-size: var(--fs-xs); color: var(--text-faint); }
.loot-list .loot-group-icon { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #e0b84a; background: var(--surface-2); flex: none; }
.loot-list .loot-group.enemy .loot-group-icon { border-color: #8e44ad; border-radius: 8px; }
.loot-list .loot-found-at .loot-group-head::before { content: '\223F'; color: #5fb3c4; transform: none; }
.loot-legend .wave { display: inline-block; width: 26px; height: 8px; vertical-align: middle; margin-right: 6px;
  background: radial-gradient(circle at 25% 0, transparent 4px, #5fb3c4 4px 5.5px, transparent 5.5px) 0 2px / 13px 8px repeat-x,
              radial-gradient(circle at 75% 100%, transparent 4px, #5fb3c4 4px 5.5px, transparent 5.5px) 0 -2px / 13px 8px repeat-x; }
.loot-legend .wave { -webkit-mask: linear-gradient(90deg, #000 0 60%, transparent 60%) 0 0 / 7px 100% repeat-x; mask: linear-gradient(90deg, #000 0 60%, transparent 60%) 0 0 / 7px 100% repeat-x; }
.loot-list .loot-group-head::before { content: '▸'; color: var(--text-faint); transition: transform var(--dur-fast); }
.loot-list .loot-group.open .loot-group-head::before { transform: rotate(90deg); }
.loot-list .loot-group > ul { list-style: none; margin: 0; padding: 0 0 0 14px; display: none; }
.loot-list .loot-group.open > ul { display: block; }
.loot-list .loot-group > ul > li:last-child { border-bottom: 0; }

.loot-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-5); }
.loot-start .section-title { margin-top: var(--space-3); }
.loot-start-grid { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.loot-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-soft); background: var(--surface-1); color: var(--text-strong); text-decoration: none; font-family: var(--body-font); font-size: var(--fs-sm); }
.loot-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong); }

.loot-attribution { margin-top: var(--space-5); font-family: var(--body-font); font-size: var(--fs-xs); color: var(--text-faint); max-width: 90ch; }

.loot-report { z-index: 1002; }   /* above .modal-backdrop (1001): without it the backdrop covers the form and swallows the clicks */
.loot-report .stack > * + * { margin-top: var(--space-3); }
.loot-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.loot-report-msg { margin: 0; font-family: var(--body-font); font-size: var(--fs-sm); color: var(--success-text); }
.loot-report-msg.is-error { color: var(--danger-text); }

@media (max-width: 900px) {
  .loot-stage { grid-template-columns: 1fr; }
  .loot-side { max-height: none; min-height: 0; }
  .loot-graph { height: 60vh; min-height: 380px; }
}
/* Phones: the single-column list is the UI; the graph is not shown. */
@media (max-width: 719px) {
  .loot-graph-wrap { display: none; }
  .loot-head .loot-fresh { white-space: normal; }
  .loot-list { overflow: visible; }
}

/* ---- Full-screen layout (owner, 2026-10-20): the graph fills the viewport under the site header; the title/trail float
   top-left, the search and the centre/detail/list widget float on the right, the start screen floats in the middle. */
body:has(.loot-full) main { padding: 0; min-height: 0; }
.loot-full [hidden] { display: none !important; }   /* the layout rules below set display on these boxes; hidden must still win */
.loot-full { max-width: none; margin: 0; }
.loot-full .loot-stage-full { position: relative; background: var(--surface-inset); }
.loot-full .loot-attribution { margin: 0; font-size: 11px; }
.loot-full .loot-toolbar { margin: 0; gap: 8px; }
.loot-full .loot-toolbar .loot-search { flex: 1 1 100%; max-width: none; }
.loot-full .loot-toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; width: 100%; }
.loot-full .loot-head { margin: 0; padding: 0; display: block; }
.loot-full .loot-head h1 { margin: 0; font-size: var(--fs-xl); line-height: 1.1; }
.loot-full .loot-head .loot-fresh { font-size: var(--fs-xs); white-space: normal; margin-top: 2px; }
.loot-full .loot-topbar { display: flex; flex-direction: column; gap: 10px; }
.loot-full .loot-titlecard { display: flex; flex-direction: column; gap: 6px; }
/* Work-in-progress notice: its own see-through card with an amber edge, under the title card */
.loot-wip { padding: 12px 16px; background: color-mix(in srgb, var(--surface-1) 78%, transparent); backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); border-left: 4px solid var(--warning); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  font-family: var(--body-font); font-size: var(--fs-sm); line-height: 1.5; color: var(--text-color); }
.loot-wip strong { display: block; margin-bottom: 4px; font-size: var(--fs-md); font-weight: 600; color: var(--warning-text); }
.loot-wip p { margin: 0; }
.loot-wip { position: relative; }
.loot-wip strong { padding-right: 22px; }
.loot-wip .loot-fresh { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-faint); }
.loot-wip-close { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-muted); font: 600 16px/24px var(--body-font); cursor: pointer; pointer-events: auto; }
.loot-wip-close:hover, .loot-wip-close:focus-visible { background: var(--accent-soft); color: var(--text-strong); }
.loot-full .loot-titlecard .loot-trail { margin: 0; }   /* the card is only the breadcrumb now */
.loot-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Map key: a button bottom-left, the legend opens above it on hover or click */
.loot-key { position: absolute; left: 12px; bottom: 10px; z-index: 6; }
.loot-key-btn { padding: 6px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border-soft); background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  color: var(--text-strong); font: 600 var(--fs-xs) var(--body-font); cursor: pointer; box-shadow: var(--shadow-md); }
.loot-key-btn:hover, .loot-key-btn:focus-visible, .loot-key.open .loot-key-btn { border-color: var(--accent); }
.loot-key .loot-legend { display: none; position: absolute; left: 0; right: auto; bottom: calc(100% + 8px); width: min(560px, calc(100vw - 480px)); min-width: 280px;
  padding: 12px 14px; background: color-mix(in srgb, var(--surface-1) 94%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); pointer-events: auto; }
.loot-key.open .loot-legend, .loot-key:hover .loot-legend, .loot-key:focus-within .loot-legend { display: flex; }
.loot-key .loot-legend::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }   /* hover bridge to the button */
/* Zoom buttons, bottom-right of the visible map */
.loot-zoom { position: absolute; right: 12px; bottom: 12px; z-index: 6; display: flex; flex-direction: column; gap: 6px; }
.loot-zoom button { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm); border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-1) 88%, transparent); color: var(--text-strong); font: 600 18px/1 var(--body-font); cursor: pointer; box-shadow: var(--shadow-md); }
.loot-zoom button:hover, .loot-zoom button:focus-visible { border-color: var(--accent); }
.loot-wip .loot-wip-tag { font-weight: 400; font-size: var(--fs-sm); color: var(--text-muted); }
.loot-full .loot-start { display: block; }
.loot-full .loot-start .lede { margin: 0 0 var(--space-3); }
.loot-full .loot-start-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-5); }
.loot-full .loot-start .loot-attribution { margin-top: var(--space-4); }

@media (min-width: 900px) {
  .loot-full .loot-stage-full { height: calc(100vh - var(--loot-header-h, 84px)); min-height: 560px; overflow: hidden; }
  .loot-full .loot-stage { position: absolute; inset: 0; display: block; }
  .loot-full .loot-graph-wrap { position: absolute; inset: 0; border: 0; border-radius: 0; background: transparent; }
  .loot-full .loot-graph { height: 100%; min-height: 0; }
  .loot-full .loot-zoom { right: 420px; bottom: 14px; }
  .loot-full .loot-topbar { position: absolute; top: 14px; left: 14px; z-index: 6; max-width: 340px; pointer-events: none; }
  /* Work-in-progress notice docked top right of the map, just left of the search / browse card (rail 392 px + gaps) */
  .loot-full .loot-wip { position: absolute; top: 14px; right: 416px; z-index: 6; width: clamp(220px, calc(100% - 800px), 340px);
    padding: 10px 14px; font-size: var(--fs-xs); }
  .loot-full .loot-wip strong { font-size: var(--fs-sm); }
  .loot-full .loot-titlecard { padding: 8px 14px;
    background: color-mix(in srgb, var(--surface-1) 82%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
  .loot-full .loot-topbar a, .loot-full .loot-topbar button { pointer-events: auto; }
  .loot-full .loot-rail { position: absolute; top: 14px; right: 14px; bottom: 14px; width: 392px; z-index: 7; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  /* The search box must paint above the widget under it (both have their own stacking layer from backdrop-filter),
     or the suggestion dropdown disappears behind the list. */
  .loot-full .loot-rail .loot-toolbar { flex: none; position: relative; z-index: 2; padding: 10px 12px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); backdrop-filter: blur(6px);
    border: 1px solid var(--border-soft); border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
  /* An open browse list takes priority over the centre card under it (it used to shrink to ~3 rows) */
  .loot-full .loot-browse { flex: 0 0 auto; max-height: 68%; background: color-mix(in srgb, var(--surface-1) 88%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border-soft); box-shadow: var(--shadow-md); }
  .loot-full .loot-side { flex: 1 1 auto; position: relative; z-index: 1; min-height: 0; max-height: none; gap: 0; padding: 0; overflow: hidden;
    background: color-mix(in srgb, var(--surface-1) 88%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border-soft); border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
  .loot-full .loot-side > .ui-card { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .loot-full .loot-side > .loot-center { border-bottom: 1px solid var(--border-faint); }
  .loot-full .loot-side > .loot-detail { border-bottom: 1px solid var(--border-faint); background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
  .loot-full .loot-list-wrap { padding: var(--space-3) var(--space-4) var(--space-2); }
  .loot-full .loot-side > .loot-attribution { flex: none; padding: 6px var(--space-4) 8px; border-top: 1px solid var(--border-faint); }
  .loot-full .loot-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; width: min(880px, calc(100% - 460px)); max-height: calc(100% - 60px); overflow: auto;
    padding: var(--space-5); background: color-mix(in srgb, var(--surface-1) 90%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
}
@media (max-width: 899px) {
  /* Stacked: title, search, graph, list. The rail is only a wrapper here. */
  .loot-full .loot-stage-full { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); }
  .loot-full .loot-rail { display: contents; }
  .loot-full .loot-topbar, .loot-full .loot-wip { order: 0; }
  .loot-full .loot-rail .loot-toolbar { order: 1; }
  .loot-full .loot-stage { order: 2; position: static; }
  .loot-full .loot-browse { order: 2; }
  .loot-full .loot-side { order: 3; }
  .loot-full .loot-start { order: 4; }
}

