:root {
  --bg: #12151d; --panel: #1b2030; --panel2: #232a3d; --line: #2e3650; --text: #eef1f7; --dim: #9aa3b5; --acc: #ffcb05; --acctext: #ffcb05; --accfg: #1a1a1a;
  --good: #4fd88a; --bad: #ff7a7a; --want: #ff8c8c; --spare: #5be0a0; --warn: #f5b942; --radius: 14px; --tab: 62px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f4f5f9; --panel: #ffffff; --panel2: #eceff6; --line: #d6dbe8; --text: #161a26; --dim: #5d667b; --accfg: #1a1a1a;
    --good: #138a4b; --bad: #c43a3a; --want: #c43a3a; --spare: #138a4b; --warn: #a76b00; --acctext: #8a5600; color-scheme: light; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
body.noscroll { overflow: hidden; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; }
p { margin: 0 0 .8em; }
img { max-width: 100%; }
.dim { color: var(--dim); } .tiny { font-size: .82rem; } .center { text-align: center; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.good { color: var(--good); } .bad { color: var(--bad); } .error { color: var(--bad); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
[hidden] { display: none !important; }

/* frame */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; padding: calc(env(safe-area-inset-top) + .5rem) 1rem .5rem; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: .02em; }
.brand span { color: var(--acc); }
.grow { flex: 1; }
.iconbtn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.offline { background: var(--warn); color: #1a1a1a; border-radius: 99px; padding: .1rem .6rem; font-size: .8rem; font-weight: 700; }
.page { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem calc(env(safe-area-inset-bottom) + 2rem); }
.page.withnav { padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 2rem); }
.tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; min-height: var(--tab); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; font-size: .78rem; color: var(--dim); }
.tabs a span { font-size: 1.3rem; }
.tabs a.on { color: var(--acctext); font-weight: 700; }
.narrow { max-width: 460px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 1.5rem) 1.2rem 3rem; }
.card-pane .brand { display: inline-block; margin-bottom: 1rem; }
.splash { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: .5rem; padding: 1rem; }
.logo { width: 76px; height: 76px; border-radius: 22px; background: var(--acc); color: var(--accfg); display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; margin: 0 auto 1rem; }
.ph { margin-top: .2rem; }
.back { display: inline-block; margin-bottom: .5rem; text-decoration: none; color: var(--dim); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--dim); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--acc); color: var(--accfg); border-color: var(--acc); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { min-height: 38px; padding: .3rem .8rem; font-size: .92rem; }
.btn.big { min-height: 52px; font-size: 1.05rem; }
.btn.full { width: 100%; margin: .3rem 0; }
.btn.oauth.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.oauth.google { background: #fff; color: #222; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; } .row.center { justify-content: center; } .row.between { justify-content: space-between; flex-wrap: nowrap; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; min-height: 44px; width: 100%; }
input:focus-visible, select:focus-visible, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.field { display: block; margin-bottom: .9rem; font-weight: 600; }
.field input, .field select { margin-top: .3rem; font-weight: 400; }
.check { display: flex; gap: .6rem; align-items: center; margin: .8rem 0; }
.check input { width: 22px; min-height: 22px; }
.code { font: 700 1.6rem/1.3 ui-monospace, Menlo, monospace; letter-spacing: .08em; text-align: center; background: var(--panel); border: 2px dashed var(--acc); border-radius: var(--radius); padding: 1rem .5rem; margin: 1rem 0; user-select: all; }

/* hero / landing */
.hero { text-align: center; padding: 2rem 0 1rem; max-width: 560px; margin: 0 auto; }
.hero h1 { font-size: 2rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-top: 2rem; }
.features > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.features h3 { font-size: 1rem; }

/* panes */
.pane, .panel, .note, .cta, .sharebar, .matchbar, .empty { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.empty { text-align: center; color: var(--dim); }
.note { font-size: .92rem; color: var(--dim); }
.cta { border-color: var(--acc); }
.sharebar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sharebar .mono { font-size: .85rem; color: var(--dim); word-break: break-all; }
.plain { list-style: none; padding: 0; margin: 0 0 .8rem; } .plain li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
details.danger { margin-top: 1rem; } details.danger summary { cursor: pointer; color: var(--bad); font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* segmented tabs */
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: .9rem; }
.seg button { flex: 1; min-height: 46px; border: 0; border-radius: 11px; background: transparent; color: var(--dim); font: inherit; font-weight: 700; display: flex; gap: .5rem; align-items: center; justify-content: center; cursor: pointer; }
.seg button b { background: var(--panel2); color: var(--text); border-radius: 99px; padding: 0 .55rem; min-width: 1.7rem; font-size: .9rem; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 -3px 0 var(--acc); }
.seg button[data-kind="want"].on b { background: var(--want); color: #1a1a1a; } .seg button[data-kind="spare"].on b { background: var(--spare); color: #1a1a1a; }

/* quick add */
.quick { background: var(--panel); border: 2px solid var(--acc); border-radius: var(--radius); padding: .8rem; margin-bottom: 1rem; }
.qlabel { display: block; font-weight: 800; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--acctext); margin-bottom: .3rem; }
.qrow { display: flex; gap: .5rem; } .qrow input { font-size: 1.1rem; text-transform: uppercase; } .qrow input::placeholder { text-transform: none; }
.qrow .btn { width: 44px; padding: 0; }
.preview { display: flex; gap: .8rem; align-items: center; margin-top: .8rem; flex-wrap: wrap; }
.preview > img { border-radius: 6px; flex: none; } .preview .pv { flex: 1; min-width: 160px; }
.hint { margin: .6rem 0 0; font-size: .9rem; }
.results { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .3rem; }
.results button { width: 100%; display: flex; gap: .7rem; align-items: center; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: .4rem; color: inherit; font: inherit; cursor: pointer; min-height: 56px; }
.results img { border-radius: 4px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.chip { min-height: 40px; padding: .3rem .8rem; border-radius: 99px; border: 1.5px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; gap: .4rem; align-items: baseline; }
.chip small { color: var(--dim); font-weight: 500; }
.chip.sel { background: var(--acc); border-color: var(--acc); color: var(--accfg); } .chip.sel small { color: #4a4a4a; }
.chips.small .chip { min-height: 36px; font-size: .9rem; padding: .2rem .7rem; }
.onlyfin { color: var(--dim); font-size: .9rem; margin: .5rem 0; }

/* toolbar + groups */
.toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .8rem; }
.toolbar input { grid-column: 1 / -1; }
@media (min-width: 560px) { .toolbar { grid-template-columns: 1fr 190px 190px; } .toolbar input { grid-column: auto; } }
.sum { margin: 0 0 .8rem; color: var(--dim); }
.group { margin: 1.4rem 0 .6rem; color: var(--dim); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
.setlist { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.setlist a { display: flex; justify-content: space-between; gap: .6rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; text-decoration: none; min-height: 52px; flex-wrap: wrap; }

/* card tiles */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.tile.hit { border-color: var(--good); box-shadow: 0 0 0 1px var(--good); }
.tile.picked { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); }
.pic { position: relative; display: block; padding: .5rem .5rem 0; border: 0; background: none; cursor: pointer; width: 100%; }
.pic img { display: block; width: 100%; height: auto; aspect-ratio: 245 / 342; border-radius: 6px; background: var(--panel2); object-fit: cover; }
.qty { position: absolute; right: .9rem; top: .9rem; background: var(--acc); color: var(--accfg); font-weight: 800; border-radius: 99px; padding: 0 .5rem; font-size: .9rem; }
.marks { position: absolute; left: .9rem; bottom: .4rem; display: flex; gap: .25rem; }
.mk { font-size: .7rem; padding: 0 .4rem; border-radius: 99px; color: #1a1a1a; } .mk.want { background: var(--want); } .mk.spare { background: var(--spare); }
.meta { padding: .5rem .6rem .7rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.nm { font-weight: 700; font-size: .95rem; line-height: 1.2; } .sub { color: var(--dim); font-size: .82rem; } .fin { font-size: .82rem; color: var(--text); opacity: .9; }
.price { display: inline-block; margin-top: auto; padding-top: .2rem; font-weight: 700; color: var(--acctext); text-decoration: none; } .price i { font-style: normal; font-size: .8em; opacity: .7; } .price:hover { text-decoration: underline; } .price.none { color: var(--dim); font-weight: 400; }
.hitnote { color: var(--good); font-size: .82rem; font-weight: 700; } .warn { color: var(--warn); font-size: .8rem; font-weight: 600; }
.rstamp { display: inline-block; font-size: .65rem; font-weight: 800; padding: 0 .35rem; border-radius: 5px; vertical-align: middle; color: #fff; background: #6b7280; }
.rstamp.t1 { background: #3b8f5b; } .rstamp.t2 { background: #3b82c4; } .rstamp.t3 { background: #c58a10; } .rstamp.t4 { background: #d6477f; } .rstamp.t5 { background: #17a2b8; } .rstamp.t6 { background: #8b5cf6; } .rstamp.t7 { background: #64748b; }
.pick { display: flex; align-items: center; gap: .5rem; min-height: 40px; font-weight: 600; cursor: pointer; } .pick input { width: 22px; min-height: 22px; accent-color: var(--acc); }

/* profile */
.phead { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.phead > div:nth-child(2) { flex: 1; min-width: 180px; } .phead h1 { margin: 0; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--acc); color: var(--accfg); display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; }
.matchbar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; text-decoration: none; flex-wrap: wrap; } .matchbar.has { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--panel)); }

/* trade builder */
.tside { margin-bottom: 1.5rem; } .tsh { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.tradebar { position: sticky; bottom: calc(var(--tab) + env(safe-area-inset-bottom)); z-index: 15; background: var(--panel); border: 1px solid var(--acc); border-radius: var(--radius); padding: .7rem; box-shadow: 0 -8px 24px rgba(0,0,0,.35); margin-top: 1rem; }
.tb-cols { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: .5rem; text-align: center; align-items: center; margin-bottom: .5rem; }
.tb-cols small { display: block; color: var(--dim); } .tb-cols b { font-size: 1.3rem; }
.tb-mid { font-weight: 800; font-size: .9rem; border-radius: 10px; padding: .4rem .3rem; background: var(--panel2); } .tb-mid.even { background: var(--good); color: #0a2616; } .tb-mid.off { background: var(--warn); color: #231800; }
.stepper { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; } .stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 1.4rem; line-height: 1; display: grid; place-items: center; padding: 0; cursor: pointer; } .stepper output { min-width: 1.6rem; text-align: center; font-weight: 800; font-size: 1.2rem; } .stepper.small button { width: 36px; height: 36px; font-size: 1.2rem; } .stepper span { color: var(--dim); font-size: .85rem; }

/* sheet */
.sheetwrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; border: 1px solid var(--line); padding: .5rem 1rem calc(env(safe-area-inset-bottom) + 1rem); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
@media (min-width: 700px) { .sheetwrap { align-items: center; } .sheet { border-radius: 22px; } }
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: .3rem auto .8rem; }
.sh-top { display: flex; gap: 1rem; margin-bottom: 1rem; } .sh-top > img { width: 120px; height: auto; align-self: flex-start; border-radius: 8px; flex: none; }
.sh-top h2 { margin-bottom: .2rem; } .prices { display: flex; flex-direction: column; gap: .1rem; margin: .5rem 0; }
.panel { margin-bottom: .7rem; } .panel.on.want { border-color: var(--want); } .panel.on.spare { border-color: var(--spare); }
.switch { display: grid; grid-template-columns: auto 1fr; column-gap: .8rem; align-items: center; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { grid-row: span 2; width: 52px; height: 30px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--dim); transition: transform .15s, background .15s; }
.switch input:checked + .track { background: var(--acc); } .switch input:checked + .track::after { transform: translateX(22px); background: var(--accfg); }
.switch input:focus-visible + .track { outline: 3px solid var(--acc); outline-offset: 2px; }
.switch .hint { grid-column: 2; margin: 0; color: var(--dim); font-size: .85rem; }
.toast, #toast { position: fixed; left: 50%; bottom: calc(var(--tab) + 1.2rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* tutorial */
.tut { text-align: center; } .ticon { font-size: 3rem; } .tut .demo { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin: .8rem 0; } .tut .body > p, .tut .body > div { text-align: left; }
.tut h2 { text-align: center; } .dots { display: flex; gap: .4rem; justify-content: center; margin: 1rem 0; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); } .dots i.on { background: var(--acc); }
.helpstep { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.helpstep .demo { background: var(--panel2); border-radius: 10px; padding: .6rem; margin: .5rem 0; }
