:root {
  --bg: #0f1226;
  --bg2: #1a1f3d;
  --panel: #20264a;
  --panel2: #2a3160;
  --text: #eef1ff;
  --muted: #a6acd6;
  --primary: #6c5ce7;
  --primary2: #a29bfe;
  --accent: #00d2ff;
  --danger: #ff5e7e;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #2b2f63, var(--bg));
  color: var(--text);
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: rgba(20,24,52,.8); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand { font-size: 22px; font-weight: 800; }
.brand span { background: linear-gradient(90deg, var(--primary2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 8px; }
.nav-btn {
  border: none; background: transparent; color: var(--muted); font-size: 15px; font-weight: 700;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.nav-btn.active { background: var(--primary); color: #fff; }
.badge { background: rgba(255,255,255,.25); border-radius: 999px; padding: 0 8px; font-size: 12px; }

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

/* Screens */
.screen { display: none; animation: fade .25s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel { background: var(--panel); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
h2 { font-size: 18px; margin: 18px 0 10px; }
h2:first-child { margin-top: 0; }
h2 small { color: var(--muted); font-weight: 500; font-size: 13px; }

textarea, input[type=text] {
  width: 100%; background: var(--bg2); border: 2px solid transparent; color: var(--text);
  border-radius: 12px; padding: 12px 14px; font-size: 16px; font-family: inherit; resize: vertical;
}
textarea:focus, input[type=text]:focus { outline: none; border-color: var(--primary2); }

/* Chips (Typ + Form) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid rgba(255,255,255,.12); background: var(--bg2); color: var(--text);
  border-radius: 999px; padding: 9px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.chip.active { background: linear-gradient(90deg, var(--primary), var(--primary2)); border-color: transparent; }

/* Buttons */
.btn {
  border: none; border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 700;
  cursor: pointer; background: var(--panel2); color: var(--text); transition: transform .08s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(90deg, var(--primary), var(--primary2)); color: #fff; }
.btn.ghost { background: rgba(255,255,255,.08); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.big { width: 100%; padding: 16px; font-size: 18px; margin-top: 18px; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.row-buttons { display: flex; gap: 10px; margin: 12px 0; }
.row-buttons.wrap { flex-wrap: wrap; }

.hint { color: var(--muted); font-size: 14px; min-height: 1em; }
.hint.small { font-size: 12px; }
.center { text-align: center; }

/* Farb-Panel */
.color-row { margin-bottom: 14px; }
.color-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.color-label { font-weight: 700; font-size: 14px; }
.color-off { background: rgba(255,255,255,.1); color: var(--muted); border: none; border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.color-row.is-off .swatches { opacity: .45; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 8px; border: 2px solid rgba(255,255,255,.15); cursor: pointer; }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); }
.color-custom { width: 38px; height: 34px; border: none; background: none; border-radius: 8px; cursor: pointer; padding: 0; }

/* Ergebnis */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.result-card { display: flex; flex-direction: column; align-items: center; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 700; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.taglist { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--bg2); border-radius: 10px; padding: 8px 12px; font-size: 14px; display: flex; gap: 8px; align-items: center; max-width: 100%; }
.tag b { color: var(--primary2); }
.tag .el { font-size: 11px; background: var(--primary); border-radius: 6px; padding: 1px 6px; }
.tag .x { cursor: pointer; color: var(--muted); font-weight: 800; }

/* 3D-Karte */
.card3d-stage { perspective: 1100px; width: 300px; height: 420px; touch-action: none; cursor: grab; }
.card3d-stage:active { cursor: grabbing; }
.card3d { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .05s linear; }
.card3d-face {
  position: absolute; inset: 0; border-radius: 18px; overflow: hidden;
  backface-visibility: hidden; box-shadow: var(--shadow);
  border: 3px solid rgba(255,255,255,.18);
}
.card3d-front { background: #fff; }
.card3d-back {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, #3a2d8a 0 14px, #4b3bb0 14px 28px),
    radial-gradient(circle at 50% 50%, var(--accent), transparent 60%);
  display: flex; align-items: center; justify-content: center;
}
.card3d-back::after { content: "🐉"; font-size: 96px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.card3d-img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.card3d-holo { position: absolute; inset: 0; mix-blend-mode: screen; pointer-events: none; }
.card3d-title {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff;
  font-weight: 800; text-align: center; font-size: 18px;
}

/* Pokédex */
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.dex-card { background: var(--bg2); border-radius: 14px; overflow: hidden; cursor: pointer; transition: transform .1s; border: 2px solid transparent; }
.dex-card:hover { transform: translateY(-3px); border-color: var(--primary2); }
.dex-thumb { position: relative; }
.dex-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.dex-card .name { padding: 8px; font-weight: 700; font-size: 14px; text-align: center; }
.dex-3d { position: absolute; top: 6px; right: 6px; background: linear-gradient(90deg, var(--primary), var(--accent)); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }

/* 3D-Modell-Viewer */
.mv {
  width: 300px; height: 420px; border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, #2b2f63, #12152e);
  border: 3px solid rgba(255,255,255,.18); box-shadow: var(--shadow);
  --poster-color: transparent;
}
.overlay-box .mv { width: 100%; max-width: 320px; height: 360px; }
@media (max-width: 720px) { .mv { width: 86vw; max-width: 340px; height: 460px; } }

/* Overlay + Loader */
.overlay, .loader {
  position: fixed; inset: 0; background: rgba(8,10,24,.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px;
}
.overlay[hidden], .loader[hidden] { display: none; }
.overlay-box { background: var(--panel); border-radius: var(--radius); padding: 24px; max-width: 420px; width: 100%; position: relative; text-align: center; max-height: 92vh; overflow: auto; }
.overlay-box #detail-card-mount { display: flex; justify-content: center; }
.overlay-close { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.12); border: none; color: var(--text); width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.detail-meta { color: var(--muted); font-size: 14px; margin: 8px 0 16px; text-align: left; }
.detail-meta b { color: var(--primary2); }
.loader-box { text-align: center; }
.spinner { width: 64px; height: 64px; border: 6px solid rgba(255,255,255,.15); border-top-color: var(--primary2); border-radius: 50%; margin: 0 auto 16px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .result-grid { grid-template-columns: 1fr; justify-items: center; }
  .nav-btn { font-size: 13px; padding: 8px 10px; }
  .brand span { display: none; }
}
