/* ==========================================================================
   slopGames — shared/sg-account.css
   Styles for the shared account modal (shared/sg-account-ui.js), loaded by
   COMBINE, GRIDIRON and COMBINE-FC.

   THEMING STRATEGY
   Every rule here is scoped under .sg-auth and every colour/typeface is read
   from the HOST GAME's own custom properties, with a neutral fallback. The
   three games use different accent tokens (--cb-accent in COMBINE, --c-accent
   in GRIDIRON, --c-lime in COMBINE-FC) but share --c-panel / --c-line /
   --c-text / --c-text-2 / --font-display / --font-body, so a single
   fallback chain themes the modal correctly in all three without any
   per-game overrides:

       var(--cb-accent, var(--c-accent, var(--c-lime, #c9a227)))

   This file must never style a bare element selector or any class the games
   own (.btn, .modal, ...) — the account UI reuses .btn/.btn--primary/
   .btn--ghost deliberately so its buttons ARE that game's buttons.
   ========================================================================== */

/* Belt-and-braces for the nav hook points. Each game styles its nav buttons
   with `.btn { display: inline-flex }`, which beats the user-agent's
   `[hidden] { display: none }` rule — so the STORE button shipped visible
   (greyed out) in GRIDIRON despite carrying `hidden` in the markup.
   sg-account-ui.js also sets style.display directly; this rule covers the
   case where the CSS loads but the script does not. */
#nav-store[hidden],
#nav-account[hidden],
#cb-nav-store[hidden],
#cb-nav-account[hidden] {
  display: none !important;
}

.sg-auth {
  --sg-accent: var(--cb-accent, var(--c-accent, var(--c-lime, #c9a227)));
  --sg-panel: var(--c-panel-2, var(--c-panel, #16181d));
  --sg-line: var(--c-line, rgba(255, 255, 255, 0.14));
  --sg-line-strong: var(--c-line-strong, rgba(255, 255, 255, 0.28));
  --sg-text: var(--c-text, #e8e8ea);
  --sg-text-2: var(--c-text-2, rgba(232, 232, 234, 0.72));
  --sg-text-3: var(--c-text-3, rgba(232, 232, 234, 0.48));
  --sg-bad: var(--c-bad, #e2564a);
  --sg-ok: var(--c-ok, #4ec27f);

  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  /* The host games' .modal is comfortably wider than a login form needs, so
     the column is capped and centred rather than stretched — full-width text
     inputs in a 700px dialog read as a data-entry screen, not a small
     optional sign-in. */
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  font-family: var(--font-body, system-ui, sans-serif);
  color: var(--sg-text);
}

/* ---------------- tabs ---------------- */

.sg-auth__tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--sg-line);
  border-radius: 3px;
  overflow: hidden;
}

.sg-auth__tab {
  flex: 1 1 50%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: var(--sg-text-3);
  font-family: var(--font-display, var(--font-body, system-ui, sans-serif));
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}

.sg-auth__tab + .sg-auth__tab {
  border-left: 1px solid var(--sg-line);
}

.sg-auth__tab:hover {
  color: var(--sg-text);
}

.sg-auth__tab.is-active {
  background: color-mix(in srgb, var(--sg-accent) 16%, transparent);
  color: var(--sg-accent);
}

.sg-auth__tab:focus-visible {
  outline: 2px solid var(--sg-accent);
  outline-offset: -2px;
}

/* ---------------- copy ---------------- */

.sg-auth__blurb,
.sg-auth__foot,
.sg-auth__status,
.sg-auth__devices,
.sg-auth__notice {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--sg-text-2);
}

.sg-auth__foot,
.sg-auth__status,
.sg-auth__devices {
  font-size: 0.76rem;
  color: var(--sg-text-3);
}

.sg-auth__status {
  padding-top: 10px;
  border-top: 1px solid var(--sg-line);
}

.sg-auth__notice {
  padding: 8px 10px;
  border-left: 2px solid var(--sg-ok);
  background: color-mix(in srgb, var(--sg-ok) 10%, transparent);
  color: var(--sg-text);
  font-size: 0.8rem;
}

/* ---------------- form ---------------- */

.sg-auth__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.sg-auth__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sg-auth__label {
  font-family: var(--font-display, var(--font-body, system-ui, sans-serif));
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--sg-text-3);
}

.sg-auth__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid var(--sg-line);
  border-radius: 3px;
  background: var(--sg-panel);
  color: var(--sg-text);
  font-family: var(--font-mono, var(--font-body, ui-monospace, monospace));
  font-size: 0.9rem;
  transition: border-color 120ms ease;
}

.sg-auth__input::placeholder {
  color: var(--sg-text-3);
}

.sg-auth__input:hover {
  border-color: var(--sg-line-strong);
}

.sg-auth__input:focus {
  outline: none;
  border-color: var(--sg-accent);
}

.sg-auth__input:focus-visible {
  outline: 2px solid var(--sg-accent);
  outline-offset: 1px;
}

.sg-auth__submit {
  width: 100%;
  margin-top: 2px;
}

.sg-auth__error {
  margin: 0;
  padding: 8px 10px;
  border-left: 2px solid var(--sg-bad);
  background: color-mix(in srgb, var(--sg-bad) 12%, transparent);
  color: var(--sg-text);
  font-size: 0.82rem;
  line-height: 1.45;
}

.sg-auth__error[hidden] {
  display: none;
}

/* ---------------- signed-in panel ---------------- */

.sg-auth__who {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--sg-line);
  border-radius: 3px;
  background: var(--sg-panel);
}

.sg-auth__who-label {
  font-family: var(--font-display, var(--font-body, system-ui, sans-serif));
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--sg-text-3);
}

.sg-auth__who-value {
  font-family: var(--font-mono, var(--font-body, ui-monospace, monospace));
  font-size: 0.86rem;
  color: var(--sg-accent);
  overflow-wrap: anywhere;
  text-align: right;
}

.sg-auth__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sg-auth__actions .btn {
  flex: 1 1 auto;
}

.sg-auth__danger:hover {
  border-color: var(--sg-bad);
  color: var(--sg-bad);
}

/* ---------------- narrow screens ---------------- */

@media (max-width: 480px) {
  .sg-auth {
    gap: 12px;
  }

  .sg-auth__tab {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    padding: 9px 6px;
  }

  .sg-auth__who {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .sg-auth__who-value {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-auth__tab,
  .sg-auth__input {
    transition: none;
  }
}
