/* ============================================================
   Siege Weapon Skin Tracker — styles
   Lives on the wiki (reference.css, 16px root). All new text is
   #fff and >=1rem per project rules. Skin-color swatches are the
   one intentional exception (they ARE the data being shown).
   ============================================================ */

/* Skin-color swatches — hoisted to :root so the intro legend (which lives
   outside .siege-tool) gets the same colors as the in-tool dots/chips. */
:root {
  --sk-white:  #e9e9f0;
  --sk-blue:   #3f74de;
  --sk-red:    #d23a2e;
  --sk-yellow: #e8b62a;
  --sk-green:  #46b049;
  --sk-violet: #b65ad6;
}

.siege-tool {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---- shared panel ---- */
.siege-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.siege-panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 14px;
}

/* ---- buttons ---- */
.siege-btn {
  font-size: 1rem;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.siege-btn:hover { border-color: var(--gold); background: rgba(200,168,75,.12); }
.siege-btn-gold { background: var(--gold); border-color: var(--gold); color: #0b0b12; }
.siege-btn-gold:hover { background: #d4b86e; }
.siege-btn-danger { border-color: var(--red); }
.siege-btn-danger:hover { border-color: var(--red); background: var(--red); }

/* ============================================================
   Summary bar
   ============================================================ */
.siege-summary { display: flex; flex-direction: column; gap: 16px; }
.siege-summary-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.siege-summary-headline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.siege-summary-count { font-size: 2.2rem; font-weight: 800; color: var(--gold); line-height: 1; }
.siege-summary-total { font-size: 1.4rem; font-weight: 700; color: #fff; }
.siege-summary-label { font-size: 1.05rem; color: #fff; }
.siege-summary-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.siege-progress {
  width: 100%; height: 14px; border-radius: 8px;
  background: var(--surface3); overflow: hidden; border: 1px solid var(--border);
}
.siege-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  width: 0%; transition: width .25s ease;
}
.siege-saved-note { font-size: 1rem; color: #fff; }

/* per-color summary chips */
.siege-color-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.siege-color-stat {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px 6px 8px;
}
.siege-color-stat .siege-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
}
.siege-color-stat span { font-size: 1rem; font-weight: 600; color: #fff; }

/* skin color dot helper (used in stats, lists, planner) */
.siege-dot[data-color="white"]  { background: var(--sk-white); }
.siege-dot[data-color="blue"]   { background: var(--sk-blue); }
.siege-dot[data-color="red"]    { background: var(--sk-red); }
.siege-dot[data-color="yellow"] { background: var(--sk-yellow); }
.siege-dot[data-color="green"]  { background: var(--sk-green); }
.siege-dot[data-color="violet"] { background: var(--sk-violet); }

/* ============================================================
   Weapon card grid
   ============================================================ */
/* collection sub-tabs (Primary / Secondary / Melee), sticky below the main tab bar */
.siege-subtabs {
  position: sticky;
  top: calc(var(--sticky-top, 143px) + var(--siege-maintabs-h, 50px));
  z-index: 49;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg);
  padding: 10px 0;
  margin-bottom: 14px;
}
.siege-subtab {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.siege-subtab:hover { border-color: var(--gold-dim); }
.siege-subtab.active { background: var(--gold); border-color: var(--gold); color: #0b0b12; }
.siege-subpanel { display: none; }
.siege-subpanel.active { display: block; }

/* right-aligned "Hide completed" filter toggle */
.siege-hide-toggle {
  margin-left: auto;
  align-self: center;
  display: flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 600; color: #fff;
  cursor: pointer; white-space: nowrap;
}
.siege-hide-toggle input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--gold); }
/* hide fully-collected weapons + zero-skin (0/0) cards when the toggle is on */
#siege-collection-grid.hide-completed .siege-card.is-complete,
#siege-collection-grid.hide-completed .siege-card.is-empty { display: none; }

/* right-click context menu on a chip */
.siege-ctx {
  position: fixed; z-index: 200;
  background: var(--surface2); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.siege-ctx[hidden] { display: none; }
.siege-ctx-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; color: #fff;
  font-size: 1rem; font-weight: 600; padding: 8px 14px;
  border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.siege-ctx-item:hover { background: rgba(200,168,75,.15); color: var(--gold); }

.siege-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 14px;
}
.siege-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.siege-card:hover { border-color: var(--gold-dim); }
.siege-card.is-complete { border-color: var(--gold); box-shadow: 0 0 12px rgba(200,168,75,.22); }

.siege-card-imgwrap {
  width: 100%; aspect-ratio: 16/9; position: relative;
  background: #0b0b12; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.siege-card-imgwrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* fallback glyph when no icon asset exists */
.siege-card-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(200,168,75,.10), transparent 60%),
    repeating-linear-gradient(135deg, #14141f 0 10px, #11111a 10px 20px);
}
.siege-card-fallback svg { width: 46px; height: 46px; opacity: .55; }
.siege-card-fallback path { fill: var(--gold); }

.siege-card-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 9px; }
.siege-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.siege-card-name { font-size: 1.05rem; font-weight: 700; color: #fff; line-height: 1.2; }
.siege-card-count {
  font-size: 1rem; font-weight: 700; color: #fff;
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 8px; white-space: nowrap; flex-shrink: 0;
}
.siege-card.is-complete .siege-card-count { color: #0b0b12; background: var(--gold); border-color: var(--gold); }

/* color toggle chips ("checkboxes") */
.siege-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.siege-chip {
  position: relative;
  width: 30px; height: 30px; border-radius: 8px;
  border: 2px solid currentColor;
  background: transparent;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s, box-shadow .15s;
  -webkit-touch-callout: none; user-select: none;  /* clean long-press on touch */
}
.siege-chip:hover { transform: translateY(-1px); box-shadow: 0 0 8px rgba(255,255,255,.18); }
.siege-chip[data-color="white"]  { color: var(--sk-white); }
.siege-chip[data-color="blue"]   { color: var(--sk-blue); }
.siege-chip[data-color="red"]    { color: var(--sk-red); }
.siege-chip[data-color="yellow"] { color: var(--sk-yellow); }
.siege-chip[data-color="green"]  { color: var(--sk-green); }
.siege-chip[data-color="violet"] { color: var(--sk-violet); }
/* owned = filled with the color + check */
.siege-chip.owned { background: currentColor; }
.siege-chip-check { display: none; width: 16px; height: 16px; }
.siege-chip.owned .siege-chip-check { display: block; }
.siege-chip-check path { stroke: #0b0b12; stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* empty (no siege skins) cards — greyed art + dashed border, but text stays full #fff */
.siege-card.is-empty { border-style: dashed; background: var(--surface2); }
.siege-card.is-empty .siege-card-imgwrap img { filter: grayscale(1); opacity: .4; }
.siege-empty-note { font-size: 1rem; color: #fff; font-weight: 600; }

/* ============================================================
   Per-class "next up" panels
   ============================================================ */
.siege-classes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  /* don't stretch a row's cards to match a card flipped into a tall checklist */
  align-items: start;
}
.siege-class {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.siege-class-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.siege-class-name { font-size: 1.2rem; font-weight: 800; color: var(--gold); }
.siege-class-remaining { font-size: 1rem; font-weight: 700; color: #fff; }
.siege-class-progress { width: 100%; height: 8px; border-radius: 6px; background: var(--surface3); overflow: hidden; border: 1px solid var(--border); }
.siege-class-progress-fill { height: 100%; background: var(--gold); width: 0%; }

.siege-next-label { font-size: 1rem; color: #fff; font-weight: 700; margin: 0; }
.siege-next-skin {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 9px 12px;
}
.siege-next-skin .siege-dot { width: 22px; height: 22px; flex-shrink: 0; }
.siege-next-skin-text { font-size: 1.1rem; font-weight: 700; color: #fff; }
.siege-class.is-done .siege-next-skin { border-color: var(--green); }
.siege-class-done-text { font-size: 1.1rem; font-weight: 700; color: var(--green); }

.siege-upcoming { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.siege-upcoming li { display: flex; align-items: center; gap: 9px; font-size: 1rem; color: #fff; }
.siege-upcoming li.is-extra { display: none; }
.siege-class.expanded .siege-upcoming li.is-extra { display: flex; }
.siege-upcoming .siege-dot { width: 15px; height: 15px; flex-shrink: 0; }
.siege-upcoming-num { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 24px; }

.siege-expand {
  align-self: flex-start;
  margin-top: 2px;
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}
.siege-expand:hover { text-decoration: underline; }

/* Per-class checklist mode (Class Unlock Order tab): a card can flip into an
   ordered, tickable list of its still-locked skins. Ticking marks the skin
   owned everywhere. */
.siege-checklist-toggle {
  align-self: flex-start;
  background: var(--surface); border: 1px solid var(--gold-dim); color: var(--gold);
  font-size: 1rem; font-weight: 700; padding: 7px 14px; border-radius: var(--radius);
  cursor: pointer;
}
.siege-checklist-toggle:hover { background: var(--surface3); border-color: var(--gold); }
.siege-checklist { display: flex; flex-direction: column; }
.siege-check-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: none; border: none; border-bottom: 1px solid rgba(255,255,255,.07);
  padding: 9px 2px; cursor: pointer; text-align: left;
}
.siege-check-row:last-child { border-bottom: none; }
.siege-check-box {
  flex: none; width: 22px; height: 22px; border: 2px solid var(--border);
  border-radius: 6px; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.siege-check-row:hover .siege-check-box { border-color: var(--gold-dim); }
.siege-check-row.is-checked .siege-check-box { background: var(--gold); border-color: var(--gold); }
.siege-check-box .siege-chip-check { display: block; width: 14px; height: 14px; opacity: 0; }
.siege-check-row.is-checked .siege-check-box .siege-chip-check { opacity: 1; }
.siege-check-row .siege-dot { width: 16px; height: 16px; flex: none; }
.siege-check-name { font-size: 1.05rem; font-weight: 600; color: #fff; }

/* ============================================================
   Skin planner (fastest path)
   ============================================================ */
.siege-planner-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.siege-field { display: flex; flex-direction: column; gap: 6px; }
.siege-field label { font-size: 1rem; font-weight: 700; color: #fff; }
.siege-select {
  font-size: 1.05rem; color: #fff; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; min-width: 200px; cursor: pointer;
}
.siege-select:focus { outline: 2px solid var(--gold-dim); }

.siege-result { margin-top: 18px; }
.siege-result-headline {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 1.25rem; font-weight: 700; color: #fff;
  background: var(--surface2); border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.siege-result-headline .siege-dot { width: 26px; height: 26px; }
.siege-result-headline.is-owned { border-color: var(--green); }
.siege-result-best { color: var(--gold); }
.siege-result-sectors { color: var(--gold); }
.siege-result-note { font-size: 1.05rem; color: #fff; margin: 12px 0 0; line-height: 1.5; }

/* Sized to its content — no full-width stretch / dead space.
   Scoped under .wiki-content to beat reference.css's `.wiki-content table { width:100% }`. */
.wiki-content .siege-class-table { width: auto; border-collapse: collapse; margin-top: 14px; }
.siege-class-table th {
  text-align: left; font-size: 1rem; font-weight: 700; color: #fff;
  padding: 7px 14px 7px 10px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.siege-class-table td { font-size: 1.05rem; color: #fff; font-weight: 400; padding: 7px 14px 7px 10px; border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; }
.siege-class-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Per-row styling — every cell in a row matches. */
.siege-class-table tr.is-best td,
.siege-class-table tr.is-best .siege-best-tag { color: var(--gold); font-weight: 700; }
.siege-class-table tr.is-out td,
.siege-class-table tr.is-out .siege-cant { color: #80808f; font-weight: 400; text-decoration: line-through; }

/* ============================================================
   How-To tab
   ============================================================ */
.siege-howto { max-width: 840px; }
.siege-howto-lead {
  font-size: 1.2rem; line-height: 1.6; color: #fff; margin: 2px 0 22px;
}
.siege-howto-part {
  font-size: 1.4rem; font-weight: 800; color: var(--gold);
  margin: 30px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.siege-howto-part:first-of-type { margin-top: 6px; }
.siege-howto-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 14px;
}
.siege-howto-card h3 { font-size: 1.2rem; font-weight: 700; color: #fff; margin: 0 0 8px; }
.siege-howto-card p { font-size: 1.08rem; line-height: 1.6; color: #fff; margin: 0; }
.siege-howto-card strong { color: #fff; font-weight: 800; }
.siege-howto-fig { margin: 14px 0 0; }
.siege-howto-fig img {
  display: block; width: 100%; max-width: 520px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg);
}
.siege-howto-fig figcaption { font-size: 1rem; color: #fff; margin-top: 8px; line-height: 1.4; }

/* ============================================================
   Color legend
   ============================================================ */
.siege-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.siege-legend-item { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; color: #fff; font-weight: 600; }
.siege-legend-item .siege-dot { width: 20px; height: 20px; }

/* ============================================================
   Lead + sticky tab bar
   ============================================================ */
.siege-lead { font-size: 1.15rem; color: #fff; line-height: 1.5; margin: 0 0 8px; max-width: 820px; }
.siege-lead a { color: var(--blue); }

/* Folder-style tabs: bordered boxes with rounded tops sitting on a baseline.
   The active tab is gold-outlined and "opens" into the content below by
   breaking the baseline (its bottom edge matches the page background). */
.siege-tabs {
  position: sticky;
  top: var(--sticky-top, 143px);
  z-index: 50;
  display: flex;
  gap: 6px;
  align-items: flex-end;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  padding-top: 14px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.siege-tab {
  appearance: none;
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 9px 9px 0 0;
  margin-bottom: -2px;            /* overlap the baseline */
  padding: 10px 22px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s, padding .1s;
}
.siege-tab:hover:not(.active) { background: var(--surface2); border-color: var(--gold-dim); color: var(--gold); }
.siege-tab.active {
  background: var(--bg);                 /* same as the content area below */
  border-color: var(--gold-dim);
  border-bottom-color: var(--bg);        /* break the baseline -> connects to content */
  box-shadow: inset 0 3px 0 var(--gold); /* gold cap on the open tab (no layout shift) */
  color: var(--gold);
  z-index: 1;
}

.siege-tab-panel { display: none; }
.siege-tab-panel.active { display: block; }

/* Tab labels: full on desktop, short on mobile (see media query). */
.siege-tab-short { display: none; }

/* Touch devices: no hover, so the color tooltips are noise on tap — hide them.
   (#wiki-tip is the shared wiki tooltip; this rule is scoped to this page's CSS.) */
@media (hover: none) {
  #wiki-tip { display: none !important; }
}

/* Long-press opens the context menu — suppress the native text-selection,
   iOS callout/lookup menu, selection magnifier, and tap-highlight across the
   whole collection grid so the hold is clean. Applied unconditionally (not
   gated behind a touch media query) so it always takes effect on phones. */
#siege-collection-grid, #siege-collection-grid * {
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
  .siege-summary-count { font-size: 1.8rem; }
  .siege-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  /* skin chips: 3 per row (Red/Blue/White, then Violet/Green/Yellow) */
  .siege-chips { display: grid; grid-template-columns: repeat(3, max-content); }
  /* short tab labels */
  .siege-tab-full { display: none; }
  .siege-tab-short { display: inline; }
  /* Tighten the 4 tabs so they all fit a phone width (Info was overflowing). */
  .siege-tabs { gap: 3px; }
  .siege-tab { padding: 9px 9px; font-size: 1rem; }
}
