/*
 * Copyright (C) 2026 Yzapre
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

/* ── True Completionist page ─────────────────────────── */
.tc-wrap {
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Hero progress panel ─────────────────────────────── */
.tc-hero-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.tc-ring-box {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.tc-ring-box svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tc-ring-track { fill: none; stroke: var(--border); stroke-width: 10; }
.tc-ring-fill {
  fill: none;
  stroke: #ffffff;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
}
.tc-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
}

.tc-hero-text { flex: 1; min-width: 220px; }
.tc-hero-text h2 { font-size: 1.15rem; margin-bottom: 0.3rem; }
.tc-hero-text p { color: var(--muted); font-size: 0.88rem; max-width: 480px; }

.tc-badge-pill {
  margin-top: 0.6rem;
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.tc-badge-pill.earned { font-weight: 800; }

/* ── Summary grid ─────────────────────────────────────── */
.sum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}

.sum-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: background 0.1s;
}
.sum-card:hover { background: var(--border); }

.sum-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sum-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.sum-check { font-weight: 700; }
.sum-value { font-size: 0.95rem; font-weight: 700; }
.sum-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
}
.sum-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s ease, background 0.2s ease;
}

/* ── Tab bar (mirrors Inventory / Completionist pages) ─ */
.tc-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tc-tab-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.tc-tab-btn:hover { background: var(--border); color: var(--text); }
.tc-tab-btn.active {
  background: var(--border);
  color: var(--text);
  font-weight: 600;
  border-color: var(--muted);
}

.tc-panel { display: none; }
.tc-panel.active { display: block; }

.tc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.tc-card-note { font-size: 0.82rem; color: var(--muted); }
.tc-muted { color: var(--muted); font-size: 0.8rem; }

.tc-link-btn {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  transition: background 0.1s;
}
.tc-link-btn:hover { background: var(--border); }

/* ── Base stations panel ─────────────────────────────── */
.station-rows {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.station-row {
  display: grid;
  grid-template-columns: 160px 1fr 90px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}
.station-row-name { font-weight: 600; }
.station-row-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.station-row-fill { height: 100%; border-radius: 4px; }
.station-row-level {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .station-row { grid-template-columns: 1fr; }
  .station-row-level { text-align: left; }
}

/* ── Chip / card grid (pickaxes, gear) ───────────────── */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}
.chip-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.1s, background 0.1s;
}
.chip-card:hover:not(.is-free) { border-color: var(--muted); }
.chip-card.owned { border-color: #2d6b2d; background: rgba(46,107,45,0.08); }
.chip-card.is-free { cursor: default; opacity: 0.85; }
.chip-card.locked { opacity: 0.45; cursor: not-allowed; }

/* Reserved image slot for pickaxes / gear (falls back to an emoji tile
   until real icon assets exist at assets/<folder>/<slug>.png) */
.item-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.item-thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.item-thumb-fallback {
  width: 100%; height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.chip-card-name { font-weight: 700; font-size: 0.88rem; }
.chip-card-costs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.chip-card-check {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.3rem;
  border-top: 1px solid var(--border);
}
.chip-card.owned .chip-card-check { color: #8eff8e; font-weight: 700; }

/* ── Quick-mark: register complete instantly, no modal, no ore spent ── */
.quick-mark-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
}
.quick-mark-btn:hover { border-color: var(--muted); color: var(--text); background: var(--border); }
.quick-mark-inline {
  position: static;
  width: auto;
  height: auto;
  border-radius: 4px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
}

/* Small ore/coin cost pill used inside chip cards, elevator & gear lists */
.cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}
.cc-icon { width: 14px; height: 14px; display: flex; align-items: center; justify-content: center; }
.cc-icon img { max-width: 14px; max-height: 14px; image-rendering: pixelated; }

/* ── Emblems, big emblem, no circle; owned panel takes the ore's colors */
.emblem-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.emblem-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 0.7rem;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.emblem-card:hover:not(.locked) { filter: brightness(1.08); }
.emblem-card.locked { opacity: 0.4; cursor: not-allowed; }

/* No forced dimensions, ore icons are all slightly different sizes, so
   only the largest side is capped and the image keeps its own aspect
   ratio instead of being squeezed into a fixed box. */
.emblem-art-plain {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0;
  min-height: 84px;
}
.emblem-art-plain img {
  width: auto;
  height: auto;
  max-width: 116px;
  max-height: 116px;
  image-rendering: pixelated;
}
.emblem-name { font-weight: 700; font-size: 0.85rem; line-height: 1.2; }
.emblem-cost { display: flex; justify-content: center; }
.emblem-card .chip-card-check { border-top-color: currentColor; opacity: 0.8; }
.emblem-card.owned .chip-card-check { color: inherit; }

/* ── Rank track ───────────────────────────────────────── */
.rank-track-wrap {
  display: flex;
  gap: 0.75rem;
}
.rank-gradient-bar {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}
.rank-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rank-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 0.65rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  text-align: left;
  transition: color 0.15s;
}
.rank-row:hover { color: var(--text); }
.rank-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}
.rank-row.reached { color: var(--text); }
.rank-name { font-weight: 700; }
.rank-xp {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--muted);
}

@keyframes tcSuperGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(188,32,255,0.45); }
  50%      { box-shadow: 0 0 10px 3px rgba(188,32,255,0.65); }
}
.rank-row.super.reached .rank-dot {
  animation: tcSuperGlow 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .rank-row.super.reached .rank-dot { animation: none; }
}

/* ── Museum: grouped sections ────────────────────────── */
.museum-sections {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
/* Nested one level deeper than usual (panel-on-page, box-on-panel), so
   this overrides the shared .section-box's background to keep contrast
   against its .tc-card parent instead of blending into it. */
.section-box { background: var(--bg); }
.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.section-title-bar strong { font-size: 0.87rem; }
.section-meta { display: flex; align-items: center; gap: 0.6rem; }
.section-subtitle { font-size: 0.76rem; color: var(--muted); }
.section-count { font-size: 0.72rem; font-weight: 700; color: var(--muted); }

/* ── Museum's own small tables (not the shared "inventory panel") ──
   These stay on the pre-existing .tc-table look, no search/sort, so
   they don't need the shared component, just a matching visual style. */
.tc-table {
  width: 100%;
  min-width: 420px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}
.tc-table thead th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tc-table th.th-center { text-align: center; }
.tc-table td {
  padding: 0.3rem 0.6rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.tc-table tbody tr:last-child td { border-bottom: none; }
.tc-table tbody tr:hover { background: rgba(255,255,255,0.025); }
[data-theme="light"] .tc-table tbody tr:hover { background: rgba(0,0,0,0.03); }
.tc-table tr.row-done { background: rgba(46,107,45,0.08); }
.td-short { color: #ff9999; font-weight: 700; }
.td-surplus { color: #8eff8e; }

.tc-table td:first-child,
.tc-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg);
  width: 1%;
  white-space: nowrap;
}
.tc-table thead th:first-child { z-index: 4; }

/* ── Generic toggle button (Museum / Elevators) ──────── */
.status-btns { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.toggle-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  font-family: inherit;
  white-space: nowrap;
}
.toggle-btn:hover:not(:disabled) { background: var(--border); color: var(--text); }
.toggle-btn.on { background: #1a3a1a; border-color: #2d6b2d; color: #8eff8e; }
.toggle-btn:disabled { opacity: 0.6; cursor: default; }

/* ── Elevators ────────────────────────────────────────── */
.elevator-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.elevator-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}
.elevator-row.unlocked { border-color: #2d6b2d; }
.elevator-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.elevator-name { font-weight: 700; font-size: 0.9rem; }
.elevator-costs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* ── Badges ───────────────────────────────────────────── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}
.badge-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  transition: border-color 0.1s, background 0.1s;
}
.badge-card:hover { border-color: var(--muted); }
.badge-card.owned { border-color: #2d6b2d; background: rgba(46,107,45,0.08); }

.badge-thumb {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.badge-thumb img { width: 100%; height: 100%; object-fit: contain; }
.badge-fallback {
  width: 100%; height: 100%;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--muted);
}
.badge-name { font-size: 0.82rem; font-weight: 700; line-height: 1.2; }

@media (max-width: 500px) {
  .tc-hero-panel { flex-direction: column; text-align: center; }
  .tc-hero-text p { max-width: none; }
}

#tc-panel-all.active {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

#tc-panel-all .section-box {
  background: var(--panel);
}
#tc-panel-all .ore-table td:first-child,
#tc-panel-all .ore-table th:first-child {
  background: var(--panel);
}

#tc-panel-all .ore-table { min-width: 700px; }

/* ── "All" tab toolbar (Compact View) ────────────────── */
.tc-all-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

#tc-panel-all.compact .ore-name-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#tc-panel-all.compact .ore-name-btn .ore-name-text {
  display: none;
}
