/* === TABLE === */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
}

td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--bg-primary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #1a1a3e; }

/* === PHASE PILLS (segmented control) === */
.phase-pills {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.phase-pills a {
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: color 0.15s, background 0.15s;
}

.phase-pills a:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.phase-pills a:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.phase-pills a + a { border-left: none; }

.phase-pills a:hover { color: var(--text-primary); background: var(--bg-hover); }

.phase-pills a.active {
  background: var(--accent-rare);
  color: #fff;
  border-color: var(--accent-rare);
}

/* === STAT BARS === */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1.5rem;
  margin-bottom: 1rem;
}

details.stats-collapsible {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

details.stats-collapsible:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

details.stats-collapsible > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  user-select: none;
  background: var(--bg-tertiary);
  padding: 0.5rem 0.8rem;
  font-weight: bold;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

details.stats-collapsible > summary::-webkit-details-marker { display: none; }
details.stats-collapsible > summary:hover { background: var(--bg-hover); }

details.stats-collapsible .stats-grid {
  padding: 0.6rem 0.8rem;
}

.stat-bar-container { margin-bottom: 0.3rem; }

.stat-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
}

.stat-bar {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  height: 14px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: var(--radius-md);
  transition: width 0.3s;
}

.stat-bar-fill.capped { background: var(--accent-uncommon); }
.stat-bar-fill.partial { background: var(--accent-rare); }
.stat-bar-fill.no-cap { background: var(--accent-epic); }

/* === CARDS === */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 112, 221, 0.2);
  border-color: var(--border-hover);
}

.card-minor {
  opacity: 0.6;
  border-style: dashed;
}

.card-minor:hover { opacity: 0.85; }

.minor-tag {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-left: 0.5rem;
}

.world-boss-section-header { color: var(--accent-warning); }

details.world-boss-group { opacity: 0.7; }
details.world-boss-group:hover { opacity: 0.9; }
details.world-boss-group > summary { border-left: 3px solid var(--accent-warning); }

.minor-section-header { color: var(--text-muted); }

details.minor-group { opacity: 0.6; }
details.minor-group:hover { opacity: 0.85; }
details.minor-group > summary { border-left: 3px solid var(--border-light); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.card-score { color: var(--accent-uncommon); font-weight: bold; font-size: 1rem; }
.card-slot { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }
.card-detail { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }
.card-stats { font-size: 0.8rem; color: var(--accent-gem); margin-top: 0.15rem; }

/* === TAGS & BADGES === */
.persist-tag {
  display: inline-block;
  background: var(--accent-uncommon);
  color: var(--bg-primary);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: bold;
  margin-left: 0.5rem;
}

.dungeon-badge {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--accent-gem);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.bis-phase-tag {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--accent-rare);
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-left: 0.25rem;
  font-weight: bold;
}

.already-upgrade-tag {
  display: inline-block;
  background: var(--accent-uncommon);
  color: var(--bg-primary);
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  font-weight: bold;
  margin-left: 0.4rem;
}

/* === HERO CARD === */
.hero-card {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-epic);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 15px rgba(163, 53, 238, 0.3);
}

.hero-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-epic);
  margin-bottom: 0.5rem;
}

.hero-score {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--accent-uncommon);
  display: inline-block;
  margin-right: 0.75rem;
}

.hero-item { font-size: 1.3rem; display: inline; }
.hero-detail { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.4rem; }

/* === PROGRESS BAR === */
.progress-container { margin-bottom: 1.5rem; }
.progress-inline {
  flex: 1;
  max-width: 220px;
  margin: 0 1rem;
}
.progress-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.25rem; }

.progress-bar {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  height: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--accent-rare), var(--accent-epic));
  transition: width 0.3s;
}

/* === COLLAPSIBLE SECTIONS (shared) === */
details.slot-group,
details.dungeon-group,
details.bis-slot-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

details.slot-group:hover,
details.dungeon-group:hover,
details.bis-slot-group:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

details.slot-group > summary,
details.dungeon-group > summary,
details.bis-slot-group > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  background: var(--bg-tertiary);
  padding: 0.5rem 0.8rem;
  font-weight: bold;
  font-size: 0.95rem;
  color: var(--accent-legendary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

details.dungeon-group > summary {
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
}

details.dungeon-group > summary .score { color: var(--accent-uncommon); }

details.slot-group > summary::-webkit-details-marker,
details.dungeon-group > summary::-webkit-details-marker,
details.bis-slot-group > summary::-webkit-details-marker {
  display: none;
}

details > summary .summary-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
  margin-left: 0.75rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

details > summary::after {
  content: "\25B6";
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 0.75rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}

details[open] > summary::after { transform: rotate(90deg); }
details > summary:hover { background: var(--bg-hover); }

.slot-group-items { padding: 0.5rem 0.75rem; }
.slot-group-items .card { margin-bottom: 0.5rem; border-color: #1a1a3e; }
.slot-group-items .card:last-child { margin-bottom: 0; }
.alt-count { padding: 0.4rem 0.75rem; font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* === COMPONENTS RESPONSIVE === */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; }
  .char-header { flex-direction: column; align-items: flex-start; }
  .char-header .char-spec { margin-left: 0; }
}

@media (max-width: 480px) {
  .phase-pills { flex-wrap: wrap; }
}
