/* myNote – Anmeldeseiten im Liquid-Glass-Stil (5.52.0, Foto-Hintergrund 5.53.0, ruhiger und mit «Passwort vergessen» 5.54.0).
   Eigenständig: sieht in jedem Theme gleich aus (dunkles Glas über dem Schreibtisch-Foto) und folgt nur der Akzentfarbe.
   Bewegung: nur transform und opacity (Rest sind Farben), Kurven aus reader.css (--ease-out), alles bei prefers-reduced-motion entschärft.
   Keine Inline-Stile (CSP): Verzögerungen stehen hier, nicht im HTML. */

:root { --ease-in-out: cubic-bezier(.77, 0, .175, 1); }

/* Immer dunkel: Das Foto ist dunkel, helles Glas darüber wäre schlecht lesbar */
body.lg-page {
  color-scheme: dark;
  --lg-text: light-dark(#14213a, #eaf1fb);
  --lg-muted: light-dark(#475670, #a6b4c8);
  --lg-danger: light-dark(#b3261b, #ff9a90);
  --lg-bg-a: #0b0e14;
  --lg-bg-b: #14100c;
  --lg-fill: light-dark(rgba(255, 255, 255, .40), rgba(18, 26, 40, .56));
  --lg-fill-top: light-dark(rgba(255, 255, 255, .62), rgba(60, 78, 108, .42));
  --lg-edge-hi: light-dark(rgba(255, 255, 255, .95), rgba(255, 255, 255, .30));
  --lg-edge-lo: light-dark(rgba(255, 255, 255, .35), rgba(255, 255, 255, .07));
  --lg-glow: light-dark(rgba(255, 255, 255, .30), rgba(255, 255, 255, .05));
  --lg-shadow: light-dark(rgba(40, 70, 130, .26), rgba(0, 0, 0, .6));
  --lg-input: light-dark(rgba(255, 255, 255, .55), rgba(8, 14, 24, .38));
  --lg-input-hover: light-dark(rgba(255, 255, 255, .70), rgba(8, 14, 24, .46));
  --lg-input-focus: light-dark(rgba(255, 255, 255, .88), rgba(8, 14, 24, .58));
  --lg-input-line: light-dark(rgba(255, 255, 255, .85), rgba(255, 255, 255, .14));
  --lg-field-line: light-dark(rgba(40, 56, 90, .42), rgba(255, 255, 255, .34));   /* Rand der Eingabefelder: mindestens 3 : 1 gegen die Karte */
}

/* html[data-theme] überstimmt die Hintergrundregeln der Glass-Themes (glass.css) */
html[data-theme] body.auth.lg-page {
  background: linear-gradient(160deg, var(--lg-bg-a), var(--lg-bg-b)) fixed;
  color: var(--lg-text);
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.lg-page .auth-main { max-width: 400px; position: relative; }

/* ---------- Hintergrund: Foto (Schreibtisch mit Notizbüchern), ruhig, darüber ein dunkler Schleier ---------- */
.lg-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.lg-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%;
  opacity: 0; transition: opacity 900ms ease-out;
}
.lg-photo.is-loaded { opacity: 1; }
/* Schleier: macht die Mitte ruhig und den Rand dunkel, damit Text auf dem Glas lesbar bleibt */
.lg-veil { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, rgba(8, 10, 16, .38) 0, rgba(8, 10, 16, .62) 100%); }
@media (scripting: none) { .lg-photo { opacity: 1; transition: none; } }

/* ---------- Glaskarte ---------- */
.lg-card {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 34px 28px 28px; border-radius: 28px; text-align: center; color: var(--lg-text);
  background: linear-gradient(160deg, var(--lg-fill-top), var(--lg-fill) 55%);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  box-shadow:
    inset 0 1px 0 var(--lg-edge-hi),
    inset 0 -1px 0 var(--lg-edge-lo),
    inset 0 0 26px var(--lg-glow),
    0 28px 64px -14px var(--lg-shadow),
    0 2px 6px light-dark(rgba(40, 70, 130, .12), rgba(0, 0, 0, .35));
}
/* Lichtkante: Farbverlauf nur auf dem 1-px-Rand (oben links hell, unten rechts hell, dazwischen glasklar) */
.lg-card::before {
  content: ""; position: absolute; inset: 0; z-index: 2; padding: 1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, var(--lg-edge-hi), transparent 38%, transparent 62%, var(--lg-edge-lo));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.lg-head, .lg-form, .lg-notice { position: relative; z-index: 1; }

.lg-logo { display: inline-block; border-radius: 14px; box-shadow: 0 10px 26px -8px light-dark(rgba(40, 70, 130, .4), rgba(0, 0, 0, .65)), 0 0 0 1px light-dark(rgba(255, 255, 255, .75), rgba(255, 255, 255, .18)); }
.lg-head h1 { margin: .5em 0 0; font-size: 1.75rem; line-height: 1.15; letter-spacing: -.01em; }
.lg-sub { margin: .3em 0 0; color: var(--lg-muted); }

/* ---------- Formular ---------- */
.lg-form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; text-align: left; }
.lg-row label { display: block; margin: 0 0 6px 2px; font-size: .85rem; font-weight: 500; color: var(--lg-muted); }
.lg-field { position: relative; border-radius: 14px; }
.lg-field input {
  display: block; width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 14px; outline: none;
  font: inherit; font-size: 1rem; color: var(--lg-text);
  background: var(--lg-input); border: 1px solid var(--lg-field-line);
  box-shadow: inset 0 1px 2px light-dark(rgba(20, 40, 90, .10), rgba(0, 0, 0, .35));
  transition: background-color 160ms ease, border-color 160ms ease;
}
.lg-field input:focus { background: var(--lg-input-focus); border-color: transparent; }
/* Fokusring als eigene Ebene: blendet per opacity/transform ein statt box-shadow zu animieren */
.lg-field::after {
  content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none;
  border: 2px solid color-mix(in srgb, var(--accent) 80%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
  opacity: 0; transform: scale(.985);
  transition: opacity 160ms var(--ease-out), transform 200ms var(--ease-out);
}
.lg-field:focus-within::after { opacity: 1; transform: none; }
.lg-field input:-webkit-autofill { -webkit-text-fill-color: var(--lg-text); box-shadow: inset 0 0 0 100px light-dark(#e3efff, #1d2a3f); caret-color: var(--lg-text); }

.lg-btn {
  position: relative; overflow: hidden; margin-top: 6px; min-height: 48px; padding: 12px 18px; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 650; color: var(--on-accent, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, #fff);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 84%, #fff), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(0, 0, 0, .08), 0 12px 26px -8px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: transform 160ms var(--ease-out), filter 140ms ease;
  -webkit-user-select: none; user-select: none;
}
a.lg-btn { display: flex; align-items: center; justify-content: center; box-sizing: border-box; text-decoration: none; text-align: center; }
.lg-btn:active { transform: scale(.97); }
.lg-btn:focus-visible { outline: 2px solid var(--lg-text); outline-offset: 3px; }
.lg-btn::after {   /* Lichtstreifen, läuft beim Überfahren einmal durch */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 255, 255, .5) 50%, transparent 64%);
  transform: translateX(-120%);
}
.lg-spin { position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; opacity: 0; transition: opacity 160ms ease; }
.lg-btn[data-busy] { pointer-events: none; }
.lg-btn[data-busy] .lg-spin { opacity: 1; animation: lg-rotate 700ms linear infinite; }

/* Hover nur mit Maus: Touch löst beim Tippen sonst falsche Hover-Zustände aus */
@media (hover: hover) and (pointer: fine) {
  .lg-field input:hover:not(:focus) { background: var(--lg-input-hover); }
  .lg-more a:hover { color: var(--lg-text); }
  .lg-btn:hover { filter: brightness(1.05); }
  .lg-btn:hover::after { transform: translateX(120%); transition: transform 700ms var(--ease-out); }
}

/* ---------- Hinweise ---------- */
body.auth .lg-notice {
  margin: 20px 0 0; padding: 11px 14px; border-radius: 14px; text-align: left; font-size: .9rem; color: var(--lg-text);
  background: light-dark(rgba(255, 255, 255, .58), rgba(8, 14, 24, .42)); border: 1px solid var(--lg-input-line);
  box-shadow: inset 0 1px 0 var(--lg-edge-hi); -webkit-backdrop-filter: none; backdrop-filter: none;
}
body.auth .lg-notice.error { color: var(--lg-danger); border-color: color-mix(in srgb, var(--lg-danger) 55%, transparent); background: color-mix(in srgb, var(--lg-danger) 12%, light-dark(rgba(255, 255, 255, .6), rgba(8, 14, 24, .45))); animation: lg-pop 320ms var(--ease-out) 90ms both; }
.lg-notice code { font-size: .88em; overflow-wrap: anywhere; }

/* ---------- Text, Hinweis und Nebenlink (Passwort vergessen / Neues Passwort) ---------- */
.lg-text { margin: 0; font-size: .95rem; line-height: 1.55; color: var(--lg-text); }
.lg-hint { margin: 0; font-size: .85rem; line-height: 1.5; color: var(--lg-muted); }
.lg-more { margin: 2px 0 0; text-align: center; font-size: .9rem; }
.lg-more a { color: var(--lg-muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); transition: color 140ms ease; }
.lg-more a:focus-visible { outline: 2px solid var(--lg-text); outline-offset: 3px; border-radius: 4px; }


/* ---------- Auftritt: Karte, dann Inhalt gestaffelt (ca. 0,9 s; blockiert keine Eingabe) ---------- */
.lg-card:not(.is-retry) { animation: lg-card-in 560ms var(--ease-out) 60ms both; }
.lg-card:not(.is-retry) .lg-in { animation: lg-rise 440ms var(--ease-out) both; }
.lg-card:not(.is-retry) .lg-logo { animation-name: lg-logo-in; animation-duration: 520ms; animation-delay: 200ms; }
.lg-card:not(.is-retry) .lg-head h1 { animation-delay: 270ms; }
.lg-card:not(.is-retry) .lg-sub { animation-delay: 320ms; }
.lg-card:not(.is-retry) .lg-notice.lg-in { animation-delay: 360ms; }
.lg-card:not(.is-retry) .lg-row:nth-of-type(1) { animation-delay: 390ms; }
.lg-card:not(.is-retry) .lg-row:nth-of-type(2) { animation-delay: 440ms; }
.lg-card:not(.is-retry) .lg-text.lg-in { animation-delay: 380ms; }
.lg-card:not(.is-retry) .lg-hint.lg-in { animation-delay: 420ms; }
.lg-card:not(.is-retry) .lg-btn { animation-delay: 500ms; }
.lg-card:not(.is-retry) .lg-more.lg-in { animation-delay: 560ms; }
/* Nach einem Fehlversuch lädt die Seite neu: kein zweiter Auftritt, nur ein Wackeln als Rückmeldung */
.lg-card.is-retry { animation: lg-shake 440ms var(--ease-out) both; }
body.lg-page:has(.lg-card.is-retry) .lg-photo { transition: none; }

@keyframes lg-fade { from { opacity: 0; } }
@keyframes lg-card-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes lg-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes lg-logo-in { from { opacity: 0; transform: translateY(6px) scale(.82); } }
@keyframes lg-pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes lg-shake { 0%, 100% { transform: none; } 18% { transform: translateX(-9px); } 36% { transform: translateX(8px); } 54% { transform: translateX(-5px); } 72% { transform: translateX(3px); } }
@keyframes lg-rotate { to { transform: rotate(1turn); } }

/* ---------- Schmal, Touch, Zugänglichkeit ---------- */
@media (max-width: 420px) {
  .lg-card { padding: 28px 20px 22px; border-radius: 24px; }
}
@media (pointer: coarse) { .lg-btn { min-height: 52px; } }

@media (prefers-reduced-motion: reduce) {
  /* weniger statt nichts: nur kurzes Einblenden, keine Bewegung */
  body.lg-page .lg-card.is-retry { animation: none !important; }
  body.lg-page .lg-photo { transition-duration: 240ms !important; }
  body.lg-page .lg-card:not(.is-retry), body.lg-page .lg-card:not(.is-retry) .lg-in { animation-name: lg-fade !important; animation-duration: 240ms !important; animation-delay: 0ms !important; }
  .lg-btn::after { display: none; }
  .lg-btn:active { transform: none; }
}

/* Weniger Transparenz gewünscht oder kein backdrop-filter: deckendere Fläche, Text bleibt lesbar */
@media (prefers-reduced-transparency: reduce) {
  body.lg-page { --lg-fill: light-dark(rgba(255, 255, 255, .92), rgba(24, 34, 48, .95)); --lg-fill-top: light-dark(rgba(255, 255, 255, .96), rgba(34, 48, 70, .96)); }
  .lg-card { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.lg-page { --lg-fill: light-dark(rgba(255, 255, 255, .88), rgba(24, 34, 48, .92)); --lg-fill-top: light-dark(rgba(255, 255, 255, .94), rgba(34, 48, 70, .94)); }
}
@media (forced-colors: active) {
  .lg-card { border: 1px solid CanvasText; }
  .lg-field:focus-within { outline: 2px solid Highlight; }
  .lg-btn { border-color: ButtonText; }
}
