:root {
  --bg: #111214;
  --bg2: #17181b;
  --card: #1c1d21;
  --card2: #232429;
  --line: #2c2d33;
  --line2: #393a42;
  --text: #f2f2f4;
  --muted: #9a9ba4;
  --faint: #6b6c75;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, .1);
  --yellow: #eab308;
  --red: #ef4444;
  --coin: #f5b93b;
  --token: #9b8cff;
  --blue: #7fb4ff;
  --pink: #ff8ad8;
  --radius: 14px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.coin::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -1px; border-radius: 50%; border: 2px solid var(--coin); }
.tok::before { content: ''; display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; transform: rotate(45deg); border-radius: 2px; background: var(--token); box-shadow: 0 0 0 2px rgba(155, 140, 255, .25); }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(17, 18, 20, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.brand b { color: var(--green); font-weight: 800; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #22c55e, #0ea5e9); color: #06120b; display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.logo.big { width: 54px; height: 54px; font-size: 20px; border-radius: 14px; margin: 0 auto 10px; }
.top-nav { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.top-nav a:hover, .top-nav a.on { color: var(--text); }
.top-user { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link:hover { color: var(--text); }

main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }
.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 18px 16px 26px; border-top: 1px solid var(--line); }

/* ---------- buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line2); background: var(--card2); color: var(--text); border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: #2b2c32; border-color: #4a4b55; }
.btn.primary { background: var(--green); border-color: var(--green); color: #052e12; }
.btn.primary:hover { background: #2fd96a; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); }
.input, .select { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; font-size: 13px; color: var(--text); min-width: 0; width: 100%; }
.input:focus, .select:focus { outline: none; border-color: #4a4b55; }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; padding: 60px 0; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; text-align: center; }
.login-card h1 { margin: 0 0 2px; font-size: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; text-align: left; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.login-card input { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.error { color: var(--red); font-size: 12.5px; min-height: 1em; margin: 0; }

/* ---------- page head ---------- */
.page-head h1 { margin: 0; font-size: 21px; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 760px; }

/* steps: import club → sync collection → build solutions */
.steps { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: stretch; margin: 16px 0 14px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; display: flex; flex-direction: column; gap: 6px; }
.step h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.step p { margin: 0; color: var(--muted); font-size: 12.5px; }
.step .row { display: flex; align-items: center; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.step small { color: var(--faint); font-size: 11.5px; }
.step .tag { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); border: 1px solid var(--line2); border-radius: 6px; padding: 1px 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 9px; padding: 6px 11px; border: 1px solid var(--line2); background: var(--bg2); }
.chip.ok { color: var(--green); border-color: rgba(34, 197, 94, .45); background: var(--green-bg); }
.chip.wait { color: var(--yellow); border-color: rgba(234, 179, 8, .4); background: rgba(234, 179, 8, .08); }
.arrow { align-self: center; color: var(--faint); font-size: 18px; }

/* planner */
.planner { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px 15px; }
.planner-head { display: flex; align-items: flex-start; gap: 12px; }
.planner-head h2 { margin: 0; font-size: 15px; }
.planner-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.planner-head .toggle { margin-left: auto; }
.limits { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.plan-title { margin: 14px 0 7px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tile { background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 11px; }
.tile span { display: block; font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.tile b { font-size: 17px; font-weight: 800; }
.v-good { color: var(--green); }
.v-ok { color: var(--yellow); }
.v-bad { color: var(--red); }
.v-none { color: var(--muted); }
.planner-foot { margin-top: 10px; display: flex; gap: 12px; align-items: center; }

/* toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; margin: 20px 0 12px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 220px; max-width: 280px; }
.toolbar .select { width: auto; }
.toolbar .grow { flex: 1; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.section-title h2 { margin: 0; font-size: 15px; letter-spacing: .3px; text-transform: uppercase; }
.section-title .link { margin-left: auto; font-size: 12px; }

/* ---------- set cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.set { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 13px 10px; display: flex; flex-direction: column; gap: 10px; }
.set:hover { border-color: var(--line2); }
.set-head { display: flex; gap: 10px; align-items: flex-start; }
.badge { width: 38px; height: 38px; object-fit: contain; flex: none; }
.badge-ph { width: 38px; height: 38px; border-radius: 10px; background: var(--card2); display: grid; place-items: center; font-weight: 800; color: var(--muted); flex: none; }
.set-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.set-sub { color: var(--muted); font-size: 12px; }
.done-mark { margin-left: auto; width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line2); background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--faint); font-size: 12px; flex: none; }
.done-mark.on { background: var(--green); border-color: var(--green); color: #052e12; }
.grade-row { display: flex; align-items: center; gap: 10px; }
.grades { display: flex; gap: 3px; }
.gd { width: 22px; height: 22px; position: relative; display: grid; place-items: center; font-size: 9.5px; font-weight: 800; color: var(--faint); cursor: default; }
.gd::before { content: ''; position: absolute; inset: 3px; transform: rotate(45deg); border: 1.5px solid #4a4b55; border-radius: 3px; background: var(--bg2); }
.gd span { position: relative; }
.gd.g-D::before { border-color: #b98a5c; } .gd.g-C::before { border-color: #9aa3ad; } .gd.g-B::before { border-color: #e2b64a; }
.gd.g-A::before { border-color: #3ccf8e; } .gd.g-S::before { border-color: #9b8cff; }
.gd.reached span { color: var(--text); }
.gd.reached::before { background: #2a2b31; }
.gd.got::before { background: var(--green); border-color: var(--green); }
.gd.got span { color: #052e12; }
.gd.plan::after { content: ''; position: absolute; bottom: -6px; left: 50%; margin-left: -4px; border: 4px solid transparent; border-bottom-color: var(--text); border-top: 0; }
.gd.no { opacity: .35; }
.grades.big .gd { width: 30px; height: 30px; font-size: 11px; cursor: pointer; }
.tokens { margin-left: auto; font-weight: 800; font-size: 16px; display: flex; align-items: center; }
.tokens small { color: var(--faint); font-weight: 600; font-size: 12px; margin-left: 4px; }
.coll-label { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); }
.coll-label b { color: var(--text); letter-spacing: 0; font-size: 12px; }
.bar { height: 5px; border-radius: 4px; background: #2c2d33; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: #7a7b85; border-radius: 4px; }
.bar.full i { background: var(--green); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 4px; text-align: center; }
.stat b { display: block; font-size: 13px; font-weight: 800; }
.stat span { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); }
.all-done { grid-column: span 2; display: flex; gap: 8px; align-items: center; color: var(--green); background: var(--green-bg); border: 1px solid rgba(34, 197, 94, .45); border-radius: 10px; padding: 6px 9px; font-size: 11.5px; font-weight: 600; text-align: left; }
.set-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }
.set-foot .link { font-size: 11px; color: var(--muted); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); grid-column: 1 / -1; }

/* ---------- set page ---------- */
.back { display: inline-flex; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.back:hover { color: var(--text); }
.set-hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.set-hero .set-head .badge, .set-hero .set-head .badge-ph { width: 46px; height: 46px; }
.set-hero h1 { margin: 0; font-size: 19px; }
.hero-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-row .tokens { margin-left: 0; }
.hero-row .stat { min-width: 92px; padding: 6px 12px; }
.score-line { font-size: 12px; color: var(--muted); }
.score-line b { color: var(--text); }
.howto { border-top: 1px solid var(--line); padding-top: 10px; }
.howto summary { cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); list-style: none; }
.howto summary::after { content: ' ›'; }
.howto ol { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.howto b { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tagpill { font-size: 11px; border-radius: 999px; padding: 3px 9px; border: 1px solid var(--line2); color: var(--muted); }
.tagpill.on { color: var(--green); border-color: rgba(34, 197, 94, .5); background: var(--green-bg); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.pc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 7px; position: relative; }
.pc.collected { border-color: rgba(34, 197, 94, .55); background: linear-gradient(180deg, rgba(34, 197, 94, .12), var(--card) 60%); }
.pc-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.pc-top .pts { color: var(--token); font-weight: 700; }
.pc-top .price { color: var(--coin); font-weight: 700; }
.pc-card { border-radius: 9px; height: 132px; position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.pc-card.q-gold { background: linear-gradient(160deg, #f6dc8a, #c99a2e 70%, #8f6a17); }
.pc-card.q-silver { background: linear-gradient(160deg, #eef1f4, #a9b1bb 70%, #6f7781); }
.pc-card.q-bronze { background: linear-gradient(160deg, #f0b98c, #b26c3a 70%, #7a4520); }
.pc-card.holo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, .45) 40%, rgba(160, 120, 255, .35) 55%, transparent 75%); mix-blend-mode: screen; }
.pc-card img { width: 100px; height: 100px; object-fit: contain; position: relative; z-index: 1; }
.pc-card .ovr { position: absolute; top: 6px; left: 8px; color: #1b1406; font-weight: 900; font-size: 19px; line-height: 1; z-index: 2; text-align: center; }
.pc-card .ovr small { display: block; font-size: 10px; font-weight: 800; }
.pc-card .club { position: absolute; top: 7px; right: 7px; width: 20px; height: 20px; z-index: 2; }
.pc-name { font-weight: 700; font-size: 12.5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-who { font-size: 10.5px; text-align: center; color: var(--muted); margin-top: -6px; }
.pc-who .w { color: var(--pink); font-weight: 700; }
.pc-who .m { color: var(--blue); font-weight: 700; }
.pc-flags { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.flag { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; font-size: 9.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); padding: 5px 2px; cursor: pointer; text-align: center; }
.flag.on { color: var(--green); border-color: rgba(34, 197, 94, .5); background: var(--green-bg); }
.copy { position: absolute; top: 6px; left: 6px; z-index: 3; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line2); background: rgba(17, 18, 20, .85); display: grid; place-items: center; cursor: pointer; font-size: 11px; color: var(--muted); }
.pc .copy { top: auto; bottom: auto; }
.sub-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 0; }
.sub-head h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; }
.sub-head .muted { font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #26272d; border: 1px solid var(--line2); color: var(--text); padding: 10px 16px; border-radius: 11px; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; z-index: 50; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr; }
  .arrow { display: none; }
  .limits { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .planner-head { flex-wrap: wrap; }
  .planner-head .toggle { margin-left: 0; }
  .top-nav { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .toolbar .search { max-width: none; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
