/* Archivo (OFL-1.1), selbst gehostet – wie bei ccna.fine9.de */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("/fonts/archivo.woff2") format("woff2-variations"), url("/fonts/archivo.woff2") format("woff2");
}

/* Drehwinkel für den umlaufenden Kartenrand */
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

:root {
  color-scheme: dark;
  /* dieselbe Palette wie die Server-Zentrale hinter dem Login (app.css) */
  --night: #080a18;
  --night-2: #10132a;
  --blue: #4f6ef7;
  --blue-dark: #3f5be0;
  --blue-deep: #263066;
  --sky: #8c9eff;
  --ice: #b4c0ff;
  --violet: #7048e8;
  --text: #eef0ff;
  --muted: #a9b0d6;
  --faint: #6c749e;
  --glass: rgba(16, 19, 42, 0.72);
  --glass-edge: rgba(160, 172, 255, 0.18);
  --field: rgba(255, 255, 255, 0.045);
  --field-edge: rgba(148, 180, 255, 0.18);
  --error: #ff8a8a;
  --error-bg: rgba(220, 38, 38, 0.14);
  --ok: #4ade80;

  --r-card: 28px;
  --r-item: 14px;
  --font: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--night);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font-family: inherit; }
h1, h2 { font-stretch: 94%; letter-spacing: -0.02em; }

/* ---------- Hintergrund ---------- */
.aurora {
  position: fixed; inset: -20vmax; z-index: 0; pointer-events: none;
  filter: blur(70px) saturate(130%);
  background: radial-gradient(ellipse at 50% 120%, var(--night-2), var(--night) 60%);
}
.aurora i {
  position: absolute; display: block; border-radius: 50%;
  width: 55vmax; height: 55vmax; opacity: .55; mix-blend-mode: screen;
  animation: drift 26s var(--ease) infinite alternate;
}
.aurora i:nth-child(1) { background: radial-gradient(circle, var(--blue) 0, transparent 62%); top: 5%; left: 0%; }
.aurora i:nth-child(2) { background: radial-gradient(circle, var(--blue-deep) 0, transparent 60%); top: 30%; left: 45%; animation-duration: 32s; animation-delay: -8s; }
.aurora i:nth-child(3) { background: radial-gradient(circle, var(--sky) 0, transparent 58%); top: -10%; left: 55%; opacity: .32; animation-duration: 38s; animation-delay: -15s; }
.aurora i:nth-child(4) { background: radial-gradient(circle, var(--violet) 0, transparent 60%); top: 55%; left: 5%; opacity: .28; animation-duration: 44s; animation-delay: -4s; }

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(8vmax, -6vmax, 0) scale(1.15); }
  100% { transform: translate3d(-6vmax, 7vmax, 0) scale(.92); }
}

#net { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }

/* feines Rauschen gegen Farbstufen im Verlauf */
.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Bühne ---------- */
.stage {
  position: relative; z-index: 3;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.m-brand { display: none; }

/* ---------- Karte mit leuchtendem, umlaufendem Rand ---------- */
.card {
  position: relative;
  width: 100%;
  max-width: 430px;
  border-radius: var(--r-card);
  padding: 1px;                                   /* Platz für den Verlaufsrand */
  background: var(--glass-edge);
  box-shadow: 0 30px 80px -20px rgba(2, 6, 23, .8), 0 0 0 1px rgba(255, 255, 255, .02);
  animation: rise .9s var(--ease) both;
  transition: transform .5s var(--ease), box-shadow .3s;
}
.card::after {                                      /* umlaufendes Licht – per Maske nur auf dem Rand */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--angle), transparent 0 55%, rgba(140, 158, 255, .9) 68%, rgba(112, 72, 232, .85) 78%, transparent 90%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: spin 7s linear infinite;
}
.card::before {                                     /* weicher Schein hinter der Karte */
  content: ""; position: absolute; inset: 12% 8% -6%; z-index: -1; border-radius: 40px;
  background: radial-gradient(closest-side, rgba(79, 110, 247, .45), transparent);
  filter: blur(30px);
}
.card-inner {
  position: relative;
  border-radius: calc(var(--r-card) - 1px);
  padding: 36px 24px 26px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  overflow: hidden;
}
.card-inner::after {                                /* Glanzkante oben */
  content: ""; position: absolute; left: 10%; right: 10%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
}

@keyframes spin { to { --angle: 360deg; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }

.card.shake { animation: shake .5s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-9px); }
  40%, 60% { transform: translateX(9px); }
}
.card.is-error { box-shadow: 0 30px 80px -20px rgba(2, 6, 23, .8), 0 0 50px -10px rgba(239, 68, 68, .45); }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.brand-logo { width: 46px; height: 46px; display: block; border-radius: 13px;
  box-shadow: 0 8px 24px -6px rgba(79, 110, 247, .7), 0 0 0 1px rgba(255, 255, 255, .12); }
.brand-name { display: block; font-weight: 800; font-size: 19px; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }

h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 800; }
.sub { margin: 8px 0 26px; color: var(--muted); }

/* ---------- Felder mit schwebendem Label ---------- */
.field { position: relative; margin-bottom: 16px; }
.field input {
  width: 100%;
  height: 58px;
  padding: 22px 48px 6px 48px;
  font-size: 16px;                                  /* kein Auto-Zoom auf iOS */
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-edge);
  border-radius: var(--r-item);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
.field input:hover { border-color: rgba(148, 180, 255, .32); }
.field input:focus {
  border-color: var(--sky);
  background: rgba(140, 158, 255, .06);
  box-shadow: 0 0 0 4px rgba(140, 158, 255, .14), 0 0 28px -6px rgba(140, 158, 255, .5);
}
.field label {
  position: absolute; left: 48px; top: 18px;
  font-size: 16px; color: var(--faint); pointer-events: none;
  transform-origin: left top;
  transition: transform .2s var(--ease), color .2s;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label { transform: translateY(-10px) scale(.75); color: var(--muted); }
.field input:focus + label { color: var(--ice); }
.field .ico {
  position: absolute; left: 16px; top: 19px; width: 20px; height: 20px;
  fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke .2s;
}
.field input:focus ~ .ico { stroke: var(--ice); }

/* Eigenes Auge statt des eingebauten von Edge/IE (sonst doppelt und versetzt) */
.field input::-ms-reveal, .field input::-ms-clear { display: none; }

/* Autofill von Chrome nicht weiß färben lassen */
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 40px #0f1d42 inset;
  caret-color: var(--text);
}

.reveal {
  position: absolute; right: 6px; top: 7px; width: 44px; height: 44px;
  display: grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; color: var(--faint);
}
.reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.reveal:hover, .reveal[aria-pressed="true"] { color: var(--ice); background: rgba(255, 255, 255, .05); }
.reveal[aria-pressed="true"] svg path { stroke-dasharray: 2 2.4; }
.reveal:focus-visible { outline: 2px solid var(--sky); }

.caps { margin: -6px 0 14px; font-size: 13px; color: #fcd34d; display: flex; align-items: center; gap: 6px; }
.caps::before { content: "⇪"; font-weight: 700; }

/* ---------- Knopf ---------- */
.btn {
  position: relative; overflow: hidden;
  width: 100%; height: 54px; margin-top: 6px;
  border: 0; border-radius: var(--r-item);
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: .01em;
  background: linear-gradient(135deg, #3b82f6 0%, var(--blue) 45%, #4f46e5 100%);
  box-shadow: 0 12px 30px -10px rgba(79, 110, 247, .9), inset 0 1px 0 rgba(255, 255, 255, .25);
  cursor: pointer; touch-action: manipulation;
  transition: transform .15s var(--ease), box-shadow .2s, filter .2s, background .4s;
}
.btn::after {                                       /* Lichtstreif beim Drüberfahren */
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-18deg);
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 16px 38px -10px rgba(79, 110, 247, 1), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn:hover::after { animation: sweep .9s var(--ease); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:focus-visible { outline: 3px solid rgba(140, 158, 255, .5); outline-offset: 3px; }
.btn:disabled { cursor: default; }
@keyframes sweep { to { left: 130%; } }

.btn-spinner, .btn-check { position: absolute; left: 50%; top: 50%; opacity: 0; transition: opacity .2s; }
.btn-spinner {
  width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .3); border-top-color: #fff;
  animation: turn .7s linear infinite;
}
.btn-check { width: 26px; height: 26px; margin: -13px 0 0 -13px; fill: none; stroke: #fff; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
.btn.loading .btn-label { opacity: 0; }
.btn.loading .btn-spinner { opacity: 1; }
.btn.done { background: linear-gradient(135deg, #22c55e, #059669); box-shadow: 0 12px 30px -10px rgba(16, 185, 129, .9); }
.btn.done .btn-label, .btn.done .btn-spinner { opacity: 0; }
.btn.done .btn-check { opacity: 1; animation: draw .45s .05s var(--ease) forwards; }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

.error {
  margin: 0 0 16px; padding: 12px 14px 12px 40px; position: relative;
  border-radius: 12px; background: var(--error-bg); color: var(--error);
  border: 1px solid rgba(248, 113, 113, .25); font-size: 14px;
}
.error::before { content: "!"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%; background: var(--error); color: #2a0b0b;
  font-weight: 800; font-size: 12px; display: grid; place-items: center; }

.foot { margin: 24px 0 0; text-align: center; font-size: 12.5px; color: var(--faint); display: flex; justify-content: center; align-items: center; gap: 8px; }
.lock { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* ---------- Begrüßung nach erfolgreichem Login ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 10; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(circle at 50% 45%, rgba(79, 110, 247, .35), var(--night) 70%);
  animation: fade .5s var(--ease) both;
}
.welcome img { border-radius: 20px; box-shadow: 0 0 80px rgba(140, 158, 255, .6); animation: pop .7s var(--ease) both; }
.welcome p { margin: 0; font-size: 22px; font-weight: 700; font-stretch: 94%; animation: rise .7s .15s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.6) rotate(-8deg); } }
.leaving .stage { transition: opacity .4s, transform .5s var(--ease), filter .5s; opacity: 0; transform: scale(1.04); filter: blur(6px); }

/* =====================================================================
   Variante HANDY (Standard bis 959 px): Marke oben, Formular als Sheet unten
   ===================================================================== */
@media (max-width: 959px) {
  .stage { display: flex; flex-direction: column; align-items: center; padding-bottom: 0; padding-left: 0; padding-right: 0; }
  .card {
    max-width: 560px; border-radius: 30px 30px 0 0;
    padding: 1px 1px 0;
    animation: sheet .8s var(--ease) both;
  }
  .card.shake { animation: shake .5s var(--ease); }
  .card-inner {
    border-radius: 29px 29px 0 0;
    padding: 14px 22px max(22px, env(safe-area-inset-bottom));
    background: rgba(10, 20, 46, .78);
  }
  .card-inner::before {                             /* Griff des Sheets */
    content: ""; display: block; width: 42px; height: 5px; border-radius: 3px;
    background: rgba(255, 255, 255, .18); margin: 0 auto 22px;
  }
  .card-inner .brand { display: none; }
  .m-brand {
    flex: 1; align-self: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
    padding: 0 16px 28px;
    animation: rise 1s var(--ease) both;
  }
  .m-brand img { width: 76px; height: 76px; border-radius: 22px; margin-bottom: 10px;
    box-shadow: 0 16px 50px -8px rgba(140, 158, 255, .7), 0 0 0 1px rgba(255, 255, 255, .14); }
  .m-brand .brand-name { font-size: 32px; }
  .m-brand .brand-sub { font-size: 13px; letter-spacing: .16em; text-transform: uppercase; }
  h1 { font-size: 27px; }
  .sub { margin-bottom: 20px; }
}
@media (max-width: 959px) and (max-height: 600px) {
  .m-brand { display: none; }                         /* Querformat / kleine Höhe: nur Formular */
  .card-inner::before { margin-bottom: 12px; }
}
@keyframes sheet { from { transform: translateY(100%); } }

/* =====================================================================
   Variante DESKTOP (ab 960 px): nur die Karte, mittig auf der Bühne
   ===================================================================== */
@media (min-width: 960px) {
  .card { max-width: 440px; }
  .card-inner { padding: 44px 42px 30px; }
  .card:hover { transform: translateY(-2px); }
}

/* Bewegung reduzieren, wenn das System es wünscht */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #net { display: none; }
}

