/* ==================================================================
   Kryptonia - Designsystem
   Dunkles Seekarten-Thema, Glasflaechen, bewegter Hintergrund.
   ================================================================== */

:root {
  --bg-0: #05080f;
  --bg-1: #0a1020;
  --bg-2: #0e1730;

  --ink: #eef4ff;
  --ink-2: #b9c6e2;
  --ink-3: #7f8fb0;

  --line: rgba(148, 176, 232, 0.16);
  --line-2: rgba(148, 176, 232, 0.30);

  --glass: rgba(18, 28, 52, 0.55);
  --glass-2: rgba(22, 34, 62, 0.72);
  --glass-hi: rgba(255, 255, 255, 0.06);

  --gold: #f2c14e;
  --teal: #2fd8c6;
  --sky: #5cc8ff;
  --violet: #a78bfa;
  --rose: #fb7185;
  --lime: #a3e635;

  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --shadow-s: 0 8px 24px rgba(0, 0, 0, 0.4);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", ui-monospace, "Courier New", monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------------------------------------------
   Bewegter Hintergrund: Aurora-Verlaeufe + feines Gitter + Sternenstaub
   ------------------------------------------------------------------ */

.bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(1200px 800px at 12% 8%, rgba(47, 216, 198, 0.16), transparent 60%),
    radial-gradient(1000px 700px at 88% 18%, rgba(167, 139, 250, 0.16), transparent 62%),
    radial-gradient(900px 900px at 70% 92%, rgba(92, 200, 255, 0.13), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 55%, #04060c 100%);
}

.bg::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    conic-gradient(from 0deg at 30% 40%, rgba(47, 216, 198, 0.10), transparent 25%, rgba(167, 139, 250, 0.10) 50%, transparent 75%, rgba(92, 200, 255, 0.10));
  filter: blur(70px);
  animation: drift 42s linear infinite;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 160, 220, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 220, 0.055) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 45%, transparent 100%);
}

@keyframes drift {
  from { transform: rotate(0deg) scale(1.05); }
  to   { transform: rotate(360deg) scale(1.05); }
}

.bg-noise {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.30;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  .bg::before { animation: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------
   Typografie
   ------------------------------------------------------------------ */

h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.18; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h2 { font-size: clamp(1.15rem, 2vw, 1.45rem); }
h3 { font-size: 1.02rem; }
p  { margin: 0 0 0.85em; line-height: 1.65; color: var(--ink-2); }
a  { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--ink-3); }

.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; margin-bottom: 0.5em;
}

.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }

.gradient-text {
  background: linear-gradient(100deg, var(--teal), var(--sky) 45%, var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ------------------------------------------------------------------
   Glasflaechen
   ------------------------------------------------------------------ */

.card {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow-s);
  padding: 20px;
}

.card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, var(--glass-hi), transparent 40%, transparent 70%, rgba(255, 255, 255, 0.04));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

.card.solid { background: var(--glass-2); }

/* ------------------------------------------------------------------
   Bedienelemente
   ------------------------------------------------------------------ */

button, .btn {
  font: inherit; font-weight: 600;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
button:hover, .btn:hover { border-color: rgba(148, 176, 232, 0.55); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--sky));
  color: #04121a; border-color: transparent;
  box-shadow: 0 8px 26px rgba(47, 216, 198, 0.28);
}
.btn-primary:hover { box-shadow: 0 12px 34px rgba(47, 216, 198, 0.4); }

.btn-ghost { background: transparent; border-color: var(--line); }
.btn-danger { background: linear-gradient(135deg, #f87171, #fb7185); color: #2a0709; border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: 0.84rem; border-radius: 8px; }

input, textarea, select {
  font: inherit; width: 100%;
  color: var(--ink);
  background: rgba(6, 12, 26, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 11px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(47, 216, 198, 0.16);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
label { display: block; font-size: 0.84rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

.field { margin-bottom: 16px; }
.field .help { font-size: 0.78rem; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }

/* ------------------------------------------------------------------
   Kleinteile
   ------------------------------------------------------------------ */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  color: var(--ink-2);
}
.pill.ok   { color: var(--ok);   border-color: rgba(52, 211, 153, 0.4);  background: rgba(52, 211, 153, 0.10); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.4);  background: rgba(251, 191, 36, 0.10); }
.pill.bad  { color: var(--bad);  border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.10); }
.pill.gold { color: var(--gold); border-color: rgba(242, 193, 78, 0.45); background: rgba(242, 193, 78, 0.12); }

.shield-niedrig { --sc: #94a3b8; }
.shield-mittel  { --sc: #fbbf24; }
.shield-hoch    { --sc: #34d399; }
.shield {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em;
  color: var(--sc); border: 1px solid color-mix(in srgb, var(--sc) 40%, transparent);
  background: color-mix(in srgb, var(--sc) 12%, transparent);
  padding: 3px 9px; border-radius: 999px;
}

.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; }
.toast {
  background: var(--glass-2); border: 1px solid var(--line-2);
  backdrop-filter: blur(16px); border-radius: var(--r-s);
  padding: 13px 17px; box-shadow: var(--shadow);
  max-width: 380px; font-size: 0.9rem;
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.ok  { border-color: rgba(52, 211, 153, 0.5); }
.toast.bad { border-color: rgba(248, 113, 113, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18); border-top-color: var(--teal);
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 176, 232, 0.2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 176, 232, 0.35); background-clip: content-box; }

.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;
}
