/* ============================================================================
   auth.css — scoped styles for login / signup / account pages + the shared
   app nav. Reuses the app.css :root palette WITHOUT redefining any theme
   variables (a sibling agent owns theming). Everything here is class-scoped.
   ========================================================================== */

.auth-page {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;          /* never scroll sideways on a phone */
  display: flex;               /* flex centers without letting the child exceed the viewport */
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% -10%, var(--ink-2) 0%, var(--ink) 70%);
  font-family: var(--sans);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: var(--r);
  padding: 30px 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
/* Phones: card fills the width minus the page padding (no horizontal overflow). */
@media (max-width: 440px) {
  .auth-page { padding: 16px; align-items: flex-start; }
  .auth-card { max-width: 100%; padding: 24px 18px; }
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.auth-logo .auth-mark {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 22px;
  color: var(--ink);
  background: var(--gold);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  box-shadow: 0 0 0 1px var(--gold-soft), 0 4px 18px rgba(242, 177, 52, 0.25);
}
.auth-logo .auth-title {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--text);
}
.auth-logo .auth-sub {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-top: 3px;
}

.auth-h {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 4px;
}
.auth-lede {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 20px;
  line-height: 1.5;
}

.auth-field { margin-bottom: 14px; }
.auth-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.auth-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-input:focus { border-color: var(--gold-soft); }
.auth-input::placeholder { color: var(--text-faint); }

.auth-btn {
  width: 100%;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #14110a;
  background: var(--gold);
  border: none;
  border-radius: var(--r);
  padding: 12px;
  cursor: pointer;
  margin-top: 6px;
  transition: box-shadow 0.15s, transform 0.1s;
}
.auth-btn:hover { box-shadow: 0 4px 16px rgba(242, 177, 52, 0.3); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

/* Back-to-home link at the top of the login/signup card. */
.auth-back {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--text-dim); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 4px;          /* comfortable tap target */
}
.auth-back:hover { color: var(--gold); }

.auth-alt {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.auth-alt a { color: var(--gold); text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

.auth-error {
  display: none;
  background: rgba(255, 106, 138, 0.1);
  border: 1px solid var(--rose);
  color: var(--rose);
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: 13px;
  margin-bottom: 14px;
}
.auth-error.show { display: block; }

/* ---------------- shared app nav (header) ---------------- */
.cf-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--mono);
}
.cf-nav a {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}
.cf-nav a:hover,
.cf-nav a.active { color: var(--gold); }

.cf-balance {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.cf-balance .cf-balance-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}
.cf-balance.low .cf-balance-dot { background: var(--rose); box-shadow: 0 0 8px var(--rose); }
.cf-balance .cf-balance-val { color: var(--gold); font-weight: 500; }

.cf-user {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.cf-logout {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.cf-logout:hover { border-color: var(--rose); color: var(--rose); }

/* ---------------- account page ---------------- */
.account-page {
  min-height: 100vh;
  background: var(--ink);
  font-family: var(--sans);
  color: var(--text);
}
.account-bar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-3), var(--ink));
}
.account-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.account-wrap h1 {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 24px;
}
.account-section {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 22px;
}
.account-section h2 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 16px;
}

.balance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.balance-cell {
  background: var(--ink-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 16px;
  text-align: center;
}
.balance-cell .bc-k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.balance-cell .bc-v {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
}
.balance-cell.total .bc-v { color: var(--gold); }

.model-select {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gold);
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  cursor: pointer;
  outline: none;
}
.model-select:hover { border-color: var(--gold-soft); }
.model-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.pack {
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 16px;
  text-align: center;
}
.pack .pk-name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}
.pack .pk-tok {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  margin: 10px 0 4px;
}
.pack .pk-usd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.pack-btn {
  width: 100%;
  margin-top: 14px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #14110a;
  background: var(--gold);
  border: none;
  border-radius: var(--r);
  padding: 9px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.pack-btn:hover { box-shadow: 0 4px 14px rgba(242, 177, 52, 0.3); }
.pack-btn:disabled { opacity: 0.5; cursor: default; }

.account-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-3);
  border: 1px solid var(--teal);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 18px;
  border-radius: var(--r);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.account-toast.show { opacity: 1; }

/* ---------------- account + auth mobile hardening ---------------- */

/* Account page: tighten the header + stack grids on phones. The header's
   theme picker + nav menu are hidden by app.css <=720px (they live in the
   bottom-nav "More" sheet there), leaving just the brand. */
@media (max-width: 720px) {
  .account-bar { height: 52px; padding: 0 14px; }
  .account-wrap { padding: 22px 16px 48px; }
  .account-wrap h1 { font-size: 16px; }
  .account-section { padding: 18px 16px; }
  /* Larger touch targets for selects + buttons. */
  .model-select { padding: 13px 12px; font-size: 14px; }
  .pack-btn { padding: 13px; font-size: 11px; }
  /* The select can render long option text — keep it inside its container. */
  .model-select { max-width: 100%; }
}

@media (max-width: 560px) {
  .balance-grid, .pack-grid { grid-template-columns: 1fr; }
}

/* Auth (login / signup) mobile: the .auth-page is a centered grid that already
   grows to min-height:100vh; ensure it scrolls when the card is taller than the
   viewport (small phones in landscape), keep full-width touch-friendly inputs,
   and never produce horizontal scroll. */
@media (max-width: 480px) {
  .auth-page {
    place-items: start center;   /* top-align so a tall card can scroll */
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .auth-card {
    max-width: 100%;
    padding: 24px 20px;
  }
  /* >=44px touch targets for inputs + the submit button. */
  .auth-input { padding: 13px 12px; font-size: 16px; } /* 16px avoids iOS zoom */
  .auth-btn { padding: 14px; }
}
