/* Accounts and sign-in: .acct-*, .btn-google, .btn-microsoft (owner: WP-C, accounts.md §15).
   The sheet frame (phone full-screen, sticky head, Back) is the shell's (.overlay > .sheet); this file
   styles only what is inside it. Media queries: only the shared MQ strings (ui.md §2.1) and
   (any-pointer: coarse) / (prefers-reduced-motion: reduce). Every control is at least 44 × 44 px. */

/* ── Menu chip (under "Playing as …") ──────────────────────────────────────────────────────── */
.acct-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap, 44px);
  max-width: 100%;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 159, 28, 0.55);
  background: rgba(255, 159, 28, 0.08);
  color: var(--amber-hi, #ffc15e);
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.acct-chip-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.acct-chip-linked,
.acct-chip-multi {
  border-color: rgba(61, 220, 151, 0.55);
  background: rgba(61, 220, 151, 0.08);
  color: var(--good, #3ddc97);
}
/* K1: the normal guest state is calm (the amber default stays for private browsing only). */
.acct-chip-local {
  border-color: var(--line, rgba(255, 255, 255, 0.16));
  background: rgba(255, 255, 255, 0.04);
  color: var(--silver, #cfd6df);
}
.acct-chip:focus-visible {
  outline: 3px solid var(--cyan-hi, #7fdcff);
  outline-offset: 2px;
}

/* ── Sheet content ─────────────────────────────────────────────────────────────────────────── */
.acct-body {
  display: grid;
  gap: 14px;
  min-width: 0;
  /* the on-screen keyboard's height while the code field is focused (set from visualViewport) */
  padding-bottom: calc(4px + var(--kb, 0px));
}
.acct-body .btn {
  min-height: var(--tap, 44px);
  min-width: var(--tap, 44px);
}
.acct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
  align-items: start;
}
.acct-grid > * {
  min-width: 0;
}
.acct-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--ink-2, #141821);
  border: 1px solid var(--line, rgba(127, 220, 255, 0.16));
  min-width: 0;
}
.acct-card h3,
.acct-card p {
  margin: 0;
}
.acct-card p,
.acct-status p,
.acct-dev-text,
.acct-linked-text {
  overflow-wrap: anywhere;
}
.acct-actions {
  gap: 10px;
}
.acct-msg {
  margin: 0;
  min-height: 1em;
  color: var(--silver, #cfd6df);
}
/* K14: an empty status line stays in the accessibility tree (a live region that is display:none until
   its first message is missed by some screen readers); it only takes no room. */
.acct-msg:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.acct-msg.warn {
  color: var(--amber-hi, #ffc15e);
}

/* Status: avatar dot + nickname + what it means */
.acct-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 159, 28, 0.35);
  background: rgba(255, 159, 28, 0.06);
}
.acct-status-linked,
.acct-status-multi {
  border-color: rgba(61, 220, 151, 0.4);
  background: rgba(61, 220, 151, 0.06);
}
.acct-status-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.acct-status-text p {
  margin: 0;
  color: var(--silver, #cfd6df);
}
.acct-dot {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

/* Fields: 16 px text so iOS never zooms in */
.acct-field {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--silver, #cfd6df);
}
.acct-body input,
.acct-pin {
  min-height: var(--tap, 44px);
  font-size: max(16px, 1rem);
  min-width: 0;
}
.acct-year {
  width: 8ch;
  text-align: center;
  letter-spacing: 0.08em;
}
.acct-age {
  display: grid;
  gap: 10px;
}
.acct-linked {
  justify-content: space-between;
}

/* Provider buttons: the providers' own button colours; never recoloured to the game's cyan.
   Official logo files are not bundled (REQUIRES CONFIGURATION), so the buttons are text only. */
.acct-providers {
  display: grid;
  gap: 10px;
}
.btn-google,
.btn-microsoft {
  justify-content: center;
  min-height: var(--tap, 44px);
  width: 100%;
  text-transform: none;
  letter-spacing: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  font-size: 1rem;
}
.btn-google,
.btn-google:hover {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #747775;
}
.btn-microsoft,
.btn-microsoft:hover {
  background: #fff;
  color: #5e5e5e;
  border: 1px solid #8c8c8c;
}

/* Devices and players on this device */
.acct-devs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.acct-dev {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--graphite, #1f2430);
}
.acct-dev-icon {
  font-size: 1.3rem;
}
.acct-dev-text {
  display: grid;
  gap: 2px;
  flex: 1 1 160px;
  min-width: 0;
}
.acct-this {
  min-height: var(--tap, 44px);
}
.acct-other-actions {
  gap: 8px;
}
.acct-leave {
  width: auto;
}
.acct-advanced summary {
  display: flex;
  align-items: center;
  min-height: var(--tap, 44px);
  cursor: pointer;
  font-weight: 800;
}
.acct-key-row > input {
  flex: 1 1 180px;
}

/* Show a code (device A) */
.acct-code-panel {
  display: grid;
  gap: 14px;
}
.acct-code-main {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}
.acct-code-main p,
.acct-code-side p {
  margin: 0;
}
.acct-code-side {
  display: grid;
  gap: 10px;
}
.acct-code,
.acct-code-input,
.acct-match {
  font: 900 clamp(1.8rem, 9vw, 3rem) / 1.1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  color: var(--white, #f4f7fa);
}
.acct-code {
  user-select: all;
  -webkit-user-select: all;
  overflow-wrap: anywhere;
}
.acct-code-input {
  font-size: clamp(1.4rem, 7vw, 2rem);
  text-align: center;
  width: min(100%, 13ch);
  text-transform: uppercase;
}
.acct-approve,
.acct-wait,
.acct-end,
.acct-pin-panel {
  display: grid;
  gap: 12px;
}
.acct-approve p,
.acct-wait p,
.acct-end p,
.acct-pin-panel p {
  margin: 0;
}
.acct-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.acct-body .acct-num {
  min-width: 72px;
  min-height: 56px;
  font-size: 1.4rem;
}
.acct-wait {
  justify-items: center;
  text-align: center;
}
.acct-match {
  font-size: clamp(2.4rem, 12vw, 3.6rem);
}

/* The waiting dots: a slow fade (well under 1 Hz, never a flash); still with reduced motion. */
.acct-dots {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
}
.acct-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: acct-dot 1.8s ease-in-out infinite;
}
.acct-dots i:nth-child(2) {
  animation-delay: 0.6s;
}
.acct-dots i:nth-child(3) {
  animation-delay: 1.2s;
}
@keyframes acct-dot {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* Who's playing? */
.acct-who-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: 10px;
}
.acct-who-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--steel, #343b4a);
  background: var(--ink-2, #141821);
  color: var(--white, #f4f7fa);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.acct-who-tile:focus-visible {
  outline: 3px solid var(--cyan-hi, #7fdcff);
  outline-offset: 2px;
}
.acct-who-name {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.acct-nomix {
  margin: 0;
}

/* The guardian PIN inside a confirmation (the shell's confirmDialog frames it since WP-Z1) */
.acct-pin-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.acct-pin {
  width: 8ch;
  text-align: center;
  letter-spacing: 0.3em;
}

/* The link to /privacy under the cards */
.acct-links {
  margin: 0;
}
.acct-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap, 44px);
  color: var(--cyan-hi, #7fdcff);
  overflow-wrap: anywhere;
}

/* Phone landscape: the code on the left, the steps and buttons on the right. */
@media (max-height: 500px) {
  .acct-code-panel {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
  .acct-who-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Phone portrait: full-width primary buttons, one column. */
@media (max-width: 480px) and (min-height: 501px) {
  .acct-body .acct-actions > .btn {
    flex: 1 1 100%;
  }
  .acct-who-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .acct-dots i {
    animation: none;
    opacity: 0.8;
  }
}

/* ── The /privacy page (served by the server with only this stylesheet) ───────────────────── */
body.acct-privacy {
  margin: 0;
  background: #0d0f14;
  color: #f4f7fa;
  font: 1rem / 1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.acct-privacy-main {
  max-width: 720px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) max(40px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
}
.acct-privacy h1 {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  line-height: 1.2;
  margin: 8px 0 12px;
}
.acct-privacy h2 {
  font-size: 1.2rem;
  margin: 28px 0 8px;
}
.acct-privacy p,
.acct-privacy li {
  overflow-wrap: anywhere;
}
.acct-privacy ul {
  padding-left: 1.2em;
}
.acct-privacy li {
  margin: 6px 0;
}
.acct-privacy a {
  color: #7fdcff;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.acct-privacy code {
  font-size: 0.9em;
  background: #141821;
  padding: 1px 5px;
  border-radius: 5px;
}
.acct-privacy-lead {
  color: #cfd6df;
  font-size: 1.05rem;
}
