:root {
  --bg: #12131a;
  --bg2: #1a1c26;
  --card: #20232f;
  --card2: #272b39;
  --line: #333849;
  --text: #e9eaf0;
  --muted: #9a9fb3;
  --accent: #ffcb3d;
  --accent-ink: #2a2100;
  --good: #3ddc84;
  --good-bg: rgba(61, 220, 132, .14);
  --new: #5aa9ff;
  --new-bg: rgba(90, 169, 255, .15);
  --bad: #ff6b6b;
  --jp: #ff5a6e; --kr: #4f8cff; --cn: #ffb020; --de: #9a9fb3; --en: #b18cff; --unk: #5d6275;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Kopf ---------- */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(18,19,26,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 1400px; margin: 0 auto; padding: 12px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 36px; position: relative; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 22px; height: 31px; border-radius: 5px; top: 2px; }
.brand-mark::before { left: 0; background: var(--card2); border: 2px solid var(--accent); transform: rotate(-12deg); }
.brand-mark::after { left: 7px; background: linear-gradient(150deg, var(--accent), #ff8a3d); transform: rotate(8deg); }
.brand b { font-size: 18px; letter-spacing: .2px; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -2px; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav.tabs a {
  text-decoration: none; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap;
}
nav.tabs a:hover { background: var(--bg2); color: var(--text); }
nav.tabs a.active { background: var(--card2); color: var(--text); }
nav.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; font-size: 12px; background: var(--line); color: var(--text); text-align: center; }
nav.tabs .count.good { background: var(--good-bg); color: var(--good); }
nav.tabs .count.new { background: var(--new-bg); color: var(--new); }

main { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* ---------- Filter ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 16px;
}
.filters input[type=search] { flex: 1 1 240px; min-width: 180px; }
.field, .filters input[type=search], .filters select {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; outline: none;
}
.field:focus, .filters input:focus, .filters select:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 11px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--muted); user-select: none;
}
.chip[aria-pressed=true] { color: #fff; border-color: transparent; }
.chip[data-lang=JP][aria-pressed=true] { background: var(--jp); }
.chip[data-lang=KR][aria-pressed=true] { background: var(--kr); }
.chip[data-lang=CN][aria-pressed=true] { background: var(--cn); color: #2a1a00; }
.chip[data-lang=DE][aria-pressed=true] { background: var(--de); color: #111; }
.chip[data-lang=EN][aria-pressed=true] { background: var(--en); }
.chip[data-lang="?"][aria-pressed=true] { background: var(--unk); }
.chip.game[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
.gametag { font-size: 11px; font-weight: 700; color: var(--text); background: var(--card2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--accent); }
.result-info { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }

/* ---------- Produktkarten ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .12s, border-color .12s; cursor: pointer;
}
.card:hover { transform: translateY(-2px); border-color: #4a5068; }
.card.drop { border-color: rgba(61,220,132,.55); box-shadow: 0 0 0 1px rgba(61,220,132,.25), var(--shadow); }
.card.soldout { opacity: .55; }
.thumb { position: relative; aspect-ratio: 1 / 1; background: #f3f3f6; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb .noimg { color: #999; font-size: 13px; }
.badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: .4px; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; }
.badge.new { background: var(--new); color: #fff; }
.badge.drop { background: var(--good); color: #052e17; }
.badge.best { background: var(--accent); color: var(--accent-ink); }
.badge.out { background: #444; color: #eee; }
.badge.pre { background: #8b5cf6; color: #fff; }
.lang { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; color: #fff; background: var(--unk); }
.lang.JP { background: var(--jp); } .lang.KR { background: var(--kr); } .lang.CN { background: var(--cn); color: #2a1a00; }
.lang.DE { background: var(--de); color: #111; } .lang.EN { background: var(--en); }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.meta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.title { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { margin-top: auto; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { font-size: 20px; font-weight: 800; }
.price.good { color: var(--good); }
.old { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.pct { color: var(--good); font-weight: 800; font-size: 13px; }
.offers-hint { font-size: 12px; color: var(--muted); }
.offers-hint b { color: var(--accent); }

/* ---------- Feed ---------- */
.feed-day { margin: 18px 0 8px; color: var(--muted); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }
.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 8px 8px; cursor: pointer;
}
.feed-row:hover { border-color: #4a5068; }
.feed-row img, .feed-row .ph { width: 64px; height: 64px; object-fit: contain; background: #f3f3f6; border-radius: 8px; }
.feed-row .what { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }
.what.new { color: var(--new); } .what.price_drop { color: var(--good); } .what.restock { color: var(--accent); }
.feed-row .t { font-weight: 600; }
.feed-row .right { text-align: right; white-space: nowrap; }

/* ---------- Vergleich ---------- */
.cmp { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.cmp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; grid-template-columns: 90px 1fr; gap: 12px; }
.cmp-card img { width: 90px; height: 90px; object-fit: contain; background: #f3f3f6; border-radius: 10px; }
.cmp-card h3 { margin: 0 0 6px; font-size: 14px; line-height: 1.3; }
table.offers { width: 100%; border-collapse: collapse; font-size: 13px; }
table.offers td { padding: 5px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
table.offers td.p { text-align: right; font-weight: 700; white-space: nowrap; }
table.offers tr.best td.p { color: var(--good); }
table.offers tr.out { opacity: .5; }
table.offers a { text-decoration: none; }
table.offers a:hover { text-decoration: underline; }
.spread { font-size: 12px; color: var(--accent); font-weight: 700; }

/* ---------- Tabellen / Admin ---------- */
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 17px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 8px; }
table.list td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--line); }
.status.ok { background: var(--good-bg); color: var(--good); }
.status.error { background: rgba(255,107,107,.15); color: var(--bad); }
.status.off { background: #2a2d39; color: var(--muted); }
.status.running { background: var(--new-bg); color: var(--new); }
.small { font-size: 12px; color: var(--muted); }
.btn {
  background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: #4a5068; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-grid { display: grid; grid-template-columns: 160px 1fr; gap: 10px 12px; align-items: center; }
.form-grid label { color: var(--muted); font-size: 14px; }
.form-grid .field { width: 100%; }
textarea.field { min-height: 70px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); grid-column: 2; margin-top: -6px; }
.test-out { margin-top: 12px; max-height: 420px; overflow: auto; }
.msg { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.msg.err { background: rgba(255,107,107,.12); color: var(--bad); }
.msg.ok { background: var(--good-bg); color: var(--good); }

/* ---------- Modal ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 18px; background: var(--bg2); color: var(--text);
  width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
.modal-head { display: flex; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); }
.modal-head img { width: 140px; height: 140px; object-fit: contain; background: #f3f3f6; border-radius: 12px; flex: none; }
.modal-head h2 { margin: 0 0 8px; font-size: 18px; line-height: 1.3; }
.modal-body { padding: 16px; display: grid; gap: 18px; }
.modal-body h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.close { margin-left: auto; align-self: flex-start; background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; }
.chart svg { width: 100%; height: auto; display: block; }
.empty { color: var(--muted); padding: 40px 10px; text-align: center; }
.more { display: flex; justify-content: center; margin: 18px 0; }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .price { font-size: 17px; }
  .cmp { grid-template-columns: 1fr; }
  .cmp-card { grid-template-columns: 64px 1fr; }
  .cmp-card img { width: 64px; height: 64px; }
  .form-grid { grid-template-columns: 1fr; }
  .hint { grid-column: 1; }
  .modal-head img { width: 90px; height: 90px; }
  nav.tabs { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .filters select { flex: 1 1 45%; }
  table.list td:last-child .row { flex-wrap: nowrap; }
  .feed-row { grid-template-columns: 48px 1fr; }
  .feed-row img, .feed-row .ph { width: 48px; height: 48px; }
  .feed-row .right { grid-column: 2; text-align: left; }
}
