/* =====================================================================
   AVATARS — live 2026-10-22, from the Design/avatar mockup, round 2
   (js/avatar.js, js/avatar-set.js)
   Built from the app's own parts: the white dialog card with canvas tiles
   inside it, the segmented control from My Space, the blue selection ring,
   the one hover (a 2px rise). No new colours.
     1. an avatar where initials were
     2. the menu under the top-bar avatar
     3. Profile, and Change password
     4. Choose an avatar (the picker)
     5. the report header, the More sheet, the toast
   ===================================================================== */

/* ---- 1. an avatar where initials were -------------------------------- */
.av.av-art{background:none !important; color:inherit; padding:0; overflow:hidden; isolation:isolate}
.av.av-art svg{display:block; width:100%; height:100%}
.ivd-avs .av.av-art{box-shadow:0 0 0 2px #fff}

/* the top-bar avatar is a button now: it opens the menu */
button.v2-me-av{display:block; padding:0; border:0; background:none; cursor:pointer; font:inherit; color:inherit}
button.v2-me-av:focus-visible{outline:none; box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--blue)}
button.v2-me-av[aria-expanded="true"]{box-shadow:0 0 0 4px var(--sky-24)}

/* ---- 2. the menu ---------------------------------------------------- */
.avm{position:fixed; z-index:60; width:296px; padding:8px; border-radius:24px; background:#fff; color:var(--ink);
  box-shadow:0 24px 60px -28px rgba(16,34,64,.42), 0 0 0 1px rgba(16,34,64,.06);
  transform-origin:top right; opacity:0; transform:translateY(-6px) scale(.97);
  transition:opacity .18s ease, transform .4s var(--mo-settle, var(--ease))}
.avm.in{opacity:1; transform:none}
.avm-me{display:flex; align-items:center; gap:14px; padding:12px 12px 16px}
.avm-av, .avp-av{position:relative; flex:none; display:block; padding:0; border:0; background:none; border-radius:50%; cursor:pointer}
.avm-av .av{width:56px; height:56px; font-size:1.05rem; background:var(--navy); color:#fff}
.avm-pen{position:absolute; right:-2px; bottom:-2px; display:grid; place-items:center; width:24px; height:24px; border-radius:50%;
  background:var(--blue); color:#fff; box-shadow:0 0 0 2.5px #fff; transition:transform .3s var(--mo-pop, var(--ease))}
.avm-pen .i{width:13px; height:13px; stroke-width:2.2}
.avm-av:hover .avm-pen, .avp-av:hover .avm-pen{transform:scale(1.12)}
.avm-av:focus-visible, .avp-av:focus-visible{outline:none; box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--blue)}
.avm-who{display:grid; min-width:0}
.avm-who b{font-size:1rem; font-weight:600; color:var(--navy); letter-spacing:-.01em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.avm-who small{font-size:.8rem; color:var(--ink-3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.avm-list{display:grid; padding:6px 0; border-top:1px solid var(--hair)}
.avm-list > *{display:flex; align-items:center; gap:12px; height:44px; padding:0 12px; border:0; border-radius:14px; background:none;
  font:inherit; font-size:.92rem; color:var(--ink); text-decoration:none; cursor:pointer; text-align:left}
.avm-list > * .i{width:18px; height:18px; color:var(--ink-3)}
.avm-list > *:hover, .avm-list > *:focus-visible{background:var(--canvas); outline:none}
.avm-end{padding-bottom:0}

/* ---- 3. Profile ----------------------------------------------------- */
.dlg.avp{width:min(640px, calc(100% - 32px))}
.avp-in{padding:clamp(24px, 4vw, 36px) !important}
.avp-t{font-size:1.75rem; font-weight:500; color:var(--navy); letter-spacing:-.03em; padding-right:44px}
.avp-head{display:flex; align-items:center; gap:22px; margin:22px 0 28px; padding:18px; border-radius:22px; background:var(--canvas)}
.avp-av .av{width:104px; height:104px; font-size:1.6rem; background:var(--navy); color:#fff}
.avp-av .avm-pen{width:32px; height:32px; right:0; bottom:0; box-shadow:0 0 0 3px var(--canvas)}
.avp-av .avm-pen .i{width:16px; height:16px}
.avp-acts{display:flex; flex-direction:column; align-items:flex-start; gap:10px}
.avp-acts .btn{background:#fff !important}
.avp-link{padding:0 2px; border:0; background:none; font:inherit; font-size:.86rem; color:var(--blue); cursor:pointer}
.avp-link:hover{text-decoration:underline; text-underline-offset:3px}
.avp-grid{display:grid; grid-template-columns:1fr 1fr; gap:18px 16px}
.avp-wide{grid-column:1 / -1}
.avp-grid .fld-in[readonly]{color:var(--ink-3)}
.avp-h{margin:30px 0 4px; font-size:.95rem; font-weight:600; color:var(--navy)}
.avp-sw{display:flex; align-items:center; justify-content:space-between; gap:16px; padding:13px 0; border-bottom:1px solid var(--hair); font-size:.94rem; color:var(--ink)}
.avp-sw:last-of-type{border-bottom:0}
.avp-row{display:flex; align-items:center; gap:12px; width:100%; height:52px; margin-top:8px; padding:0 16px; border:0; border-radius:16px;
  background:var(--canvas); font:inherit; font-size:.94rem; color:var(--ink); cursor:pointer; text-align:left; transition:transform .2s var(--ease), box-shadow .2s}
.avp-row .i{width:18px; height:18px; color:var(--ink-3)} .avp-row .i:last-child{margin-left:auto}
.avp-row:hover{transform:translateY(-2px); box-shadow:0 10px 24px -16px rgba(16,34,64,.35)}
.avp-f{position:sticky; bottom:calc(clamp(24px, 4vw, 36px) * -1); display:flex; justify-content:flex-end;
  margin:28px calc(clamp(24px, 4vw, 36px) * -1) calc(clamp(24px, 4vw, 36px) * -1); padding:16px clamp(24px, 4vw, 36px);
  background:#fff; border-top:1px solid var(--hair)}

/* ---- 3b. Change password: the current one, then the new one --------- */
.dlg.avw{width:min(480px, calc(100% - 32px))}
.avw-in{padding:clamp(24px, 4vw, 36px) !important}
.avw-form{display:flex; flex-direction:column; gap:18px}
.avw-form .avp-t{margin-bottom:4px}
/* the leaderboard's avatars (My Space > Progress) */
.k-row .av{width:34px; height:34px; font-size:.74rem; background:var(--sky-16); color:var(--navy)}

/* ---- 4. Choose an avatar ------------------------------------------- */
.dlg.avk{width:min(1080px, calc(100% - 32px)); max-height:min(880px, 92vh)}
.avk-in{padding:0 !important; overflow:hidden !important; background:#fff !important; max-height:min(880px, 92vh) !important}
.avk-wrap{display:flex; flex-direction:column; max-height:min(880px, 92vh)}
.avk-head{display:flex; align-items:center; justify-content:space-between; gap:20px; padding:30px 92px 14px 48px}
.avk-t{font-size:1.75rem; font-weight:500; color:var(--navy); letter-spacing:-.03em; white-space:nowrap}
/* before → after, the way Netflix asks before it changes the icon */
.avk-swap{display:flex; align-items:center; gap:12px; min-height:72px}
.avk-swap .av{width:72px; height:72px; font-size:1.2rem}
.avk-swap.changed > .av:first-child{width:52px; height:52px; font-size:.95rem; opacity:.55}
.avk-swap .pop{animation:avs-pop .38s var(--mo-pop, var(--ease))}
.avk-arrow .i{width:20px; height:20px; color:var(--ink-3)}
.avk-iniv{display:grid; place-items:center; background:var(--navy); color:#fff; font-weight:600; border-radius:50%}
@keyframes avs-pop{from{transform:scale(.9)} to{transform:none}}

.avk-body{flex:1; min-height:0; overflow-y:auto; padding:4px 0 22px; scrollbar-width:thin; scrollbar-color:rgba(16,34,64,.22) transparent}
.avk-row + .avk-row{margin-top:20px}
.avk-row h3{padding:0 48px; margin-bottom:6px; font-size:1rem; font-weight:600; color:var(--navy)}
.avk-track{display:flex; gap:22px; overflow-x:auto; padding:10px 48px 12px; scroll-padding:0 48px; scroll-snap-type:x proximity; scrollbar-width:none;
  /* avatars scrolled past fade out at the edges instead of stopping dead */
  -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
          mask-image:linear-gradient(90deg, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%)}
.avk-track::-webkit-scrollbar{display:none}
.avk-it{position:relative; flex:none; width:92px; height:92px; padding:0; border:0; border-radius:50%; background:none; cursor:pointer; scroll-snap-align:start;
  transition:transform .25s var(--ease), box-shadow .25s}
.avk-face, .avk-ini{display:block; width:100%; height:100%; border-radius:50%; overflow:hidden}
.avk-face svg{display:block; width:100%; height:100%}
.avk-ini{display:grid; place-items:center; background:var(--canvas); color:var(--navy); font-size:1.6rem; font-weight:600; letter-spacing:.02em}
.avk-it:hover{transform:translateY(-2px); box-shadow:0 14px 26px -18px rgba(16,34,64,.55)}
.avk-it[aria-pressed="true"]{box-shadow:0 0 0 3px #fff, 0 0 0 6px var(--blue)}
.avk-it:focus-visible{outline:none; box-shadow:0 0 0 3px #fff, 0 0 0 6px var(--navy)}
.avk-on{position:absolute; right:2px; bottom:2px; display:grid; place-items:center; width:28px; height:28px; border-radius:50%; background:var(--blue); color:#fff;
  box-shadow:0 0 0 3px #fff; animation:avs-pop .35s var(--mo-pop, var(--ease))}
.avk-on .i{width:15px; height:15px; stroke-width:2.6}
/* the mouse wheel moves a row sideways (js/avatar.js rowScroll) */
@media (pointer: fine){ .avk-track{scroll-snap-type:none} }
.avk-f{display:flex; justify-content:flex-end; padding:16px 48px 22px; border-top:1px solid var(--hair); background:#fff}
.avk-f .btn{min-width:132px}
.avk-f .btn:disabled{opacity:.45; cursor:default; transform:none}

/* ---- 5. the report header, the More sheet, the toast ---------------- */
.cv-mono.cv-av{position:relative; padding:0; background:none !important; overflow:visible; box-shadow:none}
.cv-mono.cv-av .av{width:100%; height:100%; font-size:inherit}
.cv-pen{position:absolute; right:-2px; bottom:-2px; display:grid; place-items:center; width:30px; height:30px; padding:0; border:0; border-radius:50%;
  background:#fff; color:var(--navy); cursor:pointer; box-shadow:0 6px 16px -6px rgba(0,0,0,.4); transition:transform .3s var(--mo-pop, var(--ease))}
.cv-pen .i{width:15px; height:15px}
.cv-pen:hover{transform:scale(1.1)}
@media print{.cv-pen{display:none !important}}

button.more-me{width:100%; border:0; background:none; font:inherit; color:inherit; text-align:left; cursor:pointer}
.more-me .avm-who{display:grid; flex:1}
.more-me > .i{width:18px; height:18px; color:var(--ink-3)}

.av-toast{position:fixed; left:50%; bottom:28px; z-index:80; display:flex; align-items:center; gap:10px; padding:12px 18px 12px 14px; border-radius:999px;
  background:var(--navy); color:#fff; font-size:.9rem; box-shadow:0 18px 40px -20px rgba(16,34,64,.6);
  transform:translate(-50%, 20px); opacity:0; pointer-events:none; transition:opacity .2s, transform .45s var(--mo-settle, var(--ease))}
.av-toast.in{opacity:1; transform:translate(-50%, 0)}
.av-toast .i{width:18px; height:18px; color:var(--sky)}

/* ---- phones ------------------------------------------------------------ */
@media (max-width: 760px){
  .dlg.avk, .dlg.avp, .dlg.avw{width:100%; margin:auto 0 0; max-height:94dvh}
  .avk-in, .avp-in, .dlg-in.avw-in{border-radius:28px 28px 0 0 !important; max-height:94dvh !important}
  .avk-wrap{max-height:94dvh}
  .avk-head{gap:12px; padding:22px 56px 12px 20px}
  .avk-t{font-size:1.3rem}
  .avk-swap{min-height:48px; gap:6px}
  .avk-swap .av{width:48px; height:48px; font-size:.9rem}
  .avk-swap.changed > .av:first-child{width:32px; height:32px; font-size:.7rem}
  .avk-arrow .i{width:16px; height:16px}
  .avk-row + .avk-row{margin-top:14px}
  .avk-row h3{padding:0 20px; margin-bottom:4px}
  .avk-track{gap:14px; padding:10px 20px 12px; scroll-padding:0 20px;
    -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
            mask-image:linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%)}
  .avk-it{width:80px; height:80px}
  .avk-on{width:24px; height:24px}
  .avk-f{padding:12px 20px calc(14px + env(safe-area-inset-bottom))}
  .avk-f .btn{flex:1}
  .avp-grid{grid-template-columns:1fr}
  .avp-head{gap:16px; padding:14px}
  .avp-av .av{width:84px; height:84px}
  .avm{width:min(296px, calc(100vw - 24px))}
}
@media (prefers-reduced-motion: reduce){
  .avm, .av-toast{transition:opacity .15s}
  .avk-swap .pop, .avk-on{animation:none}
}
