/* ============================================================================
   account.css — header button, sign-in sheet, trainer card, guest reminder.
   Same look as theme.css: flat panels, 2px borders, one red accent, yellow
   for selection, buttons that press down. Uses the tokens from theme.css.
   ============================================================================ */

/* ── Header button ─────────────────────────────────────────────────────── */
.acct-btn .acct-ghost {
  width: 18px;
  height: 18px;
  flex: none;
  background: no-repeat center / contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'><path fill='%23ece6dc' d='M4 1h4v1h1v3H8v1H4V5H3V2h1zM2 7h8v1h1v3H1V8h1z'/></svg>");
  image-rendering: pixelated;
}
.acct-btn.signed-in { padding-left: 0.35rem !important; }
.acct-btn.signed-in .icon-btn-label { text-transform: none; letter-spacing: 0.02em; }
.acct-btn .icon-btn-label { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand-tag.acct-greet { color: var(--ink); }

/* ── Avatar: partner sprite, Google photo or an initial ────────────────── */
.acct-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  font-family: var(--pixel-font);
  font-size: 0.75rem;
  color: #fff;
  background: var(--accent);
}
.acct-avatar img { width: 100%; height: 100%; object-fit: cover; }
.acct-avatar.partner { background: var(--card-hover); border: 2px solid var(--line-strong); }
.acct-avatar.partner img { object-fit: contain; image-rendering: pixelated; transform: scale(1.35); }
.acct-avatar.big { width: 72px; height: 72px; border-radius: 10px; font-size: 1.6rem; }
.acct-avatar.big.partner img { transform: scale(1.2); }

/* ── Sheet ─────────────────────────────────────────────────────────────── */
html.acct-lock { overflow: hidden; }
.acct {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(8, 8, 11, 0.82);
  animation: acct-in 160ms ease-out both;
}
@keyframes acct-in { from { opacity: 0; } }
.acct-card {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.4rem 1.3rem 1.2rem;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: var(--shell-panel);
  box-shadow: 0 8px 0 var(--edge);
  color: var(--ink);
}
.acct-x {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 34px;
  height: 34px;
  min-height: 0 !important;
  padding: 0;
  border: 2px solid var(--line-strong);
  background: var(--card);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.9rem;
  box-shadow: none;
}
.acct-x:hover { background: var(--card-hover); color: var(--ink); }

.acct-title {
  margin: 0 2.5rem 0.4rem 0;
  font-family: var(--pixel-font);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.acct-lead { margin: 0 0 1.1rem; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; }

.acct-google { display: flex; justify-content: center; min-height: 44px; }
.acct-note { color: var(--ink-soft); font-size: 0.82rem; align-self: center; }
.acct-note.err { color: var(--err); }

.acct-or {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
}
.acct-or::before, .acct-or::after { content: ""; flex: 1; height: 2px; background: var(--line); }

/* Create account / Sign in: two flat tabs with a ▶ on the chosen one. */
.acct-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-bottom: 0.9rem; }
.acct-tabs[hidden] { display: none; }
.acct-tabs button {
  min-height: 40px;
  padding: 0.5rem;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.72rem;
  box-shadow: none;
}
.acct-tabs button:hover { background: var(--card-hover); color: var(--ink); }
.acct-tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.acct-tabs button[aria-selected="true"]::before { content: "▶ "; color: var(--focus); font-size: 0.8em; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.acct-form { display: grid; gap: 0.75rem; }
.acct-field { position: relative; display: grid; gap: 0.3rem; }
.acct-field > span { font-size: 0.8rem; color: var(--ink-soft); }
.acct-field input {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;                      /* 16px: stops iOS zooming in */
}
.acct-field input::placeholder { color: var(--ink-faint); }
.acct-field input:focus { outline: none; border-color: var(--focus); }
.acct-field input.bad { border-color: var(--err); }
.acct-field input[type="password"], .acct-field input#acctPassword { padding-right: 4.2rem; }
.acct-err { min-height: 0; font-size: 0.78rem; color: var(--err); }
.acct-err:empty { display: none; }
.acct-err.ok { color: var(--ok); }

.acct-reveal {
  position: absolute;
  right: 6px;
  top: calc(0.8rem * 1.35 + 0.3rem + 6px);
  min-height: 0 !important;
  height: 32px;
  padding: 0 0.6rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
}
.acct-reveal:hover { background: var(--card); color: var(--ink); }
.acct-reveal:active { transform: none; }

.acct-go {
  min-height: 46px;
  margin-top: 0.2rem;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 0 var(--accent-lo);
}
.acct-go:hover { background: var(--accent-hi); }
.acct-go:active { box-shadow: 0 1px 0 var(--accent-lo); }
.acct-go:disabled { opacity: 0.6; cursor: wait; }
.acct-go.small { min-height: 38px; padding: 0.45rem 0.9rem; font-size: 0.72rem; margin-top: 0; }

.acct-link {
  justify-self: center;
  min-height: 0 !important;
  padding: 0.35rem 0.4rem;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.acct-link:hover { background: none; color: var(--ink); }
.acct-link:active { transform: none; }

.acct-step { margin: 0; color: var(--ink-soft); font-size: 0.88rem; }
.acct-step b { color: var(--ink); }
.acct-fine { margin: 1rem 0 0; color: var(--ink-faint); font-size: 0.76rem; text-align: center; }
.acct-fine a { color: var(--ink-soft); }

/* ── Trainer card ──────────────────────────────────────────────────────── */
.acct-hello {
  margin: 0 2.5rem 1rem 0;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--focus);
  background: var(--card);
  font-size: 0.86rem;
  color: var(--ink);
}
.acct-id { display: flex; align-items: center; gap: 0.9rem; margin: 0 2.5rem 1rem 0; }
.acct-id-text { min-width: 0; }
.acct-name {
  margin: 0;
  font-family: var(--pixel-font);
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}
.acct-sub { margin: 0.3rem 0 0; color: var(--ink-soft); font-size: 0.8rem; }

.acct-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 1.1rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg-deep);
}
.acct-stats > div { padding: 0.6rem 0.4rem; text-align: center; }
.acct-stats > div + div { border-left: 2px solid var(--line); }
.acct-stats dt { font-size: 0.7rem; color: var(--ink-soft); }
.acct-stats dd { margin: 0.2rem 0 0; font-family: var(--pixel-font); font-size: 0.95rem; color: var(--ink); }

.acct-edit { grid-template-columns: 1fr auto; align-items: end; margin-bottom: 1rem; }
.acct-edit .acct-field { grid-column: 1; }
.acct-edit .acct-go { grid-column: 2; grid-row: 1; height: 44px; align-self: start; margin-top: calc(0.8rem * 1.35 + 0.3rem); }

.acct-partner { margin-bottom: 1.1rem; }
.acct-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin-top: 0.5rem; }
.acct-picks:empty { display: none; }
.acct-pick {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  min-height: 0 !important;
  padding: 0.35rem 0.25rem 0.45rem;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 0.6rem;
  box-shadow: none;
}
.acct-pick:hover { background: var(--card-hover); border-color: var(--focus); }
.acct-pick img { width: 56px; height: 56px; image-rendering: pixelated; }
.acct-pick span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acct-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 0.9rem;
  border-top: 2px solid var(--line);
}
.acct-email { min-width: 0; color: var(--ink-faint); font-size: 0.76rem; overflow-wrap: anywhere; }
.acct-out {
  flex: none;
  min-height: 36px !important;
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-size: 0.68rem;
  box-shadow: 0 3px 0 var(--edge);
}
.acct-out:hover { background: var(--card-hover); }

/* ── Guest reminder (bottom of the screen, once a day at most) ─────────── */
.acct-nudge {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 1100;
  width: min(420px, calc(100% - 2rem));
  transform: translateX(-50%);
  padding: 0.85rem 0.95rem;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  background: var(--shell-panel);
  box-shadow: 0 6px 0 var(--edge);
  animation: acct-up 200ms ease-out both;
}
@keyframes acct-up { from { opacity: 0; transform: translate(-50%, 10px); } }
.acct-nudge p { margin: 0 0 0.6rem; font-size: 0.86rem; color: var(--ink); line-height: 1.45; }
.acct-nudge-actions { display: flex; align-items: center; gap: 0.6rem; }

/* Pokédex header link for guests */
.acct-dex-cta {
  min-height: 0 !important;
  padding: 0.3rem 0.6rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0;
  text-align: left;
  box-shadow: none;
}
.acct-dex-cta:hover { background: rgba(0, 0, 0, 0.3); }

@media (max-width: 520px) {
  .acct { place-items: end center; padding: 0; }
  .acct-card {
    width: 100%;
    max-height: 92dvh;
    border-radius: 14px 14px 0 0;
    border-bottom: 0;
    padding-bottom: calc(1.2rem + env(safe-area-inset-bottom));
    box-shadow: none;
  }
  .acct-stats { grid-template-columns: repeat(2, 1fr); }
  .acct-stats > div:nth-child(3) { border-left: 0; }
  .acct-stats > div:nth-child(n + 3) { border-top: 2px solid var(--line); }
}
