/* Piece 8 profile v8 — loaded only by profile.html */

.page-profile .site-header{
  position:sticky;top:0;z-index:45;max-width:none;margin:0;
  padding:13px clamp(16px,3.4vw,40px);
  background:rgba(7,8,13,.72);
  border-bottom:1px solid rgba(255,255,255,.06);
  backdrop-filter:blur(18px) saturate(140%);
  -webkit-backdrop-filter:blur(18px) saturate(140%);
}
.page-profile .profile-wrap{max-width:1120px;padding:clamp(18px,3.6vw,42px) clamp(16px,3vw,32px) 90px}

.profile-head{position:relative;text-align:start;padding:2px 0 30px}
.profile-head h1{
  font-size:clamp(26px,4vw,40px);letter-spacing:-.6px;line-height:1.3;
  background:linear-gradient(120deg,#fff 8%,#d7e4ff 48%,#ffe0b2 96%);
  -webkit-background-clip:text;background-clip:text;color:transparent;
}
.profile-head .muted{max-width:560px;margin-top:10px;font-size:14px}
.profile-head::after{
  content:"";position:absolute;inset-inline-start:0;bottom:14px;
  width:64px;height:4px;border-radius:99px;background:var(--grad);
  box-shadow:0 6px 18px -4px rgba(var(--brand-rgb),.8);
}

.profile-grid{grid-template-columns:316px minmax(0,1fr);gap:20px}
.profile-side{
  top:86px;padding:26px 22px;gap:12px;
  background:
    radial-gradient(120% 90% at 50% -10%,rgba(var(--brand-rgb),.16),transparent 62%),
    linear-gradient(180deg,rgba(255,255,255,.06),rgba(255,255,255,.022));
  border-color:rgba(var(--brand-rgb),.22);
  box-shadow:0 30px 70px -40px rgba(var(--brand-rgb),.55),var(--shadow);
}
.avatar-xl{
  width:108px;height:108px;border-radius:32px;
  border:1px solid rgba(255,255,255,.24);
  box-shadow:
    0 0 0 6px rgba(var(--brand-rgb),.14),
    0 0 0 12px rgba(var(--brand-2-rgb),.06),
    0 24px 50px -18px rgba(var(--brand-rgb),.85);
  animation:pv8Pop .7s cubic-bezier(.22,1,.36,1) both;
}
.avatar-picker{gap:10px;margin-top:6px}
.avatar-filters{padding:4px;border-radius:14px;background:rgba(0,0,0,.32);border-color:rgba(255,255,255,.1)}
.avatar-filter{border-radius:10px}
.avatar-choice{border-radius:16px}
.avatar-choice:hover{transform:translateY(-3px);border-color:rgba(var(--brand-rgb),.5)}
.profile-identity{border-top-color:rgba(255,255,255,.1)}
.profile-identity h2{font-size:18px;letter-spacing:-.2px}
.profile-side .btn-secondary{
  border-color:rgba(248,113,113,.32);color:#fecaca;background:rgba(248,113,113,.08);
}
.profile-side .btn-secondary:hover{background:rgba(248,113,113,.16);border-color:rgba(248,113,113,.55);color:#fee2e2}

.profile-main{gap:18px}
.profile-card{
  position:relative;padding:26px 26px 24px;overflow:hidden;
  background:linear-gradient(180deg,rgba(255,255,255,.055),rgba(255,255,255,.02));
  border-color:rgba(255,255,255,.1);
  transition:border-color .25s,box-shadow .25s,transform .25s;
}
.profile-card::before{
  content:"";position:absolute;inset-inline:0;top:0;height:1px;
  background:linear-gradient(90deg,transparent,rgba(var(--brand-rgb),.55),rgba(var(--brand-2-rgb),.4),transparent);
  opacity:.55;transition:opacity .25s;
}
.profile-card:hover{border-color:rgba(var(--brand-rgb),.3);box-shadow:0 26px 60px -38px rgba(var(--brand-rgb),.65);transform:translateY(-2px)}
.profile-card:hover::before{opacity:1}
.profile-card h2{display:flex;align-items:center;gap:9px;font-size:16px;margin-bottom:4px}
.profile-card h2::before{
  content:"";width:16px;height:16px;border-radius:6px;flex:none;
  background:var(--grad);box-shadow:0 4px 12px -3px rgba(var(--brand-rgb),.9);
  opacity:.9;
}
.profile-card form{margin-top:8px}
.profile-card input,
.profile-card textarea{
  transition:border-color .2s,box-shadow .2s,background .2s;
}
.profile-card input:hover{background:rgba(0,0,0,.34)}
.profile-card input:focus,
.profile-card textarea:focus{
  border-color:rgba(var(--brand-rgb),.7);
  box-shadow:0 0 0 4px rgba(var(--brand-rgb),.14);
}
.profile-card .btn-primary{margin-top:16px;border-radius:13px}
.profile-card .btn-primary:hover:not(:disabled){transform:translateY(-1px)}
.form-msg.ok{color:#86efac}
.form-msg[role="alert"]:not(:empty){animation:pv8Shake .34s ease}

.friend-list{gap:8px}
.friend-item{
  background:rgba(255,255,255,.035);border-color:rgba(255,255,255,.09);
  border-radius:14px;padding:9px 11px;
  transition:border-color .2s,background .2s,transform .2s;
}
.friend-item:hover{background:rgba(var(--brand-rgb),.1);border-color:rgba(var(--brand-rgb),.34);transform:translateX(-2px)}
html[dir="ltr"] .friend-item:hover{transform:translateX(2px)}
.friend-form input{min-width:0}

.pw-meter{overflow:hidden;border-radius:99px}
.pw-meter span{border-radius:99px;transition:width .25s ease,background .25s}

.accent-row{gap:8px}
.accent-swatch{transition:transform .16s ease,box-shadow .2s}
.accent-swatch:hover{transform:translateY(-2px) scale(1.06)}

/* theme manager */
.theme-mode-row{display:flex;gap:var(--sp-2)}
.theme-mode{
  flex:1;min-height:42px;padding:8px 12px;border-radius:var(--r-sm);
  border:1px solid var(--border);background:var(--surface-2);color:var(--text-2);
  font:inherit;font-size:var(--fs-md);cursor:pointer;
  transition:background var(--dur-fast) var(--ease-standard),border-color var(--dur-fast) var(--ease-standard),color var(--dur-fast) var(--ease-standard);
}
.theme-mode:hover{background:var(--surface-3);color:var(--text-1)}
.theme-mode.active{
  background:rgba(var(--brand-rgb),.16);border-color:rgba(var(--brand-rgb),.55);color:var(--text-1);
  box-shadow:inset 0 0 0 1px rgba(var(--brand-rgb),.22);
}
.theme-preset-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(138px,1fr));gap:var(--sp-2)}
.theme-preset{
  display:flex;flex-direction:column;align-items:stretch;gap:5px;text-align:start;
  padding:8px 9px;border-radius:var(--r-sm);border:1px solid var(--border);
  background:var(--surface-2);color:var(--text-1);font:inherit;cursor:pointer;
  transition:transform var(--dur-fast) var(--ease-standard),border-color var(--dur-fast) var(--ease-standard),background var(--dur-fast) var(--ease-standard);
}
.theme-preset:hover{transform:translateY(-1px);background:var(--surface-3);border-color:var(--border-strong)}
.theme-preset.active{border-color:rgba(var(--brand-rgb),.6);box-shadow:inset 0 0 0 1px rgba(var(--brand-rgb),.3)}
.tp-chip-lg{display:block;width:100%;height:24px;border-radius:7px;border:1px solid var(--border)}
.tp-preset-name{font-size:var(--fs-sm);font-weight:var(--weight-semibold);line-height:1.4}
.tp-preset-mode{font-size:var(--fs-xs);color:var(--text-3)}
.theme-preview{
  position:relative;display:flex;flex-direction:column;gap:var(--sp-2);
  margin:var(--sp-4) 0 var(--sp-2);padding:var(--sp-3);
  border:1px solid var(--border);border-radius:var(--r-md);
  background:linear-gradient(180deg,var(--surface-2),transparent),var(--surface-1);
  overflow:hidden;
}
.theme-preview::after{
  content:"";position:absolute;inset-block-start:0;inset-inline-start:0;width:100%;height:2px;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
}
.tp-bar{display:flex;gap:6px}
.tp-bar span{width:8px;height:8px;border-radius:50%;background:var(--border-strong)}
.tp-bar span:first-child{background:var(--accent)}
.tp-bar span:nth-child(2){background:var(--accent-2)}
.tp-body{display:flex;flex-direction:column;gap:7px}
.tp-body .tp-chip{width:44px;height:14px;border-radius:var(--r-pill);background:linear-gradient(135deg,var(--accent),var(--accent-2))}
.tp-body .tp-line{display:block;height:7px;width:82%;border-radius:4px;background:rgba(255,255,255,.16)}
.tp-body .tp-line.short{width:54%;background:rgba(255,255,255,.09)}
.tp-body .tp-btn{width:70px;height:22px;border-radius:7px;margin-top:2px;background:linear-gradient(135deg,var(--accent),var(--accent-2));opacity:.9}
.tp-name{position:absolute;inset-block-start:9px;inset-inline-end:12px;font-size:var(--fs-xs);color:var(--text-2)}
html[data-theme="light"] .tp-body .tp-line{background:rgba(15,23,42,.16)}
html[data-theme="light"] .tp-body .tp-line.short{background:rgba(15,23,42,.09)}

.hex-row{display:flex;flex-wrap:wrap;gap:var(--sp-2);margin-top:var(--sp-2)}
.hex-field{display:flex;flex-direction:column;gap:4px;flex:1;min-width:124px;font-size:var(--fs-xs);color:var(--text-2)}
.hex-field input{
  min-height:40px;padding:8px 10px;border-radius:var(--r-sm);
  border:1px solid var(--border);background:var(--surface-2);color:var(--text-1);
  font-family:var(--font-mono);font-size:var(--fs-sm);letter-spacing:.02em;
}
.hex-field input:focus-visible{border-color:rgba(var(--brand-rgb),.7)}
.theme-save-row{display:flex;gap:var(--sp-2);flex-wrap:wrap}
.theme-save-row input{
  flex:1;min-width:150px;min-height:40px;padding:8px 12px;border-radius:var(--r-sm);
  border:1px solid var(--border);background:var(--surface-2);color:var(--text-1);font:inherit;font-size:var(--fs-md);
}
.theme-save-row .btn{margin-top:0;border-radius:var(--r-sm)}
.saved-themes{display:flex;flex-direction:column;gap:var(--sp-2);list-style:none;margin:0;padding:0}
.saved-theme{
  display:flex;align-items:center;gap:var(--sp-2);padding:8px 10px;
  border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface-2);
}
.saved-theme.active{border-color:rgba(var(--brand-rgb),.5)}
.saved-theme .tp-chip-lg{width:30px;height:30px;flex:0 0 auto;border-radius:9px}
.saved-theme-meta{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1}
.saved-theme-meta strong{font-size:var(--fs-sm);font-weight:var(--weight-semibold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.saved-theme .btn{margin-top:0;flex:0 0 auto}
.saved-del{flex:0 0 auto;color:var(--note-error);font-size:var(--fs-sm)}
.saved-del:hover{text-decoration:underline}
.appearance-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sp-4);margin-top:var(--sp-4)}
.appearance-actions .btn{margin-top:0}
#themeRestorePrev:disabled{opacity:.45;cursor:not-allowed}
.appearance-locked{padding:var(--sp-3);border:1px dashed var(--border-strong);border-radius:var(--r-sm)}
.appearance-locked .hint{margin:0}
.theme-mode:focus-visible,.theme-preset:focus-visible,.saved-theme .btn:focus-visible{
  outline:2px solid var(--focus-ring);outline-offset:2px;
}
html[data-theme="light"] .theme-mode,
html[data-theme="light"] .theme-preset,
html[data-theme="light"] .hex-field input,
html[data-theme="light"] .theme-save-row input,
html[data-theme="light"] .saved-theme{background:#fff;border-color:rgba(15,23,42,.12)}
html[data-theme="light"] .theme-mode:hover,
html[data-theme="light"] .theme-preset:hover{background:rgba(15,23,42,.04)}
html[data-theme="light"] .theme-mode.active{background:rgba(var(--brand-rgb),.1);color:#0f172a}

/* entrance */
@keyframes pv8Rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes pv8Pop{from{opacity:0;transform:scale(.82)}to{opacity:1;transform:scale(1)}}
@keyframes pv8Shake{0%,100%{transform:translateX(0)}25%{transform:translateX(4px)}60%{transform:translateX(-3px)}}
.profile-head{animation:pv8Rise .6s cubic-bezier(.22,1,.36,1) both}
.profile-side{animation:pv8Rise .7s .06s cubic-bezier(.22,1,.36,1) both}
.profile-card{animation:pv8Rise .65s cubic-bezier(.22,1,.36,1) both}
.profile-card:nth-child(1){animation-delay:.1s}
.profile-card:nth-child(2){animation-delay:.16s}
.profile-card:nth-child(3){animation-delay:.22s}
.profile-card:nth-child(4){animation-delay:.28s}
.profile-card:nth-child(5){animation-delay:.34s}

/* light theme */
html[data-theme="light"] .page-profile .site-header{
  background:rgba(255,255,255,.82);border-bottom-color:rgba(15,23,42,.08);
}
html[data-theme="light"] .profile-head h1{
  background:linear-gradient(120deg,#0f172a 10%,#1e3a8a 60%,#9a3412 100%);
  -webkit-background-clip:text;background-clip:text;
}
html[data-theme="light"] .profile-side{
  background:
    radial-gradient(120% 90% at 50% -10%,rgba(var(--brand-rgb),.12),transparent 62%),
    linear-gradient(180deg,#fff,rgba(255,255,255,.9));
  border-color:rgba(var(--brand-rgb),.22);
}
html[data-theme="light"] .profile-card{
  background:linear-gradient(180deg,#fff,rgba(255,255,255,.9));
  border-color:rgba(15,23,42,.09);
}
html[data-theme="light"] .profile-card:hover{border-color:rgba(var(--brand-rgb),.4)}
html[data-theme="light"] .avatar-filters{background:rgba(15,23,42,.05);border-color:rgba(15,23,42,.1)}
html[data-theme="light"] .friend-item{background:rgba(15,23,42,.03);border-color:rgba(15,23,42,.08)}
html[data-theme="light"] .profile-side .btn-secondary{
  border-color:rgba(185,28,28,.28);color:#b91c1c;background:rgba(248,113,113,.08);
}
html[data-theme="light"] .profile-side .btn-secondary:hover{background:rgba(248,113,113,.16);color:#991b1b}

@media (max-width:980px){
  .profile-grid{grid-template-columns:1fr}
  .profile-side{position:static;top:auto}
  .profile-head::after{bottom:12px}
}
@media (max-width:640px){
  .page-profile .site-header{padding:12px 16px}
  .page-profile .profile-wrap{padding-top:16px}
  .profile-card{padding:20px 16px 18px}
  .profile-side{padding:22px 14px}
  .avatar-xl{width:92px;height:92px;border-radius:26px}
  .profile-head h1{font-size:26px}
}

@media (prefers-reduced-motion:reduce){
  .profile-head,.profile-side,.profile-card,.avatar-xl{animation:none!important}
  .profile-card:hover,.friend-item:hover,.avatar-choice:hover,.accent-swatch:hover{transform:none}
}

/* recent activity */
.activity-list{list-style:none;display:flex;flex-direction:column;gap:8px;margin-top:16px}
.activity-item{
  display:flex;align-items:center;gap:11px;
  padding:10px 12px;border-radius:14px;
  background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.08);
  animation:pv8Rise .5s cubic-bezier(.22,1,.36,1) both;
  transition:border-color .2s,background .2s;
}
.activity-item:nth-child(2){animation-delay:.05s}
.activity-item:nth-child(3){animation-delay:.1s}
.activity-item:nth-child(4){animation-delay:.15s}
.activity-item:nth-child(5){animation-delay:.2s}
.activity-item:nth-child(6){animation-delay:.25s}
.activity-item:hover{background:rgba(var(--brand-rgb),.09);border-color:rgba(var(--brand-rgb),.3)}
.activity-dot{
  flex:none;width:9px;height:9px;border-radius:50%;
  background:var(--grad);box-shadow:0 0 10px rgba(var(--brand-rgb),.8);
}
.activity-main{display:flex;align-items:center;gap:8px;min-width:0;flex:1;flex-wrap:wrap}
.activity-main strong{font-size:13px;font-weight:700}
.activity-room{
  font-size:10.5px;font-weight:700;letter-spacing:.8px;
  padding:2px 8px;border-radius:99px;
  background:rgba(var(--brand-2-rgb),.1);border:1px solid rgba(var(--brand-2-rgb),.28);color:#ffe0b2;
}
.activity-item time{flex:none;font-size:11px;color:var(--text-faint);font-variant-numeric:tabular-nums}
.activity-empty{text-align:center;padding:14px 6px 6px}
html[data-theme="light"] .activity-item{background:rgba(15,23,42,.03);border-color:rgba(15,23,42,.08)}
html[data-theme="light"] .activity-item:hover{background:rgba(var(--brand-rgb),.07);border-color:rgba(var(--brand-rgb),.3)}
html[data-theme="light"] .activity-room{color:#9a3412;background:rgba(var(--brand-2-rgb),.14)}

/* subscription status */
.plan-status{display:flex;align-items:flex-start;gap:11px;padding:13px 14px;border-radius:14px;background:rgba(255,255,255,.03);border:1px solid var(--border);margin:12px 0 14px}
.plan-status-dot{flex:none;width:9px;height:9px;border-radius:50%;margin-top:5px;background:var(--text-faint);box-shadow:0 0 10px rgba(255,255,255,.18)}
.plan-status-dot[data-state="active"]{background:#34d399;box-shadow:0 0 0 4px rgba(52,211,153,.14),0 0 12px rgba(52,211,153,.8)}
.plan-status-dot[data-state="pending"]{background:#fcd34d;box-shadow:0 0 0 4px rgba(251,191,36,.13),0 0 12px rgba(251,191,36,.7)}
.plan-status-dot[data-state="expired"]{background:#f87171;box-shadow:0 0 0 4px rgba(248,113,113,.13)}
.plan-status strong{display:block;font-size:14px}
.plan-status p{margin-top:2px;font-size:12px}
.plan-card-link{align-self:flex-start}
html[data-theme="light"] .plan-status{background:rgba(15,23,42,.03)}

.recovery-btn{display:block;margin:12px auto 0;background:none;font-size:12px;color:var(--text-dim)}
.recovery-msg{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.9;word-break:break-word}

/* device capabilities + notifications */
.device-summary{margin:12px 0 10px;font-size:12.5px;color:var(--text-dim)}
.device-summary strong{color:var(--text);font-weight:700}
.cap-details{border:1px solid var(--border);border-radius:13px;background:rgba(255,255,255,.025);overflow:hidden}
.cap-details summary{cursor:pointer;padding:12px 14px;font-size:12.5px;font-weight:700;color:var(--text-dim);list-style:none;display:flex;align-items:center;justify-content:space-between;gap:8px}
.cap-details summary::-webkit-details-marker{display:none}
.cap-details summary::after{content:"⌄";font-size:14px;transition:transform .2s}
.cap-details[open] summary::after{transform:rotate(180deg)}
.cap-list{list-style:none;margin:0;padding:0 14px 12px;display:grid;gap:8px}
.cap-row{padding:9px 11px;border-radius:10px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06)}
.cap-head{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12.5px;font-weight:600}
.cap-pill{flex:none;font-size:10.5px;font-weight:800;letter-spacing:.3px;padding:2px 9px;border-radius:99px;border:1px solid transparent}
.cap-pill.ok{color:#86efac;background:rgba(52,211,153,.12);border-color:rgba(52,211,153,.32)}
.cap-pill.limited{color:#fcd34d;background:rgba(251,191,36,.12);border-color:rgba(251,191,36,.32)}
.cap-pill.no{color:#fca5a5;background:rgba(248,113,113,.1);border-color:rgba(248,113,113,.3)}
.cap-note{display:block;margin-top:4px;font-size:11.5px;line-height:1.7;color:var(--text-faint)}
.notif-block{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}
.notif-block h3{font-size:13.5px;margin-bottom:4px}
.notif-expl{margin-top:8px;padding:9px 11px;border-radius:10px;background:rgba(var(--brand-rgb),.08);border:1px solid rgba(var(--brand-rgb),.22);color:var(--text-dim)}
.notif-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:10px}
.notif-prefs{display:grid;gap:8px;margin-top:12px}
.notif-muted{margin-top:14px}
.notif-muted h3{font-size:12.5px;color:var(--text-dim)}
.muted-rooms{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:6px}
.muted-room{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 12px;border-radius:10px;background:rgba(255,255,255,.03);border:1px solid var(--border);font-size:12.5px}
html[data-theme="light"] .cap-details,html[data-theme="light"] .cap-row,html[data-theme="light"] .muted-room{background:rgba(15,23,42,.03);border-color:rgba(15,23,42,.09)}
html[data-theme="light"] .cap-pill.ok{color:#047857;background:rgba(5,150,105,.1);border-color:rgba(5,150,105,.3)}
html[data-theme="light"] .cap-pill.limited{color:#92400e;background:rgba(245,158,11,.12);border-color:rgba(245,158,11,.32)}
html[data-theme="light"] .cap-pill.no{color:#b91c1c}

@media (max-width:480px){
  .theme-preset-grid{grid-template-columns:repeat(auto-fill,minmax(118px,1fr))}
  .theme-save-row .btn{width:100%}
  .saved-theme{flex-wrap:wrap}
  .saved-theme .saved-del{margin-inline-start:auto}
}

.plan-choices{margin-top:16px;display:grid;gap:10px}
.plan-choices-head{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.plan-coupon{flex:1;min-width:160px;padding:8px 12px;border-radius:11px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.03);color:inherit;font:inherit}
.plan-option{display:flex;gap:12px;justify-content:space-between;align-items:center;padding:12px;border:1px solid rgba(255,255,255,.08);border-radius:14px;background:rgba(255,255,255,.02);flex-wrap:wrap}
.plan-option.popular{border-color:rgba(var(--brand-rgb,79,70,229),.45);box-shadow:0 0 0 1px rgba(var(--brand-rgb,79,70,229),.15) inset}
.plan-option-info{display:grid;gap:2px;min-width:0}
.plan-option-price{font-weight:700;color:#dfe4f2}
.plan-option-actions{display:flex;gap:6px;flex-wrap:wrap}
.plan-msg{margin:0;font-size:12px;color:#9aa3b8}
html[data-theme="light"] .plan-option{border-color:rgba(15,23,42,.1);background:rgba(15,23,42,.02)}
html[data-theme="light"] .plan-option-price{color:#1e293b}
html[data-theme="light"] .plan-coupon{border-color:rgba(15,23,42,.14);background:#fff}
