/* Account (web/screens/account.js) - 4.0, T5-016 (R-025 / R-044).

   Cards, top to bottom on a phone: Profile, Password, Players I follow,
   Sessions, Data, Delete account, Legal, Sign out. From 768 px the same cards
   sit in two columns (the `.grid-2` utility, like More): who you are and who
   you follow on the left; where you are signed in, your data and leaving on the
   right. Everything composes the web/css/components.css primitives (.card,
   .card-head / .card-title / .card-sub, .row, .field, .btn, .avatar, .tag,
   .info-tip, .skeleton) - only the Account-specific layout is defined here.

   Load order (web/index.html): tokens -> components -> shell -> per-screen, this
   file among the five 4.0 screens that load last, so a rule here may override
   shell.css and components.css, never the other way round. Every var() used
   here must be defined in tokens.css (tests/test_web.py). The destructive
   button's colours live in components.css (`.btn.danger`, shared with Admin). */

/* ---------- layout: one column, two from 768px ---------- */

.acct-grid { align-items: start; gap: 12px; }
@media (min-width: 768px) { .acct-grid { gap: 16px; } }

/* `min-width: 0`: a grid item's default `min-width: auto` lets one long run of
   text (an e-mail address, a user agent) widen the whole column past the
   viewport - the classic grid blowout that becomes sideways scroll at 320. */
.acct-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (min-width: 768px) { .acct-col { gap: 16px; } }
.acct-card { min-width: 0; }

/* ---------- rows ---------- */

/* The shared `.row` (components.css) gives the hairline dividers; wrapping lets
   the actions drop under the text on a phone instead of squeezing it. */
.acct-row { min-height: 52px; flex-wrap: wrap; row-gap: 8px; }
.acct-main {
  flex: 1 1 180px; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  overflow-wrap: anywhere;
}
.acct-label {
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.acct-value { font-weight: 700; min-width: 0; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.acct-actions .btn.sm { height: 40px; }
.acct-editing .field { width: 100%; flex: none; }

.acct-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 800; }
.acct-name-text { min-width: 0; overflow-wrap: anywhere; }
.acct-default, .acct-this-device { flex: none; }

/* Verified / Not verified, beside the address. */
.acct-badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 8px;
  border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .02em;
  vertical-align: middle; white-space: nowrap;
}
.acct-badge.ok { background: var(--good-soft); color: var(--good); }
.acct-badge.warn { background: var(--warn-soft); color: var(--warn); }

/* Lines under a list: an action's failure, an at-the-limit note. */
.acct-note { margin: 6px 0 0; }
.acct-foot { padding-top: 10px; border-top: 1px solid var(--line); }
.acct-foot .btn { width: 100%; }

.acct-session.current { padding-bottom: 12px; }
.acct-session-meta { overflow-wrap: anywhere; }

/* ---------- link rows (Data, Legal, Sign out) ---------- */

.acct-menu-row { width: 100%; min-height: 48px; color: var(--ink); text-align: left; cursor: pointer; }
.acct-menu-label { flex: 1; min-width: 0; font-weight: 700; }
.acct-menu-row > .i:last-child { color: var(--ink-3); }
.acct-menu-row > .i:first-child:not(:last-child) { color: var(--ink-2); }
.acct-signout .acct-menu-label { color: var(--ink); }
.acct-data-note { margin: 4px 0 0; }
.acct-inline-link, .acct-follow-link { font-weight: 700; }
.acct-inline-link { white-space: nowrap; }
.acct-follow-link { display: inline-flex; align-items: center; min-height: 44px; }
.acct-card-signout { padding-top: 4px; padding-bottom: 4px; }

/* ---------- the destructive button ---------- */

/* The colours are the shared `.btn.danger` (components.css, T5-030c); only the busy look is here. */
.btn.acct-danger:disabled { opacity: .6; }

/* ---------- loading / failure ---------- */

.acct-skeleton { display: flex; flex-direction: column; gap: 12px; padding: 6px 0; }
.acct-skel-line { height: 16px; }
.acct-skel-line:nth-child(2) { width: 70%; }
.acct-skel-line:nth-child(3) { width: 45%; }

/* F2-02: the endpoint's own message in the app-wide red, the Retry under it. */
.acct-error { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.acct-error .error-text { margin-top: 0; }
.acct-banner { margin-bottom: 12px; }
.acct-banner .acct-error {
  padding: 10px 14px; border-radius: 12px;
  background: var(--bad-soft); border: 1px solid var(--bad);
}

/* ---------- sheets ---------- */

.acct-form { display: flex; flex-direction: column; gap: 14px; }
.acct-field { display: flex; flex-direction: column; gap: 6px; }
.acct-field-label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.acct-field .field { flex: none; width: 100%; }
.acct-hint { font-size: 12px; color: var(--ink-3); }
.acct-sheet-copy { margin: 0; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.acct-sheet-who { font-family: var(--display); font-weight: 800; font-size: 18px; overflow-wrap: anywhere; }
.acct-sheet-error { margin: 0; }

/* ---------- toast (same shape as the recap's) ---------- */

.acct-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  z-index: 150;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--s3);
  border: 1px solid var(--good);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  text-align: center;
}
.acct-toast-bad { border-color: var(--bad); }
@media (min-width: 1024px) {
  .acct-toast { bottom: 24px; }
}

/* ---------- narrow phones ---------- */

@media (max-width: 420px) {
  /* The avatar + name fill the first line of a player row; its two actions drop
     under them instead of squeezing the name. */
  .acct-player .acct-main { flex-basis: calc(100% - 48px); }
}
