/**
 * Login Studio layout — color tokens live in theme-studio.css
 * Themes via html[data-studio-theme] (shared with app shell)
 */
:root {
  --ls-ease-out: cubic-bezier(.16, 1, .3, 1);
  --ls-radius: 28px;
  --ls-touch: 48px;
  --ls-blur: 28px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.ls-body {
  margin: 0;
  font-family: var(--ls-font);
  color: var(--ls-ink);
  background: var(--ls-stage-1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.ls-stage {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  isolation: isolate;
}

/* Ambient canvas */
.ls-ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 85% -10%, var(--ls-stage-2), transparent 55%),
    radial-gradient(900px 600px at -5% 110%, var(--ls-stage-3), transparent 50%),
    linear-gradient(160deg, var(--ls-stage-1), var(--ls-stage-3) 55%, var(--ls-stage-2));
  transition: background .8s var(--ls-ease);
}
.ls-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--ls-grain);
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.ls-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform;
  animation: lsOrbDrift 18s var(--ls-ease) infinite alternate;
}
.ls-orb-a {
  width: min(48vw, 420px); height: min(48vw, 420px);
  background: var(--ls-orb-a);
  top: -8%; right: 8%;
  animation-duration: 16s;
}
.ls-orb-b {
  width: min(42vw, 360px); height: min(42vw, 360px);
  background: var(--ls-orb-b);
  bottom: -6%; left: -4%;
  animation-duration: 22s;
  animation-delay: -4s;
}
.ls-orb-c {
  width: min(36vw, 300px); height: min(36vw, 300px);
  background: var(--ls-orb-c);
  top: 42%; left: 48%;
  animation-duration: 20s;
  animation-delay: -8s;
}
@keyframes lsOrbDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4%, -6%, 0) scale(1.12); }
}

html[data-studio-theme="phosphor"] .ls-ambient::before,
html[data-login-theme="phosphor"] .ls-ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(52, 211, 153, .03) 2px,
    rgba(52, 211, 153, .03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Main composition */
.ls-frame {
  position: relative;
  z-index: 2;
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(18px, 3vw, 40px);
  align-items: center;
  animation: lsIn .7s var(--ls-ease-out) both;
}
@keyframes lsIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.ls-brand {
  color: var(--ls-brand-ink);
  padding: clamp(8px, 2vw, 20px);
  max-width: 34rem;
}
.ls-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  animation: lsIn .8s var(--ls-ease-out) .05s both;
}
.ls-brand-mark img {
  width: clamp(52px, 8vw, 72px);
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35));
}
.ls-brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(12px);
}
.ls-brand h1 {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 4.6vw, 3.15rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  text-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  animation: lsIn .85s var(--ls-ease-out) .12s both;
}
.ls-brand p {
  margin: 0;
  max-width: 36ch;
  font-size: clamp(.95rem, 1.6vw, 1.1rem);
  line-height: 1.7;
  color: var(--ls-brand-muted);
  font-weight: 500;
  animation: lsIn .85s var(--ls-ease-out) .2s both;
}
.ls-brand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  animation: lsIn .85s var(--ls-ease-out) .28s both;
}
.ls-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--ls-brand-ink);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(10px);
}
.ls-meta-pill i { opacity: .85; }

/* Glass card */
.ls-card {
  position: relative;
  border-radius: var(--ls-radius);
  padding: clamp(22px, 3.5vw, 34px);
  background: linear-gradient(155deg, var(--ls-surface), var(--ls-surface-2));
  border: 1px solid var(--ls-line);
  box-shadow: var(--ls-card-shadow);
  backdrop-filter: blur(var(--ls-blur)) saturate(1.35);
  -webkit-backdrop-filter: blur(var(--ls-blur)) saturate(1.35);
  animation: lsCardIn .9s var(--ls-ease-out) .15s both;
  overflow: hidden;
}
.ls-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  opacity: .7;
  pointer-events: none;
}
@keyframes lsCardIn {
  from { opacity: 0; transform: translateY(28px) scale(.96); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

.ls-card-head {
  margin-bottom: 22px;
}
.ls-card-head h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ls-ink);
}
.ls-card-head p {
  margin: 0;
  font-size: .82rem;
  color: var(--ls-muted);
  font-weight: 600;
}

.ls-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ls-danger-bg);
  border: 1px solid rgba(185, 28, 28, .25);
  color: var(--ls-danger);
  font-size: .82rem;
  font-weight: 700;
  animation: lsShake .45s var(--ls-ease);
}
.ls-alert.is-visible { display: flex; }
@keyframes lsShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.ls-field {
  margin-bottom: 14px;
  animation: lsIn .6s var(--ls-ease-out) both;
}
.ls-field:nth-child(1) { animation-delay: .22s; }
.ls-field:nth-child(2) { animation-delay: .3s; }
.ls-field label {
  display: block;
  margin-bottom: 7px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--ls-muted);
}
.ls-field-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--ls-touch);
  padding: 0 14px;
  border-radius: 16px;
  background: var(--ls-field-bg);
  border: 1px solid var(--ls-line);
  transition: border-color .25s var(--ls-ease), box-shadow .25s var(--ls-ease), transform .25s var(--ls-ease);
}
.ls-field-shell:focus-within {
  border-color: var(--ls-accent);
  box-shadow: 0 0 0 4px var(--ls-accent-soft), 0 0 28px -8px var(--ls-glow);
  transform: translateY(-1px);
}
.ls-field-shell svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: .7;
  color: var(--ls-accent);
}
.ls-field-shell input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ls-field-ink);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  direction: ltr;
  text-align: left;
  padding: 12px 0;
}
.ls-field-shell input::placeholder { color: var(--ls-muted); opacity: .7; font-weight: 500; }
.ls-toggle-pass {
  border: 0;
  background: transparent;
  color: var(--ls-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: color .2s, background .2s;
}
.ls-toggle-pass:hover { color: var(--ls-accent); background: var(--ls-accent-soft); }
.ls-toggle-pass svg { width: 18px; height: 18px; }

.ls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 18px;
  flex-wrap: wrap;
}
.ls-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--ls-muted);
  cursor: pointer;
  user-select: none;
}
.ls-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ls-accent);
}
.ls-link {
  font-size: .78rem;
  font-weight: 700;
  color: var(--ls-accent);
  text-decoration: none;
  transition: opacity .2s;
}
.ls-link:hover { opacity: .8; }

.ls-submit {
  position: relative;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  font-family: inherit;
  font-size: .98rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ls-accent), var(--ls-accent-2));
  box-shadow: 0 14px 36px -14px var(--ls-glow), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .25s var(--ls-ease), box-shadow .25s var(--ls-ease), filter .25s;
  animation: lsIn .65s var(--ls-ease-out) .38s both;
}
.ls-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .28) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: lsShimmer 3.6s var(--ls-ease) infinite;
}
@keyframes lsShimmer {
  0%, 55% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
.ls-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px -12px var(--ls-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
  filter: brightness(1.05);
}
.ls-submit:active { transform: translateY(0) scale(.985); }
.ls-submit.is-loading {
  pointer-events: none;
  opacity: .85;
}
.ls-submit-inner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.ls-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lsSpin .7s linear infinite;
  display: none;
}
.ls-submit.is-loading .ls-spinner { display: block; }
.ls-submit.is-loading .ls-submit-label { opacity: .85; }
@keyframes lsSpin { to { transform: rotate(360deg); } }

.ls-alt {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  animation: lsIn .65s var(--ls-ease-out) .45s both;
}
.ls-alt a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 14px;
  text-decoration: none;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ls-ink);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--ls-line);
  transition: background .2s, transform .2s, border-color .2s;
}
.ls-alt a:hover {
  background: var(--ls-accent-soft);
  border-color: var(--ls-accent);
  transform: translateY(-1px);
}

.ls-card-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--ls-line);
  text-align: center;
  font-size: .7rem;
  font-weight: 600;
  color: var(--ls-muted);
}

/* Theme dock */
.ls-dock {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .55);
  animation: lsIn .7s var(--ls-ease-out) .5s both;
}
.ls-dock-label {
  padding: 0 8px 0 4px;
  font-size: .68rem;
  font-weight: 800;
  color: rgba(255, 255, 255, .72);
  white-space: nowrap;
}
.ls-theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform .25s var(--ls-ease), box-shadow .25s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}
.ls-theme-btn:hover { transform: scale(1.12); }
.ls-theme-btn.is-active {
  transform: scale(1.14);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .35), 0 0 18px rgba(255, 255, 255, .25);
}
.ls-theme-btn[data-theme="aurora"] {
  background: conic-gradient(from 210deg, #0f766e, #38bdf8, #0f172a, #0f766e);
}
.ls-theme-btn[data-theme="cinema"] {
  background: conic-gradient(from 180deg, #0a0a0a, #eab308, #292524, #0a0a0a);
}
.ls-theme-btn[data-theme="tide"] {
  background: conic-gradient(from 120deg, #082f49, #22d3ee, #1d4ed8, #082f49);
}
.ls-theme-btn[data-theme="ember"] {
  background: conic-gradient(from 40deg, #1c1917, #f97316, #7c2d12, #1c1917);
}
.ls-theme-btn[data-theme="sage"] {
  background: conic-gradient(from 90deg, #14532d, #86efac, #3f6212, #14532d);
}
.ls-theme-btn[data-theme="phosphor"] {
  background: conic-gradient(from 200deg, #022c22, #34d399, #064e3b, #022c22);
}

.ls-utils {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 20;
  display: flex;
  gap: 8px;
}
.ls-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(15, 23, 42, .4);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform .2s, background .2s;
}
.ls-icon-btn:hover { transform: translateY(-1px); background: rgba(15, 23, 42, .55); }
.ls-icon-btn svg { width: 18px; height: 18px; }

/* Theme crossfade flash */
.ls-stage.is-theme-switching .ls-card,
.ls-stage.is-theme-switching .ls-brand {
  animation: lsThemePulse .55s var(--ls-ease);
}
@keyframes lsThemePulse {
  0% { filter: blur(0); opacity: 1; }
  40% { filter: blur(4px); opacity: .72; }
  100% { filter: blur(0); opacity: 1; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Responsive: stack — brand stays first */
@media (max-width: 900px) {
  .ls-frame {
    grid-template-columns: 1fr;
    max-width: 460px;
  }
  .ls-brand {
    text-align: center;
    max-width: none;
    padding-bottom: 0;
  }
  .ls-brand-mark { justify-content: center; }
  .ls-brand p { margin-inline: auto; }
  .ls-brand-meta { justify-content: center; }
  .ls-dock-label { display: none; }
}

@media (max-width: 480px) {
  .ls-card { padding: 18px 16px; border-radius: 22px; }
  .ls-brand h1 { font-size: 1.65rem; }
  .ls-dock { gap: 6px; padding: 7px 8px; }
  .ls-theme-btn { width: 24px; height: 24px; }
}
