/* ============================================================
   Coppersmog: Sign-in / Register (page-specific)
   Base variables, reset, and typography live in base.css.
   ============================================================ */

body.page-signin {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(160, 122, 58, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(80, 14, 24, 0.08) 0%, transparent 50%),
    var(--bg-0);
  background-attachment: fixed;
}

/* ── Layout: just the auth card, centered in viewport ────── */
#welcome {
  min-height: 100vh;
  padding: 75px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* ── Auth gate ──────────────────────────────────────────── */
.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Brand logo above the card (replaces the old text titles) */
.auth-logo-wrap {
  position: relative;
  display: block;
  width: 440px;
  max-width: 90vw;
  margin-bottom: 28px;
}
.auth-logo {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.55));
}

/* Reverse-running real-time clock seated behind the logo's porthole.
   Geometry tracks the transparent hole in the art: centre 49.77%/18.05%,
   width slightly over the ~7.2% aperture so the dial tucks under the ring. */
.auth-clock {
  position: absolute;
  left: 49.77%;
  top: 18.05%;
  width: 7.6%;
  aspect-ratio: 1 / 1;
  height: auto;
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* Blorb eye superimposed on the cyan gem at the foot of the logo (above the art). */
.auth-eye {
  position: absolute;
  left: 50.06%;
  top: 83.0%;
  width: 11%;
  aspect-ratio: 1 / 1;
  height: auto;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

/* Asset preload bar: fills with the spark's cyan before the login card appears,
   so a fresh test-build player has every runtime asset warm in cache first. */
.auth-preload {
  width: 500px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.preload-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bronze-dk);
  border: 1px solid var(--brass-black);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.preload-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--spark) 0%, #7ff4f8 100%);
  box-shadow: 0 0 10px 2px var(--spark-glow);
  transition: width 180ms ease-out;
}
.preload-label {
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--brass-dk);
  text-transform: uppercase;
}

/* Version stamp under the login card */
.auth-version {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--brass-dk);
  opacity: 0.7;
}

.auth-card {
  width: 500px;
  position: relative;
  background:
    linear-gradient(to bottom,
      var(--bronze) 0%,
      var(--brass-mid) 35%,
      var(--bronze-dk) 70%,
      var(--brass-black) 100%);
  border: none;
  border-radius: var(--radius-md);
  padding: 32px 28px 28px;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.30),
    inset 0 -2px 4px rgba(0, 0, 0, 0.55),
    0 18px 40px rgba(0, 0, 0, 0.55);
}

/* Corner rivets */
.auth-card::before,
.auth-card::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, var(--brass-edge) 0%, var(--brass-mid) 50%, var(--brass-black) 100%);
  box-shadow:
    inset 0 -1px 1px rgba(20, 12, 4, 0.65),
    0 1px 1px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.auth-card::before { top: 10px; left: 10px; }
.auth-card::after  { top: 10px; right: 10px; }

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}
.auth-tab {
  flex: 1 1 0;
  background: transparent;
  border: none;
  color: rgba(243, 215, 122, 0.45);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  padding: 10px 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.auth-tab:hover { color: rgba(243, 215, 122, 0.60); }
.auth-tab.active {
  color: var(--amber);
  border-bottom-color: var(--brass);
}
.auth-field {
  display: block;
  margin-bottom: 14px;
}
.auth-field > span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(243, 215, 122, 0.45);
  margin-bottom: 6px;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
}
.auth-field input {
  width: 100%;
  background: rgba(6, 1, 3, 0.60);
  border: 1px solid rgba(160, 122, 58, 0.35);
  border-radius: var(--radius);
  color: var(--text-1);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.auth-field input:hover {
  border-color: rgba(160, 122, 58, 0.55);
}
.auth-field input:focus {
  border-color: var(--brass);
  background: rgba(6, 1, 3, 0.75);
  outline: none;
  box-shadow: 0 0 0 3px rgba(216, 178, 102, 0.12);
}
.auth-error {
  background: rgba(80, 14, 24, 0.40);
  border: 1px solid rgba(180, 40, 50, 0.40);
  border-radius: var(--radius);
  color: #ffb3b8;
  font-size: 13px;
  padding: 8px 12px;
  margin: 4px 0 14px;
}
#auth-submit {
  width: 100%;
  background:
    linear-gradient(to bottom,
      var(--brass) 0%,
      var(--brass-lt) 50%,
      var(--brass-dk) 100%);
  border: none;
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 16px;
  margin-top: 4px;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(240, 214, 144, 0.40);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.40),
    inset 0 -1px 2px rgba(0, 0, 0, 0.30),
    0 2px 6px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
#auth-submit:hover:not(:disabled) {
  background:
    linear-gradient(to bottom,
      var(--brass-hi) 0%,
      var(--brass) 50%,
      var(--bronze) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.50),
    inset 0 -1px 2px rgba(0, 0, 0, 0.30),
    0 2px 8px rgba(0, 0, 0, 0.4);
}
#auth-submit:active:not(:disabled) { transform: scale(0.99); }
#auth-submit:disabled { opacity: 0.5; cursor: progress; }

/* Bottom rivets via box-shadow on the form submit (positioned on the card) */
#auth-form { position: relative; }

/* ── Sign-out button (welcome page: fixed top-right) ──── */
#signout-btn:not(.rail-chip-signout):not(.rail-signout-btn):not(.rail-btn) {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 18, 12, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 8px 14px;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
#signout-btn:not(.rail-chip-signout):not(.rail-signout-btn):not(.rail-btn):hover {
  color: var(--text-1);
  border-color: var(--brass);
  background: rgba(160, 122, 58, 0.10);
}
#signout-btn:not(.rail-chip-signout):not(.rail-signout-btn):not(.rail-btn) #signout-username { color: var(--brass-hi); font-weight: 700; }
#signout-btn:not(.rail-chip-signout):not(.rail-signout-btn):not(.rail-btn) .signout-sep { color: var(--text-4); }
#signout-btn:not(.rail-chip-signout):not(.rail-signout-btn):not(.rail-btn) .signout-label { color: var(--text-3); }
#signout-btn:not(.rail-chip-signout):not(.rail-signout-btn):not(.rail-btn):hover .signout-label { color: var(--text-2); }

/* ── Accessibility brightness/contrast overrides ───────────
   Private vars derived from --a11y-* (defined in base.css,
   overridden at runtime by prefs.js).
   ───────────────────────────────────────────────────────── */

/* ── Text-bright: primary gold/amber labels, titles, active elements ── */
.auth-tab.active,
.toggle-label,
.module-title,
/* menu */
.rail-chip,
.hub-porthole-label,
.hub-tile-label,
.nutrient-label,
.nutrient-price-label,
.nutrient-stock,
.qty-btn,
.qty-input {
  filter: brightness(calc(1 + var(--_tb)));
}

/* ── Text-dim: muted labels, descriptions, placeholders ── */
.settings-current,
.settings-field label,
.auth-field > span,
.auth-gate::after,
.cyl-face,
/* shop */
.nutrient-empty {
  filter: brightness(calc(1 + var(--_td)));
}

/* ── Chrome: brass/bronze buttons and leaf-level metal ── */
.toggle-track,
.toggle-thumb,
.settings-btn,
#auth-submit,
/* lab */
.cyl-arrow,
.tinker-cap,
/* menu */
.rail-btn,
.hub-porthole .porthole-ring,
.hub-tile .tile-frame,
/* shop */
.strain-buy,
.buy-btn {
  filter: brightness(calc(1 + var(--_ch)));
}

/* ── Chrome-container: panels that hold children, gentler factor ── */
.auth-card,
.dash-plate,
.nutrient-card,
.ledger-plate,
.ledger-parchment {
  filter: brightness(calc(1 + var(--_ch) * 0.4));
}

/* ── Text-darken: ticker text gets darker as dials increase ── */
.ticker-row,
.ticker-amount,
.ticker-party,
.ticker-ts,
.ticker-tag {
  filter: brightness(calc(1 - var(--_tb) * 0.25));
}

/* ── Glow: focus rings, active indicators, amber pulses ── */
:focus-visible,
.toggle-switch input:checked + .toggle-track,
/* menu */
.rail-btn.is-active {
  filter: brightness(calc(1 + var(--_gl)));
}

/* ── What's new: changelog link + overlay ─────────────── */
.auth-whatsnew {
  display: block;
  margin: 6px auto 0;
  background: transparent;
  border: none;
  color: var(--brass);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  opacity: 0.85;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.auth-whatsnew:hover { opacity: 1; color: var(--amber); }

.whatsnew-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(10, 5, 2, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}
.whatsnew-card {
  width: 600px;
  max-width: calc(100vw - 48px);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(to bottom,
      var(--bronze) 0%,
      var(--brass-mid) 35%,
      var(--bronze-dk) 70%,
      var(--brass-black) 100%);
  border-radius: var(--radius-md);
  padding: 26px 28px 22px;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.30),
    inset 0 -2px 4px rgba(0, 0, 0, 0.55),
    0 18px 40px rgba(0, 0, 0, 0.65);
}
.whatsnew-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(26, 15, 4, 0.85);
  text-shadow: 0 1px 0 rgba(255, 220, 150, 0.25);
}
/* The log itself is a parchment sheet routed into the brass frame (the vault
   inset treatment), so the copy runs dark ink on paper, not light on metal. */
.whatsnew-entries {
  overflow-y: auto;
  min-height: 0;
  margin-top: 8px;
  padding: 10px 14px 12px;
  border-radius: 3px;
  background:
    linear-gradient(165deg, #e8dcc4 0%, #d9c9a6 45%, #c8b68c 100%);
  box-shadow:
    0 0 0 3px rgba(18, 10, 5, 0.55),
    inset 0 1px 3px rgba(20, 12, 4, 0.35);
}
/* A bronze rail sunk into the paper, so the sheet keeps its parchment reading
   instead of a stock grey bar cutting down its edge. */
.whatsnew-entries {
  scrollbar-width: thin;
  scrollbar-color: var(--bronze) rgba(26, 15, 4, 0.14);
}
.whatsnew-entries::-webkit-scrollbar { width: 8px; }
.whatsnew-entries::-webkit-scrollbar-track {
  background: rgba(26, 15, 4, 0.14);
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(20, 12, 4, 0.4);
}
.whatsnew-entries::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: linear-gradient(to right,
    var(--bronze-dk) 0%,
    var(--bronze) 45%,
    var(--brass-mid) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.3),
    inset 0 -1px 2px rgba(20, 12, 4, 0.5);
}
.whatsnew-entries::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to right,
    var(--bronze) 0%,
    var(--brass-lt) 45%,
    var(--bronze-dk) 100%);
}
.whatsnew-entries h3 {
  margin: 12px 0 2px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.whatsnew-entries section:first-child h3 { margin-top: 0; }
.whatsnew-date {
  font-size: 13px;
  color: var(--ink);
  opacity: 0.55;
  margin-bottom: 8px;
}
.whatsnew-entries h4 {
  margin: 10px 0 3px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
  opacity: 0.78;
}
.whatsnew-entries ul {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}
.whatsnew-entries li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 7px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
/* vector dot, not a glyph bullet */
.whatsnew-entries li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bronze-dk);
}
.whatsnew-close {
  align-self: flex-end;
  margin-top: 14px;
  background:
    linear-gradient(to bottom,
      var(--brass) 0%,
      var(--brass-lt) 50%,
      var(--brass-dk) 100%);
  border: none;
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(240, 214, 144, 0.40);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.40),
    inset 0 -1px 2px rgba(0, 0, 0, 0.30),
    0 2px 6px rgba(0, 0, 0, 0.35);
}
.whatsnew-close:hover {
  background:
    linear-gradient(to bottom,
      var(--brass-hi) 0%,
      var(--brass) 50%,
      var(--bronze) 100%);
}
