:root {
  color-scheme: dark;
  --bg: #0e0c16;
  --card: #17141f;
  --card-hover: #1e1a29;
  --line: #2a2536;
  --text: #f2eff7;
  --muted: #9a93ab;
  --accent: #ff5ca8;
  --accent-2: #ffa95c;
  --done: #4ade9a;
  --warn: #ffb44f;

  --platinum: #a6d4ff;
  --gold: #f4c64e;
  --silver: #c8cdd8;
  --bronze: #d98d57;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
body.locked { overflow: hidden; }

.page { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.head { padding: 28px 0 8px; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.count { font-size: 15px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }
.sub { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sub span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.gdot { width: 10px; height: 10px; border-radius: 50%; background: var(--g); flex: none; display: inline-block; }
.g-platinum { --g: var(--platinum); }
.g-gold { --g: var(--gold); }
.g-silver { --g: var(--silver); }
.g-bronze { --g: var(--bronze); }

/* ---------- Profile row ---------- */
.profile-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.psn { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.psn-chip {
  display: inline-flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 99px;
  background: var(--card); border: 1px solid var(--line); cursor: pointer; max-width: 100%;
}
.psn-chip:hover { border-color: #463f57; }
.psn-avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #1a0d14; font-weight: 800; font-size: 14px;
}
.psn-text { display: grid; line-height: 1.2; min-width: 0; text-align: left; }
.psn-text small { font-size: 11px; color: var(--muted); }
.psn-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psn-edit { color: var(--muted); font-size: 13px; }
.psn-add { color: var(--muted); font-weight: 600; font-size: 14px; }
.psn-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.psn-form input {
  width: 190px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); outline: none;
}
.psn-form input:focus { border-color: var(--accent); }
.psn-err { color: #ff6b81; font-size: 12.5px; width: 100%; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; white-space: nowrap;
}
.pill-btn:hover { border-color: var(--accent); }
.pill-btn svg { width: 17px; height: 17px; fill: currentColor; }
.pill-btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-color: transparent; color: #1a0d14; }
.pill-btn.primary:hover { filter: brightness(1.08); }
.pill-btn.small { padding: 7px 12px; font-size: 13px; }

/* ---------- Scope filter ---------- */
.scope { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.scope button {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; font-size: 14px;
}
.scope button span { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; }
.scope button:hover { color: var(--text); }
.scope button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.scope button[data-scope="missable"][aria-pressed="true"] { background: var(--warn); border-color: var(--warn); color: #241503; }

/* ---------- Image modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(5, 4, 10, .72); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal-card {
  width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.img-wrap { padding: 16px; overflow: auto; display: grid; place-items: center; min-height: 200px; }
.img-wrap img { width: 100%; max-width: 360px; aspect-ratio: 4 / 5; border-radius: 10px; border: 1px solid var(--line); display: block; }
.img-wrap img:not([src]) { display: none; }
.img-loading { color: var(--muted); margin: 0; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Consent banner ---------- */
.consent {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 45;
  width: min(640px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 14px;
  background: #1d1928; border: 1px solid #3a3449; box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  display: flex; gap: 14px; align-items: center; font-size: 13.5px; animation: up .3s ease;
}
.consent p { margin: 0; flex: 1; color: var(--muted); }
.consent p b { color: var(--text); }
.consent-btns { display: flex; gap: 8px; flex: none; }

/* ---------- Rarity ---------- */
.rarity { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.rarity.t-ultra { color: var(--gold); }
.rarity.t-very { color: var(--accent); }
.rarity.t-rare { color: var(--platinum); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; }
.tab { background: none; border: 0; padding: 10px 0; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

/* ---------- Missable banner ---------- */
.missable {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px;
  border-radius: 12px; font-size: 14px; background: rgba(255, 180, 79, .09); border: 1px solid rgba(255, 180, 79, .3);
}
.missable b { color: var(--warn); }
.missable .text-btn { color: var(--warn); }

/* ---------- Controls ---------- */
.controls { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.controls input {
  flex: 1 1 220px; min-width: 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); outline: none;
}
.controls input:focus { border-color: var(--accent); }
.filter { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.filter button { background: none; border: 0; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
.filter button[aria-pressed="true"] { background: var(--line); color: var(--text); }

/* ---------- List ---------- */
.group { margin-top: 22px; }
.group-title { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.group-title span { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row:hover { background: var(--card-hover); }

.tick {
  flex: none; width: 26px; height: 26px; margin: 0 4px 0 14px; border-radius: 50%; cursor: pointer;
  border: 2px solid #4a4459; background: transparent; display: grid; place-items: center; padding: 0;
  transition: background .15s, border-color .15s, transform .1s;
}
.tick svg { width: 14px; height: 14px; fill: none; stroke: transparent; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.tick:hover { border-color: var(--done); }
.tick:active { transform: scale(.9); }
.tick[aria-pressed="true"] { background: var(--done); border-color: var(--done); }
.tick[aria-pressed="true"] svg { stroke: #072415; }
.tick:disabled { cursor: default; opacity: .6; }

.row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 13px 14px 13px 10px;
  background: none; border: 0; text-align: left; cursor: pointer;
}
.row-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.row-name .gdot { width: 8px; height: 8px; }
.row-desc { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.done .row-name { color: var(--muted); }
.row-side { flex: none; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chev { color: #5d566d; font-size: 20px; line-height: 1; }

.badge { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.badge.warn { background: rgba(255, 180, 79, .15); color: var(--warn); }
.badge.unk { background: rgba(154, 147, 171, .15); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- Roadmap ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 24px; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fact dt { font-size: 12px; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-weight: 600; font-size: 14.5px; }
.stage { display: grid; grid-template-columns: 36px 1fr; gap: 0 14px; margin-bottom: 22px; }
.stage-num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--card); border: 1px solid var(--line); color: var(--accent); }
.stage h3 { margin: 6px 0 2px; font-size: 17px; }
.stage .time { color: var(--muted); font-size: 13px; }
.stage ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }

/* ---------- Guide panel ---------- */
.scrim { position: fixed; inset: 0; background: rgba(5, 4, 10, .6); z-index: 30; animation: fade .2s; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 31;
  background: var(--bg); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  animation: slide .25s cubic-bezier(.2, .8, .2, 1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.panel-bar { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.panel-pos { color: var(--muted); font-size: 13px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 0; background: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { background: var(--card); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn.close { margin-left: auto; font-size: 17px; }
.panel-body { overflow-y: auto; padding: 22px 22px 40px; flex: 1; }

.g-head { display: flex; gap: 14px; align-items: flex-start; }
.g-cup { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--g) 15%, transparent); border: 1px solid color-mix(in srgb, var(--g) 40%, transparent); }
.g-cup svg { width: 28px; height: 28px; fill: var(--g); }
.g-grade { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--g); }
.panel h2 { margin: 2px 0 2px; font-size: 22px; line-height: 1.25; letter-spacing: -.2px; }
.g-desc { margin: 0; color: var(--muted); }

.earn-btn {
  width: 100%; margin: 18px 0 0; padding: 12px; border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 15px;
  border: 1px solid var(--line); background: var(--card); display: flex; align-items: center; justify-content: center; gap: 8px;
}
.earn-btn:hover { border-color: var(--done); }
.earn-btn[aria-pressed="true"] { background: rgba(74, 222, 154, .12); border-color: rgba(74, 222, 154, .5); color: var(--done); }
.earn-btn:disabled { opacity: .6; cursor: default; }

.info { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 18px 0 0; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.info div { background: var(--card); padding: 10px 12px; }
.info dt { font-size: 12px; color: var(--muted); }
.info dd { margin: 1px 0 0; font-size: 14px; font-weight: 600; }
.info dd.warn { color: var(--warn); }

.g-sec { margin-top: 24px; }
.g-sec h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.callout { margin: 18px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--card); border-left: 3px solid var(--accent); font-size: 15px; }
.callout.warn { border-left-color: var(--warn); }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.steps li::before {
  content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: var(--card); border: 1px solid var(--line); color: var(--accent);
}
.tips { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.tips li::marker { color: var(--accent-2); }

/* trackers */
.counter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.counter input {
  width: 100px; height: 40px; text-align: center; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; outline: none;
}
.counter input:focus { border-color: var(--accent); }
.step-btn {
  min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 16px; font-weight: 600;
}
.step-btn:hover { border-color: var(--accent); }
.of { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width .3s; }
.bar.full i { background: var(--done); }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.checks { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.checks li { border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks label { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; cursor: pointer; background: var(--card); }
.checks label:hover { background: var(--card-hover); }
.checks input {
  appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0; border-radius: 6px; border: 2px solid #4a4459;
  display: grid; place-items: center; cursor: pointer;
}
.checks input:checked { background: var(--done); border-color: var(--done); }
.checks input:checked::after { content: ""; width: 5px; height: 10px; border: solid #072415; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.checks .ci { display: grid; gap: 1px; }
.checks .ci small { color: var(--muted); font-size: 12.5px; }
.checks input:checked ~ .ci > span { color: var(--muted); text-decoration: line-through; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--muted); }

.ref { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ref li { padding: 9px 14px; background: var(--card); border-top: 1px solid var(--line); font-size: 14px; }
.ref li:first-child { border-top: 0; }
.ref li small { color: var(--muted); display: block; font-size: 12.5px; }

.c100 { display: grid; gap: 10px; }
.c100-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.c100-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.c100-item b { font-size: 14.5px; }
.c100-item.full { border-color: rgba(74, 222, 154, .4); }
.c100-item .counter input { width: 76px; height: 34px; font-size: 14px; }
.c100-item .step-btn { min-width: 34px; height: 34px; }

.src { margin-top: 28px; font-size: 13px; color: var(--muted); }

/* ---------- Footer, toasts ---------- */
.foot { margin: 48px 0 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot p { margin: 6px 0; }
.text-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--text); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.text-btn.danger:hover { color: #ff6b81; }

.toast-box { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: #231f2e; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 14px; animation: up .3s ease; }
.toast .gdot { width: 12px; height: 12px; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 560px) {
  .head h1 { font-size: 22px; }
  .filter { width: 100%; }
  .filter button { flex: 1; }
  .row-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .panel { border-left: 0; }
  .panel-body { padding: 18px 16px 40px; }
  .info { grid-template-columns: 1fr; }
  .consent { flex-direction: column; align-items: stretch; }
  .consent-btns > * { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
