/*
 * Animal Army — authentication gate styling.
 *
 * Kept in its own file so styles/game.css stays byte-for-byte diffable against
 * the original prototype artifact. Everything here reuses the existing design
 * tokens from game.css (:root) — manila case file on a dark ink background,
 * stamp-monospace labels, pine/stamp accents.
 */

/* While the gate is up, the game must not be visible or reachable. game.js
   also defers its boot, so these nodes are empty at this point — hiding them
   prevents any flash of layout while auth resolves. */
body.aa-locked .fight-layout,
body.aa-locked .how-to-play-fab,
body.aa-locked .fight-overlay,
body.aa-locked .rules-overlay {
  display: none !important;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  background: radial-gradient(120% 90% at 50% 0%, rgba(10, 6, 3, 0.35), rgba(6, 20, 12, 0.82));
}
.auth-gate[hidden] { display: none; }

/* Reuses .card from game.css (manila paper, rotate, settle animation) and only
   overrides what a form needs. */
.auth-card {
  width: min(400px, 100%);
  margin: auto;
  padding: 30px 26px 24px;
}

.auth-title {
  font-family: var(--font-stamp);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: clamp(19px, 4vw, 23px);
  line-height: 1.2;
  color: var(--ink-text);
  margin: 8px 0 10px;
}
.auth-lede {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-text-dim);
  margin: 0 0 18px;
}

.auth-form { display: block; margin: 0; }

.auth-field { display: block; margin-bottom: 14px; }
.auth-label {
  display: block;
  font-family: var(--font-stamp);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-text-dim);
  margin-bottom: 6px;
}
.auth-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px; /* 16px avoids the iOS focus zoom */
  color: var(--ink-text);
  background: rgba(255, 255, 255, 0.45);
  border: 1.5px solid var(--ink-text-dim);
  border-radius: 4px;
  padding: 11px 12px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.auth-input::placeholder { color: rgba(46, 34, 16, 0.42); }
.auth-input:hover { border-color: var(--ink-text); }
.auth-input:focus {
  outline: none;
  border-color: var(--pine-dark);
  box-shadow: 0 0 0 3px rgba(92, 143, 58, 0.24);
}
.auth-hint {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-text-dim);
  margin-top: 5px;
}

.auth-submit { margin-top: 6px; }
.auth-submit[disabled] { opacity: 0.65; cursor: progress; }

.auth-message {
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 0 0 16px;
  border-left: 3px solid transparent;
}
.auth-message-error {
  color: var(--stamp-dark);
  background: rgba(196, 69, 31, 0.12);
  border-left-color: var(--stamp);
}
.auth-message-success {
  color: var(--pine-dark);
  background: rgba(92, 143, 58, 0.14);
  border-left-color: var(--pine);
}
.auth-message-info {
  color: var(--ink-text);
  background: rgba(217, 150, 46, 0.14);
  border-left-color: var(--amber);
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 14px;
}
.auth-link {
  font-family: var(--font-stamp);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-text-dim);
  background: none;
  border: none;
  border-bottom: 1px solid rgba(46, 34, 16, 0.3);
  padding: 2px 0;
  cursor: pointer;
}
.auth-link:hover { color: var(--ink-text); border-bottom-color: var(--ink-text); }
.auth-link:focus-visible { outline: 2px solid var(--stamp); outline-offset: 3px; }

.auth-foot {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-text-dim);
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed rgba(46, 34, 16, 0.25);
}

.auth-spinner {
  width: 26px;
  height: 26px;
  margin: 12px auto 18px;
  border: 3px solid rgba(46, 34, 16, 0.22);
  border-top-color: var(--pine-dark);
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------- signed-in account bar */

.account-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 6px 8px 6px 12px;
  border: 1px solid rgba(251, 241, 222, 0.28);
  border-radius: 999px;
  background: rgba(10, 6, 3, 0.55);
  backdrop-filter: blur(4px);
}
.account-bar[hidden] { display: none; }
.account-name {
  font-family: var(--font-stamp);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--chalk-dim);
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Cloud-save status. Sits between the account name and Sign out: readable at a
   glance, never louder than the game. Only the states that need the player to
   act (offline / error / conflict / stale) pick up a colour and a pointer. */
.sync-chip {
  font-family: var(--font-stamp);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  background: transparent;
  border: 1px solid rgba(251, 241, 222, 0.22);
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
  cursor: default;
}
.sync-chip[hidden] { display: none; }
.sync-chip:not([disabled]) { cursor: pointer; }
.sync-chip:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; }
.sync-chip[data-state='saved'] { color: var(--pine); border-color: rgba(92, 143, 58, 0.55); }
.sync-chip[data-state='syncing'] { animation: syncPulse 1.4s ease-in-out infinite; }
.sync-chip[data-state='offline'],
.sync-chip[data-state='stale'] { color: var(--amber); border-color: rgba(217, 150, 46, 0.6); }
.sync-chip[data-state='error'],
.sync-chip[data-state='conflict'] { color: var(--chalk); background: var(--stamp-dark); border-color: var(--stamp); }
.sync-chip[data-state='offline']:hover,
.sync-chip[data-state='stale']:hover,
.sync-chip[data-state='error']:hover,
.sync-chip[data-state='conflict']:hover { color: var(--chalk); background: var(--stamp); border-color: var(--stamp); }
@keyframes syncPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.account-signout {
  font-family: var(--font-stamp);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chalk);
  background: transparent;
  border: 1px solid rgba(251, 241, 222, 0.4);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.account-signout:hover { background: var(--stamp); border-color: var(--stamp); }
.account-signout:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; }
.account-signout[disabled] { opacity: 0.6; cursor: progress; }

/* Unmissable marker for an AA_AUTH_ENABLED=false build. */
.auth-disabled-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1500;
  font-family: var(--font-stamp);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink);
  background: var(--amber);
  padding: 5px 8px;
}

/* game.css already reserves 58px of top padding at this width for the fixed
   "How To Play" button (top-left). The account bar shares that strip on the
   right, so it only needs a tighter name budget to avoid colliding with it. */
@media (max-width: 560px) {
  .account-bar { top: 11px; right: 10px; padding-left: 10px; gap: 6px; }
  .account-name { max-width: 26vw; }
  .sync-chip { font-size: 9px; padding: 4px 7px; letter-spacing: 0.05em; }
  .auth-card { padding: 26px 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spinner { animation-duration: 2s; }
}
