:root {
  --bg: #12141c;
  --panel: #1c1f2b;
  --panel-2: #252a3a;
  --text: #e8eaf0;
  --muted: #9aa0b5;
  --accent: #f0a500;
  --accent-2: #4f7cff;
  --good: #35c46a;
  --border: #2e3346;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  /* Stimmungsbild als fester Seitenhintergrund. Ein dezenter dunkler
     Verlauf darueber haelt Texte lesbar; die Deko an den Raendern bleibt
     auf breiten Bildschirmen neben dem 1200px-Inhalt sichtbar. */
  background:
    linear-gradient(rgba(15, 17, 25, 0.35), rgba(15, 17, 25, 0.60)),
    url("/static/img/background.webp") center top / cover no-repeat fixed,
    var(--bg);
}
/* Auf Mobilgeraeten kein festes Parallax (Performance/Ruckeln). */
@media (max-width: 768px) {
  body { background-attachment: scroll, scroll, scroll; }
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  /* Leicht durchscheinend, damit das Hintergrundbild oben mitspielt. */
  background: rgba(28, 31, 43, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-logo { height: 40px; width: 40px; object-fit: contain; border-radius: 8px; }
.brand-text { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.brand .game { color: var(--accent); font-size: 14px; margin-left: 6px; }
@media (max-width: 640px) { .brand-text { display: none; } }

.userbox { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.nav-lang { display: inline-flex; align-items: center; gap: 4px; }
/* Hamburger-Knopf: nur auf dem Handy sichtbar. */
.nav-toggle {
  display: none;
  font-size: 22px; line-height: 1;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 5px 12px; cursor: pointer;
}

/* ---------- Mobile Navigation ---------- */
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  /* Userbox wird zum Klappmenü unter der Kopfzeile. */
  .userbox {
    position: absolute;
    top: 100%; left: 0; right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(18, 20, 28, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .userbox.open { display: flex; }
  .userbox .nav-user { padding: 4px 2px 8px; border-bottom: 1px solid var(--border); }
  .userbox button { width: 100%; text-align: left; padding: 12px 14px; }
  .nav-lang { justify-content: space-between; width: 100%; padding: 4px 2px; }
  .nav-lang select { flex: 1; margin-left: 8px; }
}

main { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ---------- Spielleiste ---------- */
.gamebar { display: flex; gap: 8px; padding: 10px 20px 0; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.gamebar:empty { padding: 0; }
.game-tab {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px 10px 0 0;
  padding: 9px 18px; font-size: 15px; font-weight: 600; border-bottom: 2px solid transparent;
}
.game-tab:hover { border-color: var(--accent-2); }
.game-tab.active { border-color: var(--border); border-bottom: 2px solid var(--accent); color: var(--accent); background: var(--panel-2); }

/* ---------- Buttons / Inputs ---------- */
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: .15s;
}
button:hover { border-color: var(--accent-2); }
button.primary { background: var(--accent-2); border-color: var(--accent-2); }
button.primary:hover { filter: brightness(1.1); }
button.buy { background: var(--accent); color: #1a1300; border-color: var(--accent); font-weight: 600; }

input, select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
}

/* ---------- Auth ---------- */
/* Startseite = das Banner-Bild in voller Größe, das Login-Fenster schwebt
   mittig darüber. Deckt den ganzen Bildschirm (auch Kopfzeile) ab. */
.login-page {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background-color: var(--bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}
.auth {
  width: 100%;
  max-width: 360px;
  margin: auto;
  /* Kräftig abgesetztes, leicht durchscheinendes Panel für gute Lesbarkeit
     über dem Bild. */
  background: rgba(16, 18, 26, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 28px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}
.auth h2 { margin-top: 0; }
.auth .field { margin-bottom: 14px; }
.auth label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.auth .switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.auth .switch a { color: var(--accent-2); cursor: pointer; }
.error { color: #ff6b6b; font-size: 13px; margin: 8px 0; min-height: 16px; }

/* ---------- Sets ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.crumb { color: var(--muted); cursor: pointer; }
.crumb:hover { color: var(--text); }

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.set-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: .15s;
  display: flex;
  gap: 12px;
  align-items: center;
}
.set-card:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.set-card img { width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.set-card img.svg-icon { filter: invert(.9); }
.set-card .info { overflow: hidden; }
.set-card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-card .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.progress { height: 6px; background: var(--panel-2); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--good); }

/* ---------- Karten ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 63 / 88;
  background: var(--panel-2);
  cursor: pointer;
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: .2s; }
.card .noimg {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 10px; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--panel-2); box-sizing: border-box;
}
.card.missing img { filter: grayscale(1) brightness(.5); }
.card .num {
  position: absolute; bottom: 4px; left: 6px; z-index: 2;
  font-size: 11px; background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.card .num .rdot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 3px rgba(0,0,0,.6); flex: 0 0 auto;
}
.sortbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.card .langtag {
  position: absolute; bottom: 4px; right: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  background: rgba(240,165,0,.85); color: #1a1300; padding: 1px 5px; border-radius: 6px;
  z-index: 2;
}

/* Segmentierter Umschalter Normal / Foil */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--panel-2); padding: 7px 14px; }
.seg button.active { background: var(--accent-2); color: #fff; }
.seg button:not(.active):hover { background: #2e3550; }

/* Foil-Ansicht: schimmernder Regenbogen-Rahmen + Glanz */
.card.foilview {
  box-shadow: 0 0 0 2px transparent;
  background:
    linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
    linear-gradient(135deg,#ff6ec4,#7873f5,#4ADEDE,#f9d423,#ff6ec4) border-box;
  border: 2px solid transparent;
}
.card.foilview .shine {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 45%, rgba(255,255,255,.05) 55%, transparent 70%);
  background-size: 250% 250%;
  mix-blend-mode: screen;
  animation: foilshine 4s linear infinite;
}
@keyframes foilshine { 0%{background-position:0% 0%} 100%{background-position:100% 100%} }

button.buy.foil {
  background: linear-gradient(135deg,#ff6ec4,#7873f5,#4ADEDE);
  color: #10121a; border: 0;
}
.card-actions {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  display: flex; flex-direction: column; gap: 5px;
}
.card .own-btn, .card .wish-btn {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.25);
  font-size: 15px; opacity: 0; transition: .15s;
}
.card:hover .own-btn, .card:hover .wish-btn { opacity: 1; }
.card.owned .own-btn { opacity: 1; background: var(--good); border-color: var(--good); }
.card .wish-btn.on { opacity: 1; background: rgba(0,0,0,.7); }
.card.owned::after {
  content: "✓"; position: absolute; top: 6px; left: 6px;
  background: var(--good); color: #06210f; font-weight: 700;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}

.stats { font-size: 14px; color: var(--muted); }
.stats b { color: var(--text); }

/* ---------- Meine Sammlung (Uebersicht) ---------- */
.ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.ov-set {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.ov-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ov-name { font-weight: 700; }
.ov-year { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ov-langs { display: flex; flex-direction: column; gap: 8px; }
.ov-lang {
  display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px;
  cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: .12s;
}
.ov-lang:hover { background: var(--panel-2); }
.ov-lname { font-size: 13px; }
.ov-bar { height: 7px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.ov-bar > div { height: 100%; background: var(--good); }
.ov-nums { font-size: 12px; color: var(--muted); white-space: nowrap; }
.badge-done {
  font-size: 10px; font-weight: 700; background: var(--good); color: #06210f;
  padding: 1px 6px; border-radius: 6px; margin-left: 4px;
}

/* ---------- Statistik-Dashboard ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px;
}
.stat-num { font-size: 30px; font-weight: 800; color: var(--accent); letter-spacing: .3px; }
.stat-lab { font-size: 13px; color: var(--muted); margin-top: 4px; }

.panel-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 16px;
}
.panel-title { font-weight: 700; margin-bottom: 12px; }
.panel-title .hint, .hint { font-weight: 400; font-size: 12px; color: var(--muted); }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .ylab, .chart .xlab { fill: var(--muted); font-size: 11px; }
.chart .ylab { text-anchor: end; }
.chart .area { fill: var(--accent-2); opacity: .16; }
.chart .line { fill: none; stroke: var(--accent-2); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent-2); }

.stat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .stat-cols { grid-template-columns: 1fr; } }
.gstat { margin-bottom: 12px; }
.gstat-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.gstat-val { color: var(--muted); }
.gbar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.gbar > div { height: 100%; background: var(--accent); }
.top-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.top-row:last-child { border-bottom: 0; }
.top-row.clickable { cursor: pointer; padding: 7px 8px; margin: 0 -8px; border-radius: 6px; }
.top-row.clickable:hover { background: var(--panel-2); }
.top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-price { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ---------- Wunschliste ---------- */
.ov-game { margin: 18px 0 10px; font-size: 17px; }
.wish-list { display: flex; flex-direction: column; gap: 8px; }
.wish-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px 8px 10px;
}
.wish-thumb { width: 40px; height: 56px; object-fit: cover; border-radius: 5px; flex: 0 0 auto; background: var(--panel-2); }
.wish-thumb-noimg { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.wish-info { flex: 1; min-width: 0; }
.wish-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wish-num { color: var(--muted); font-size: 12px; font-weight: 400; }
.wish-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge-foil { font-size: 10px; background: linear-gradient(135deg,#ff6ec4,#7873f5); color:#fff; padding: 1px 6px; border-radius: 6px; }
.wish-prio { width: auto; flex: 0 0 auto; }
.wish-del { flex: 0 0 auto; color: #ff6b6b; border-color: transparent; background: transparent; font-size: 16px; }
.wish-del:hover { border-color: #ff6b6b; }
@media (max-width: 560px) {
  .wish-sub { display: none; }
  .wish-prio { max-width: 90px; }
}

/* ---------- Hilfe / FAQ ---------- */
.faq { max-width: 780px; display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 4px 16px;
}
.faq-item summary {
  cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "＋"; color: var(--accent); font-weight: 700; }
.faq-item[open] summary::before { content: "－"; }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-a { padding: 12px 0 14px; color: var(--muted); line-height: 1.55; font-size: 14px; }
.faq-a b { color: var(--text); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
/* Wichtig: 'display:flex' oben wuerde sonst das hidden-Attribut aushebeln
   und ein unsichtbares Overlay ueber die ganze Seite legen (schluckt Klicks). */
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  max-width: 720px; width: 100%; display: flex; gap: 20px; padding: 20px;
  max-height: 90vh; overflow: auto;
}
.modal img.big { width: 300px; max-width: 45%; border-radius: 12px; }
.modal .noimg-big {
  width: 300px; max-width: 45%; aspect-ratio: 63/88; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 16px; font-weight: 700; font-size: 18px;
}
.modal .detail { flex: 1; min-width: 0; }
.modal h3 { margin: 0 0 6px; }
.modal .row { margin: 6px 0; font-size: 14px; color: var(--muted); }
.modal .row b { color: var(--text); }
.modal .oracle { white-space: pre-wrap; font-size: 13px; margin-top: 10px; line-height: 1.4; }
.modal .actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.wish-box {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel-2);
}
.wish-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.prio-btn {
  padding: 6px 12px; font-size: 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel);
}
.prio-btn.active { border-color: var(--pc); box-shadow: inset 0 0 0 1px var(--pc); color: #fff; }
.prio-btn.remove { color: #ff6b6b; margin-left: auto; }
.prio-btn.hidden { display: none; }
.close-x { position: absolute; }

@media (max-width: 560px) {
  .modal { flex-direction: column; }
  .modal img.big { width: 200px; max-width: 60%; margin: 0 auto; }
}

/* ---------- Kartenliste ---------- */
.listmodal { max-width: 560px; }
.li-list {
  margin-top: 12px; max-height: 55vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px;
}
.li-row {
  display: grid; grid-template-columns: 70px 1fr 30px; align-items: center; gap: 10px;
  padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.li-row:last-child { border-bottom: 0; }
.li-row:nth-child(even) { background: rgba(255,255,255,.02); }
.li-num { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.li-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-buy a { text-decoration: none; font-size: 16px; }
.li-buy a:hover { filter: brightness(1.3); }
/* Kopier-Textfeld nur fuer Fallback; normal versteckt */
#listText {
  position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0;
}

/* Fußzeile mit Rechtslinks */
.site-footer {
  margin-top: 40px;
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.site-footer a { color: var(--muted); text-decoration: none; margin: 0 4px; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
