/* ==========================================================================
   Nexona – Design-Tokens & Komponenten
   Farben liegen als RGB-Kanäle vor, damit Tailwind sie mit Opazität nutzen
   kann: rgb(var(--c-brand) / <alpha-value>).
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --c-base: 7 8 12;
  --c-base-2: 10 12 18;
  --c-surface: 15 17 25;
  --c-surface-2: 22 25 36;
  --c-surface-3: 30 34 48;
  --c-line: 34 38 54;
  --c-line-strong: 50 55 76;
  --c-fg: 236 238 246;
  --c-fg-muted: 158 164 186;
  --c-fg-subtle: 110 116 140;
  --c-brand: 139 92 246;
  --c-brand-2: 59 130 246;
  --c-brand-text: 196 181 253;
  --c-accent: 16 185 129;
  --c-accent-text: 52 211 153;
  --c-warn: 245 158 11;
  --c-warn-text: 252 211 77;
  --c-danger: 244 63 94;
  --c-danger-text: 251 113 133;
  --c-info: 56 189 248;
  --c-info-text: 125 211 252;
  --glow: 1;
  --grid-rgb: 255 255 255;
  --grid-alpha: 0.035;
  --shadow-rgb: 0 0 0;
  --shadow-alpha: 0.55;
}

:root[data-theme="light"] {
  color-scheme: light;
  --c-base: 246 247 251;
  --c-base-2: 239 241 248;
  --c-surface: 255 255 255;
  --c-surface-2: 244 245 250;
  --c-surface-3: 233 235 244;
  --c-line: 225 228 238;
  --c-line-strong: 203 208 224;
  --c-fg: 15 17 26;
  --c-fg-muted: 80 87 110;
  --c-fg-subtle: 120 127 150;
  --c-brand: 124 58 237;
  --c-brand-2: 37 99 235;
  --c-brand-text: 109 40 217;
  --c-accent: 5 150 105;
  --c-accent-text: 4 120 87;
  --c-warn: 217 119 6;
  --c-warn-text: 180 83 9;
  --c-danger: 225 29 72;
  --c-danger-text: 190 18 60;
  --c-info: 2 132 199;
  --c-info-text: 3 105 161;
  --glow: 0.45;
  --grid-rgb: 15 17 26;
  --grid-alpha: 0.05;
  --shadow-rgb: 30 27 75;
  --shadow-alpha: 0.16;
}

/* --------------------------------------------------------------------------
   Basis
   -------------------------------------------------------------------------- */
html { background: rgb(var(--c-base)); scroll-padding-top: 5rem; }
body {
  /* transparent, damit die fixierte Hintergrund-Ebene (.app-bg, 3D-Blöcke) sichtbar ist –
     die Grundfarbe kommt vom html-Element */
  background: transparent;
  color: rgb(var(--c-fg));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#app { flex: 1 0 auto; outline: none; }
::selection { background: rgb(var(--c-brand) / 0.35); color: rgb(var(--c-fg)); }

h1, h2, h3, h4, .font-display { font-family: Sora, Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.015em; }

:focus-visible { outline: 2px solid rgb(var(--c-brand)); outline-offset: 2px; border-radius: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.skip-link {
  position: fixed; left: 1rem; top: -4rem; z-index: 100;
  padding: 0.6rem 1rem; border-radius: 0.75rem;
  background: rgb(var(--c-brand)); color: #fff; font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

* { scrollbar-width: thin; scrollbar-color: rgb(var(--c-line-strong)) transparent; }

/* Hintergrund: Voxel-Raster + weiche Glows */
/* Höhe = großer Viewport, damit die Ebene beim Ein-/Ausblenden der mobilen Adressleiste nicht springt */
.app-bg { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none; overflow: hidden; }
.app-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgb(var(--grid-rgb) / var(--grid-alpha)) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--grid-rgb) / var(--grid-alpha)) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 78%);
}
.app-bg::after {
  content: ""; position: absolute; left: -10%; right: -10%; top: -25%; height: 80vh;
  background:
    radial-gradient(38% 45% at 18% 35%, rgb(var(--c-brand) / calc(0.20 * var(--glow))), transparent 70%),
    radial-gradient(32% 40% at 82% 25%, rgb(var(--c-brand-2) / calc(0.16 * var(--glow))), transparent 70%);
}

/* 3D-Hintergrund (schwebende Voxel-Blöcke, siehe ui/background.js).
   Zur Mitte hin abgedunkelt, damit Texte gut lesbar bleiben. */
.bg-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  -webkit-mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, rgba(0, 0, 0, 0.42), #000 88%);
  mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, rgba(0, 0, 0, 0.42), #000 88%);
}
:root[data-theme="light"] .bg-canvas { opacity: 0.85; }

/* Boot-Anzeige */
.boot { min-height: 60vh; display: grid; place-items: center; }
.boot-logo {
  width: 150px; height: auto;
  animation: bootPulse 1.4s ease-in-out infinite;
}
@keyframes bootPulse { 0%, 100% { transform: scale(0.96); opacity: 0.65; } 50% { transform: scale(1); opacity: 1; } }

/* Logo: nicht markierbar, im Light Mode mit leichtem Schatten für klare Kanten */
.brand-logo { user-select: none; -webkit-user-drag: none; }
:root[data-theme="light"] .brand-logo { filter: drop-shadow(0 1px 1.5px rgb(15 17 26 / 0.25)); }

/* --------------------------------------------------------------------------
   Layout-Helfer
   -------------------------------------------------------------------------- */
.container-nx { width: 100%; max-width: 88rem; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container-nx { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .container-nx { padding-inline: 2rem; } }

.text-gradient {
  background: linear-gradient(110deg, rgb(var(--c-brand-text)) 0%, rgb(var(--c-brand)) 45%, rgb(var(--c-brand-2)) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgb(var(--c-brand-text));
}
.pulse-dot { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: rgb(var(--c-accent)); box-shadow: 0 0 0 0 rgb(var(--c-accent) / 0.6); animation: pulseDot 2s infinite; }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgb(var(--c-accent) / 0.55); } 70% { box-shadow: 0 0 0 8px rgb(var(--c-accent) / 0); } 100% { box-shadow: 0 0 0 0 rgb(var(--c-accent) / 0); } }

.divider { height: 1px; background: rgb(var(--c-line)); }
.kbd { font-family: "JetBrains Mono", monospace; font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 0.35rem; border: 1px solid rgb(var(--c-line-strong)); color: rgb(var(--c-fg-muted)); }
.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }
.pre-line { white-space: pre-line; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.5rem; padding: 0 1rem; border-radius: 0.75rem;
  font-weight: 600; font-size: 0.875rem; line-height: 1; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer; user-select: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.2s, transform 0.12s, filter 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; border-radius: 0.625rem; gap: 0.375rem; }
.btn-lg { height: 3rem; padding: 0 1.375rem; font-size: 0.9375rem; border-radius: 0.875rem; }
.btn-icon { width: 2.5rem; padding: 0; }
.btn-icon.btn-sm { width: 2rem; }
.btn-block { width: 100%; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, rgb(var(--c-brand)), rgb(var(--c-brand-2)));
  box-shadow: 0 10px 26px -12px rgb(var(--c-brand) / 0.75), inset 0 1px 0 rgb(255 255 255 / 0.18);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 14px 32px -12px rgb(var(--c-brand) / 0.9), inset 0 1px 0 rgb(255 255 255 / 0.25); }
.btn-secondary { background: rgb(var(--c-surface-2)); border-color: rgb(var(--c-line)); color: rgb(var(--c-fg)); }
.btn-secondary:hover:not(:disabled) { background: rgb(var(--c-surface-3)); border-color: rgb(var(--c-line-strong)); }
.btn-ghost { background: transparent; color: rgb(var(--c-fg-muted)); }
.btn-ghost:hover:not(:disabled) { background: rgb(var(--c-surface-2)); color: rgb(var(--c-fg)); }
.btn-success { color: #fff; background: rgb(var(--c-accent)); box-shadow: 0 10px 26px -14px rgb(var(--c-accent) / 0.9), inset 0 1px 0 rgb(255 255 255 / 0.18); }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger { color: rgb(var(--c-danger-text)); background: rgb(var(--c-danger) / 0.1); border-color: rgb(var(--c-danger) / 0.3); }
.btn-danger:hover:not(:disabled) { background: rgb(var(--c-danger) / 0.18); }
/* „Mit Google anmelden“: neutral-heller Button nach Googles Vorgaben (in beiden Themes gut erkennbar) */
.btn-google { color: #1f1f1f; background: #fff; border-color: #dadce0; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.btn-google:hover:not(:disabled) { background: #f6f8fc; border-color: #c4c7c5; }
.btn-danger-solid { color: #fff; background: rgb(var(--c-danger)); }
.btn-danger-solid:hover:not(:disabled) { filter: brightness(1.08); }

.spinner { width: 1rem; height: 1rem; border-radius: 999px; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Formulare
   -------------------------------------------------------------------------- */
.input, .select, .textarea {
  width: 100%; display: block;
  background: rgb(var(--c-surface-2));
  border: 1px solid rgb(var(--c-line));
  color: rgb(var(--c-fg));
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem; line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.input { height: 2.75rem; }
.textarea { min-height: 8rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: rgb(var(--c-fg-subtle)); }
.input:hover, .select:hover, .textarea:hover { border-color: rgb(var(--c-line-strong)); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: rgb(var(--c-brand));
  box-shadow: 0 0 0 3px rgb(var(--c-brand) / 0.2);
  background: rgb(var(--c-surface));
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: rgb(var(--c-danger)); box-shadow: 0 0 0 3px rgb(var(--c-danger) / 0.14);
}
.select {
  height: 2.75rem; appearance: none; -webkit-appearance: none; padding-right: 2.25rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a90a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem;
}
.select option, .select optgroup { background: rgb(var(--c-surface)); color: rgb(var(--c-fg)); }
.input-sm, .select-sm { height: 2.25rem; font-size: 0.8125rem; border-radius: 0.625rem; }
.input-with-icon { padding-left: 2.5rem; }
.input-icon { position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%); color: rgb(var(--c-fg-subtle)); pointer-events: none; }

input[type="checkbox"], input[type="radio"] { accent-color: rgb(var(--c-brand)); width: 1rem; height: 1rem; cursor: pointer; }
input[type="range"] { accent-color: rgb(var(--c-brand)); width: 100%; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.85); }

.label { display: block; font-size: 0.8125rem; font-weight: 600; color: rgb(var(--c-fg)); margin-bottom: 0.4rem; }
.label .req { color: rgb(var(--c-danger-text)); margin-left: 0.125rem; }
.label .opt { color: rgb(var(--c-fg-subtle)); font-weight: 500; margin-left: 0.25rem; }
.help { font-size: 0.75rem; color: rgb(var(--c-fg-subtle)); margin-top: 0.4rem; }
.field-error { font-size: 0.75rem; color: rgb(var(--c-danger-text)); margin-top: 0.4rem; display: flex; gap: 0.3rem; align-items: center; }
.counter { font-family: "JetBrains Mono", monospace; font-size: 0.7rem; color: rgb(var(--c-fg-subtle)); }

[hidden] { display: none !important; }

/* Farbton-Regler */
.hue-range {
  -webkit-appearance: none; appearance: none; height: 0.65rem; border-radius: 999px; outline-offset: 4px;
  background: linear-gradient(90deg, hsl(0 85% 55%), hsl(60 85% 55%), hsl(120 75% 45%), hsl(180 80% 45%), hsl(240 80% 62%), hsl(300 80% 58%), hsl(360 85% 55%));
}
.hue-range::-webkit-slider-thumb { -webkit-appearance: none; width: 1.25rem; height: 1.25rem; border-radius: 999px; background: #fff; border: 3px solid rgb(var(--c-surface)); box-shadow: 0 0 0 1px rgb(var(--c-line-strong)), 0 2px 6px rgb(0 0 0 / 0.35); cursor: grab; }
.hue-range::-moz-range-thumb { width: 1.25rem; height: 1.25rem; border-radius: 999px; background: #fff; border: 3px solid rgb(var(--c-surface)); box-shadow: 0 0 0 1px rgb(var(--c-line-strong)), 0 2px 6px rgb(0 0 0 / 0.35); cursor: grab; }
.hue-swatch { width: 1.6rem; height: 1.6rem; border-radius: 0.5rem; background: hsl(var(--h) 72% 55%); border: 2px solid rgb(var(--c-surface)); box-shadow: 0 0 0 1px rgb(var(--c-line-strong)); transition: transform 0.15s; }
.hue-swatch:hover { transform: scale(1.12); }
.hue-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px rgb(var(--c-fg)); }

/* Schalter */
.switch {
  position: relative; width: 2.6rem; height: 1.5rem; flex-shrink: 0;
  border-radius: 999px; background: rgb(var(--c-surface-3));
  border: 1px solid rgb(var(--c-line-strong)); cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: calc(1.5rem - 6px); height: calc(1.5rem - 6px); border-radius: 999px;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.switch[aria-checked="true"] { background: rgb(var(--c-accent)); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(1.1rem); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* Segment-Control */
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: rgb(var(--c-surface-2)); border: 1px solid rgb(var(--c-line)); border-radius: 0.8rem; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 0.375rem;
  height: 2rem; padding: 0 0.75rem; border-radius: 0.6rem;
  font-size: 0.8125rem; font-weight: 600; color: rgb(var(--c-fg-muted));
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg-btn:hover { color: rgb(var(--c-fg)); }
.seg-btn[aria-checked="true"], .seg-btn[aria-pressed="true"], .seg-btn[aria-selected="true"] {
  background: rgb(var(--c-surface)); color: rgb(var(--c-fg));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 0 0 1px rgb(var(--c-line-strong));
}
.seg-block { display: flex; width: 100%; }
.seg-block .seg-btn { flex: 1; justify-content: center; }

/* Filter-/Auswahl-Chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  height: 2rem; padding: 0 0.75rem; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 500; color: rgb(var(--c-fg-muted));
  background: rgb(var(--c-surface-2)); border: 1px solid rgb(var(--c-line));
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { color: rgb(var(--c-fg)); border-color: rgb(var(--c-line-strong)); }
.chip[aria-pressed="true"], .chip.is-active { color: rgb(var(--c-brand-text)); border-color: rgb(var(--c-brand) / 0.45); background: rgb(var(--c-brand) / 0.12); }
.chip-sm { height: 1.65rem; padding: 0 0.6rem; font-size: 0.75rem; }

/* Tag-Eingabe */
.tag-input { display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; min-height: 2.75rem; padding: 0.375rem 0.5rem; cursor: text; }
.tag-input input { flex: 1; min-width: 8rem; background: transparent; border: 0; outline: none; color: rgb(var(--c-fg)); font-size: 0.9rem; padding: 0.25rem; }
.tag-chip { display: inline-flex; align-items: center; gap: 0.25rem; height: 1.75rem; padding: 0 0.25rem 0 0.6rem; border-radius: 0.5rem; background: rgb(var(--c-brand) / 0.14); border: 1px solid rgb(var(--c-brand) / 0.3); color: rgb(var(--c-brand-text)); font-size: 0.8rem; font-weight: 600; }
.tag-chip button { width: 1.25rem; height: 1.25rem; display: grid; place-items: center; border-radius: 0.35rem; color: inherit; opacity: 0.75; }
.tag-chip button:hover { opacity: 1; background: rgb(var(--c-brand) / 0.2); }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  border: 1.5px dashed rgb(var(--c-line-strong)); border-radius: 1rem;
  background: rgb(var(--c-surface-2) / 0.5); color: rgb(var(--c-fg-muted));
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone.drag-over { border-color: rgb(var(--c-brand)); background: rgb(var(--c-brand) / 0.06); color: rgb(var(--c-fg)); }
.dropzone.is-disabled { opacity: 0.55; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Karten, Badges
   -------------------------------------------------------------------------- */
.card { background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 1rem; }
.card-glass { background: rgb(var(--c-surface) / 0.72); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.card-pad { padding: 1.25rem; }
@media (min-width: 640px) { .card-pad { padding: 1.5rem; } }
.card-link { transition: border-color 0.2s, transform 0.2s, background-color 0.2s; }
.card-link:hover { border-color: rgb(var(--c-line-strong)); transform: translateY(-2px); }

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  height: 1.5rem; padding: 0 0.55rem; border-radius: 0.5rem;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-neutral { background: rgb(var(--c-surface) / 0.85); border-color: rgb(var(--c-line-strong)); color: rgb(var(--c-fg)); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.badge-muted { background: rgb(var(--c-surface-2)); border-color: rgb(var(--c-line)); color: rgb(var(--c-fg-muted)); }
.badge-brand { background: rgb(var(--c-brand) / 0.14); border-color: rgb(var(--c-brand) / 0.32); color: rgb(var(--c-brand-text)); }
.badge-accent { background: rgb(var(--c-accent) / 0.14); border-color: rgb(var(--c-accent) / 0.32); color: rgb(var(--c-accent-text)); }
.badge-warn { background: rgb(var(--c-warn) / 0.14); border-color: rgb(var(--c-warn) / 0.32); color: rgb(var(--c-warn-text)); }
.badge-info { background: rgb(var(--c-info) / 0.14); border-color: rgb(var(--c-info) / 0.32); color: rgb(var(--c-info-text)); }
.badge-danger { background: rgb(var(--c-danger) / 0.14); border-color: rgb(var(--c-danger) / 0.32); color: rgb(var(--c-danger-text)); }
.badge-dot { width: 0.4rem; height: 0.4rem; border-radius: 999px; background: currentColor; }

.price-free { color: rgb(var(--c-accent-text)); font-weight: 700; }
.price-paid { color: rgb(var(--c-fg)); font-weight: 700; }

/* Modellkarte */
.model-card {
  --hue: 265;
  position: relative; display: flex; flex-direction: column;
  background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line));
  border-radius: 1rem; overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s, box-shadow 0.25s;
}
.model-card:hover { transform: translateY(-3px); border-color: hsl(var(--hue) 70% 58% / 0.45); box-shadow: 0 20px 44px -22px hsl(var(--hue) 85% 50% / calc(0.65 * var(--glow) + 0.1)); }
.model-card:focus-within { border-color: hsl(var(--hue) 70% 58% / 0.55); }
.model-card > a:focus-visible { outline-offset: -2px; border-radius: 1rem; }

.card-media {
  --hue: 265;
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background:
    radial-gradient(65% 65% at 50% 46%, hsl(var(--hue) 80% 58% / calc(0.30 * var(--glow) + 0.08)), transparent 72%),
    linear-gradient(180deg, rgb(var(--c-surface-2)), rgb(var(--c-surface)));
}
.card-media::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgb(var(--grid-rgb) / calc(var(--grid-alpha) * 1.2)) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--grid-rgb) / calc(var(--grid-alpha) * 1.2)) 1px, transparent 1px);
  background-size: 18px 18px; background-position: center;
  -webkit-mask-image: radial-gradient(circle at 50% 60%, #000, transparent 75%);
  mask-image: radial-gradient(circle at 50% 60%, #000, transparent 75%);
}
.card-media > img { position: relative; width: 100%; height: 100%; transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.card-media > img.is-voxel { object-fit: contain; padding: 4%; }
.card-media > img.is-photo { object-fit: cover; }
.model-card:hover .card-media > img.is-voxel { transform: scale(1.06) translateY(-2%); }
.model-card:hover .card-media > img.is-photo { transform: scale(1.04); }

.like-btn {
  position: absolute; top: 0.75rem; right: 0.75rem; z-index: 2;
  width: 2.25rem; height: 2.25rem; border-radius: 0.75rem;
  display: grid; place-items: center;
  background: rgb(var(--c-surface) / 0.78); border: 1px solid rgb(var(--c-line-strong));
  color: rgb(var(--c-fg-muted));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: color 0.15s, background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.like-btn:hover { color: rgb(var(--c-danger-text)); transform: scale(1.06); }
.like-btn[aria-pressed="true"] { color: rgb(var(--c-danger)); border-color: rgb(var(--c-danger) / 0.4); background: rgb(var(--c-danger) / 0.14); }
.like-btn[aria-pressed="true"] svg, .like-toggle[aria-pressed="true"] svg { fill: currentColor; }
.like-toggle[aria-pressed="true"] { color: rgb(var(--c-danger-text)); border-color: rgb(var(--c-danger) / 0.4); background: rgb(var(--c-danger) / 0.1); }
.pop { animation: pop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.4); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* Avatar */
.avatar {
  --hue: 265;
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 1.5rem; height: 1.5rem; border-radius: 0.45rem;
  font-size: 0.65rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, hsl(var(--hue) 70% 55%), hsl(calc(var(--hue) + 40) 70% 45%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25);
}
.avatar-md { width: 2.25rem; height: 2.25rem; border-radius: 0.7rem; font-size: 0.8rem; }
.avatar-lg { width: 3.25rem; height: 3.25rem; border-radius: 0.95rem; font-size: 1.05rem; }

/* Navigation */
/* Kopfzeile: Navigation ab 1024 px in der Zeile, darunter im Menü. Nichts darf umbrechen. */
.nav-shell .seg { flex-wrap: nowrap; }
.nav-shell { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid rgb(var(--c-line) / 0.8); background: rgb(var(--c-base) / 0.72); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap;
  height: 2.25rem; padding: 0 0.75rem; border-radius: 0.65rem;
  font-size: 0.875rem; font-weight: 500; color: rgb(var(--c-fg-muted));
  transition: color 0.15s, background-color 0.15s;
}
.nav-link:hover { color: rgb(var(--c-fg)); background: rgb(var(--c-surface-2)); }
.nav-link[aria-current="page"] { color: rgb(var(--c-fg)); background: rgb(var(--c-surface-2)); }
.nav-count { min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem; border-radius: 999px; font-size: 0.65rem; font-weight: 700; display: inline-grid; place-items: center; background: rgb(var(--c-brand)); color: #fff; }
.mobile-menu { animation: menuIn 0.2s ease; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.side-link {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  height: 2.6rem; padding: 0 0.75rem; border-radius: 0.75rem;
  font-size: 0.875rem; font-weight: 500; color: rgb(var(--c-fg-muted));
  transition: color 0.15s, background-color 0.15s;
}
.side-link:hover { color: rgb(var(--c-fg)); background: rgb(var(--c-surface-2)); }
.side-link[aria-current="page"], .side-link[aria-pressed="true"] { color: rgb(var(--c-fg)); background: rgb(var(--c-brand) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--c-brand) / 0.28); }
.side-link[aria-current="page"] svg, .side-link[aria-pressed="true"] svg { color: rgb(var(--c-brand-text)); }
.tab-link { display: inline-flex; align-items: center; gap: 0.5rem; height: 2.25rem; padding: 0 0.85rem; border-radius: 0.65rem; font-size: 0.8125rem; font-weight: 600; color: rgb(var(--c-fg-muted)); white-space: nowrap; }
.tab-link[aria-current="page"], .tab-link[aria-selected="true"] { color: rgb(var(--c-fg)); background: rgb(var(--c-surface-2)); box-shadow: inset 0 0 0 1px rgb(var(--c-line-strong)); }

/* Tabellen */
.table-nx { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.table-nx th { text-align: left; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: rgb(var(--c-fg-subtle)); padding: 0.75rem 1rem; border-bottom: 1px solid rgb(var(--c-line)); white-space: nowrap; }
.table-nx td { padding: 0.75rem 1rem; border-bottom: 1px solid rgb(var(--c-line)); vertical-align: middle; }
.table-nx tr:last-child td { border-bottom: 0; }
.table-nx tbody tr { transition: background-color 0.15s; }
.table-nx tbody tr:hover { background: rgb(var(--c-surface-2) / 0.6); }

/* Kanban */
.kanban-col { background: rgb(var(--c-surface) / 0.6); border: 1px solid rgb(var(--c-line)); border-radius: 1rem; transition: border-color 0.15s, background-color 0.15s; }
.kanban-col.drag-over { border-color: rgb(var(--c-brand)); background: rgb(var(--c-brand) / 0.07); }
.req-card { cursor: grab; transition: border-color 0.15s, transform 0.15s, box-shadow 0.2s, opacity 0.15s; }
.req-card:hover { border-color: rgb(var(--c-line-strong)); box-shadow: 0 10px 24px -16px rgb(var(--shadow-rgb) / var(--shadow-alpha)); }
.req-card.dragging { opacity: 0.4; }
.status-dot { width: 0.55rem; height: 0.55rem; border-radius: 999px; flex-shrink: 0; }

/* Zeitleiste */
.timeline { position: relative; padding-left: 1.25rem; }
.timeline::before { content: ""; position: absolute; left: 0.3rem; top: 0.35rem; bottom: 0.35rem; width: 1px; background: rgb(var(--c-line-strong)); }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -1.2rem; top: 0.35rem; width: 0.6rem; height: 0.6rem; border-radius: 999px; background: rgb(var(--c-surface)); border: 2px solid var(--dot, rgb(var(--c-brand))); }

/* Balkendiagramm (Studio-Übersicht): eine Serie, dünne Balken, 4px-Rundung an der Datenseite */
.hbar-row { display: grid; grid-template-columns: minmax(5.5rem, 8rem) 1fr; align-items: center; gap: 0.75rem; padding: 0.2rem 0.4rem; border-radius: 0.6rem; outline-offset: 0; }
.hbar-row:hover, .hbar-row:focus-visible { background: rgb(var(--c-surface-2)); }
.hbar-plot { position: relative; display: flex; align-items: center; height: 1.6rem; border-left: 1px solid rgb(var(--c-line-strong)); }
.hbar { display: block; height: 12px; min-width: 2px; border-radius: 0 4px 4px 0; background: rgb(var(--c-brand)); transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.15s; }
.hbar-row:hover .hbar, .hbar-row:focus-visible .hbar { filter: brightness(1.18); }
.hbar-value { margin-left: 0.5rem; font-size: 0.75rem; font-variant-numeric: tabular-nums; color: rgb(var(--c-fg-muted)); white-space: nowrap; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; padding: 0.45rem 0.65rem; border-radius: 0.6rem; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line-strong)); box-shadow: 0 12px 28px -14px rgb(var(--shadow-rgb) / var(--shadow-alpha)); white-space: nowrap; }

/* 3D-Viewer */
.viewer {
  --hue: 265;
  position: relative; overflow: hidden; border-radius: 1.25rem;
  border: 1px solid rgb(var(--c-line));
  background:
    radial-gradient(60% 60% at 50% 42%, hsl(var(--hue) 80% 58% / calc(0.28 * var(--glow) + 0.08)), transparent 72%),
    linear-gradient(180deg, rgb(var(--c-surface-2)), rgb(var(--c-surface)));
}
.viewer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgb(var(--grid-rgb) / calc(var(--grid-alpha) * 1.3)) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--grid-rgb) / calc(var(--grid-alpha) * 1.3)) 1px, transparent 1px);
  background-size: 24px 24px; background-position: center;
  -webkit-mask-image: radial-gradient(circle at 50% 65%, #000 10%, transparent 70%);
  mask-image: radial-gradient(circle at 50% 65%, #000 10%, transparent 70%);
}
.viewer canvas { position: relative; display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.viewer canvas:active { cursor: grabbing; }
.viewer canvas:focus-visible { outline-offset: -3px; border-radius: 1.25rem; }
.viewer > img { position: relative; width: 100%; height: 100%; object-fit: contain; }
.viewer > img.is-photo { object-fit: cover; }
.viewer-tools { position: absolute; z-index: 2; display: flex; gap: 0.375rem; }
.viewer-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 0.7rem; display: grid; place-items: center;
  background: rgb(var(--c-surface) / 0.8); border: 1px solid rgb(var(--c-line-strong)); color: rgb(var(--c-fg-muted));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: color 0.15s, background-color 0.15s;
}
.viewer-btn:hover { color: rgb(var(--c-fg)); background: rgb(var(--c-surface-2)); }
.viewer-btn[aria-pressed="true"] { color: rgb(var(--c-brand-text)); border-color: rgb(var(--c-brand) / 0.45); }

.hero-dots button { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: rgb(var(--c-fg-subtle) / 0.5); transition: width 0.25s, background-color 0.25s; }
.hero-dots button[aria-current="true"] { width: 1.5rem; background: rgb(var(--c-brand)); }
.fade-swap { transition: opacity 0.25s ease, transform 0.25s ease; }
.fade-swap.is-out { opacity: 0; transform: translateY(4px); }

/* Pixel-Stufen-Rahmen für Akzente */
.pixel-corners { clip-path: polygon(0 6px, 6px 6px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px)); }

.gradient-border { position: relative; border-radius: 1.5rem; }
.gradient-border::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgb(var(--c-brand) / 0.7), rgb(var(--c-brand-2) / 0.35) 45%, rgb(var(--c-line)) 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* --------------------------------------------------------------------------
   Overlays: Toasts, Dialoge, Drawer
   -------------------------------------------------------------------------- */
.toast-root { position: fixed; z-index: 90; right: 1rem; bottom: 1rem; left: 1rem; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; pointer-events: none; }
@media (min-width: 640px) { .toast-root { left: auto; } }
.toast {
  pointer-events: auto; display: flex; gap: 0.75rem; align-items: flex-start;
  width: 100%; max-width: 24rem; padding: 0.8rem 0.9rem; border-radius: 0.9rem;
  background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line-strong));
  box-shadow: 0 22px 44px -18px rgb(var(--shadow-rgb) / var(--shadow-alpha));
  font-size: 0.875rem; animation: toastIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.is-leaving { animation: toastOut 0.2s ease forwards; }
.toast-icon { flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: 0.55rem; display: grid; place-items: center; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(0.98); } }

.overlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgb(4 5 9 / 0.62); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  animation: fadeIn 0.2s ease;
}
:root[data-theme="light"] .overlay { background: rgb(15 17 26 / 0.38); }
@media (min-width: 640px) { .overlay { align-items: center; padding: 1.5rem; } }
.overlay.is-leaving { animation: fadeOut 0.18s ease forwards; }
.dialog {
  position: relative; width: 100%; max-width: 32rem; max-height: 92vh; overflow-y: auto;
  background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line-strong));
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 40px 80px -30px rgb(0 0 0 / 0.6);
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (min-width: 640px) { .dialog { border-radius: 1.25rem; animation: dialogIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); } }
.dialog-lg { max-width: 46rem; }
.dialog-sm { max-width: 26rem; }
.overlay.is-leaving .dialog { animation: dialogOut 0.18s ease forwards; }

.overlay-drawer { justify-content: flex-end; align-items: stretch; padding: 0 !important; }
.drawer {
  position: relative; width: 100%; max-width: 32rem; height: 100%; overflow-y: auto;
  background: rgb(var(--c-surface)); border-left: 1px solid rgb(var(--c-line-strong));
  box-shadow: -30px 0 60px -30px rgb(0 0 0 / 0.5);
  animation: drawerIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.overlay.is-leaving .drawer { animation: drawerOut 0.2s ease forwards; }
.overlay-drawer-left { justify-content: flex-start; }
.overlay-drawer-left .drawer { border-left: 0; border-right: 1px solid rgb(var(--c-line-strong)); animation-name: drawerInLeft; }
.overlay-drawer-left.is-leaving .drawer { animation-name: drawerOutLeft; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dialogIn { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dialogOut { to { transform: translateY(8px) scale(0.98); opacity: 0; } }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawerOut { to { transform: translateX(100%); } }
@keyframes drawerInLeft { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes drawerOutLeft { to { transform: translateX(-100%); } }

.success-burst { animation: burst 0.5s cubic-bezier(0.2, 0.8, 0.2, 1.3); }
@keyframes burst { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

.view-enter { animation: viewIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
