/* Accounts: the sign-in gate and account area.
   Files in css/ load in name order (index.html); later files win on equal selectors. */
/* ---------- Accounts ---------- */
body.gated { overflow: hidden; }
/* Until Firebase answers, html[data-boot] (set in index.html's head) shows what this device last saw. */
html[data-boot="out"] body { overflow: hidden; }
html[data-boot="out"] .gate { display: block; }
html[data-boot="out"] .shell { visibility: hidden; }
/* The gate is the landing page: it scrolls on its own, with the sign-in card in the hero. */
.gate {
  position: fixed; inset: 0; z-index: 200; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; overscroll-behavior: contain;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg);
}
.gate[hidden] { display: none; }
.gate-bg {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(40% 50% at 15% 20%, var(--glow-a), transparent 70%),
    radial-gradient(45% 55% at 85% 80%, var(--glow-b), transparent 70%);
}
.gate-bg::after {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(var(--border-2) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: radial-gradient(circle at center, #000, transparent 70%); -webkit-mask-image: radial-gradient(circle at center, #000, transparent 70%);
}
.gate-card {
  position: relative; width: min(420px, 100%); scroll-margin: 90px; min-width: 0; padding: 32px 30px 26px; border-radius: 28px;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--holo) border-box; border: 1.5px solid transparent;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5);
}
.gate-logo { padding: 0; margin-bottom: 26px; }
.gate-card h2 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }
.gate-sub { margin: 10px 0 22px; color: var(--muted); font-size: 14px; }
.gate-google {
  width: 100%; height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  border-radius: 14px; border: 1px solid var(--border-2); background: var(--surface-2); font-weight: 700; font-size: 14px;
  transition: border-color .2s;
}
.gate-google:hover { border-color: var(--text); }
.gate-google svg { width: 20px; height: 20px; }
.gate-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font: 700 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#gateForm { display: flex; flex-direction: column; gap: 12px; }
#gateForm label { display: flex; flex-direction: column; gap: 6px; font: 700 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
#gateForm input {
  height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  font: 500 15px/1 var(--font); color: var(--text); outline: none; text-transform: none; letter-spacing: 0;
}
#gateForm input:focus { border-color: var(--border-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.gate[data-mode="reset"] .gate-pw { display: none; }
.gate-error { margin: 0; min-height: 18px; font-size: 13px; color: #ff5f7a; }
.gate-error.ok { color: #2bd67b; }
.gate-submit {
  height: 50px; border: 0; border-radius: 14px; cursor: pointer; font-size: 15px; font-weight: 800; color: #14121f;
  background: var(--holo); transition: filter .2s, transform .1s;
}
.gate-submit:hover { filter: brightness(1.05); }
.gate-submit:active { transform: scale(.98); }
.gate-submit:disabled { opacity: .6; cursor: wait; }
.gate-switch { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.gate-switch button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.gate-switch > span { display: none; }
.gate[data-mode="in"] .only-in, .gate[data-mode="up"] .only-up, .gate[data-mode="reset"] .only-reset { display: inline; }

.acc { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.acc-avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; object-fit: cover;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2); font-weight: 800;
}
.acc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acc-text b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-text small { font: 700 10px/1.4 var(--mono); color: #2bd67b; }
.acc-text small[data-state="saving"] { color: var(--muted); }
.acc-text small[data-state="error"] { color: #ff9f43; }
.acc-local { display: block; padding: 8px 10px; font: 700 10px/1.3 var(--mono); color: var(--faint); letter-spacing: .04em; }
.gate-google-slot { display: flex; justify-content: center; min-height: 44px; max-width: 100%; overflow: hidden; color-scheme: light; }
.gate-google-slot[hidden] { display: none; }
.gate-google[hidden] { display: none; }
.gate-confirm { display: none !important; }
.gate[data-mode="up"] .gate-confirm { display: flex !important; }
