:root {
  --auth-text: #f5f7f2;
  --auth-muted: rgba(239, 245, 238, .74);
  --auth-glass: rgba(17, 30, 25, .72);
  --auth-glass-strong: rgba(19, 34, 28, .84);
  --auth-border: rgba(235, 244, 233, .2);
  --auth-focus: #d4e987;
  --auth-accent: #b8d96c;
  --auth-accent-deep: #6b923f;
}

.auth-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: #18251f;
  color: var(--auth-text);
}

.auth-season-image,
.auth-atmosphere {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.auth-season-image {
  z-index: -3;
  object-fit: cover;
  object-position: center;
  animation: auth-image-in 700ms ease-out both;
}

.auth-atmosphere {
  z-index: -2;
  background: linear-gradient(90deg, rgba(10, 23, 18, .2) 0%, rgba(10, 23, 18, .3) 42%, rgba(8, 18, 14, .72) 100%), linear-gradient(180deg, rgba(8, 18, 14, .1), rgba(8, 18, 14, .48));
}

.auth-card {
  position: relative;
  width: min(100%, 450px);
  margin-left: clamp(0px, 28vw, 470px);
  padding: clamp(30px, 5vw, 48px);
  border: 1px solid var(--auth-border);
  border-radius: 18px;
  background: var(--auth-glass);
  box-shadow: 0 28px 90px rgba(3, 13, 9, .35), inset 0 1px 0 rgba(255, 255, 255, .14);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  animation: auth-panel-in 450ms ease-out both;
}

@supports not ((backdrop-filter: blur(20px))) {
  .auth-card { background: var(--auth-glass-strong); }
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  color: var(--auth-text);
  font-family: Georgia, serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-decoration: none;
}

.auth-logo img {
  width: auto;
  height: 62px;
  max-width: 92px;
  object-fit: contain;
  filter: drop-shadow(0 5px 13px rgba(0, 0, 0, .25));
  animation: auth-logo-in 600ms 80ms ease-out both;
}

.auth-card h1 { color: var(--auth-text); font-family: Georgia, serif; font-size: clamp(2.2rem, 7vw, 3.25rem); line-height: 1.02; letter-spacing: -.025em; }
.auth-card h2 { color: var(--auth-text); }
.auth-card .eyebrow { color: var(--auth-focus); }
.auth-card .muted { color: var(--auth-muted); }
.auth-card .lede { color: var(--auth-muted); }
.auth-card .form { gap: 18px; margin-top: 30px; }
.auth-card .form label { color: var(--auth-text); font-size: .82rem; }
.auth-card input,
.auth-card select {
  min-height: 52px;
  margin-top: 2px;
  border: 1px solid rgba(239, 247, 235, .27);
  border-radius: 9px;
  background: rgba(8, 19, 14, .4);
  color: var(--auth-text);
  font-size: 16px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.auth-card input::placeholder { color: rgba(239, 247, 235, .45); }
.auth-card input:focus,
.auth-card select:focus { border-color: var(--auth-focus); background: rgba(8, 19, 14, .58); box-shadow: 0 0 0 3px rgba(212, 233, 135, .17); outline: none; }
.auth-card input:-webkit-autofill { -webkit-text-fill-color: var(--auth-text); box-shadow: 0 0 0 100px #30483b inset; caret-color: var(--auth-text); }
.auth-card .button,
.auth-card .primary { width: 100%; min-height: 52px; border-radius: 9px; background: var(--auth-accent); color: #172318; box-shadow: 0 9px 24px rgba(0, 0, 0, .18); transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease; }
.auth-card .button:hover { background: #d2e88b; box-shadow: 0 12px 28px rgba(0, 0, 0, .25); transform: translateY(-1px); }
.auth-card .button:active { box-shadow: 0 5px 14px rgba(0, 0, 0, .2); transform: translateY(1px); }
.auth-card .button:disabled { cursor: wait; opacity: .75; transform: none; }
.auth-card .button.is-loading::after { content: ''; display: inline-block; width: 13px; height: 13px; margin-left: 9px; border: 2px solid rgba(23, 35, 24, .35); border-top-color: #172318; border-radius: 50%; vertical-align: -2px; animation: auth-spin 650ms linear infinite; }
.auth-card .button:focus-visible,
.auth-card a:focus-visible,
.auth-card button:focus-visible { outline: 3px solid var(--auth-focus); outline-offset: 3px; }
.auth-card .quiet-link { color: var(--auth-muted); transition: color 180ms ease; }
.auth-card .quiet-link:hover { color: var(--auth-text); }
.password-field { position: relative; }
.password-field input { padding-right: 54px; }
.password-toggle { position: absolute; right: 10px; bottom: 7px; width: 38px; height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--auth-muted); cursor: pointer; }
.password-toggle:hover { background: rgba(255, 255, 255, .1); color: var(--auth-text); }
.password-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.auth-card .flash { display: flex; align-items: flex-start; gap: 10px; min-height: 48px; margin-bottom: 24px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 9px; color: var(--auth-text); background: rgba(109, 43, 33, .65); animation: auth-message-in 250ms ease-out both; }
.auth-card .flash.success { background: rgba(47, 101, 59, .67); }
.flash-icon { position: relative; flex: 0 0 15px; width: 15px; height: 15px; margin-top: 1px; border: 1px solid currentColor; border-radius: 50%; }
.flash-icon::after { content: '!'; position: absolute; inset: 0; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; }
.auth-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 30px 0 0; color: rgba(239, 247, 235, .5); font-size: .72rem; letter-spacing: .04em; }
.auth-status span { width: 6px; height: 6px; border-radius: 50%; background: #b8d96c; box-shadow: 0 0 0 4px rgba(184, 217, 108, .12); }
.otp { text-align: center; font-size: 1.45rem !important; font-weight: 600; letter-spacing: .5em; }
.qr { display: block; width: min(100%, 210px); height: auto; margin: 24px auto 26px; padding: 14px; border-radius: 12px; background: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); }
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 26px 0; }
.recovery-codes code { padding: 11px 8px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 6px; background: rgba(7, 18, 13, .46); color: var(--auth-focus); font: .86rem ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.auth-card .dev-error { color: var(--auth-text); }

@keyframes auth-panel-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-image-in { from { opacity: .7; transform: scale(1.015); } to { opacity: 1; transform: scale(1); } }
@keyframes auth-logo-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-message-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .auth-shell { place-items: start center; }
  .auth-card { margin: 5vh 0 0; padding: 30px 24px; border-radius: 15px; }
  .auth-logo { margin-bottom: 30px; }
  .auth-logo img { height: 54px; }
  .auth-atmosphere { background: linear-gradient(180deg, rgba(8, 18, 14, .2), rgba(8, 18, 14, .7)); }
}

@media (max-height: 720px) and (min-width: 721px) {
  .auth-card { padding-top: 26px; padding-bottom: 26px; }
  .auth-logo { margin-bottom: 22px; }
  .auth-card .form { margin-top: 18px; }
  .auth-status { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-season-image, .auth-card, .auth-logo img, .auth-card .flash, .auth-card .button.is-loading::after { animation: none; }
  .auth-card .button, .auth-card input, .auth-card select, .auth-card .quiet-link { transition: none; }
}
