:root {
  --bg: #06070c;
  --ink: #f4f2ff;
  --muted: rgba(232, 228, 255, .58);
  --faint: rgba(232, 228, 255, .14);
  --cyan: #7cf3ff;
  --violet: #c58bff;
  --gold: #ffd36b;
  --tint: 124, 243, 255;

  --card: 280px;          /* wird per JS an die Fenstergröße angepasst */
  --bg-angle: -45deg;     /* +45° (mathematisch): Reihen steigen nach rechts oben */
  --bg-size: 92px;
  --bg-gap: 28px;

  --gx: 50;               /* Glanz-Position (0–100), folgt der Maus */
  --gy: 50;

  --ring-y: 42%;          /* Höhe des Karussells (Scheitel des Regenbogens) */

  --font: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { user-select: none; -webkit-user-select: none; touch-action: none; }

img { -webkit-user-drag: none; }

button { font: inherit; color: inherit; }

kbd {
  font-family: var(--mono);
  font-size: .78em;
  padding: .1em .45em;
  border-radius: 5px;
  border: 1px solid var(--faint);
  background: rgba(255, 255, 255, .04);
}

/* ---------- Hintergrund: diagonale Ordner-Reihen ---------- */

.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-plane {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--bg-gap);
  transform: translate(-50%, -50%) rotate(var(--bg-angle));
  will-change: transform;
}

.bg-row {
  display: block;
  flex: none;
  align-self: flex-start;   /* sonst staucht die Flex-Spalte die Leinwand auf Plane-Breite */
  animation: bg-scroll var(--dur, 160s) linear infinite;
  will-change: transform;
}

.bg-row.right { animation-direction: reverse; }
.bg-row.fade { opacity: 0; transition: opacity 1.2s ease; }   /* erster Aufbau: Reihen blenden sanft ein */
.bg-row.fade.in { opacity: 1; }

@keyframes bg-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

.aura {
  position: fixed;
  left: 50%;
  top: var(--ring-y);
  width: min(120vw, 1300px);
  aspect-ratio: 1.6;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(var(--tint), .26), rgba(var(--tint), .07) 55%, transparent 75%);
  opacity: 0;
  transition: opacity 1.1s ease;   /* zwei Ebenen blenden beim Ordnerwechsel weich über */
  pointer-events: none;
}

.aura.on { opacity: 1; }

.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 42% at 50% var(--ring-y), rgba(6, 7, 12, .72), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(6, 7, 12, .9)),
    linear-gradient(to bottom, rgba(6, 7, 12, .7), transparent 22%, transparent 62%, rgba(6, 7, 12, .95));
}

/* Unter dem Ordner-Bogen wird der Hintergrund dunkler und grauer. Die Ellipse (Größe und Lage
   rechnet app.js aus) folgt mit ihrer Oberkante dem Bogen, die Kante läuft weich aus. */
.under {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(10, 11, 15, .58), rgba(6, 7, 10, .8) 70%);
  -webkit-mask: radial-gradient(var(--ux, 1300px) var(--uy, 420px) at 50% var(--ucy, 130%), #000 84%, transparent 100%);
  mask: radial-gradient(var(--ux, 1300px) var(--uy, 420px) at 50% var(--ucy, 130%), #000 84%, transparent 100%);
}

/* ---------- Kopfzeile ---------- */

.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* Logo | Filter | Bundle – alle auf einer Höhe */
  align-items: center;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 4vw, 44px) 0;
}

.top .brand { justify-self: start; }
.top .chips { justify-self: center; }
.top .bundle-btn { justify-self: end; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 19px;
  letter-spacing: -.01em;
  font-weight: 500;
}

.brand svg { width: 30px; height: 30px; }
.brand b { font-weight: 800; }

.bundle-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 7px 7px 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  font-size: 14px;
  transition: border-color .2s, background .2s, transform .2s;
}

.bundle-btn:hover { border-color: rgba(255, 255, 255, .34); background: rgba(255, 255, 255, .09); transform: translateY(-1px); }

.bundle-price {
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  color: #12081f;
  background: linear-gradient(120deg, var(--cyan), var(--violet) 60%, #ff9ad5);
  background-size: 200% 100%;
  animation: shine 6s ease-in-out infinite;
}

@keyframes shine { 50% { background-position: 100% 0; } }

/* ---------- Filter (in der Kopfzeile) ---------- */

.chips {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--faint);
  background: rgba(10, 11, 20, .55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chip {
  border: 0;
  background: transparent;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, background .2s;
}

.chip:hover { color: var(--ink); }
.chip[aria-selected="true"] { color: #0b0c14; background: var(--ink); font-weight: 650; }
.chip small { opacity: .6; margin-left: 4px; font-size: 11px; }


/* ---------- Bühne & Karussell ---------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 5;
  perspective: calc(var(--card) * 4.2);
  perspective-origin: 50% var(--ring-y);  /* auf Karussell-Höhe: die Bogenform kommt allein aus app.js */
  cursor: grab;
}

.stage.dragging { cursor: grabbing; }

.ring {
  position: absolute;
  left: 50%;
  top: var(--ring-y);
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

.card {
  position: absolute;
  left: calc(var(--card) / -2);
  top: calc(var(--card) / -2);
  width: var(--card);
  height: var(--card);
  transform-style: preserve-3d;
  will-change: transform, opacity;
  cursor: pointer;
}

.card img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

.tilt {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

/* Dicke und Glanz nur bei Ordnern, wo man sie sieht (spart Grafikarbeit) */
.card:not(.deep) .layer,
.card:not(.lit) .glare { display: none; }

/* Dicke des 3D-Ordners: gestapelte, abgedunkelte Kopien hinter der Vorderseite */
.layer {
  position: absolute;
  inset: 0;
  filter: brightness(.32) saturate(.7);
  transform: translateZ(calc(var(--i) * -1.5px));
}

.front {
  position: absolute;
  inset: 0;
  isolation: isolate;
  transform: translateZ(0);
}

/* Sanfter Lichtreflex, folgt der Neigung – bewusst dezent, damit die Farben echt bleiben */
.glare {
  position: absolute;
  inset: 0;
  -webkit-mask: var(--img) center / contain no-repeat;
  mask: var(--img) center / contain no-repeat;
  background: radial-gradient(circle at calc(var(--gx) * 1%) calc(var(--gy) * 1%),
    rgba(255, 255, 255, .5), rgba(255, 255, 255, .08) 30%, transparent 55%);
  mix-blend-mode: soft-light;
  opacity: calc(var(--focus, 0) * .7);
  pointer-events: none;
}

/* Glitzer-Spray: wird von app.js nur dort gemalt, wo die Maus gerade über den Ordner fährt */
.spray {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .8;
  pointer-events: none;
}

.reflect {
  position: absolute;
  left: 0;
  top: 100%;
  transform: translateY(calc(var(--card) * -.06)) scaleY(-1);
  opacity: calc(var(--refl, 1) * .22);
  -webkit-mask: linear-gradient(to top, rgba(0, 0, 0, .9), transparent 42%);
  mask: linear-gradient(to top, rgba(0, 0, 0, .9), transparent 42%);
}

.shadow {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 2%;
  height: 12%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .7), transparent);
  transform: translateY(40%) rotateX(80deg);
  filter: blur(4px);
}

.empty {
  position: absolute;
  left: 50%;
  top: var(--ring-y);
  transform: translate(-50%, -50%);
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.sparkles {
  position: fixed;
  z-index: 6;
  pointer-events: none;
}

/* ---------- Info unter dem Ordner ---------- */

.info {
  position: fixed;
  left: 50%;
  bottom: clamp(52px, 9vh, 96px);
  z-index: 10;
  width: min(760px, calc(100vw - 32px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.info > * { pointer-events: auto; }

.counter {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--muted);
}

.nav {
  position: relative;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .55));
  transition: transform .18s;
}

/* Unsichtbares, großes Klickfeld: man muss den Pfeil nicht genau treffen */
.nav::before { content: ""; position: absolute; top: -22px; bottom: -22px; }
.nav.prev::before { left: -38px; right: -8px; }
.nav.next::before { left: -8px; right: -38px; }
.nav svg { display: block; width: 100%; height: 100%; }
.nav.prev:hover { transform: translateX(-3px); }
.nav.next:hover { transform: translateX(3px); }

/* ---------- Ordnername = Suchfeld ---------- */

.title-row {
  display: flex;              /* eigene Zeile unter dem Zähler, Inhalt mittig */
  align-items: center;
  justify-content: center;
  gap: .3em;
  margin: 10px 0 6px;
  font-size: clamp(28px, 4.6vw, 58px);
}

h1 {
  margin: 0;
  font-size: 1em;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.035em;
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(var(--tint), .35);
  cursor: text;
}

.pen {
  position: relative;
  flex: none;
  width: max(.44em, 18px);
  height: max(.44em, 18px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  /* unsichtbar, bis der Name eingeblendet ist – dann kleine Bewegung ins Bild */
  opacity: 0;
  transform: translateX(-10px) rotate(-25deg) scale(.8);
  pointer-events: none;
  transition: opacity .35s ease, transform .5s cubic-bezier(.2, .9, .3, 1.35), color .2s;
}

.pen.show { opacity: 1; transform: none; pointer-events: auto; }
.pen::before { content: ""; position: absolute; inset: -.35em; }   /* größeres Klickfeld */
.pen svg { display: block; width: 100%; height: 100%; }
.title-row:hover .pen.show { color: var(--ink); transform: rotate(-10deg); }

/* Beim Suchen: bunte Schrift, die langsam durch dezente Farbpaare wandert, dazu ein farbiger Cursor */
.title-search {
  display: none;
  width: min(640px, 80vw);
  field-sizing: content;          /* wächst mit dem Text mit (wo unterstützt), Stift bleibt nah dran */
  min-width: 1.2em;
  max-width: min(640px, 80vw);
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.035em;
  text-align: center;
  color: transparent;
  background: linear-gradient(90deg, #ff6b6b, #ffa94d, #69db7c, #c0eb75, #b197fc, #f783ac, #ff6b6b) 0 0 / 600% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  caret-color: #ff6b6b;
  animation: ink-drift 30s linear infinite, caret-drift 30s linear infinite;
}

.title-search::-webkit-search-cancel-button { display: none; }

.info.editing h1 { display: none; }
.info.editing .title-search { display: block; }
.info.editing .pen { display: none; }   /* beim Tippen kein Stift */

@keyframes ink-drift { to { background-position: 100% 0; } }

@keyframes caret-drift {
  0%, 100% { caret-color: #ff6b6b; }
  17% { caret-color: #ffa94d; }
  33% { caret-color: #69db7c; }
  50% { caret-color: #c0eb75; }
  67% { caret-color: #b197fc; }
  83% { caret-color: #f783ac; }
}

/* Solange gefiltert wird: kleiner Hinweis mit Trefferzahl, Klick setzt die Suche zurück */
.query-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--tint), .45);
  background: rgba(var(--tint), .12);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.query-pill span { opacity: .7; }

.info.no-results .counter,
.info.no-results .actions { visibility: hidden; }


.meta {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #1a1203;
  background: var(--gold);
  vertical-align: 1px;
}

.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s, border-color .2s, background .2s, box-shadow .2s;
}

.btn svg { width: 18px; height: 18px; }
.btn small { font-weight: 500; font-size: 12px; color: var(--muted); }
.btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .36); }

.btn.primary {
  border-color: transparent;
  color: #0b0c14;
  background: linear-gradient(120deg, #fff, rgb(var(--tint)) 140%);
  box-shadow: 0 8px 30px -8px rgba(var(--tint), .7);
}

.btn.primary small { color: rgba(11, 12, 20, .6); }
.btn.primary:hover { box-shadow: 0 12px 40px -8px rgba(var(--tint), .9); }

/* ---------- Fußzeile ---------- */

.foot {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 clamp(16px, 4vw, 44px) max(16px, env(safe-area-inset-bottom));
  font-size: 12px;
  color: var(--muted);
}

.hint kbd { margin-right: 3px; }

.links { display: flex; gap: 16px; }

.links button,
.links a {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--faint);
}

.links button:hover,
.links a:hover { color: var(--ink); }

/* ---------- Dialoge ---------- */

.sheet {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(14, 15, 26, .9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
  user-select: text;
}

.sheet::backdrop { background: rgba(3, 3, 8, .6); backdrop-filter: blur(4px); }
.sheet[open] { animation: pop .35s cubic-bezier(.2, .9, .3, 1.2); }

@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.sheet h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.02em; }
.sheet h3 { margin: 18px 0 6px; font-size: 15px; color: var(--cyan); }
.sheet ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.sheet ol b { color: var(--ink); }
.sheet code { font-family: var(--mono); font-size: 12px; }
.lead { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.lead b { color: var(--ink); }

.close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--faint);
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.ticks { list-style: none; margin: 0 0 22px; padding: 0; font-size: 14px; }
.ticks li { padding: 5px 0 5px 26px; position: relative; }
.ticks li::before { content: "✦"; position: absolute; left: 4px; color: var(--gold); }

.btn.big { width: 100%; justify-content: center; padding: 15px; font-size: 17px; border-radius: 16px; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.note { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

.fan {
  position: relative;
  height: 120px;
  margin: 4px 0 18px;
}

.fan img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 104px;
  height: 104px;
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(var(--r)) translateX(var(--x));
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5));
}

/* ---------- Kleine Bildschirme ---------- */

/* Mittlere Breite: Filter rutschen unter Logo und Bundle-Knopf */
@media (max-width: 900px) {
  :root { --ring-y: 44%; }
  .top { grid-template-columns: 1fr auto; row-gap: 10px; }
  .top .chips { grid-column: 1 / -1; grid-row: 2; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
}

@media (max-width: 720px) {
  .bundle-label { display: none; }
  .bundle-btn { padding-left: 7px; }
  .bundle-btn::before { content: "Bundle"; padding-left: 8px; font-weight: 600; }
  .hint { display: none; }
  .foot { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-row, .bundle-price { animation: none; }
}
