/* No per-screen flex+gap here — it would compound with shell/app-frame.css's shared `> * + *` margin. */
.profile-loading, .profile-error {
  padding: 20px; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 8px; color: var(--text-muted);
}
.profile-error { color: var(--accent-red); }
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  justify-items: center;
  text-align: center;
}
.profile-stat-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%;
}
.profile-stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.profile-stat-value { font-size: 1.6rem; color: var(--text-primary); font-weight: 700; }
.profile-stat-sub   { font-size: 0.68rem; color: var(--text-muted); }
.profile-games-section h2 {
  font-size: 1.05rem; color: var(--text-primary); margin-bottom: 10px;
}
.profile-avatar-large {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bronze-gradient);
  color: var(--on-bronze);
  border: 1px solid var(--bronze-deep);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
/* bg-2, not bg-1 — bg-1 is near-indistinguishable from the page in dark. */
.profile-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-1);
}
/* The shadow alone lifts these off the page; a border as well read as a box drawn twice. Every
   profile and settings card carries BOTH classes, so this is the shape of all of them. (0,2,0)
   so it does not depend on sitting after .profile-card. */
.profile-card.profile-acct-card { border: 0; }

.profile-card-title {
  font-size: 0.95rem; color: var(--text-primary);
  margin: 0;
}
.profile-card-sub {
  font-size: 0.8rem; color: var(--text-muted); margin: 0;
  line-height: 1.4;
}
.profile-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: 6px;
  color: var(--text-primary); font: inherit; font-size: 0.92rem;
}

.profile-save-status {
  margin-top: 2px;
  font-size: 0.82rem;
}
.profile-save-ok  { color: var(--accent-green); font-weight: 600; }
.profile-save-err { color: var(--accent-red);   font-weight: 600; }
.profile-danger {
  border-color: rgba(201, 64, 64, 0.35);
}

.profile-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.profile-body {
  display: flex; flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}
/* Square the fused card's top corners so tabs + card read as one container. */
.profile-body > .profile-acct-card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
@media (max-width: 768px) {
  .profile-body > .profile-acct-card {
    border-top-left-radius: var(--radius-l);
    border-top-right-radius: var(--radius-l);
  }
}


/* Delete escalates through its RED TITLE and its red button, not an edge: both danger rows are
   borderless washes. */
.profile-danger-title {
  color: var(--accent-red);
}

.profile-delete-modal {
  max-width: 440px;
}
.profile-delete-typeprompt {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.profile-delete-typeprompt code,
.profile-delete-typeprompt strong {
  color: var(--text-primary);
  font-weight: 700;
}
.profile-delete-input {
  width: 100%;
  margin-top: 4px;
}
/* Breathing room before destructive Delete button. */
.profile-delete-modal .modal-buttons {
  margin-top: 14px;
}

@media (max-width: 480px) {
  /* Keep avatar + identity-text on SAME row on mobile. */
  .profile-avatar-large { width: 54px; height: 54px; font-size: 1.5rem; flex-shrink: 0; }
  .profile-tab { padding: 8px 12px; font-size: 0.85rem; }
}

/* ============================================================
   Prototype Account tab — one card, sections separated by rules
   (avatar picker / username / password / email / membership /
   sign-out-all / delete).
   ============================================================ */
.profile-acct-card {
  padding: 24px 28px;
  background: transparent;
}
.profile-hr {
  border: 0;
  border-top: 1px solid var(--divider);
  margin: 14px 0;
  width: 100%;
}
/* Section heads are sans + semibold like the prototype .acct-sub (the shared
   h3 base is serif). */
.profile-acct-card .profile-card-title {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
/* Compact labelled field (prototype .acct-field): label above a ≤420px input. */
.profile-acct-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 420px;
}
.profile-acct-field > span {
  font-size: 0.82rem;
  color: var(--ink-2);
  font-weight: 500;
}
.profile-acct-card .profile-input {
  flex: none;
  width: 100%;
  max-width: 420px;
  background: var(--bg-1); /* inset well against the bg-2 card */
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  color: var(--ink);
  font-size: 0.95rem;
  padding: 10px 12px;
}
.profile-acct-card .profile-input:focus {
  outline: none;
  border-color: var(--bronze);
}
.profile-acct-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* The three bronze "Update …" buttons + the Link Google button share one width. */
.profile-acct-actions > .btn-bronze,
.profile-link-google-row > .btn {
  min-width: 200px;
  justify-content: center;
}

/* Avatar picker */
.profile-avatar-picker { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.profile-avatar-emblem { position: relative; flex: 0 0 auto; }
.profile-avatar-emblem .profile-avatar-large { width: 84px; height: 84px; font-size: 2.1rem; }
.profile-avatar-editbtn {
  position: absolute; right: -2px; bottom: -2px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.profile-avatar-editbtn:hover { color: var(--bronze); border-color: var(--bronze); }
.profile-avatar-editbtn svg { width: 15px; height: 15px; }
.profile-avatar-editbtn input[type="file"] { display: none; }
.profile-avatar-ctrl { flex: 1 1 auto; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.profile-avatar-fallback { display: flex; gap: 14px; flex-wrap: wrap; }
.profile-avatar-fallback.is-dim { opacity: 0.5; }
.profile-avatar-select { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.profile-avatar-select > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
}
.profile-avatar-remove { align-self: flex-start; }

/* Membership + danger rows (prototype .acct-upgrade / .danger-row). */
.profile-inline-row,
.profile-danger-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
/* Match the danger rows' 18px inset so the Upgrade button + label align
   with Sign out / Delete below (those rows carry padding via their border box). */
.profile-inline-row { padding: 0 18px; }
.profile-danger-row {
  padding: 16px 18px;
  margin-top: 12px;
  /* A red wash rather than a grey step: sign-out and delete are the card's two destructive
     rows, and the tint is what separates them from the settings above. */
  background: linear-gradient(180deg, color-mix(in srgb, var(--porphyry) 4%, var(--bg-2)) 0%, var(--bg-2) 100%);
  border-radius: var(--radius-l);
}
.profile-inline-text { flex: 1 1 auto; min-width: 0; }
.profile-inline-title { font-size: 0.98rem; font-weight: 600; color: var(--ink); }
/* Upgrade / Sign out / Delete share one width AND height. */
.profile-inline-row > .btn,
.profile-danger-row > .btn {
  flex: 0 0 auto;
  min-width: 180px;
  height: 40px;
  padding-top: 0;
  padding-bottom: 0;
  justify-content: center;
}
.profile-row-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.profile-link-google-row { margin-top: 2px; }
@media (max-width: 640px) {
  .profile-acct-card { padding: 18px 16px; }
  .profile-inline-row, .profile-danger-row { flex-direction: column; align-items: stretch; }
  .profile-inline-row > .btn, .profile-danger-row > .btn { width: 100%; }
  .profile-row-actions { flex-direction: column; }
  /* min-width:0 undoes the 200px pin above; width:100% alone cannot shrink past it. */
  .profile-acct-actions { align-items: stretch; }
  .profile-acct-actions > .btn,
  .profile-link-google-row > .btn { width: 100%; min-width: 0; }
}

