:root {
  --bg: #120f1b;
  --bg-2: #1a1423;
  --panel: #211a2e;
  --panel-2: #2a2140;
  --line: #3a2f52;
  --text: #efeaf7;
  --muted: #a99fc2;
  --accent: #ff7ab8;
  --accent-2: #ffd166;
  --good: #63d6a3;
  --bad: #ff6b81;

  --opal: #c9d6ff;
  --sapphire: #5b8dff;
  --ruby: #ff5d73;
  --garnet: #d34a86;
  --emerald: #3fcf8e;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 122, 184, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(91, 141, 255, 0.16), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus { left: 1rem; top: 1rem; background: #fff; color: #000; padding: 0.5rem; z-index: 100; }

/* ---------- layout ---------- */
.app { max-width: 1180px; margin: 0 auto; padding: 0 1rem 3rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand .logo { font-size: 1.6rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: 0.75rem; }

.nav { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.nav-link {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
}
.nav-link:hover { color: var(--text); background: var(--panel); }
.nav-link.active { color: #1a1423; background: var(--accent); }

.page { animation: fade 0.25s ease; display: flex; flex-direction: column; gap: 1.25rem; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}
.lede { color: var(--muted); max-width: 62ch; }

/* ---------- hero ---------- */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 122, 184, 0.12), rgba(91, 141, 255, 0.10)),
    var(--panel);
  box-shadow: var(--shadow);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent-2);
  margin: 0;
}
.hero-text { flex: 1 1 420px; }
.hero-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }
.byline { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- controls ---------- */
.btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  transition: 0.15s ease;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #1a1423; border-color: transparent; }

.segmented {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.seg {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
}
.seg.active { background: var(--accent-2); color: #1a1423; }

.tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tab {
  appearance: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}
.tab.active { color: var(--text); border-color: var(--accent); background: var(--panel-2); }

/* ---------- cards & grids ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.align-start { align-items: start; }

ul.ticks, ul.crosses { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
ul.ticks li, ul.crosses li { position: relative; padding-left: 1.5rem; }
ul.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 800; }
ul.crosses li::before { content: "✕"; position: absolute; left: 0; color: var(--bad); font-weight: 800; }

ol.steps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.55rem; }
ol.steps li::marker { color: var(--accent-2); font-weight: 700; }

.ability-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; margin-top: 0.5rem; }
.preview { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem; }
.preview p { margin: 0.15rem 0; }

/* ---------- gem chips ---------- */
.gem {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #12101a;
  white-space: nowrap;
}
.gem-sm { font-size: 0.75rem; padding: 0.2rem 0.5rem; }
.gem-opal { background: var(--opal); }
.gem-sapphire { background: var(--sapphire); color: #fff; }
.gem-ruby { background: var(--ruby); color: #fff; }
.gem-garnet { background: var(--garnet); color: #fff; }
.gem-emerald { background: var(--emerald); }
.gem-none { background: var(--muted); }

.gem-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-bottom: 0.4rem; }
.gem-dot.gem-opal { background: var(--opal); }
.gem-dot.gem-sapphire { background: var(--sapphire); }
.gem-dot.gem-ruby { background: var(--ruby); }
.gem-dot.gem-garnet { background: var(--garnet); }
.gem-dot.gem-emerald { background: var(--emerald); }
.gem-dot.gem-primary { background: var(--accent); }
.gem-dot.gem-secondary { background: var(--accent-2); }
.gem-dot.gem-special { background: #8b7bff; }
.gem-dot.gem-defensive { background: var(--good); }

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.swatch.gem-opal { background: var(--opal); }
.swatch.gem-sapphire { background: var(--sapphire); }
.swatch.gem-ruby { background: var(--ruby); }
.swatch.gem-garnet { background: var(--garnet); }
.swatch.gem-emerald { background: var(--emerald); }
.swatch.gem-primary { background: var(--accent); }
.swatch.gem-secondary { background: var(--accent-2); }
.swatch.gem-special { background: #8b7bff; }
.swatch.gem-defensive { background: var(--good); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-size: 0.82rem;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.chip.chip-bad { border-color: rgba(255, 107, 129, 0.5); color: #ffc2c9; }
.chip.item { font-size: 0.8rem; }

/* ---------- notebox ---------- */
.notebox {
  border-left: 4px solid var(--accent);
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.9rem 1.1rem;
}
.notebox h4 { color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; margin-bottom: 0.35rem; }
.notebox p:last-child { margin-bottom: 0; }
.notebox.notes { border-left-color: var(--accent-2); }
.notebox.warn { border-left-color: var(--bad); }

/* ---------- tier lists (gems) ---------- */
.tier { display: grid; grid-template-columns: 110px 1fr; gap: 0.75rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.tier:last-child { border-bottom: 0; }
.tier-label {
  font-weight: 800;
  font-size: 0.8rem;
  text-align: center;
  padding: 0.35rem 0.25rem;
  border-radius: 8px;
  color: #12101a;
  background: var(--muted);
}
.tier-s .tier-label { background: #ffcf5c; }
.tier-a .tier-label { background: #9be37b; }
.tier-b .tier-label { background: #7fc8ff; }
.tier-c .tier-label { background: #c6b3ff; }
.tier-d .tier-label { background: #ffb3c7; }
.tier-f .tier-label { background: #8b8496; color: #eee; }
.tier-gems { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---------- score table ---------- */
.score-section { margin-bottom: 1rem; }
.score-section:last-child { margin-bottom: 0; }
.score-section h3 { color: var(--accent-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
table.scores { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.scores th, table.scores td { padding: 0.35rem 0.4rem; text-align: right; border-bottom: 1px solid var(--line); }
table.scores th:first-child, table.scores td:first-child { text-align: left; }
table.scores th { color: var(--muted); font-weight: 600; font-size: 0.75rem; }
table.scores tr.great td { background: rgba(255, 209, 102, 0.06); }
table.scores td.avg { font-weight: 700; color: var(--accent-2); }

/* ---------- abilities ---------- */
.ability-list { display: flex; flex-direction: column; gap: 1rem; }
.ability { border-left-width: 4px; }
.ability.accent-gem-opal { border-left-color: var(--opal); }
.ability.accent-gem-sapphire { border-left-color: var(--sapphire); }
.ability.accent-gem-ruby { border-left-color: var(--ruby); }
.ability.accent-gem-garnet { border-left-color: var(--garnet); }
.ability.accent-gem-emerald { border-left-color: var(--emerald); }
.ability.accent-gem-primary { border-left-color: var(--accent); }
.ability.accent-gem-secondary { border-left-color: var(--accent-2); }
.ability.accent-gem-special { border-left-color: #8b7bff; }
.ability.accent-gem-defensive { border-left-color: var(--good); }
.swatch.accent-gem-opal { background: var(--opal); }
.swatch.accent-gem-sapphire { background: var(--sapphire); }
.swatch.accent-gem-ruby { background: var(--ruby); }
.swatch.accent-gem-garnet { background: var(--garnet); }
.swatch.accent-gem-emerald { background: var(--emerald); }
.swatch.accent-gem-primary { background: var(--accent); }
.swatch.accent-gem-secondary { background: var(--accent-2); }
.swatch.accent-gem-special { background: #8b7bff; }
.swatch.accent-gem-defensive { background: var(--good); }

.ability-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.ability-head > div { display: flex; align-items: center; gap: 0.25rem; }
.ability-head h2 { margin: 0; font-size: 1.1rem; }
.ability-head .swatch { width: 14px; height: 14px; border-radius: 4px; }
.tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}
.desc { color: var(--text); margin-top: 0.5rem; }
.synergy-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0.75rem 0; }
.synergy-cols h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
h3.good { color: var(--good); }
h3.bad { color: var(--bad); }
@media (max-width: 640px) { .synergy-cols { grid-template-columns: 1fr; } }

/* ---------- loot ---------- */
.searchbar { display: flex; align-items: center; gap: 0.75rem; }
.searchbar input {
  flex: 1;
  font: inherit;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
}
.searchbar input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.tiers { display: flex; flex-direction: column; gap: 0.75rem; }
.loot-tier { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.loot-tier-head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.6rem; }
.loot-tier-head h2 { margin: 0; font-size: 1.02rem; }
.count { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 0.5rem; }
.loot-tier.tone-0 { border-color: rgba(255, 209, 102, 0.55); }
.loot-tier.tone-1 { border-color: rgba(99, 214, 163, 0.4); }
.loot-tier.tone-2 { border-color: rgba(127, 200, 255, 0.4); }
.loot-tier.tone-9 { border-color: rgba(255, 107, 129, 0.4); }
.loot-tier.tone-0 .loot-tier-head h2 { color: var(--accent-2); }

/* ---------- footer ---------- */
.footer { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.footer p { margin: 0 0 0.4rem; }

@media (max-width: 520px) {
  .tier { grid-template-columns: 84px 1fr; }
  .ability-head { flex-direction: column; align-items: flex-start; }
}
