:root {
  --bg: #0b0b10;
  --bg-2: #12121a;
  --surface: #171722;
  --surface-2: #1f1f2d;
  --line: #2a2a3a;
  --text: #f2f2f7;
  --muted: #9a9ab0;
  --faint: #6b6b80;
  --accent: #ff3b5c;
  --accent-2: #8b5cf6;
  --good: #34d399;
  --warn: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(900px 400px at 110% 0%, rgba(255, 59, 92, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: "Space Grotesk", Inter, sans-serif; letter-spacing: -0.01em; margin: 0; }

.boot { display: grid; place-items: center; min-height: 100dvh; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(11, 11, 16, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Space Grotesk"; font-weight: 700; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; font-size: 15px; box-shadow: 0 4px 18px rgba(255, 59, 92, 0.35);
}
.brand small { display: block; font: 500 11px Inter; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.topbar .spacer { flex: 1; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; transition: 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); font-weight: 600; transition: 0.15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--grad); border: 0; box-shadow: 0 6px 24px rgba(255, 59, 92, 0.3); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8095; }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0 14px; }
.stat {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.stat .label { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font: 700 22px "Space Grotesk"; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat .value { font-size: 19px; }
}

/* ---------- tcg tabs ---------- */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none;
  margin: 0 -16px; padding-left: 16px; padding-right: 16px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-weight: 600; font-size: 14px; transition: 0.15s;
}
.tab .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); box-shadow: 0 0 10px var(--c); }
.tab .count { font-size: 12px; color: var(--faint); font-weight: 600; }
.tab.active { color: var(--text); border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface)); }
.tab.active .count { color: var(--text); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search {
  flex: 1 1 240px; position: relative;
}
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 42px; }
.input, .select, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; min-height: 70px; padding: 10px 14px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239a9ab0' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.toolbar .select { width: auto; flex: 0 1 auto; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg button { width: 42px; height: 42px; border: 0; background: transparent; color: var(--faint); display: grid; place-items: center; }
.seg button.on { color: var(--text); background: var(--surface-2); }
.seg svg { width: 18px; height: 18px; }
@media (max-width: 720px) {
  .toolbar .search { flex-basis: 100%; }
  .toolbar .select { flex: 1; }
}

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding-bottom: 140px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  display: flex; flex-direction: column; text-align: left; padding: 0;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 60%, var(--line)); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4); }
.card .img {
  aspect-ratio: 1; background: radial-gradient(circle at 50% 40%, #262636, #14141d 75%); display: grid; place-items: center; padding: 14px;
}
.card .img img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5)); }
.card .qty {
  position: absolute; top: 10px; right: 10px; min-width: 34px; height: 28px; padding: 0 9px; border-radius: 999px;
  background: rgba(11, 11, 16, 0.85); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(6px);
  font: 700 13px "Space Grotesk"; display: grid; place-items: center;
}
.card .tcg-pill {
  position: absolute; top: 10px; left: 10px; font: 700 10px Inter; letter-spacing: 0.06em; padding: 4px 7px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 25%, rgba(11, 11, 16, 0.85)); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.card .body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card .name { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .set { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .money { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 8px; font-size: 13px; }
.card .money b { font-family: "Space Grotesk"; font-size: 15px; }
.card .money span { color: var(--muted); }
@media (max-width: 520px) {
  .card .money { flex-direction: column-reverse; align-items: flex-start; gap: 1px; }
  .card .money span { font-size: 12px; }
}

/* list view */
.list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 140px; }
.row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px 10px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: left; transition: 0.15s;
  border-left: 3px solid var(--c);
}
.row:hover { background: var(--surface-2); }
.row .thumb { width: 64px; height: 64px; border-radius: 10px; background: #1b1b27; display: grid; place-items: center; padding: 5px; }
.row .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.row .name { font-weight: 600; font-size: 14px; }
.row .set { color: var(--muted); font-size: 12px; }
.row .right { text-align: right; font-size: 13px; color: var(--muted); }
.row .right b { display: block; color: var(--text); font: 700 16px "Space Grotesk"; }

.empty { text-align: center; padding: 70px 20px 160px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 8px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* ---------- floating action ---------- */
.fab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; pointer-events: none;
  display: flex; justify-content: center; gap: 10px; padding: 16px 16px calc(18px + var(--safe-b));
  background: linear-gradient(transparent, rgba(11, 11, 16, 0.9) 45%);
}
.fab-bar .btn { pointer-events: auto; height: 56px; border-radius: 18px; font-size: 16px; box-shadow: var(--shadow); }
.fab-bar .btn.primary { padding: 0 28px; }
.fab-bar .btn:not(.primary) { width: 56px; padding: 0; background: var(--surface-2); }
.fab-bar svg { width: 22px; height: 22px; }

/* ---------- sheet / modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 640px; max-height: 94dvh; overflow: auto; background: var(--bg-2);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  animation: up 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1); padding-bottom: var(--safe-b);
}
@keyframes up { from { transform: translateY(40px); opacity: 0.4; } }
@media (min-width: 760px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--line); }
}
.sheet-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: rgba(18, 18, 26, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 18px; flex: 1; }
.sheet-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.grabber { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; }
@media (min-width: 760px) { .grabber { display: none; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint { font-size: 12px; color: var(--faint); }
.error-msg { color: #ff8095; font-size: 13px; }
.section-title { font: 600 12px Inter; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: -6px; display: flex; justify-content: space-between; align-items: center; }

.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); height: 44px; overflow: hidden; }
.stepper button { width: 44px; height: 100%; border: 0; background: transparent; font-size: 20px; color: var(--muted); }
.stepper button:active { background: var(--surface-2); }
.stepper input { flex: 1; min-width: 0; text-align: center; border: 0; background: transparent; outline: none; font: 700 17px "Space Grotesk"; height: 100%; }

/* product hero inside sheets */
.hero { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; }
.hero .pic { aspect-ratio: 1; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #2a2a3b, #15151e 75%); display: grid; place-items: center; padding: 10px; border: 1px solid var(--line); }
.hero .pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.hero h3 { font-size: 18px; line-height: 1.25; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.tcg { color: var(--c); border-color: color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); }
.badge.ok { color: var(--good); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.1); }
@media (min-width: 560px) { .hero { grid-template-columns: 160px 1fr; } }

/* picker list (search results / suggestions) */
.picks { display: flex; flex-direction: column; gap: 8px; }
.pick {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px 8px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; transition: 0.15s;
}
.pick:hover, .pick:focus-visible { border-color: var(--accent-2); background: var(--surface-2); outline: none; }
.pick .thumb { width: 56px; height: 56px; border-radius: 8px; background: #1b1b27; display: grid; place-items: center; padding: 4px; }
.pick .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pick .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.pick .set { color: var(--muted); font-size: 12px; }
.pick .go { color: var(--faint); }
.pick .go svg { width: 18px; height: 18px; }

.notice { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 14px; display: flex; gap: 12px; align-items: flex-start; }
.notice.accent { border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.08); }
.notice img { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.notice .t { font-weight: 600; }

/* scanner */
.scanner { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; border: 1px solid var(--line); }
.scanner #reader { width: 100%; height: 100%; }
.scanner #reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scanner #reader img, .scanner #reader__dashboard { display: none !important; }
.scan-frame { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }
.scan-frame div {
  width: 78%; height: 38%; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.85); position: relative; overflow: hidden;
}
.scan-frame div::after {
  content: ""; position: absolute; left: 6%; right: 6%; height: 2px; background: var(--accent);
  box-shadow: 0 0 12px var(--accent); animation: laser 1.8s ease-in-out infinite alternate; top: 10%;
}
@keyframes laser { to { top: 88%; } }
.scan-status { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 13px; color: #ddd; text-shadow: 0 1px 4px #000; }
.scanner.error { display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); }

.ean-input { display: flex; gap: 8px; }
.ean-input .input { font: 600 17px "Space Grotesk"; letter-spacing: 0.08em; }

/* purchases table */
.purchases { display: flex; flex-direction: column; gap: 8px; }
.purchase { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.purchase .top { font-weight: 600; }
.purchase .sub { color: var(--muted); font-size: 12px; }
.purchase .amt { text-align: right; font: 700 15px "Space Grotesk"; }
.purchase .actions { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }

.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kv span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kv b { font: 700 17px "Space Grotesk"; }

.image-drop {
  border: 1.5px dashed var(--line); border-radius: 14px; padding: 14px; display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; background: var(--surface);
}
.image-drop .pv { width: 96px; height: 96px; border-radius: 10px; background: #1b1b27; display: grid; place-items: center; overflow: hidden; color: var(--faint); font-size: 30px; }
.image-drop .pv img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-drop .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.image-choices { display: flex; gap: 8px; overflow-x: auto; }
.image-choices button { flex: none; width: 64px; height: 64px; border-radius: 10px; border: 2px solid var(--line); background: #fff; padding: 3px; }
.image-choices button.on { border-color: var(--accent); }
.image-choices img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: rgba(23, 23, 34, 0.85); border: 1px solid var(--line); border-radius: 24px; padding: 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 20px; }
.auth-card .brand-mark { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }
.auth-card p { color: var(--muted); text-align: center; margin: 0 0 6px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--surface-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow);
  font-weight: 600; font-size: 14px; animation: drop 0.25s ease; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
}
.toast.ok { border-color: rgba(52, 211, 153, 0.5); }
.toast.err { border-color: rgba(255, 59, 92, 0.6); }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

.menu { position: absolute; right: 16px; top: 58px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 220px; z-index: 40; }
.menu button, .menu .item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 10px; background: none; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--surface); }
.menu .item { color: var(--muted); font-size: 12px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- sealed / singles ---------- */
.mode-switch { display: flex; gap: 4px; padding: 4px; margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; width: fit-content; }
.mode-switch button { border: 0; background: transparent; color: var(--muted); height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; transition: 0.15s; }
.mode-switch button.on { background: var(--grad); color: #fff; box-shadow: 0 4px 16px rgba(255, 59, 92, 0.3); }
@media (max-width: 520px) { .mode-switch { width: 100%; } .mode-switch button { flex: 1; } }

.grid.cards { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 520px) { .grid.cards { grid-template-columns: repeat(2, 1fr); } }
.card.single .img { aspect-ratio: 5 / 7; padding: 10px; }
.card.single .img img { border-radius: 4.5% / 3.2%; }
.attrs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.attrs .badge { font-size: 10px; padding: 2px 6px; }
.badge.grade { color: #1a1300; background: linear-gradient(135deg, #ffe08a, #f5b82e); border-color: transparent; }
.badge.holo { color: #c9b8ff; border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.12); }
.row.single { grid-template-columns: 50px 1fr auto; }
.row.single .thumb { width: 50px; height: 70px; }
.hero.single .pic { aspect-ratio: 5 / 7; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-weight: 600; font-size: 13px; transition: 0.15s;
}
.chip.on { color: var(--text); border-color: var(--c, var(--accent-2)); background: color-mix(in srgb, var(--c, var(--accent-2)) 18%, var(--surface)); }
#cond .chip { flex: 1; min-width: 48px; }

.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; user-select: none; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent-2); }

.input.mono { font: 600 16px "Space Grotesk"; letter-spacing: 0.04em; }
.photo-btn { cursor: pointer; border-style: dashed; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: -3px; }
.scanning { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }

.card-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .card-picks { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
.card-pick {
  display: flex; flex-direction: column; gap: 2px; padding: 6px 6px 8px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); text-align: left; transition: 0.15s; min-width: 0;
}
.card-pick:hover, .card-pick:focus-visible { border-color: var(--accent-2); background: var(--surface-2); outline: none; transform: translateY(-2px); }
.card-pick .cimg { aspect-ratio: 5 / 7; border-radius: 7px; background: #1b1b27; display: grid; place-items: center; overflow: hidden; margin-bottom: 4px; }
.card-pick .cimg img { width: 100%; height: 100%; object-fit: contain; }
.card-pick .cname { font-weight: 600; font-size: 12px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-pick .cset, .card-pick .cnum { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- market value ---------- */
.stat-hint { font-size: 11px; color: var(--faint); margin-top: 2px; }
.stat .value .pl { font-size: 15px; }
.pl { display: inline-flex; align-items: center; gap: 4px; font: 700 13px "Space Grotesk"; padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.pl.sm { font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.pl.up { color: var(--good); background: rgba(52, 211, 153, 0.12); }
.pl.down { color: #ff8095; background: rgba(255, 59, 92, 0.12); }
.pl.flat { color: var(--muted); background: var(--surface-2); }
.pl.none { color: var(--faint); font-weight: 500; font-family: Inter; }
.money-pl { margin-top: 4px; min-height: 18px; }
.pl-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.kv b.small { font-size: 14px; }
.notice.warn { border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.07); }
.section-title span { font-weight: 500; text-transform: none; letter-spacing: 0; }
.chip.sm { height: 28px; padding: 0 10px; font-size: 12px; }

.market { margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.market-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; border: 0; background: transparent; font-weight: 600; text-align: left; }
.market-head .hint { flex: 1; }
.market-head .chev svg { width: 18px; height: 18px; transition: transform 0.2s; transform: rotate(90deg); color: var(--muted); }
.market-head .chev.open svg { transform: rotate(-90deg); }
.market-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; padding: 0 16px 16px; }
@media (max-width: 860px) { .market-body { grid-template-columns: 1fr; } }
.chart-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span, .tip div { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .tip i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.legend i.dash, .tip i.dash { height: 0; border-top: 2px dashed; background: none; }
.chart { position: relative; min-height: 120px; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font: 11px Inter; }
.chart .xhair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; z-index: 2; min-width: 150px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow);
  font-size: 12px; display: flex; flex-direction: column; gap: 3px; color: var(--muted);
}
.chart .tip b { color: var(--text); }
.chart-empty { padding: 30px 0; text-align: center; }
.chart-table { margin-top: 6px; font-size: 12px; color: var(--muted); }
.chart-table summary { cursor: pointer; }
.chart-table table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.chart-table th, .chart-table td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.movers-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .movers-cols { grid-template-columns: 1fr; } }
.movers-title { font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.movers-title.up { color: var(--good); }
.movers-title.down { color: #ff8095; }
.mover { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; width: 100%; padding: 5px 4px; border: 0; border-radius: 8px; background: none; text-align: left; }
.mover:hover { background: var(--surface-2); }
.mover img { width: 30px; height: 36px; object-fit: contain; }
.mover .mname { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover small { color: var(--faint); font-weight: 500; }
.pick.cm { grid-template-columns: 1fr auto; }
.chart .tip[hidden], .menu [hidden] { display: none; }

/* ---------- Cardmarket links ---------- */
.cm-link { text-decoration: none; }
.cm-btn {
  position: absolute; top: 44px; right: 10px; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(11, 11, 16, 0.85); border: 1px solid rgba(255, 255, 255, 0.12); color: var(--muted); opacity: 0; transition: opacity 0.15s;
}
.cm-btn svg { width: 15px; height: 15px; }
.card:hover .cm-btn, .card:focus-within .cm-btn { opacity: 1; }
@media (hover: none) { .cm-btn { opacity: 1; } }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; color: var(--muted); }
.icon-btn.sm svg { width: 16px; height: 16px; }
