* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #111;
  color: #e5e5e5;
  line-height: 1.5;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

header { margin-bottom: 1rem; }
header h1 { font-size: 1.4rem; font-weight: 600; }
.banner { margin-bottom: 0.75rem; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 4; }
.banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.desc { font-size: 0.72rem; color: #555; margin-top: 0.4rem; line-height: 1.5; }
.meta { font-size: 0.75rem; color: #666; margin-top: 0.25rem; }
.meta a { color: #666; text-decoration: underline; text-underline-offset: 2px; }
.meta a:hover { color: #999; }
.notes { font-size: 0.7rem; color: #444; margin-top: 0.35rem; line-height: 1.6; }
.source-info { color: #555; }

/* Page-level tabs (Tier List / Immunities) */
.page-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid #222;
}
.ptab {
  padding: 0.55rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: #555;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
}
.ptab:hover { color: #aaa; }
.ptab.active { color: #e5e5e5; border-bottom-color: #e5e5e5; }
a.ptab { text-decoration: none; }

.page { display: none; }
.page.active { display: block; }

/* Class/immunity tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #1c1c1c;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 0.45rem 0.7rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: #555;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}
.tab:hover { color: #aaa; }
.tab.active { color: #ccc; border-bottom-color: #888; }

/* Search */
.toolbar { margin-bottom: 0.75rem; }
#search {
  width: 100%;
  padding: 0.45rem 0.7rem;
  background: #181818;
  border: 1px solid #252525;
  border-radius: 6px;
  color: #e5e5e5;
  font-size: 0.82rem;
  outline: none;
}
#search:focus { border-color: #444; }

/* Tier section */
.tier-section { margin-bottom: 1.25rem; }
.tier-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.3rem 0;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  justify-content: space-between;
}
.tier-count { font-weight: 400; color: #333; }

/* Champion row */
.champ {
  display: flex;
  align-items: center;
  padding: 0.3rem 0;
  gap: 0.5rem;
}

.champ-rank {
  width: 22px;
  font-size: 0.65rem;
  color: #3a3a3a;
  text-align: right;
  flex-shrink: 0;
}

.champ-portrait {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  flex-shrink: 0;
  background: #1a1a1a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.champ-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.champ-portrait .fb {
  font-size: 0.6rem;
  font-weight: 600;
  color: #3a3a3a;
}

.champ-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.champ-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.champ-imm-line {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.aw {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #f59e0b;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

.hs {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

.no7 {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  color: #ef4444;
  background: #ef444420;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  text-decoration: line-through;
}

.tb {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Legend grid */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  padding: 0.5rem 0.6rem;
  margin-top: 0.4rem;
  margin-bottom: 0.25rem;
  background: #161616;
  border-radius: 6px;
  border: 1px solid #1e1e1e;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  color: #666;
  white-space: nowrap;
}

.champ-class {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.champ-bar-wrap {
  width: 70px;
  flex-shrink: 0;
}
.champ-bar {
  height: 3px;
  border-radius: 2px;
  background: #1a1a1a;
  overflow: hidden;
}
.champ-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.champ-score {
  width: 22px;
  font-size: 0.7rem;
  color: #555;
  text-align: right;
  flex-shrink: 0;
}

/* Trait tags on champion rows */
.champ-tags {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  flex-wrap: wrap;
  max-width: 160px;
}
.tag {
  font-size: 0.45rem;
  padding: 0.05rem 0.2rem;
  border-radius: 2px;
  background: #1a1a1a;
  color: #555;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Immunity badges on champion rows (legacy, kept for immunity page) */
.imm-tag {
  font-size: 0.5rem;
  padding: 0.05rem 0.25rem;
  border-radius: 2px;
  background: #1f1f1f;
  color: #888;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Immunity page */
.imm-hint {
  font-size: 0.7rem;
  color: #444;
  margin-bottom: 0.6rem;
}

.imm-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.imm-toggle {
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  border: 1px solid #282828;
  border-radius: 5px;
  background: #181818;
  color: #777;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.imm-toggle:hover { border-color: #444; color: #aaa; }
.imm-toggle.on {
  background: #ffffff12;
  border-color: var(--imm-color, #888);
  color: var(--imm-color, #ccc);
}

.imm-results-info {
  font-size: 0.7rem;
  color: #555;
  margin-bottom: 0.5rem;
}

.imm-champ-row {
  display: flex;
  align-items: center;
  padding: 0.3rem 0;
  gap: 0.5rem;
}
.imm-champ-row img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
}
.imm-champ-row .fb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #3a3a3a;
  font-weight: 600;
}
.imm-champ-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.imm-champ-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.imm-champ-tags .imm-tag.matched {
  background: #ffffff15;
  color: #ccc;
}
.imm-champ-score {
  width: 22px;
  font-size: 0.7rem;
  color: #555;
  text-align: right;
  flex-shrink: 0;
}

/* Shared page hints */
.page-hint {
  font-size: 0.7rem;
  color: #444;
  margin-bottom: 0.6rem;
}

/* Awakening gem page */
.aw-results-info {
  font-size: 0.7rem;
  color: #555;
  margin-bottom: 0.5rem;
}
.aw-champ-row {
  display: flex;
  align-items: center;
  padding: 0.3rem 0;
  gap: 0.5rem;
}
.aw-champ-row img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  flex-shrink: 0;
}
.aw-champ-row .fb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #3a3a3a;
  font-weight: 600;
  flex-shrink: 0;
}
.aw-champ-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-champ-score {
  width: 22px;
  font-size: 0.7rem;
  color: #555;
  text-align: right;
  flex-shrink: 0;
}

/* Sig stones page */
.sig-section { margin-bottom: 1.25rem; }
.sig-priority-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.3rem 0;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  justify-content: space-between;
}
.sig-priority-count { font-weight: 400; color: #333; }
.sig-champ-row {
  display: flex;
  align-items: center;
  padding: 0.3rem 0;
  gap: 0.5rem;
}
.sig-champ-row img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  flex-shrink: 0;
}
.sig-champ-row .fb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #3a3a3a;
  font-weight: 600;
  flex-shrink: 0;
}
.sig-champ-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}
.sig-champ-note {
  flex: 1;
  font-size: 0.65rem;
  color: #555;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sig-champ-score {
  width: 22px;
  font-size: 0.7rem;
  color: #555;
  text-align: right;
  flex-shrink: 0;
}

/* Prestige page */
.prestige-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.prestige-select {
  padding: 0.45rem 0.7rem;
  background: #181818;
  border: 1px solid #252525;
  border-radius: 6px;
  color: #e5e5e5;
  font-size: 0.82rem;
  outline: none;
}
.prestige-select:focus { border-color: #444; }
.prestige-search {
  flex: 1;
  min-width: 120px;
  padding: 0.45rem 0.7rem;
  background: #181818;
  border: 1px solid #252525;
  border-radius: 6px;
  color: #e5e5e5;
  font-size: 0.82rem;
  outline: none;
}
.prestige-search:focus { border-color: #444; }
.prestige-info {
  font-size: 0.7rem;
  color: #555;
  margin-bottom: 0.5rem;
}
.prestige-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.prestige-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}
.prestige-table th {
  position: sticky;
  top: 0;
  background: #111;
  color: #555;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.4rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid #1a1a1a;
}
.prestige-table th:nth-child(1),
.prestige-table th:nth-child(2),
.prestige-table th:nth-child(3) { text-align: left; }
.prestige-table td {
  padding: 0.3rem 0.4rem;
  white-space: nowrap;
  border-bottom: 1px solid #141414;
  font-variant-numeric: tabular-nums;
}
.prestige-table td:nth-child(1) {
  color: #3a3a3a;
  font-size: 0.65rem;
  text-align: right;
  width: 22px;
}
.prestige-table td:nth-child(2) { width: 28px; padding: 0.2rem 0.3rem; }
.prestige-table td:nth-child(3) {
  font-weight: 500;
  font-size: 0.78rem;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prestige-table td.pv {
  text-align: right;
  color: #888;
  font-size: 0.68rem;
}
.prestige-table tr:hover td { background: #161616; }
.prestige-table .pv-hi { color: #ccc; }

.empty { color: #444; padding: 2rem 0; text-align: center; font-size: 0.85rem; }

@media (max-width: 480px) {
  .banner { margin-left: -1rem; margin-right: -1rem; border-radius: 0; }
  .champ-bar-wrap { width: 40px; }
  .champ-class { display: none; }
  .champ-imm-line { display: none; }
  .tab { padding: 0.45rem 0.5rem; font-size: 0.7rem; }
  .ptab { padding: 0.45rem 0.7rem; font-size: 0.8rem; }
}
