:root {
  --bg: #0e1322;
  --bg-2: #151c31;
  --panel: #1a2340;
  --line: #2a3557;
  --text: #e9edf7;
  --muted: #94a0bf;
  --accent: #f5b82e;
  --accent-ink: #1b1400;
  --pos: #3ecf8e;
  --neg: #ff6b6b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: radial-gradient(1200px 600px at 80% -10%, #22305a 0%, var(--bg) 60%) fixed, var(--bg); color: var(--text); font: 16px/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--bg-2); padding: 2px 6px; border-radius: 6px; }
code.wrap { word-break: break-all; display: block; margin-top: 4px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; margin: .2em 0 .4em; }
h2 { font-size: 1.3rem; margin: 1.6em 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.accent { color: var(--accent); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: rgba(14, 19, 34, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: .2px; }
.brand-sub { color: var(--accent); font-weight: 700; }
.brand-mark { width: 22px; height: 28px; border-radius: 4px; background: var(--accent); box-shadow: inset 0 0 0 4px var(--accent), inset 0 0 0 9px var(--bg); transform: rotate(-8deg); }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a, .linkish { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font: inherit; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav a.active, .linkish:hover { color: var(--text); background: var(--bg-2); }
.nav a.balance { color: var(--accent-ink); background: var(--accent); font-weight: 700; }
.nav a.btn { color: var(--accent-ink); background: var(--accent); }
.nav a.btn:hover { color: var(--accent-ink); background: var(--accent); filter: brightness(1.08); }

.view { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; outline: none; }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; text-align: center; padding: 18px 16px; }
.footer p { margin: 4px 0; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 10px; border: 0; cursor: pointer; text-decoration: none; transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.big { padding: 14px 28px; font-size: 1.1rem; }
input { font: inherit; color: var(--text); background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus { outline: none; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.stack label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row input { flex: 1; min-width: 140px; }
.grow { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.auth { max-width: 420px; margin: 24px auto; background: var(--panel); padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow); }

/* hero & packs */
.hero { padding: 24px 0 8px; max-width: 760px; }
.hero p { color: var(--muted); font-size: 1.1rem; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.pack { background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; border: 1px solid var(--line); transition: transform .15s; }
.pack:hover { transform: translateY(-3px); }
.pack-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pack-body p { margin: 0; color: var(--muted); }
.chase { font-size: .9rem; }
.chase strong { color: var(--text); }
.pack-foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-weight: 800; font-size: 1.3rem; }
.price.big { font-size: 2rem; margin: .2em 0; }
.pack-art { position: relative; aspect-ratio: 16 / 9; display: flex; align-items: flex-end; padding: 16px; background: linear-gradient(135deg, #3a4a86, #1d2650); overflow: hidden; }
.pack-art::before { content: ""; position: absolute; inset: -40%; background: repeating-linear-gradient(115deg, rgba(255,255,255,.07) 0 14px, transparent 14px 40px); }
.pack-art.big { aspect-ratio: 3 / 4; border-radius: var(--radius); box-shadow: var(--shadow); }
.pack-title { position: relative; font-weight: 900; font-size: 1.6rem; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.pack-art.big .pack-title { font-size: 2rem; }
.pack-count { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.45); padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pack-shed-starter { background: linear-gradient(135deg, #2e8b57, #134a2e); }
.pack-modern-hits { background: linear-gradient(135deg, #7b3fe4, #2e1666); }
.pack-graded-vault { background: linear-gradient(135deg, #d39b1f, #5c3b05); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 40px; }
.how > div { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.how h3 { margin: 0 0 4px; }
.how p { margin: 0; color: var(--muted); }

.back { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.pack-detail { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 28px; align-items: start; }
.open-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
@media (max-width: 640px) { .pack-detail { grid-template-columns: 1fr; } .pack-art.big { aspect-ratio: 16 / 9; } }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: .78rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--r1, #8892a8); }

/* rarity palette (sets --r1/--r2 for card frames and odds dots) */
.rarity-common { --r1: #8f9bb3; --r2: #4c566e; }
.rarity-uncommon { --r1: #5fc6a8; --r2: #1f6150; }
.rarity-rare, .rarity-holo { --r1: #5aa9ff; --r2: #1d4a85; }
.rarity-rare-holo { --r1: #8ab8ff; --r2: #3550a8; }
.rarity-double-rare { --r1: #c07bff; --r2: #4c2190; }
.rarity-ultra-rare { --r1: #ff8bd0; --r2: #8a1f5d; }
.rarity-secret-rare { --r1: #ffd56b; --r2: #8a5a00; }
.rarity-special-illustration-rare { --r1: #ff9a4d; --r2: #7a1f6b; }

/* TCG card face */
.tcg { color: var(--text); text-align: left; width: 100%; aspect-ratio: 63 / 88; border-radius: 12px; padding: 6px; background: linear-gradient(145deg, var(--r1, #8f9bb3), var(--r2, #4c566e)); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.tcg-inner { height: 100%; border-radius: 8px; background: linear-gradient(180deg, #1c2440, #10162a); display: flex; flex-direction: column; padding: 8px 10px; gap: 4px; overflow: hidden; }
.tcg-top { display: flex; justify-content: space-between; gap: 4px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--r1); }
.tcg-grade { background: #fff; color: #b30000; border-radius: 4px; padding: 0 5px; }
.tcg-art { flex: 1; border-radius: 6px; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, var(--r1), var(--r2) 70%); position: relative; overflow: hidden; min-height: 60px; }
.tcg-art span { font-size: 3rem; font-weight: 900; color: rgba(255,255,255,.85); text-shadow: 0 4px 14px rgba(0,0,0,.4); }
.rarity-special-illustration-rare .tcg-art::after, .rarity-secret-rare .tcg-art::after, .rarity-ultra-rare .tcg-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 45%, transparent 60%); background-size: 250% 100%; animation: shine 3s linear infinite; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.tcg-name { font-weight: 800; font-size: .95rem; line-height: 1.2; }
.tcg-set { font-size: .72rem; color: var(--muted); }
.tcg-value { font-weight: 800; color: var(--accent); }

/* reveal */
.reveal { margin: 28px 0; padding: 20px; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); }
.reveal h2 { margin-top: 0; }
.reveal-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.flip { width: min(200px, 42vw); aspect-ratio: 63 / 88; perspective: 1000px; background: none; border: 0; padding: 0; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-back, .flip-front { position: absolute; inset: 0; backface-visibility: hidden; }
.flip-back { border-radius: 12px; background: repeating-linear-gradient(45deg, #24305a 0 10px, #1c2649 10px 20px); border: 4px solid var(--accent); display: grid; place-items: center; box-shadow: var(--shadow); animation: bob 1.6s ease-in-out infinite; }
.flip-back span { font-weight: 900; font-size: 2rem; color: var(--accent); }
.flip-front { transform: rotateY(180deg); }
.flip:not(.flipped):hover .flip-back { filter: brightness(1.2); }
@keyframes bob { 50% { transform: translateY(-4px); } }
.reveal-foot { margin-top: 12px; }

/* collection */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; top: 62px; z-index: 5; background: var(--bg-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius); margin: 12px 0 18px; }
.spacer { flex: 1; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card-grid.dim { opacity: .7; }
.collect { position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer; border-radius: 14px; padding: 4px; transition: box-shadow .15s, transform .15s; }
.collect input { position: absolute; bottom: 40px; right: 16px; z-index: 2; width: 20px; height: 20px; }
.collect.picked { box-shadow: 0 0 0 3px var(--accent); transform: translateY(-2px); }
.buyback { font-size: .82rem; color: var(--muted); text-align: center; }

/* wallet */
.wallet-top { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 20px; }
.balance-big { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; justify-content: center; }
.balance-big strong { font-size: 2.4rem; }
.topup { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.topup h2 { margin-top: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
@media (max-width: 640px) { .wallet-top { grid-template-columns: 1fr; } }

.seed-box { display: grid; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

.notice { padding: 12px 16px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 16px; }
.notice.ok { border-color: var(--pos); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); background: var(--bg-2); border: 1px dashed var(--line); border-radius: var(--radius); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin-top: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--pos); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); transition: all .25s; max-width: calc(100vw - 32px); z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-left-color: var(--neg); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 640px) { .opt { display: none; } th, td { padding: 10px; } }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 760px; }
.steps { display: grid; gap: 12px; padding: 0; margin: 16px 0 20px; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 56px; color: var(--muted); }
.steps li strong { display: block; color: var(--text); margin-bottom: 2px; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; }
.tech { margin-bottom: 20px; color: var(--muted); }
.tech summary { cursor: pointer; color: var(--text); font-weight: 600; }

/* sell to us */
textarea, select { font: inherit; color: var(--text); background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
.steps.compact { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.sell-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.line, .lines-head { display: grid; grid-template-columns: 2fr 1.5fr 1.3fr 80px 40px; gap: 8px; align-items: center; }
#lines { display: grid; gap: 8px; }
.line .rm { padding: 6px 0; }
.payout { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.payout legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.payout label { display: flex; align-items: center; gap: 10px; font-weight: 400; flex-direction: row; }
.subs { display: grid; gap: 12px; }
.sub { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.sub p { margin: 6px 0; }
.sub-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.badge { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.status-offer_made { border-left-color: var(--accent); }
.status-offer_made .badge { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.status-accepted, .status-completed { border-left-color: var(--pos); }
.status-rejected, .status-cancelled, .status-declined { opacity: .75; }
.offer strong { color: var(--accent); font-size: 1.15rem; }
@media (max-width: 640px) {
  .lines-head { display: none; }
  .line { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .line input[name=name] { grid-column: 1 / -1; }
}

/* card images */
.tcg-art img { width: 100%; height: 100%; object-fit: contain; position: relative; z-index: 1; }
.tcg.has-img .tcg-art { background: #0b1020; }

/* ---------- admin portal ---------- */
.view.wide { max-width: 1320px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin-bottom: .3em; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel.inner { background: var(--bg-2); }
.panel h3 { margin-top: 0; }
fieldset.panel legend { font-weight: 700; padding: 0 6px; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile strong { font-size: 1.5rem; }
.big-num { font-size: 2.2rem; font-weight: 800; margin-bottom: 12px; }
.thumb { width: 36px; height: 50px; object-fit: contain; border-radius: 4px; display: inline-grid; place-items: center; background: linear-gradient(145deg, var(--r1, #8f9bb3), var(--r2, #4c566e)); font-weight: 800; color: #fff; }
img.thumb { background: #0b1020; }
.filter { margin-bottom: 12px; max-width: 420px; }
.tag.warn, .warn { color: #ffb347; border-color: #ffb347; }
.notice.err { border-color: var(--neg); }
.btn.danger { color: var(--neg); box-shadow: inset 0 0 0 1.5px var(--neg); background: transparent; }
label.btn.file { cursor: pointer; }
.preview { position: sticky; top: 80px; max-width: 240px; justify-self: center; width: 100%; }
.center { text-align: center; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.img-pick { display: flex; flex-direction: column; gap: 6px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: var(--text); font: inherit; cursor: pointer; }
.img-pick:hover { border-color: var(--accent); }
.img-pick img { width: 100%; border-radius: 6px; }
.odds-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .odds-layout { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 80px; }
#odds-t input.w { width: 110px; text-align: right; padding: 6px 8px; }
#odds-t tr.off { opacity: .5; }
.econ-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; }
.tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .9rem; }
.tabs a.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.thread { display: grid; gap: 10px; margin-bottom: 12px; }
.msg { padding: 10px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); max-width: 85%; }
.msg p { margin: 4px 0 0; }
.msg.staff { justify-self: end; border-color: var(--accent); }
.pre { white-space: pre-wrap; word-break: break-word; }
.split > div > * + * { margin-top: 16px; }
