:root {
  --bg: #0b1020; --panel: #121a2e; --panel2: #18223a; --line: #243150; --text: #eef3ff; --muted: #8f9bb8;
  --accent: #03f0fc; --gold: #ffd54a; --pink: #ff4fd8; --good: #5fe08a; --bad: #ff5d6c; --tera: #ff7a1a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: "gg sans", "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
#app { height: 100%; display: flex; flex-direction: column; }

/* boot */
.boot { margin: auto; text-align: center; padding: 24px; }
.ball { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; position: relative; animation: wob 1.2s ease-in-out infinite;
  background: linear-gradient(#ff4a4a 0 46%, #10131d 46% 54%, #f4f6fb 54%); box-shadow: 0 6px 24px rgba(3,240,252,.15); }
.ball::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%,-50%); border-radius: 50%; background: #f4f6fb; border: 4px solid #10131d; }
@keyframes wob { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.boot-logo { font-weight: 800; font-size: 30px; letter-spacing: .5px; color: var(--accent); }
.boot-msg { color: var(--muted); margin-top: 10px; max-width: 420px; line-height: 1.5; margin-left: auto; margin-right: auto; }
.boot.err .ball { animation: none; filter: grayscale(.6); }
.boot.err .boot-msg { color: var(--text); }

/* top bar */
.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: linear-gradient(#111a30, #0d1426); border-bottom: 1px solid var(--line); flex: none; }
.av { width: 44px; height: 44px; border-radius: 50%; background: var(--panel2) center/cover; border: 2px solid var(--accent); flex: none; }
.who { min-width: 0; } .who b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { color: var(--muted); font-size: 13px; }
.bal { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--panel2); font-weight: 700; font-size: 14px; white-space: nowrap; }
.chip small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.tabs { display: flex; gap: 6px; padding: 8px 16px 0; background: #0d1426; flex: none; }
.tab { padding: 10px 16px; border-radius: 12px 12px 0 0; font-weight: 700; color: var(--muted); }
.tab.on { background: var(--bg); color: var(--text); box-shadow: inset 0 3px 0 var(--accent); }

/* main area */
.main { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.stat b { font-size: 21px; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.search { flex: 1 1 220px; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; outline: none; }
.search:focus { border-color: var(--accent); }
.sel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.f { padding: 7px 13px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; }
.f.on { background: rgba(3,240,252,.12); border-color: var(--accent); color: var(--text); }
.count { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.mon { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 10px; text-align: center; transition: transform .12s, border-color .12s; }
.mon:hover { transform: translateY(-2px); border-color: #3a4c78; }
.mon.shiny { border-color: rgba(255,213,74,.6); background: linear-gradient(160deg, rgba(255,213,74,.12), var(--panel) 55%); }
.mon.tera { border-color: rgba(255,122,26,.7); }
.mon .pic { height: 96px; display: grid; place-items: center; }
.mon img { max-width: 96px; max-height: 96px; image-rendering: pixelated; }
.mon .nm { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mon .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.mon .num { position: absolute; left: 8px; top: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.mon .tags { position: absolute; right: 7px; top: 6px; display: flex; gap: 3px; }
.tag { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: var(--panel2); }
.tag.s { background: var(--gold); color: #2a2000; } .tag.t { background: var(--tera); color: #1d0b00; } .tag.e { background: var(--pink); color: #2a0022; }
.tag.l { background: var(--good); color: #032010; } .tag.fav { background: none; color: var(--pink); font-size: 13px; padding: 0 2px; }
.ivbar { height: 5px; border-radius: 5px; background: var(--panel2); margin: 7px 6px 0; overflow: hidden; }
.ivbar i { display: block; height: 100%; border-radius: 5px; }
.more { display: block; margin: 16px auto 0; padding: 11px 22px; border-radius: 12px; background: var(--panel2); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; line-height: 1.6; }

/* dex */
.dex .mon .pic { height: 84px; } .dex .mon img { max-width: 84px; max-height: 84px; }
.types { display: flex; gap: 4px; justify-content: center; margin-top: 5px; flex-wrap: wrap; }
.type { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.35); }

/* welcome (no account yet) */
.hero { max-width: 640px; margin: 10px auto; text-align: center; background: radial-gradient(circle at 50% 0%, rgba(3,240,252,.18), transparent 60%), var(--panel);
  border: 1px solid var(--line); border-radius: 20px; padding: 26px 22px; }
.hero h1 { margin: 6px 0 6px; font-size: 26px; } .hero p { color: var(--muted); line-height: 1.6; margin: 6px 0; }
.steps { text-align: left; display: grid; gap: 8px; margin: 18px 0; }
.step { background: var(--panel2); border-radius: 12px; padding: 10px 14px; } .step b { color: var(--accent); margin-right: 6px; }
code { background: #0a0f1d; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 13px; }
.btn { display: inline-block; padding: 11px 18px; border-radius: 12px; font-weight: 800; background: var(--accent); color: #002a2c; margin: 4px; }
.btn.ghost { background: var(--panel2); color: var(--text); }
.showcase { display: flex; justify-content: center; gap: 4px; margin: 6px 0 2px; }
.showcase img { width: 72px; height: 72px; image-rendering: pixelated; object-fit: contain; }

/* detail sheet */
.sheet { position: fixed; inset: 0; background: rgba(4,7,15,.72); display: flex; align-items: flex-end; justify-content: center; z-index: 10; backdrop-filter: blur(3px); }
.sheet[hidden] { display: none; }
.card { width: min(720px, 100%); max-height: 92vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 0 0 22px; animation: up .22s ease; }
@media (min-height: 700px) and (min-width: 760px) { .sheet { align-items: center; } .card { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.head { position: relative; padding: 18px 20px 10px; display: flex; gap: 16px; align-items: center; border-radius: 22px 22px 0 0; }
.head .big { width: 150px; height: 150px; flex: none; display: grid; place-items: center; border-radius: 20px; background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%); }
.head .big img { max-width: 140px; max-height: 140px; image-rendering: pixelated; }
.head h2 { margin: 0; font-size: 25px; } .head .meta { color: var(--muted); margin-top: 4px; font-size: 14px; }
.close { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.35); font-size: 18px; font-weight: 700; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badges .tag { font-size: 11px; padding: 3px 9px; }
.sec { padding: 6px 20px; }
.sec h3 { margin: 14px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.fact { background: var(--panel2); border-radius: 12px; padding: 9px 12px; } .fact small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; } .fact b { font-size: 15px; }
.rows { display: grid; gap: 7px; }
.row { display: grid; grid-template-columns: 62px 1fr 42px; gap: 10px; align-items: center; font-size: 14px; }
.row span { color: var(--muted); font-weight: 700; } .row em { font-style: normal; text-align: right; font-weight: 700; }
.track { height: 10px; border-radius: 10px; background: var(--panel2); overflow: hidden; } .track i { display: block; height: 100%; border-radius: 10px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; } .hint code { color: var(--text); }
.busy { color: var(--gold); font-weight: 700; font-size: 13px; }

@media (max-width: 560px) {
  .bal .chip:nth-child(n+3) { display: none; }
  .head { flex-direction: column; text-align: center; } .badges { justify-content: center; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .mon .pic { height: 78px; } .mon img { max-width: 78px; max-height: 78px; }
}
