/* Live authentication only. The account UI keeps its existing visual system. */
html:has(#authScreen:not(.hidden)) { color-scheme: dark; background: #080b09; }
body:has(#authScreen:not(.hidden)) { background: #080b09; }
.editorial-product #authScreen {
  --auth-paper: #080b09;
  --auth-ink: #f5f0e4;
  --auth-muted: #bbbdb2;
  --auth-gold: #ddbd73;
  --text: var(--auth-ink);
  --text-soft: var(--auth-muted);
  --brand: var(--auth-gold);
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  min-height: 100vh;
  min-height: 100svh;
  overflow: clip;
  isolation: isolate;
  color: var(--auth-ink);
  color-scheme: dark;
  background: var(--auth-paper);
}

#authScreen .auth-scene-header {
  position: relative;
  z-index: 5;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px max(24px, 4.2vw, env(safe-area-inset-left));
  border-bottom: 1px solid #d8c39724;
  background: #080b09e8;
  padding-top: max(8px, env(safe-area-inset-top));
}

#authScreen .auth-scene-brand {
  flex: 0 0 auto;
  color: var(--auth-ink);
  font-family: var(--display-serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
}

#authScreen .auth-scene-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

#authScreen .auth-scene-nav a,
#authScreen .auth-scene-nav button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid #d8c39735;
  border-radius: 24px;
  color: var(--auth-muted);
  background: transparent;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
}

#authScreen .auth-scene-nav a:hover,
#authScreen .auth-scene-nav button:hover {
  color: var(--auth-ink);
  border-color: var(--auth-gold);
  background: #ddbd730d;
}

#authScreen .auth-scene-photo {
  position: absolute;
  z-index: 0;
  inset: 72px 0 auto;
  width: 100%;
  height: max(760px, calc(100svh - 72px));
  margin: 0;
  overflow: hidden;
  background: var(--auth-paper);
}

#authScreen .auth-scene-photo [data-scene-image] {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right top;
  transform: none;
  animation: none;
}

.editorial-product #authScreen .auth-panel {
  position: relative;
  z-index: 3;
  width: min(490px, 39%);
  height: auto;
  min-height: 0;
  margin: 0 0 0 4.2%;
  padding: 32px 0 42px;
  overflow: visible;
  color: var(--auth-ink);
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

#authScreen .auth-panel::before { content: none; }
#authScreen .auth-panel > * { animation: none; }

.editorial-product #authScreen .auth-kicker {
  color: var(--auth-gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
}

.editorial-product #authScreen .auth-panel h1 {
  max-width: 100%;
  margin: 13px 0 14px;
  color: var(--auth-ink);
  font-family: var(--display-serif);
  font-size: clamp(36px, 3.5vw, 52px);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.025em;
  text-wrap: balance;
}

#authScreen .auth-panel > .muted {
  margin: 0 0 16px;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.6;
}

.editorial-product #authScreen .auth-direct-note {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0 0 14px;
  padding: 0 0 14px;
  border: 0;
  border-bottom: 1px solid #d8c3972b;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#authScreen .auth-direct-note > svg { display: none; }
#authScreen .auth-direct-note strong { color: #e0d5b8; font-size: 11px; }
#authScreen .auth-direct-note small { display: block; color: var(--auth-muted); font-size: 11px; line-height: 1.5; }
#authScreen .auth-direct-note small:empty { display: none; }

/* The brief registration copy has no extra introductory blocks. Login and
   selected lab tools retain their own context when data-auth-copy is absent. */
#authScreen[data-auth-copy="trial"] .auth-kicker,
.editorial-product #authScreen[data-auth-copy="trial"] .auth-direct-note { display: none; }
.editorial-product #authScreen[data-auth-copy="trial"] .auth-panel h1 { margin-top: 0; }
#authScreen[data-auth-copy="trial"] .auth-panel > .muted { font-size: 16px; }
#authScreen[data-auth-copy="trial"] .auth-panel #authNote { font-size: 12px; }

#authScreen .auth-tabs { margin: 0 0 16px; border-color: #d8c39735; }
#authScreen .auth-tabs button { min-height: 44px; padding: 8px 10px; color: var(--auth-muted); font-size: 12px; }
#authScreen .auth-tabs button.active { color: var(--auth-gold); border-color: var(--auth-gold); background: #ddbd7309; }
#authScreen .auth-tabs button:hover { color: var(--auth-ink); background: #ddbd7310; }

#authScreen .auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#authScreen .auth-form > label { gap: 7px; color: var(--auth-muted); font-size: 12px; }
#authScreen .auth-form input[type="email"],
#authScreen .auth-form input[type="password"],
#authScreen .auth-form input[type="text"] {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid #d8c39745;
  border-radius: 4px;
  color: var(--auth-ink);
  background: #0e1512;
  font-size: 16px;
}

#authScreen .auth-form input::placeholder { color: #979e92; font-size: 13px; }
#authScreen .auth-form input:focus { border-color: var(--auth-gold); box-shadow: 0 0 0 3px #ddbd7320; }
#authScreen .auth-form input:-webkit-autofill { -webkit-text-fill-color: #f5f0e4; box-shadow: 0 0 0 1000px #182019 inset; }

#authScreen .legal-consent-group {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  grid-column: 1 / -1;
  gap: 0 8px;
  padding: 2px 0 0;
}

#authScreen .auth-form .legal-consent {
  display: grid;
  min-height: 44px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: none;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  color: var(--auth-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

#authScreen .auth-form .legal-consent-age { grid-column: 1 / -1; }

#authScreen .legal-consent input { width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: var(--auth-gold); }
.editorial-product #authScreen .legal-consent a { color: #e5cd93; text-decoration: underline; font-weight: 400; }

.editorial-product #authScreen .auth-form > .primary {
  grid-column: 1 / -1;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--auth-gold);
  border-radius: 4px;
  color: #191b14;
  background: var(--auth-gold);
  font-size: 13px;
  font-weight: 750;
}

.editorial-product #authScreen .auth-form > .primary:hover { color: #080b09; background: #edcf89; border-color: #edcf89; }
#authScreen .auth-panel .auth-note { margin: 12px 0 0 !important; color: #c2bcae; text-align: left; font-size: 11px; line-height: 1.55; }
#authScreen .auth-legal-links { justify-content: flex-start; gap: 0 16px; margin: 10px 0 0; }
#authScreen .auth-legal-links a { display: inline-flex; min-height: 44px; align-items: center; color: var(--auth-muted); font-size: 11px; font-weight: 400; }
#authScreen .auth-panel .auth-scene-identity { margin: 3px 0 0; color: #a7afa3; font-size: 10px; line-height: 1.5; }

#authScreen .auth-scene-caption {
  position: absolute;
  z-index: 3;
  right: 4%;
  bottom: 35px;
  width: min(360px, 33%);
  padding: 12px 0 0;
  border-top: 1px solid #d8c39738;
  color: #d8c397;
  text-shadow: 0 2px 8px #080b09;
}

#authScreen .auth-scene-caption p { margin: 0 0 5px; font-family: var(--display-serif); font-size: 23px; line-height: 1.1; }
#authScreen .auth-scene-caption span { font-size: 10px; color: var(--auth-muted); }
#authScreen :is(a, button, input):focus-visible { outline: 2px solid var(--auth-gold); outline-offset: 3px; }

@media (min-width: 961px) and (max-width: 1150px) {
  .editorial-product #authScreen .auth-panel { width: 42%; margin-left: 3%; padding-top: 28px; }
  #authScreen .auth-form { grid-template-columns: minmax(0, 1fr); }
  #authScreen .auth-scene-photo { height: max(800px, calc(100svh - 72px)); }
}

@media (max-width: 960px) {
  #authScreen .auth-scene-header { min-height: 64px; gap: 8px; padding: 6px max(18px, env(safe-area-inset-left)); }
  #authScreen .auth-scene-nav { gap: 4px; }
  #authScreen .auth-scene-nav a, #authScreen .auth-scene-nav button { padding: 7px 10px; font-size: 11px; }
  #authScreen .auth-scene-photo { position: relative; inset: auto; width: 100%; height: auto; aspect-ratio: 8 / 5; }
  #authScreen .auth-scene-photo [data-scene-image] { object-position: center; }
  .editorial-product #authScreen .auth-panel { width: min(580px, 100%); margin: 0 auto; padding: 28px 24px max(36px, env(safe-area-inset-bottom)); }
  .editorial-product #authScreen .auth-panel h1 { font-size: clamp(36px, 6vw, 48px); }
  #authScreen .auth-scene-caption { position: relative; right: auto; bottom: auto; width: min(532px, calc(100% - 48px)); margin: 0 auto 30px; }
  #authScreen .scene-bridge, #authScreen > .scene-spotlight { pointer-events: none; }
}

@media (max-width: 540px) {
  #authScreen .auth-scene-header { flex-wrap: wrap; padding: 6px max(16px, env(safe-area-inset-left)); }
  #authScreen .auth-scene-brand { font-size: 23px; }
  #authScreen .auth-scene-nav { flex: 1; justify-content: flex-end; }
  #authScreen .auth-scene-nav a, #authScreen .auth-scene-nav button { padding: 6px 8px; font-size: 10px; }
  #authScreen .auth-scene-nav [data-scene-replay] { display: none; }
  .editorial-product #authScreen .auth-panel { padding: 24px 20px max(30px, env(safe-area-inset-bottom)); }
  .editorial-product #authScreen .auth-panel h1 { font-size: clamp(34px, 9.7vw, 43px); }
  #authScreen .auth-form { grid-template-columns: minmax(0, 1fr); }
  #authScreen .auth-form .legal-consent { font-size: 12px; }
  #authScreen .auth-panel > .muted { font-size: 14px; }
  #authScreen .auth-panel .auth-note, #authScreen .auth-panel .auth-scene-identity { font-size: 11px; }
}

@media (max-height: 500px) and (pointer: coarse) {
  #authScreen .auth-scene-header { position: relative; }
  #authScreen .auth-scene-photo { max-height: 260px; }
  .editorial-product #authScreen .auth-panel { width: min(600px, 100%); }
  #authScreen .auth-form { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  #authScreen .auth-panel > * { animation: none !important; }
}

@media (max-width: 960px) {
  #authScreen .auth-scene-header { padding-top: max(6px, env(safe-area-inset-top)); }
}

/* Mobile: the cropped scene precedes the form; the original JPG is unchanged. */
@media (max-width: 960px) {
  .editorial-product #authScreen {
    display: flex;
    flex-direction: column;
  }
  #authScreen .auth-scene-header { order: 0; min-height: 60px; }
  .editorial-product #authScreen .auth-panel {
    order: 2;
    width: min(520px, 100%);
    padding: 22px max(20px, env(safe-area-inset-left)) 28px;
  }
  #authScreen .auth-kicker,
  #authScreen .auth-direct-note,
  #authScreen .auth-scene-caption { display: none; }
  .editorial-product #authScreen .auth-panel h1 {
    margin: 0 0 12px;
    font-size: clamp(32px, 8.9vw, 40px);
    line-height: 1.05;
  }
  #authScreen .auth-panel > .muted {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.5;
  }
  #authScreen .auth-tabs { margin-bottom: 16px; }
  #authScreen .auth-tabs button { padding: 8px; font-size: 12px; }
  #authScreen .auth-form { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  #authScreen .auth-form .legal-consent { font-size: 12px; line-height: 1.5; }
  #authScreen:has(#legalConsentGroup:not(.hidden)) .auth-legal-links { display: none; }
  #authScreen .auth-panel .auth-scene-identity { margin-top: 14px; font-size: 11px; line-height: 1.5; }
  #authScreen .auth-scene-photo {
    order: 1;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    max-height: none;
    max-width: 480px;
    align-self: center;
    aspect-ratio: 1.08;
    margin-bottom: 0;
  }
  #authScreen .auth-scene-photo [data-scene-image] { object-fit: cover; object-position: right center; }
  #authScreen .auth-scene-nav [data-scene-toggle],
  #authScreen .auth-scene-nav [data-scene-replay] { display: none; }
  #authScreen > .scene-bridge,
  #authScreen > .scene-spotlight {
    top: max(60px, calc(54px + env(safe-area-inset-top))); bottom: auto;
    left: max(0px, calc((100% - 480px) / 2)); right: auto;
    width: min(100%, 480px); height: calc(min(100vw, 480px) / 1.08);
  }
}

/* Narrow phones keep labels legible instead of shrinking the consent text. */
@media (max-width: 359px) {
  #authScreen .legal-consent-group { grid-template-columns: max-content minmax(0, 1fr); }
}
