/* ==========================================================================
   auth.css - the login / register gate.

   Reuses the shared design tokens (base.css) and the .screen/.panel/.btn
   primitives (screens.css) so the gate looks like the rest of the game rather
   than a bolted-on dialog. Only the pieces that have no other home are here:
   the tab strip, the account roster and the auth host layer.
   ========================================================================== */

/* Sits above the workshop (z-index 15) and the screen layer (20): while the
   gate is up, nothing else may be reachable. */
.auth-host {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: auto;
}

.auth-host--hidden { display: none !important; }

.auth-screen {
  /* The gate is the first thing the player sees, before any 3D is on screen,
     so it paints its own backdrop instead of relying on the canvas behind it. */
  background:
    radial-gradient(1100px 620px at 50% 12%, rgba(99, 102, 241, 0.16), transparent 68%),
    radial-gradient(900px 540px at 50% 100%, rgba(56, 189, 248, 0.10), transparent 70%),
    linear-gradient(180deg, #05070d, #080c16 60%, #05070d);
}

.auth-panel {
  width: min(460px, 92vw);
  padding: 26px 28px 22px;
}

/* ------------------------------------------------------------------ brand */

.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}

.auth-brand__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0.2em;
  color: var(--ink);
  text-shadow: var(--hud-glow);
}

.auth-brand__sub {
  margin: 9px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.6;
}

/* ------------------------------------------------------------------- tabs */

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 18px;
}

.auth-tab {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 8px;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}

.auth-tab:hover { color: var(--ink-dim); }

.auth-tab--active {
  color: #04121f;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

/* ------------------------------------------------------------------- form */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Decoy inputs: absorb the browser's password-manager autofill so it cannot
   silently overwrite the real fields with another account's credentials. */
.auth-decoy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.auth-field__input {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.auth-field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.auth-hint {
  min-height: 17px;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}

.auth-hint--warn { color: var(--warn); }
.auth-hint--good { color: var(--good); }

.auth-submit {
  width: 100%;
  padding: 11px 18px;
  font-size: 14px;
}

/* ---------------------------------------------------------------- message */

.auth-message {
  min-height: 18px;
  margin-top: 12px;
  font-size: 12.5px;
  text-align: center;
  line-height: 1.5;
}

.auth-message--bad { color: var(--bad); }
.auth-message--good { color: var(--good); }

/* ----------------------------------------------------------------- roster */

.auth-roster {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.auth-roster:empty { display: none; }

.auth-roster__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.auth-account {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 6px;
}

.auth-account__pick {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.auth-account__pick:hover {
  background: var(--bg-raise);
  border-color: var(--line-glow);
}

.auth-account__name {
  font-size: 13px;
  font-weight: 600;
}

.auth-account__meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
}

.auth-account__del {
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-faint);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 10px;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.auth-account__del:hover {
  color: var(--bad);
  border-color: var(--bad);
}

/* ------------------------------------------------- workshop account chip */

/* The signed-in user, shown in the workshop header. It has to read as an
   identity badge rather than a button, but still be clickable (sign out). */
.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.account-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
  flex: 0 0 auto;
}

.account-chip__name {
  font-weight: 600;
  color: var(--ink);
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip__meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
}

.account-chip__funds {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--warn);
}

.account-chip__out {
  font: inherit;
  font-size: 11px;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.account-chip__out:hover {
  color: var(--warn);
  border-color: var(--warn);
}
