/* KlipitMon auf card-pal.de (E-038).
   Gestaltung: eine Trainer-Ausruestung bei Nacht - dunkler Grund wie ein
   Stream-Overlay, Pokeball-Rot als einziger lauter Akzent, Gelb nur fuer
   Shinys und Hinweise. Schrift: Noto Sans (OFL), liegt auf dem eigenen Server -
   keine Google-Fonts-Abfrage, damit keine Besucher-IP an Dritte geht. */

@font-face { font-family: "Noto Sans"; src: url("/web/schrift/NotoSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("/web/schrift/NotoSans-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("/web/schrift/NotoSans-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }

:root {
  /* Layout: schmale Lesespalte fuer Texte, breites Raster fuer Box und Pokedex */
  --grund: #11131c;
  --flaeche: #1a1d2a;
  --flaeche-2: #232738;
  --linie: #30354a;
  --text: #eef0f6;
  --leise: #9aa1b9;
  --rot: #ff4b55;
  --rot-tief: #c9303a;
  --gelb: #ffd447;
  --gruen: #3fd18f;
  --twitch: #a970ff;
  --discord: #7984ff;
  --schrift: "Noto Sans", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --rund: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--grund); color: var(--text); font: 400 16px/1.6 var(--schrift); min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-weight: 900; font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -0.02em; }
h2 { font-weight: 900; font-size: 1.45rem; letter-spacing: -0.01em; }
h3 { font-weight: 700; font-size: 1.08rem; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--gelb); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sprung { position: absolute; left: -999px; top: 8px; background: var(--gelb); color: var(--grund); padding: 6px 12px; border-radius: 8px; z-index: 50; }
.sprung:focus { left: 8px; }

/* ── Kopf ── */
.kopf { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--grund) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--linie); }
.kopf-innen { max-width: 1180px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.marke { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.2rem; text-decoration: none; letter-spacing: -0.01em; }
.ball { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--text); background: linear-gradient(var(--rot) 0 calc(50% - 1.5px), var(--text) calc(50% - 1.5px) calc(50% + 1.5px), var(--flaeche-2) calc(50% + 1.5px)); position: relative; flex: none; }
.ball::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: 8px; height: 8px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--flaeche-2); border: 2.5px solid var(--text); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--leise); font-weight: 700; font-size: .93rem; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--flaeche); }
.nav a[aria-current="page"] { color: var(--text); background: var(--flaeche-2); }
.konto { display: flex; align-items: center; gap: 8px; }
.ich-chip { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--flaeche); border: 1px solid var(--linie); max-width: 200px; }
.ich-chip img { width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; border-radius: 50%; background: var(--flaeche-2); }
.ich-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .kopf-innen { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .nav { grid-column: 1 / -1; grid-row: 2; margin: 0 -6px; }
  .ich-chip span { display: none; }
  .ich-chip { padding: 4px; }
}

/* ── Inhalt ── */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); display: grid; gap: 36px; align-content: start; }
main:focus { outline: none; }
.lesen { max-width: 760px; display: grid; gap: 28px; }
.abschnitt { display: grid; gap: 14px; align-content: start; }
.leise { color: var(--leise); }
.klein { font-size: .9rem; }
.laedt { color: var(--leise); }
.vorspann { font-size: 1.12rem; color: var(--leise); max-width: 62ch; }
.augenbraue { font-weight: 700; font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--rot); }
code, kbd { font-family: var(--mono); font-size: .9em; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 6px; padding: 1px 6px; }
ul.liste { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }

/* Knoepfe */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 700 .95rem var(--schrift); color: var(--text); background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 10px; padding: 10px 16px; cursor: pointer; text-decoration: none; min-height: 44px; }
.knopf:hover { border-color: var(--leise); }
.knopf.haupt { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.haupt:hover { background: var(--rot-tief); }
.knopf.twitch { background: var(--twitch); border-color: var(--twitch); color: #14101f; }
.knopf.discord { background: var(--discord); border-color: var(--discord); color: #0f1124; }
.knopf.klein { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 10px; }

/* Karten und Felder */
.feld { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.hinweis { border-left: 4px solid var(--gelb); background: color-mix(in srgb, var(--gelb) 10%, var(--flaeche)); padding: 12px 16px; border-radius: 0 10px 10px 0; }
.fehler { border-left: 4px solid var(--rot); background: color-mix(in srgb, var(--rot) 12%, var(--flaeche)); padding: 12px 16px; border-radius: 0 10px 10px 0; }
.ok { border-left: 4px solid var(--gruen); background: color-mix(in srgb, var(--gruen) 12%, var(--flaeche)); padding: 12px 16px; border-radius: 0 10px 10px 0; }
.marke-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .78rem; padding: 2px 10px; border-radius: 999px; background: var(--flaeche-2); border: 1px solid var(--linie); white-space: nowrap; }
.marke-chip.twitch { color: var(--twitch); border-color: color-mix(in srgb, var(--twitch) 50%, var(--linie)); }
.marke-chip.discord { color: var(--discord); border-color: color-mix(in srgb, var(--discord) 50%, var(--linie)); }
.marke-chip.shiny { color: var(--gelb); }
.marke-chip.live { color: #fff; background: var(--rot); border-color: var(--rot); }
.marke-chip.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: puls 1.4s infinite; }
@keyframes puls { 50% { opacity: .3; } }

/* Tabellen */
.tabelle-huelle { overflow-x: auto; border: 1px solid var(--linie); border-radius: var(--rund); background: var(--flaeche); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--leise); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Start ── */
.held { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: center; padding-block: 12px 8px; }
.held h1 em { font-style: normal; color: var(--rot); }
.held-bild { position: relative; aspect-ratio: 1; max-width: 360px; justify-self: center; width: 100%; }
.held-bild .gross-ball { position: absolute; inset: 8%; border-radius: 50%; border: 10px solid var(--linie); background: linear-gradient(var(--flaeche-2) 0 47%, var(--linie) 47% 53%, var(--flaeche) 53%); }
.held-bild .gross-ball::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; transform: translate(-50%, -50%); border-radius: 50%; background: var(--flaeche); border: 10px solid var(--linie); }
.held-bild img { position: absolute; width: 58%; left: 21%; top: 12%; image-rendering: pixelated; filter: drop-shadow(0 12px 18px rgba(0,0,0,.5)); animation: schweben 3.2s ease-in-out infinite; }
@keyframes schweben { 50% { transform: translateY(-10px); } }
.schritte { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.schritt b.nr { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--rot); color: #fff; font-weight: 900; }
@media (max-width: 760px) { .held { grid-template-columns: 1fr; } .held-bild { max-width: 220px; order: -1; } }

/* ── Tausch ── */
.tausch-seiten { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.tausch-leiste { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--grund); border-top: 1px solid var(--linie); }
.tausch-zeile, .tauschpartner { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; flex-wrap: wrap; }
.tauschpartner { display: grid; gap: 2px; }
button.mon { font: inherit; color: inherit; }
button.mon:disabled { opacity: .45; cursor: not-allowed; }
.tausch-buehne { position: fixed; inset: 0; z-index: 70; background: radial-gradient(circle at 50% 45%, var(--flaeche-2), var(--grund) 70%); }
.tausch-mon { position: absolute; top: 50%; width: min(34vw, 220px); aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; }
.tausch-mon.links { left: 22%; }
.tausch-mon.rechts { left: 78%; }
.tausch-mon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.tausch-ball { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; opacity: 0; transform: translate(-50%, -50%); }
.tausch-text { position: absolute; left: 50%; bottom: calc(14% + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(92vw, 560px); text-align: center; font-weight: 900; font-size: 1.3rem; background: var(--flaeche); border: 2px solid var(--linie); border-radius: 14px; padding: 12px 18px; }

/* Stream-Marke (Gen 1-3, tritt gegen PokeKlipit an) und Ewigstein */
.stream-marke { color: var(--rot); font-weight: 700; }
.stream-zeile { font-size: .72rem; font-weight: 700; color: var(--rot); margin-top: 2px; }
.stream-zeile.nein { color: var(--leise); }
.ewig { color: var(--leise); }

/* ── Arena ── */
.gegner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.kampf-buehne { position: relative; display: grid; gap: 8px; padding: 18px 16px 96px; border-radius: 18px; border: 1px solid var(--linie); overflow: hidden;
  background: linear-gradient(180deg, #2b3a58 0%, #3d5a3f 58%, #2f4632 100%); min-height: 420px; }
.kampf-reihe { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; }
.kampf-mon { justify-self: center; width: min(40vw, 190px); aspect-ratio: 1; display: grid; place-items: center; position: relative; }
.kampf-mon::after { content: ""; position: absolute; bottom: 4%; left: 12%; right: 12%; height: 16%; border-radius: 50%; background: rgba(0,0,0,.28); z-index: 0; }
.kampf-mon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; position: relative; z-index: 1; }
.kampf-mon.rueckseite img { transform: scaleX(-1); }
.kampf-mon.besiegt img { transition: transform .5s, opacity .5s; transform: translateY(40%) scaleY(.2); opacity: 0; }
.kampf-info { background: color-mix(in srgb, var(--grund) 82%, transparent); border: 1px solid var(--linie); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; min-width: 0; }
.kampf-info b { overflow-wrap: anywhere; }
.kp { height: 9px; border-radius: 5px; background: var(--flaeche-2); overflow: hidden; }
.kp i { display: block; height: 100%; width: 100%; background: var(--gruen); transition: width .45s ease; }
.kp i.mittel { background: var(--gelb); }
.kp i.tief { background: var(--rot); }
.kp-zahl { font-variant-numeric: tabular-nums; color: var(--leise); }
.kampf-text { position: absolute; left: 12px; right: 12px; bottom: 12px; margin: 0; min-height: 64px; display: flex; align-items: center; background: var(--flaeche); border: 2px solid var(--linie); border-radius: 12px; padding: 10px 14px; font-weight: 700; }

/* ── Eigenes Dashboard ── */
.dash-kopf { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: center; }
.dash-trainer { position: relative; width: 140px; height: 140px; border-radius: 50%; background: var(--flaeche); border: 2px solid var(--linie); display: grid; place-items: center; overflow: hidden; cursor: pointer; padding: 0; }
.dash-trainer:hover { border-color: var(--rot); }
.dash-aendern { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); font: 700 .72rem var(--schrift); color: var(--text); background: color-mix(in srgb, var(--grund) 80%, transparent); padding: 1px 8px; border-radius: 999px; }
.dash-trainer img { width: 110px; height: 110px; object-fit: contain; image-rendering: pixelated; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.kachel { gap: 2px; }
.kachel b { font-weight: 900; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
a.mon { text-decoration: none; color: inherit; }
.dash-anleitung { border-color: color-mix(in srgb, var(--rot) 45%, var(--linie)); }
@media (max-width: 760px) { .dash-kopf { grid-template-columns: 84px minmax(0, 1fr); gap: 14px; } .dash-trainer { width: 84px; height: 84px; } .dash-trainer img { width: 66px; height: 66px; } }

/* ── Anmelden ── */
.code-feld { display: grid; gap: 18px; justify-items: start; }
.code { font: 900 clamp(2.2rem, 9vw, 3.6rem)/1 var(--mono); letter-spacing: .08em; padding: 18px 24px; background: var(--grund); border: 2px dashed var(--linie); border-radius: var(--rund); user-select: all; }
.uhr { font-variant-numeric: tabular-nums; }
.vorschau-paar { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }

/* ── Box ── */
.box-kopf { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; }
.team { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .team { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.platz { position: relative; min-height: 132px; border: 2px dashed var(--linie); border-radius: var(--rund); background: var(--flaeche); display: grid; place-items: center; text-align: center; padding: 8px; transition: border-color .15s, background .15s; }
.platz .nummer { position: absolute; top: 6px; left: 10px; font-weight: 900; color: var(--leise); font-size: .85rem; }
.platz.eins { border-color: color-mix(in srgb, var(--rot) 70%, var(--linie)); }
.platz.eins .nummer { color: var(--rot); }
.platz.ziel, .platz.waehlbar:hover { border-color: var(--gelb); background: color-mix(in srgb, var(--gelb) 8%, var(--flaeche)); }
.platz.waehlbar { cursor: pointer; }
.platz .leer { color: var(--leise); font-size: .85rem; }
.filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter input[type="search"], .filter select { font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 8px 12px; min-height: 40px; }
.filter input[type="search"] { min-width: 0; flex: 1 1 200px; }
.schalter { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche); cursor: pointer; user-select: none; min-height: 36px; }
.schalter input { accent-color: var(--rot); }
.mons { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.mon { position: relative; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 10px; display: grid; gap: 4px; justify-items: center; text-align: center; cursor: pointer; user-select: none; touch-action: manipulation; }
.mon:hover { border-color: var(--leise); }
.mon.gewaehlt { border-color: var(--gelb); box-shadow: 0 0 0 2px var(--gelb) inset; }
.mon.shiny { background: linear-gradient(160deg, color-mix(in srgb, var(--gelb) 14%, var(--flaeche)), var(--flaeche) 55%); }
.mon.zieht { opacity: .4; }
.mon img, .platz img { width: 84px; height: 84px; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
.platz img { width: 72px; height: 72px; }
.mon .name { font-weight: 700; font-size: .95rem; line-height: 1.2; overflow-wrap: anywhere; }
.mon .lv, .platz .lv { font-size: .82rem; color: var(--leise); font-variant-numeric: tabular-nums; }
.mon .ecke { position: absolute; top: 6px; right: 8px; display: flex; gap: 4px; font-size: .85rem; }
.mon .ecke.links { left: 8px; right: auto; font-weight: 900; color: var(--rot); }
.xp { width: 100%; height: 5px; background: var(--flaeche-2); border-radius: 3px; overflow: hidden; }
.xp i { display: block; height: 100%; background: var(--gruen); }
.leer-box { text-align: center; padding: 30px; }

/* Detail-Schublade */
.schublade { position: fixed; inset: auto 0 0 0; z-index: 40; background: var(--flaeche); border-top: 1px solid var(--linie); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.5); max-height: 82vh; overflow-y: auto; padding: 18px max(16px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.schublade-innen { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.schublade .oben { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.schublade .oben img { width: 120px; height: 120px; object-fit: contain; image-rendering: pixelated; }
.schleier { position: fixed; inset: 0; z-index: 39; background: rgba(5,6,10,.6); }
.werte { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 8px 16px; font-size: .93rem; }
.werte div { display: grid; }
.werte span { color: var(--leise); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 520px) { .schublade .oben { grid-template-columns: 84px minmax(0, 1fr) auto; } .schublade .oben img { width: 84px; height: 84px; } }

/* Profil */
.trainer-wahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.trainer-wahl button { background: var(--flaeche-2); border: 2px solid var(--linie); border-radius: 12px; padding: 6px; cursor: pointer; display: grid; justify-items: center; gap: 2px; color: var(--leise); font: 700 .75rem var(--schrift); }
.trainer-wahl button[aria-pressed="true"] { border-color: var(--rot); color: var(--text); }
.trainer-wahl img { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; }
.geraete { display: grid; gap: 8px; }
.geraet { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--flaeche-2); border-radius: 10px; }

/* Pokedex */
.dex-karte { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.dex-karte img { width: 72px; height: 72px; image-rendering: pixelated; grid-row: span 2; }
.dex-karte .nr { color: var(--leise); font-variant-numeric: tabular-nums; font-size: .85rem; }
.chancen { display: flex; gap: 10px; flex-wrap: wrap; font-size: .85rem; color: var(--leise); grid-column: 1 / -1; font-variant-numeric: tabular-nums; }
.selten-legendary, .selten-very_rare { color: var(--gelb); }

/* Fuss */
.fuss { border-top: 1px solid var(--linie); color: var(--leise); font-size: .9rem; }
.fuss-innen { max-width: 1180px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
.fuss-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.fuss a { color: var(--leise); }
.fuss a:hover { color: var(--text); }

/* Meldung unten */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 12px; padding: 10px 16px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.45); max-width: calc(100vw - 32px); }
.toast.fehler-toast { border-color: var(--rot); }

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