/* ── account ──
 * The sign-in panel (/sync, /login): a centred card on a dimmed page, six states painted
 * by src/account.js. Frame and head copy the share panel's tokens (share-overlay.css,
 * share-card.css — it reuses .share-head and .btn), so every theme in themes.css works
 * with no colour of its own. Linked right after share-card.css; the order is load-bearing. */

#account-overlay {
  position: fixed;
  inset: 0;
  z-index: 125;                       /* over the share panel (110), the island's pill and the install banner (120); under the confirm dialog (130) */
  background: color-mix(in srgb, var(--bg-page) 55%, transparent);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#account-overlay.hidden { display: none; }

#account-card {
  width: 380px;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  background: color-mix(in srgb, var(--bg-raised) 98%, transparent);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px var(--accent-soft);
  animation: share-in 0.2s var(--ease);
  outline: none;
}

.acc-body { padding: 16px 18px 18px; font-size: 12px; color: var(--fg); }
.acc-dim { color: var(--fg-dim); }
.acc-accent { color: var(--accent); }

/* sign in / create account */
.acc-tabs { display: flex; gap: 16px; margin-bottom: 14px; font-size: 12px; }
.acc-tab {
  font: inherit;
  color: var(--fg-dim);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 3px;
  cursor: pointer;
}
.acc-tab:hover { color: var(--fg); }
.acc-tab.on { color: var(--fg); border-bottom-color: var(--accent); cursor: default; }

.acc-ttl { font-size: 12px; color: var(--fg); margin-bottom: 12px; }

/* a labelled field, drawn like the mock: the label sits inside the box */
.acc-fld {
  display: block;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 10px 8px;
  margin-bottom: 8px;
  background: var(--bg-page);
  cursor: text;
}
.acc-fld:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.acc-lb { display: block; font-size: 10px; color: var(--fg-dim); margin-bottom: 2px; }
.acc-fld input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg);
  background: none;
  border: 0;
  padding: 0;
  outline: none;
}
.acc-fld input::placeholder { color: var(--fg-faint); }
/* a password field's dots are font-size dependent; keep them from looking like a hairline */
.acc-fld input[type="password"] { letter-spacing: 0.08em; }
.acc-fld input[type="password"]::placeholder { letter-spacing: normal; }

/* A secret field (src/account.js accField). Its input stays type="password"; the dots are
 * drawn by .acc-ovl over it, in the same font, size and letter-spacing so the input's own
 * caret lands between the right ones. The input's text is transparent, never display:none. */
.acc-fld[data-secret] { position: relative; overflow: hidden; }
.acc-fld[data-secret] .acc-lb { line-height: 1.4; }
.acc-box { position: relative; }
.acc-fld input[type="password"] {
  color: transparent;
  -webkit-text-fill-color: transparent;       /* autofill and iOS paint over `color` alone */
  caret-color: var(--fg);
}
.acc-fld input[type="password"]::placeholder { -webkit-text-fill-color: var(--fg-faint); }
.acc-ovl {
  position: absolute;
  inset: 0;
  overflow: hidden;
  white-space: pre;
  pointer-events: none;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  /* In WebKit the input's scroll range is 2px wider than the text (room for the caret); the
     overlay needs the same, or at the end of a long secret it cannot scroll as far. */
  padding-right: 2px;
  color: var(--fg);
}
.acc-last { color: var(--accent); }
/* an astral character the browser masks as N dots: one glyph, N cells wide */
.acc-last[style*="--units"] { display: inline-block; width: calc(var(--units) * (1ch + 0.08em)); }
/* the width probe (accMasksPerUnit): laid out, never seen */
.acc-fld .acc-probe { position: absolute; left: -9999px; top: 0; width: 1px; visibility: hidden; pointer-events: none; }

/* beside the label, top right; after the input in the DOM so Tab goes input → show */
.acc-meta {
  position: absolute;
  top: 7px;
  right: 10px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--fg-dim);
}
.acc-count.good { color: var(--accent); }
.acc-sep { color: var(--fg-faint); }
.acc-sep[hidden] { display: none; }
.acc-tog {
  font: inherit;
  color: var(--fg-dim);
  background: none;
  border: 0;
  border-bottom: 1px dashed transparent;
  padding: 0;
  cursor: pointer;
}
.acc-tog:hover, .acc-tog:focus-visible, .acc-tog[aria-pressed="true"] { color: var(--accent); }
.acc-tog:hover, .acc-tog:focus-visible { border-bottom-color: var(--accent); outline: none; }

/* progress toward the minimum, along the field's bottom edge */
.acc-line {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--fg-faint);
  transition: width 0.15s ease, background 0.2s;
}
.acc-line.ok { background: var(--accent); }

.acc-ghost { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.acc-hint { font-size: 11px; color: var(--fg-dim); margin: -4px 0 8px; line-height: 1.5; }
.acc-hint.warn { color: var(--warn); }
.acc-hint:empty { display: none; }
.acc-ttl + .acc-hint, .acc-body > .acc-hint { margin: 0 0 10px; }

.acc-err { font-size: 11px; line-height: 1.5; color: var(--danger); margin: 2px 0 6px; }
.acc-err:empty { display: none; }
.acc-note { font-size: 11px; color: var(--accent); margin: -4px 0 10px; }

.acc-go { display: block; width: 100%; margin-top: 6px; text-align: center; }
.acc-go:disabled, .acc-wide:disabled { opacity: 0.5; cursor: progress; transform: none; }
/* a form that chooses a new secret, not yet valid: dimmed, but still pressable (it shows why) */
.acc-go.soft { opacity: 0.55; }

.acc-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 11px; }
.acc-link {
  font: inherit;
  color: var(--fg-dim);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.acc-link:hover { color: var(--accent); text-decoration: underline; }

/* the signed-in account */
.acc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}
.acc-wide { display: block; width: 100%; margin-top: 6px; text-align: center; }
.acc-wide:first-of-type { margin-top: 12px; }

/* The phone: fill the width, and keep inputs at 16px so iOS does not zoom into them. */
@media (max-width: 600px) {
  #account-overlay { padding: 12px; }
  #account-card { width: 100%; }
  .acc-fld input, .acc-ovl { font-size: 16px; }
}
