/* ============================================================
   ARKADE 2.0 — Components
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--r-pill); border: var(--border-w) solid var(--border-hi);
  background: var(--surface-hi); color: var(--text); font-weight: 700; font-size: 15px;
  font-family: var(--font-display);
  transition: transform .14s var(--ease-out), box-shadow .14s var(--ease-out), background .2s, border-color .2s;
  user-select: none; white-space: nowrap; position: relative; overflow: hidden;
}
/* Arkade 3.0: Interaktionsmodell gewechselt. Runde 18 hatte "harter Schatten wächst/zieht sich
   zurück" mit DIAGONALEM Versatz (translate(-2px,-2px)) — das liest sich wie ein verschobener
   Aufkleber. Jetzt hebt sich das Element stattdessen SENKRECHT von der Fläche ab und der weiche
   Schatten wird größer/weiter; beim Drücken sinkt es zurück und bekommt einen Innenschatten.
   Das ist dieselbe Lichtlogik wie überall sonst im neuen Look: Licht von oben, Objekt über Grund. */
.btn { box-shadow: var(--sh-sm), var(--lift); }
.btn:hover { transform: translateY(-2px); border-color: var(--border-hi); box-shadow: var(--sh-md), var(--lift-strong); }
.btn:active { transform: translateY(1px); box-shadow: var(--sh-press); transition-duration: .06s; }
.btn.primary { background: var(--grad-accent); border: var(--border-w) solid transparent; color: #0a0b10; box-shadow: var(--sh-glow), var(--lift-strong); }
.btn.primary:hover { box-shadow: var(--sh-glow), var(--glow-accent), var(--lift-strong); transform: translateY(-2px); }
.btn.primary:active { box-shadow: var(--sh-press); transform: translateY(1px); }
/* Runde 7: kurzer Ripple-Puls bei Klick, ausgehend vom Cursor (--mx/--my aus ui.js) */
.btn::before {
  content: ''; position: absolute; left: var(--mx,50%); top: var(--my,50%); width: 8px; height: 8px;
  border-radius: 50%; background: rgba(255,255,255,0.55); transform: translate(-50%,-50%) scale(0);
  opacity: 0; pointer-events: none;
}
.btn.is-pressed::before { animation: btnRipple var(--dur-snap) var(--ease-out) forwards; }
@keyframes btnRipple { 0% { transform: translate(-50%,-50%) scale(0); opacity: .6; } 100% { transform: translate(-50%,-50%) scale(22); opacity: 0; } }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { background: rgba(251,113,133,0.14); border-color: rgba(251,113,133,0.42); color: #fda4af; }
.btn.warm { background: var(--grad-warm); border: none; color: #201400; }
.btn.sm { padding: 8px 16px; font-size: 13px; }
.btn.lg { padding: 15px 28px; font-size: 16px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

.iconbtn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--surface); border: var(--border-w) solid var(--border); color: var(--text); font-size: 17px; transition: all .15s;
}
.iconbtn:hover { border-color: var(--border-hi); background: var(--surface-hi); transform: translateY(-1px); box-shadow: var(--sh-sm), var(--lift); }

/* ---------- Cards / Panels ---------- */
/* Arkade 3.0: Signature-Material ist wieder ein GESCHICHTETES Material — leicht transluzente
   Fläche mit echter Unschärfe dahinter, darüber ein sehr dezenter Flächenverlauf (--grad-surface)
   und eine Lichtkante an der Oberkante (--lift). Der harte 4px-Akzentbalken links (Runde 18)
   entfällt; seine Aufgabe (Panels visuell "anfassbar" machen) übernimmt jetzt die Lichtkante
   plus eine feine Akzent-Linie oben, die sich beim Hover aufhellt. */
.panel {
  background: var(--grad-surface), var(--surface);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: var(--border-w) solid var(--border); border-radius: var(--r-blob);
  padding: 22px; box-shadow: var(--sh-sm), var(--lift);
  transition: border-color .2s, box-shadow .18s var(--ease-out), transform .18s var(--ease-out);
  position: relative;
}
.panel::after {
  content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px;
  background: var(--grad-accent); opacity: .5; pointer-events: none;
  transition: opacity .2s var(--ease-out);
}
.panel:hover { box-shadow: var(--sh-md), var(--lift-strong); transform: translateY(-2px); }
.panel:hover::after { opacity: .9; }
.panel.pad-lg { padding: 30px; }
.glass {
  background: var(--glass-bg); border: var(--border-w) solid var(--glass-border);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
}
/* Auf schwachen Geräten ist backdrop-filter der teuerste Effekt dieses Looks — dort wird die
   Unschärfe komplett abgeschaltet und die Fläche stattdessen deckend gemacht (bleibt lesbar,
   nur ohne Milchglas). Ergänzt den --glass-blur:0-Schalter in tokens.css. */
html.low-power .panel, html.low-power .glass, html.low-power .modal, html.low-power #topbar, html.low-power #sidenav {
  -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface-solid);
}

.section-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 22px; position: relative; }
.section-head h2 { font-size: clamp(21px, 3vw, 27px); position: relative; padding-left: 16px; }
.section-head h2::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.section-head .sub { color: var(--text-dim); font-size: 14px; }
.section-head .grow { flex: 1; }
/* Design-Refresh (finale Runde): neue Signatur-Animation, bisher nirgends im Projekt verwendet —
   ein Verlaufs-Strich zieht sich beim Betreten jedes Screens unter dem Titel ein statt einfach
   dazustehen. Läuft über ::after am .section-head selbst (nicht am h2, damit die Breite unabhängig
   von der Titellänge konsistent bleibt). */
.section-head::after {
  content: ''; position: absolute; left: 16px; bottom: -10px; height: 3px; width: 64px;
  border-radius: var(--r-pill); background: var(--grad-accent); transform-origin: left center;
  animation: sectionUnderlineIn .55s var(--ease-spring, cubic-bezier(.3,1.4,.5,1)) .1s both;
}
@keyframes sectionUnderlineIn { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* Runde 17 (Plan-Punkt 25): wiederverwendbarer Panel-Innen-Kopf (h3 + optionales rechtes
   Tag/Badge) — bündelt das bisher an ~70 Stellen leicht unterschiedlich per Inline-Style
   nachgebaute Muster "Überschrift links, Kennzahl/Status rechts" in EINER Klasse. Siehe A.widgetHead() in ui.js. */
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.widget-head h3 { font-size: 15px; }
.widget-head .wh-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

/* Wiederverwendbares Icon-Container-Motiv — Arkade 3.0: weich gerundet mit Lichtkante,
   statt eckig (Runde 18) oder Kreis (Runde 9). */
.hex-frame {
  border-radius: var(--r-md);
  display: grid; place-items: center; background: var(--surface-hi); border: var(--border-w) solid var(--edge-line);
  box-shadow: var(--lift);
}

/* ---------- Grids ---------- */
.grid { display: grid; gap: 16px; }
/* Runde 18 (Nutzer-Fund): g2/g3/g4 sind Widget-/Formular-Grids mit oft WENIGEN Elementen —
   auto-fill reserviert dabei auf breiten Bildschirmen unsichtbare leere Spalten-Tracks rechts von
   den echten Karten (Inhalt klebt links, riesige Leerfläche rechts). auto-fit kollabiert leere
   Tracks komplett und lässt die echten Elemente den verfügbaren Platz ausfüllen — auf schmalen
   Viewports (Mobile/iPad) identisches Verhalten zu auto-fill (dort ist ohnehin nur 1-2 Spalten Platz).
   .grid.cards bleibt bewusst auto-fill: dort stehen fast immer genug Elemente (Spiele/Shop-Artikel),
   damit soll die letzte, ggf. unvollständige Reihe NICHT künstlich in die Breite gezogen werden. */
.grid.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.g4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
/* Runde 18: Home-Zeile "Tagesquests (breit) neben Freunde (schmal)" — 2:1-Verhältnis auf breiten
   Bildschirmen, fällt auf schmalen (Handy/iPad-Hochformat) auf eine Spalte zusammen, gleicher
   Breakpoint wie die mobile Bottom-Nav-Umschaltung (base.css), damit sich beide konsistent anfühlen. */
.grid.g-quests { grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .grid.g-quests { grid-template-columns: 1fr; } }
/* Runde 10: Karten, die (noch) nicht im sichtbaren Bereich sind, lässt der Browser komplett aus
   (Layout+Paint übersprungen) — spart Arbeit bei langen Spiele-/Shop-Listen, ohne irgendetwas optisch zu verändern. */
.grid.cards > *, #view .grid.g4 > *, #view .shop-item { content-visibility: auto; contain-intrinsic-size: 0 190px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Game Card ---------- */
.gcard {
  position: relative; border-radius: var(--r-blob-2); overflow: hidden; cursor: pointer;
  border: var(--border-w) solid var(--border); background: var(--surface-solid); box-shadow: var(--elev-1);
  transition: transform .16s var(--ease-out), box-shadow .16s var(--ease-out), border-color .16s;
  display: flex; flex-direction: column; min-height: 168px;
}
/* Runde 18: der cursor-folgende weiche Leucht-Rand ist entfernt (siehe .btn::after weiter oben) —
   Hover/Press laufen jetzt über dasselbe harte Schatten-Modell wie Buttons/Panels. */
.gcard:hover { transform: translateY(-4px); box-shadow: var(--sh-lg), var(--lift-strong); border-color: var(--border-hi); }
.gcard:active { transform: translateY(0); box-shadow: var(--sh-press); transition-duration: .08s; }
.gcard { border-top: var(--border-w) solid var(--border); }
.tilt-card { transition: transform .25s var(--ease-soft); }
.gcard .gc-art { transition: transform .4s var(--ease-soft); }
.gcard:hover .gc-art { transform: scale(1.06); }
.gcard .gc-art {
  height: 116px; display: grid; place-items: center; font-size: 52px; position: relative; overflow: hidden;
  background: var(--gc-grad, var(--grad-accent-soft)), var(--ink-1);
}
.gcard .gc-art { text-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.gcard .gc-art::after {
  content:''; position:absolute; inset:0; z-index: 1;
  background: radial-gradient(120% 90% at 50% 15%, transparent 30%, rgba(0,0,0,0.5) 100%);
}
.gcard .gc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.gcard .gc-title { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; }
.gcard .gc-desc { color: var(--text-mut); font-size: 12px; line-height: 1.4; }
.gcard .gc-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.gcard .gc-tag { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-sm); background: var(--surface-hi); color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.gcard .gc-best { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--gold); }
/* Badge sitzt links, weil rechts oben der Favoriten-Stern liegt — vorher lagen beide auf
   derselben Ecke und überdeckten sich gegenseitig (im Mobile-Test aufgefallen). */
.gcard .gc-badge { position: absolute; top: 10px; left: 10px; z-index: 2; font-size: 10px; font-weight: 800; padding: 4px 9px; border-radius: var(--r-pill); background: var(--grad-hot); color: #fff; letter-spacing: .05em; box-shadow: var(--sh-sm), var(--lift); }

/* Runde 14: sanftes Idle-Atmen für Lobby-Charaktere (rein CSS, kein rAF) */
.lobby-char-bob { animation: lobbyBob 2.6s ease-in-out infinite; }
@keyframes lobbyBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
html.low-power .lobby-char-bob, html.tab-hidden .lobby-char-bob { animation: none; }
.gcard.locked { opacity: .55; }
.gcard.locked::after { content: '🔒'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; background: rgba(0,0,0,0.45); z-index: 3; }

/* Category filter pills */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pill {
  padding: 8px 15px; border-radius: var(--r-pill); background: var(--surface); border: var(--border-w) solid var(--border);
  color: var(--text-dim); font-weight: 600; font-size: 13.5px; transition: all .15s;
}
.pill:hover { border-color: var(--border-hi); color: var(--text); }
.pill.active { background: var(--grad-accent); color: #0a0b10; border-color: var(--border-hi); font-weight: 700; position: relative; padding-left: 22px; }
.pill.active::before { content: ''; position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%; background: #0a0b10; }

/* ---------- Stat tiles ---------- */
.stat {
  background: var(--surface); border: var(--border-w) solid var(--edge-line); border-radius: var(--r-md);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.stat .st-ic.hex-frame { width: 34px; height: 34px; font-size: 16px; margin-bottom: 4px; }
.stat .st-val { font-family: var(--font-mono); font-size: 26px; font-weight: 700; }
.stat .st-lab { color: var(--text-mut); font-size: 12.5px; font-weight: 600; }
.stat .st-ic { font-size: 20px; margin-bottom: 2px; }

/* ---------- Progress ---------- */
.bar { height: 9px; border-radius: var(--r-pill); background: var(--surface-hi); overflow: hidden; border: var(--border-w) solid var(--border); box-shadow: var(--sh-press); }
.bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--grad-accent); transition: width .5s var(--ease); box-shadow: 0 0 12px var(--accent-glow); }
.ring { transform: rotate(-90deg); }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; padding: 13px 20px; border-radius: var(--r-pill);
  background: var(--surface-hi); border: var(--border-w) solid var(--border-hi);
  font-weight: 600; font-size: 14px; box-shadow: var(--sh-lg); display: flex; align-items: center; gap: 10px;
  animation: toastIn .4s var(--ease); max-width: 90vw;
}
.toast { box-shadow: var(--sh-lg), var(--lift); }
.toast.gold { border-color: rgba(255,176,32,0.55); box-shadow: var(--sh-lg), 0 0 24px rgba(255,176,32,0.25), var(--lift); }
.toast.good { border-color: rgba(52,211,153,0.55); box-shadow: var(--sh-lg), 0 0 24px rgba(52,211,153,0.22), var(--lift); }
.toast.bad { border-color: rgba(251,113,133,0.55); box-shadow: var(--sh-lg), 0 0 24px rgba(251,113,133,0.22), var(--lift); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .3s var(--ease-in) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.95); } }

/* ---------- Modal ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 150; display: none; align-items: center; justify-content: center;
  padding: 20px; background: var(--overlay);
}
.modal-scrim.open { display: flex; animation: fadeIn .25s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto; border-radius: var(--r-blob-modal);
  background: var(--glass-bg), var(--bg-2);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 1.5)); backdrop-filter: blur(calc(var(--glass-blur) * 1.5));
  border: var(--border-w) solid var(--glass-border); box-shadow: var(--sh-xl), var(--lift-strong);
  padding: 26px; animation: modalIn .35s var(--ease); position: relative;
}
.modal::before { content: ''; position: absolute; left: 26px; right: 26px; top: 0; height: 2px; border-radius: var(--r-pill); background: var(--grad-accent); opacity: .85; }
.modal::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--grain-layer); opacity: .5; mix-blend-mode: overlay; border-radius: inherit; }
.modal.wide { max-width: 820px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

/* Bottom-Sheet-Variante für Handy (Runde 7) */
.modal-scrim.sheet-scrim { align-items: flex-end; padding: 0; }
.modal.sheet {
  max-width: 100%; width: 100%; max-height: 86dvh; border-radius: var(--r-xl) var(--r-xl) 0 0;
  animation: sheetIn .35s var(--ease-out); padding-bottom: max(22px, env(safe-area-inset-bottom));
}
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 44px; height: 5px; border-radius: var(--r-pill); background: var(--border-hi); margin: 0 auto 14px; touch-action: none; cursor: grab; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { font-size: 21px; flex: 1; }
.modal-close { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--surface); border: var(--border-w) solid var(--border); color: var(--text-dim); font-size: 18px; display: grid; place-items: center; }
.modal-close:hover { color: var(--text); }

/* ---------- Inputs ---------- */
.input, select.input, textarea.input {
  width: 100%; padding: 12px 15px; border-radius: var(--r-md); background: var(--bg-1);
  border: var(--border-w) solid var(--border); color: var(--text); font-size: 15px; font-family: inherit; transition: border-color .2s, box-shadow .2s;
}
/* Arkade 3.0: weicher Fokus-Ring zurück (--ring), zusätzlich zur Randfarbe — im neuen Look
   trägt Licht die Zustände, nicht Kontur-Dicke. */
.input { box-shadow: var(--sh-press); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-dim); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
/* Arkade 3.0: Pillenform zurück, runder Knopf mit eigenem Schatten (physisches Schalter-Gefühl). */
.toggle { position: relative; width: 46px; height: 26px; border-radius: var(--r-pill); background: var(--surface-hi); border: var(--border-w) solid var(--border); transition: all .15s; flex-shrink: 0; box-shadow: var(--sh-press); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: all .15s var(--ease-out); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.toggle.on { background: var(--grad-accent); transition: background .2s var(--ease-out); }
.toggle.on::after { left: 26px; transition: left .2s var(--ease-out); }

/* Runde 7: allgemeiner Aufmerksamkeits-Puls für Wallet/Erfolgs-Feedback */
.a-pulse { animation: aPulse .5s var(--ease-bounce); }
@keyframes aPulse { 0% { transform: scale(1); } 40% { transform: scale(1.22); filter: drop-shadow(0 0 10px var(--accent-glow)); } 100% { transform: scale(1); } }

/* Runde 7: Shake bei Formfehlern */
.shake-err { animation: shakeErr .4s var(--ease-bounce); border-color: var(--red) !important; }
@keyframes shakeErr { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

/* Runde 7: Slide-Underline beim Nav-Wechsel (aktive Markierung bereits vorhanden, hier weicherer Übergang) */
.nav-item.active::before { transition: top .3s var(--ease-spring), height .3s var(--ease-spring); }

/* Badge / tag */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--r-sm); font-size: 12px; font-weight: 700; background: var(--surface-hi); }
.tag.new { background: var(--grad-hot); color: #fff; }
.tag.hot { background: var(--grad-warm); color: #201400; }
.tag.owned { background: rgba(52,211,153,0.16); color: var(--green); }

/* Countdown pill for perks */
.countdown { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); display: inline-flex; align-items: center; gap: 5px; }

/* Divider */
.hr { height: 1px; background: var(--edge-line); margin: 18px 0; border: none; }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--text-mut); }
.empty .em-ic { font-size: 46px; margin-bottom: 12px; opacity: .7; animation: emptyFloat 3s ease-in-out infinite; display: inline-block; }
@keyframes emptyFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Panel-Akzent-Varianten — Arkade 3.0: färben die neue Licht-Linie an der Oberkante (.panel::after)
   statt einen dicken Rand zu setzen; dadurch bleibt die Panel-Kontur überall gleich ruhig. */
.panel.accent-violet::after { background: var(--accent); opacity: .85; }
.panel.accent-cyan::after { background: var(--accent-2); opacity: .85; }
.panel.accent-gold::after { background: var(--gold); opacity: .85; }

/* Runde 7: allgemeine Glow-Hover-Utility (für Elemente außerhalb .btn/.gcard) */
.glow-hover { transition: box-shadow .3s var(--ease-soft), transform .3s var(--ease-soft); }
.glow-hover:hover { box-shadow: var(--glow-2); transform: translateY(-2px); }

/* Runde 17 (Abschnitt J): 4-stufiges Rarity-System, auf die aktuelle Koralle/Violett-Palette
   abgestimmt (löst die toten Pink/Gold-Werte + den toten --r-cut-Verweis aus Runde 7/8 ab).
   Gewöhnlich bekommt bewusst KEINE Sonderoptik (Standard-Rahmen reicht) — Auffälligkeit steigt
   erst ab "Selten", damit die Stufen wirklich als Fortschritt lesbar sind. */
.rarity-rare { border-color: rgba(96,165,250,0.45) !important; box-shadow: 0 0 16px rgba(96,165,250,0.20), var(--lift); }
.rarity-epic { border-color: rgba(124,92,255,0.55) !important; box-shadow: 0 0 22px rgba(124,92,255,0.28), var(--lift); }
.rarity-legendary { border-color: rgba(255,176,32,0.6) !important; box-shadow: 0 0 28px rgba(255,176,32,0.30), 0 0 16px rgba(244,114,182,0.20), var(--lift-strong); position: relative; }
.rarity-legendary::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--grad-accent); opacity: .55;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.rarity-badge { font-size: 9.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; display: inline-block; }
.rarity-badge.rarity-rare { box-shadow: none; background: rgba(96,165,250,0.18); color: #93c5fd; border: 1px solid rgba(96,165,250,0.35) !important; }
.rarity-badge.rarity-epic { box-shadow: none; background: rgba(124,92,255,0.18); color: #c4b5fd; border: 1px solid rgba(124,92,255,0.4) !important; }
.rarity-badge.rarity-legendary { box-shadow: none; background: var(--grad-accent-soft); color: #fcd34d; border: 1px solid rgba(255,176,32,0.45) !important; }
.rarity-badge.rarity-legendary::after { display: none; }

/* Runde 8: feiner Grain-/Scanline-Layer — Utility, additiv auf position:relative-Elemente anwendbar */
.grain::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: var(--grain-layer); opacity: .5; border-radius: inherit; mix-blend-mode: overlay;
}
/* Runde 8: dünne kantige Rahmenlinie statt vollflächigem Glow — "Cyber"-Note */
.edge-line { border-color: var(--edge-line) !important; box-shadow: inset 0 0 0 1px var(--edge-line); }

/* Confetti canvas */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 180; }

/* Event announcement (fullscreen) */
.event-announce { position: fixed; inset: 0; z-index: 195; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle at 50% 40%, rgba(255,84,112,0.18), transparent 60%); }
.event-announce .ea-card {
  text-align: center; padding: 34px 48px; border-radius: var(--r-xl);
  background: var(--bg-2); border: var(--border-w-lg) solid var(--border-hi);
  box-shadow: var(--sh-xl); animation: eaPop .7s var(--ease);
}
.event-announce .ea-emoji { font-size: 60px; animation: eaBounce 1s var(--ease) infinite alternate; }
.event-announce .ea-title { font-family: var(--font-display); font-size: clamp(26px, 6vw, 42px); font-weight: 700; margin: 8px 0 6px; background: var(--grad-hot); -webkit-background-clip: text; background-clip: text; color: transparent; }
.event-announce .ea-sub { color: var(--text-dim); font-size: 16px; }
@keyframes eaPop { 0% { transform: scale(.5) translateY(40px); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes eaBounce { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-12px) rotate(6deg); } }

/* Anime-Charakter Idle-Animation (Runde 4) */
.anime-blink { transform-box: fill-box; transform-origin: center; animation: animeBlink 4.2s ease-in-out infinite; }
@keyframes animeBlink { 0%, 92%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.08); } 96% { transform: scaleY(1); } }
.anime-float { transform-box: fill-box; transform-origin: center; animation: animeFloat 3.6s ease-in-out infinite; }
@keyframes animeFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.2%); } }

/* Public Chat (Runde 4) */
.chat-list { height: min(50vh, 420px); overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.chat-line { max-width: 80%; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface); border: var(--border-w) solid var(--edge-line); animation: chatIn .3s var(--ease-out); }
.chat-line.mine { align-self: flex-end; background: var(--grad-accent-soft); border-color: var(--accent); }
.chat-user { font-weight: 700; font-size: 12.5px; margin-right: 8px; }
.chat-time { font-size: 10.5px; color: var(--text-mut); font-family: var(--font-mono); }
.chat-text { font-size: 14px; margin-top: 3px; word-break: break-word; }
/* Arkade 3.0: eigene animierte Sticker als Chat-Inhalt (js/data/stickerArt.js) — größer als eine
   normale Textzeile und ohne die Sprechblasen-Innenpolsterung, damit der Sticker wie ein
   aufgeklebtes Bild wirkt statt wie eingerahmter Text. */
.chat-line:has(.chat-sticker) { background: transparent; border-color: transparent; padding: 4px 2px; }
.chat-sticker { margin-top: 4px; line-height: 0; }
@keyframes chatIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.chat-emoji-pop { position: absolute; bottom: 6px; font-size: 30px; animation: chatPop 2.2s ease-out forwards; pointer-events: none; }
@keyframes chatPop { 0% { opacity: 0; transform: translateY(0) scale(.5); } 15% { opacity: 1; transform: translateY(-20px) scale(1.15); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-160px) scale(1); } }

/* Levelpfad Meilenstein-Puls (Runde 4) */
@keyframes lvlPulse { 0%,100% { box-shadow: 0 0 20px var(--accent-glow); } 50% { box-shadow: 0 0 34px var(--accent-glow), 0 0 12px #fff; } }

/* Levelpfad Glühwürmchen im Kosmos-Bereich (Runde 7) — reines CSS, kein Canvas-rAF */
@keyframes lvlFirefly {
  0%, 100% { opacity: .15; transform: translate(0,0) scale(.8); }
  50% { opacity: 1; transform: translate(6px,-8px) scale(1.3); }
}
/* Runde 17 (Abschnitt P): Regenstreifen im Bergbereich des Levelpfads — reine CSS-Fallanimation. */
@keyframes lvlRain { 0% { transform: translateY(-20px); opacity: 0; } 15% { opacity: .8; } 100% { transform: translateY(40px); opacity: 0; } }
/* Runde 17 (Abschnitt J, Punkt 150): fließender Verlauf in der Spuren-Vorschau statt starrer Fläche. */
@keyframes trailFlow { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }

/* Levelpfad Runde 8: Wind-Sway für DOM-Bäume, Wolken-Drift-Textur, Vogel-Flug, rotierender Marker-Ring */
@keyframes lvlSway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes lvlCloudDrift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes lvlBirdFly {
  0% { transform: translate(0,0) scaleX(1); opacity: 0; }
  6% { opacity: .8; }
  45% { transform: translate(220px,-26px) scaleX(1); }
  50% { transform: translate(240px,-30px) scaleX(-1); }
  94% { opacity: .8; }
  100% { transform: translate(0,-4px) scaleX(-1); opacity: 0; }
}
@keyframes lvlSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Runde 17 Punkt 159: glossiger Sheen-Sweep über "done"-Meilenstein-Marker */
@keyframes lvlSheen { 0% { transform: translateX(-120%) rotate(20deg); } 100% { transform: translateX(220%) rotate(20deg); } }

/* Runde 17 Punkt 160: Mini-Vorschau-Animation beim Erreichen eines Meilensteins */
@keyframes lvlMsPreviewIn {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.4) rotate(-8deg); }
  55% { opacity: 1; transform: translate(-50%,-50%) scale(1.12) rotate(3deg); }
  75% { transform: translate(-50%,-50%) scale(.96) rotate(-1deg); }
  100% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(0deg); }
}
@keyframes lvlMsPreviewOut { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.85); } }

/* Home Hero card (Runde 5 — Design-Overhaul 3, Runde 18: Brutal-Umbau) */
/* Arkade 3.0: der Hero ist die einzige Fläche, die bewusst tiefer liegt als der Rest — dunkles
   "Sichtfenster" mit Lichtwolke, statt der flachen Vollton-Poster-Fläche aus Runde 18. */
.hero-card {
  position: relative; overflow: hidden; padding: clamp(24px, 4vw, 38px);
  border-radius: var(--r-blob); border: var(--border-w) solid var(--border);
  background: radial-gradient(120% 90% at 80% -10%, rgba(124, 92, 255, 0.22), transparent 62%), var(--ink-1);
  box-shadow: var(--sh-lg), var(--lift);
}
.hero-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--grad-accent); }
.hero-card::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: none; }
.hero-avatar { position: relative; }
.hero-avatar::after { content: ''; position: absolute; inset: -7px; border-radius: var(--r-lg); border: var(--border-w) solid var(--edge-line); pointer-events: none; }
/* Weiche Lichtwolke in der Ecke — ersetzt das harte Dreieck aus Runde 18. */
.hero-glow {
  position: absolute; top: -40px; right: -40px; width: 240px; height: 240px;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  pointer-events: none;
}
.hero-name { font-size: clamp(30px, 5.5vw, 44px); margin: 2px 0 4px; color: var(--accent); }
.hero-stat { padding: 10px 18px; border-radius: var(--r-md); background: var(--surface-hi); border: var(--border-w) solid var(--edge-line); min-width: 88px; box-shadow: var(--sh-sm); }
.hero-stat.gold { border-color: var(--gold); }
.hero-stat-v { font-family: var(--font-mono); font-weight: 700; font-size: 20px; }
.hero-stat.gold .hero-stat-v { color: var(--gold); }
.hero-stat-l { font-size: 11px; color: var(--text-mut); margin-top: 2px; }
/* Arkade 3.0: eigene Kopfzeile statt der generischen .row — die durfte umbrechen, wodurch der
   Avatar auf schmalen Handys unter die Statistik-Kacheln rutschte und dort mit der darunter
   liegenden XP-Leiste überlappte (im Mobile-Test sichtbar geworden). Jetzt feste zwei Spalten,
   die nicht umbrechen; auf sehr schmalen Geräten weicht stattdessen der Avatar. */
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: nowrap; position: relative; }
.hero-avatar { width: 108px; height: 132px; flex-shrink: 0; overflow: hidden; display: grid; place-items: center; filter: drop-shadow(0 10px 24px rgba(0,0,0,0.4)); }
.hero-avatar > svg { max-width: 100%; max-height: 100%; }
/* Schnellaktionen unter dem Hero */
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; position: relative; }
@media (max-width: 560px) { .hero-avatar { width: 76px; height: 92px; } .hero-stat { min-width: 70px; padding: 7px 12px; } }
@media (max-width: 420px) { .hero-avatar { display: none; } }

/* Animated titles */
.title-anim { font-weight: 800; letter-spacing: .02em; background-clip: text; -webkit-background-clip: text; color: transparent; }
/* Runde 15: kein Rainbow-Shimmer mehr — ruhige, klar unterscheidbare Farbtöne statt Dauer-Animation */
.title-shimmer { background: none; color: var(--gold); }
.title-flow { background: none; color: var(--accent); }
.title-rainbow { background: none; color: var(--accent-3); }
.title-glow { color: var(--accent); }
@keyframes titleShine { to { background-position: 200% 0; } }
@keyframes titleGlow { 0%,100% { opacity: .75; } 50% { opacity: 1; } }

/* Responsive card grids (placed here to win the cascade over the base .grid.cards) */
@media (max-width: 680px) { .grid.cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; } }
@media (max-width: 400px) { .grid.cards { grid-template-columns: 1fr 1fr; gap: 10px; } }
/* Runde 21 (Responsive-Audit): .grid.g2/g3/g4 hatten bisher KEINE Mobile-Werte (im Unterschied zu
   .grid.cards oben) — betraf u.a. die Farm- und Charakter-Raster, die auf schmalen Handys nahe an
   den Rand gedrückt bzw. potenziell abgeschnitten wurden. Gleiche Breakpoints wie .grid.cards. */
@media (max-width: 680px) {
  .grid.g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
  .grid.g3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .grid.g4 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
}
@media (max-width: 400px) {
  .grid.g2 { grid-template-columns: 1fr; gap: 10px; }
  .grid.g3 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid.g4 { grid-template-columns: 1fr 1fr; gap: 8px; }
}
