/* =========================================================
   Profiles — "Who's watching?" screen, profile editor, header menu, account section (public/js/profiles.js)
   ========================================================= */
.pf-av { position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 26%; flex: none; background: var(--ink-3); }
.pf-av img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pf-av-letter { background: radial-gradient(120% 120% at 20% 10%, color-mix(in srgb, var(--pf-hue) 80%, #fff 20%), var(--pf-hue) 55%, color-mix(in srgb, var(--pf-hue) 55%, #000 45%)); color: #fff; }
.pf-av-letter b { font-weight: 800; line-height: 1; font-size: 0.48em; }
.pf-av-xl { width: clamp(96px, 13vw, 150px); height: clamp(96px, 13vw, 150px); font-size: clamp(96px, 13vw, 150px); border-radius: 24%; }
.pf-av-md { width: 56px; height: 56px; font-size: 56px; border-radius: 16px; }
.pf-av-sm { width: 32px; height: 32px; font-size: 32px; border-radius: 9px; }
.pf-av-head { position: absolute; inset: 0; width: 100%; height: 100%; font-size: 40px; border-radius: 50%; }
.avatar-btn.has-profile { background: var(--ink-3); }
.avatar-btn .pf-av-head b { font-size: 0.42em; }

.pf-kids { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  color: #102a28; background: linear-gradient(120deg, #5fe0d3, #f2d06b); white-space: nowrap; }

/* ---------- full-screen chooser ---------- */
.pf-screen { position: fixed; inset: 0; z-index: 180; overflow-y: auto; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  background: radial-gradient(90% 70% at 50% 0%, rgba(194, 39, 61, 0.18), transparent 60%), radial-gradient(70% 60% at 85% 100%, rgba(123, 63, 176, 0.16), transparent 60%), var(--ink-0);
  font-family: var(--font); animation: pf-in 0.35s var(--ease) both; }
@keyframes pf-in { from { opacity: 0; } }
.pf-wrap { width: min(1040px, 100%); display: grid; justify-items: center; gap: clamp(18px, 3vw, 30px); text-align: center; }
.pf-brand { opacity: 0.9; }
.pf-title { margin: 0; font-size: clamp(1.7rem, 1.1rem + 2.6vw, 3rem); font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.pf-sub { margin: -8px 0 0; color: var(--text-2); font-size: var(--fs-s); max-width: 46ch; }
.pf-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(16px, 2.6vw, 34px); }
.pf-grid > li { display: flex; }
.pf-tile { display: grid; justify-items: center; align-content: start; gap: 10px; width: clamp(104px, 14vw, 164px); padding: 6px; border: 0; background: none; color: var(--text-2); cursor: pointer; font: inherit; border-radius: 22px; }
.pf-pic { position: relative; display: block; border-radius: 24%; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); box-shadow: 0 14px 34px -18px rgba(0, 0, 0, 0.9); }
.pf-pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); pointer-events: none; transition: box-shadow 0.25s var(--ease); }
.pf-tile:hover .pf-pic, .pf-tile:focus-visible .pf-pic { transform: translateY(-4px) scale(1.04); }
.pf-tile:hover .pf-pic::after, .pf-tile:focus-visible .pf-pic::after { box-shadow: inset 0 0 0 3px #fff; }
.pf-tile:focus-visible { outline: none; }
.pf-name { font-size: clamp(0.92rem, 0.85rem + 0.3vw, 1.08rem); font-weight: 500; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.2s; }
.pf-tile:hover .pf-name, .pf-tile:focus-visible .pf-name { color: #fff; }
.pf-pic .pf-kids { position: absolute; bottom: -9px; inset-inline-start: 50%; transform: translateX(-50%); box-shadow: 0 0 0 3px var(--ink-0); }
[dir="rtl"] .pf-pic .pf-kids { transform: translateX(50%); }
.pf-tile { padding-top: 6px; } .pf-tile .pf-name { margin-top: 4px; }
.pf-av-add { background: rgba(255, 255, 255, 0.05); border: 2px dashed rgba(255, 255, 255, 0.22); color: var(--text-2); }
.pf-av-add svg { width: 38%; height: 38%; stroke-width: 1.6; }
.pf-edit-ic { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: rgba(5, 6, 9, 0.55); color: #fff; }
.pf-edit-ic svg { width: 30%; height: 30%; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pf-actions .btn { min-height: 44px; padding-inline: 22px; border-radius: 99px; }

/* ---------- editor ---------- */
.pf-editor { width: min(640px, 100%); text-align: start; justify-items: stretch; gap: 20px; }
.pf-editor .pf-title { text-align: center; }
.pf-ed-head { display: flex; gap: 20px; align-items: center; }
.pf-ed-fields { flex: 1; display: grid; gap: 10px; min-width: 0; }
.pf-label { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; letter-spacing: 0.02em; padding: 0; }
.pf-input { width: 100%; min-height: 48px; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.06); color: var(--text); font: inherit; font-size: 1rem; }
.pf-input:focus { outline: none; border-color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.09); }
.pf-switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 0; }
.pf-switch input { position: absolute; opacity: 0; pointer-events: none; }
.pf-sw { position: relative; width: 46px; height: 26px; flex: none; border-radius: 99px; background: var(--ink-4); border: 1px solid var(--line-2); transition: background 0.2s; }
.pf-sw::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.pf-switch input:checked + .pf-sw { background: linear-gradient(120deg, #1fa39b, #e8b04b); }
.pf-switch input:checked + .pf-sw::after { transform: translateX(20px); }
[dir="rtl"] .pf-switch input:checked + .pf-sw::after { transform: translateX(-20px); }
.pf-switch input:focus-visible + .pf-sw { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }
.pf-switch span:last-child { display: grid; gap: 2px; }
.pf-switch b { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.pf-switch small { color: var(--text-3); font-size: var(--fs-xs); }
.pf-pick { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.pf-pick-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; justify-items: center; }
.pf-opt { position: relative; display: grid; place-items: center; padding: 4px; border-radius: 20px; cursor: pointer; }
.pf-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pf-opt .pf-av { transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.pf-opt:hover .pf-av { transform: scale(1.06); }
.pf-opt:has(input:checked) .pf-av { box-shadow: 0 0 0 3px var(--ink-0), 0 0 0 5px #fff; }
.pf-opt:has(input:focus-visible) .pf-av { box-shadow: 0 0 0 3px var(--ink-0), 0 0 0 5px var(--gold); }
.pf-err { color: #ff8a92; font-size: var(--fs-s); text-align: center; }
.pf-ed-actions { justify-content: center; }
.pf-del { color: #ff8a92; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header menu ---------- */
.pf-menu { position: fixed; z-index: 150; width: 260px; max-width: calc(100vw - 24px); padding: 8px; border-radius: 18px; display: grid; gap: 2px;
  background: rgba(17, 20, 28, 0.92); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line-2); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85); font-family: var(--font); }
.pf-menu-list { display: grid; gap: 2px; }
.pf-mi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 12px; background: none; color: var(--text-2); font: inherit; font-size: 0.92rem; text-align: start; cursor: pointer; text-decoration: none; }
.pf-mi:hover, .pf-mi:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; outline: none; }
.pf-mi > svg, .pf-mi > i { width: 18px; height: 18px; margin-inline: 7px; flex: none; }
.pf-mi[aria-checked="true"] { color: #fff; }
.pf-mi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-mi-on { color: var(--gold); display: grid; }
.pf-mi-on svg { width: 16px; height: 16px; }
.pf-menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- account page section ---------- */
.pf-acct { grid-column: 1 / -1; }
.pf-acct-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pf-acct-head small { color: var(--text-3); font-weight: 500; margin-inline-start: 4px; }
.pf-acct-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, 104px); gap: 12px; }
.pf-acct-list > li { display: flex; min-width: 0; }
.pf-acct-tile { display: grid; justify-items: center; align-content: start; gap: 6px; width: 100%; min-width: 0; padding: 12px 6px; border-radius: 16px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.03); color: var(--text-2); font: inherit; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.pf-acct-tile:hover, .pf-acct-tile:focus-visible { background: rgba(255, 255, 255, 0.07); outline: none; }
.pf-acct-tile[aria-pressed="true"] { border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.06); color: #fff; }
.pf-acct-tile .pf-name { font-size: 0.86rem; color: inherit; }
.pf-now { font-size: 0.68rem; color: var(--gold); }

body.pf-on .tabbar, body.pf-on #tabbar { visibility: hidden; }

@media (max-width: 600px) {
  .pf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 132px)); gap: 22px 26px; }
  .pf-tile { width: 100%; }
  .pf-av-xl { width: 112px; height: 112px; font-size: 112px; }
  .pf-ed-head { flex-direction: column; text-align: center; }
  .pf-ed-fields { width: 100%; text-align: start; }
  .pf-pick-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .pf-av-md { width: 52px; height: 52px; font-size: 52px; }
  .pf-acct-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .pf-acct-tile .pf-av-md { width: 48px; height: 48px; font-size: 48px; }
  .pf-acct-tile .pf-name { font-size: 0.8rem; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .pf-screen { animation: none; } .pf-pic, .pf-opt .pf-av { transition: none; } }
.pf-screen .pf-tile.focusable:focus, .pf-screen .pf-tile.focusable:focus-visible { outline: none; box-shadow: none; }
.pf-screen .pf-tile:focus-visible .pf-name { text-decoration: underline; text-underline-offset: 4px; }
