/* ===== sheets: profile (4.png), friends/chat, leaderboard, saves, customize, settings, dashboard ===== */
#panels { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#panels::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .45s var(--ease); }
html.panel-open #panels::before { opacity: 1; }
.panel { position: fixed; left: 50%; top: 12px; bottom: 12px; width: min(1100px, calc(100% - 24px)); margin-left: calc(min(1100px, 100vw - 24px) / -2); display: flex; flex-direction: column; pointer-events: auto; opacity: 0; transform: translateY(32px) scale(.985); border-radius: 40px; background: rgba(40, 40, 46, .62); -webkit-backdrop-filter: blur(44px) saturate(1.9) brightness(1.04); backdrop-filter: blur(44px) saturate(1.9) brightness(1.04); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--shadow-l); transition: opacity .4s var(--ease), transform .6s var(--ease); overflow: hidden; }
.panel.in { opacity: 1; transform: none; } .panel.leaving { opacity: 0; transform: translateY(24px) scale(.985); transition-duration: .35s; }
.panel.narrow, .cust-panel, .settings-panel { width: min(680px, calc(100% - 24px)); margin-left: calc(min(680px, 100vw - 24px) / -2); }
.friends-panel { width: min(1200px, calc(100% - 24px)); margin-left: calc(min(1200px, 100vw - 24px) / -2); }
.panel-top { display: flex; align-items: center; gap: 14px; width: 100%; padding: 22px 26px 8px 32px; flex: none; }
.panel-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel-title h2 { font-size: clamp(26px, 4vw, 34px); font-weight: 700; letter-spacing: -.03em; }
.panel-title span { color: var(--label2); font-size: 14px; }
.panel-actions { display: flex; gap: 8px; }
.panel-close { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 22px; flex: none; transition: transform .3s var(--spring), background .2s; background: rgba(120, 120, 128, .3); }
.panel-close:hover { background: rgba(160, 160, 170, .4); transform: translateX(3px); } .panel-close:active { transform: scale(.9); }
.panel-body { flex: 1; overflow: auto; width: 100%; padding: 8px 32px calc(32px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.friends-panel .panel-body { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }

/* inset grouped cards (iOS list style) */
.card, .cust-sec, .stat, .stat-card, .rest-row, .lb-row, .notif, .user-row, .save-group, .person, .chat-row, .preset { background: rgba(255, 255, 255, .07); border-radius: 22px; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12); }

/* ---- profile ---- */
.profile-panel .panel-body > * { animation: fadeUp .6s var(--ease) both; } .profile-panel .panel-body > :nth-child(2) { animation-delay: .05s; } .profile-panel .panel-body > :nth-child(3) { animation-delay: .1s; } .profile-panel .panel-body > :nth-child(4) { animation-delay: .15s; } .profile-panel .panel-body > :nth-child(5) { animation-delay: .2s; }
.pf-head { display: grid; grid-template-columns: auto 1fr auto; gap: clamp(16px, 3vw, 28px); align-items: center; padding: 10px 0 18px; }
.pf-avatar { position: relative; }
.pf-avatar .avatar { border-radius: 28%; box-shadow: 0 16px 40px rgba(0, 0, 0, .4), inset 0 0 0 .5px rgba(255, 255, 255, .3); } .pf-avatar .avatar .dot { display: none; }
.pf-cam { position: absolute; right: -6px; bottom: -6px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 19px; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); transition: transform .25s var(--spring); } .pf-cam:hover { transform: scale(1.1); }
.pf-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .pf-name h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 700; letter-spacing: -.03em; word-break: break-all; }
.pf-lv { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; } .pf-lv .lv-pill { font-size: 14px; padding: 3px 12px; } .pf-lv .title-chip { font-size: 12px; padding: 3px 12px; }
.pf-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--label2); font-size: 14px; } .pf-status .dot { position: static; width: 10px; height: 10px; min-width: 0; min-height: 0; border: 0; } .pf-status.playing { color: var(--accent); } .pf-status.online { color: var(--good); }
.pf-bio { margin-top: 10px; color: rgba(255, 255, 255, .8); max-width: 52ch; line-height: 1.5; } .pf-bio.muted { color: var(--label3); }
.pf-actions { display: flex; gap: 12px; align-items: center; } .pf-actions .round-btn { width: 52px; height: 52px; font-size: 22px; }
.btn.dm { padding: 14px 28px; font-weight: 700; letter-spacing: .04em; background: var(--accent); color: #fff; }
.pf-xp { margin: 4px 0 6px; } .xp-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .14); overflow: hidden; } .xp-bar i { display: block; height: 100%; transform-origin: 0 50%; background: #fff; border-radius: 6px; animation: grow 1.1s var(--ease) both; } @keyframes grow { from { transform: scaleX(0) !important; } }
.pf-xp small { color: var(--label2); display: block; margin-top: 6px; }
.pf-games { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 4vw, 40px); margin-top: 20px; align-items: start; }
.fav-card { display: flex; gap: 18px; align-items: center; padding: 18px; border-radius: 28px; background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .16); }
.fav-card b { display: block; font-size: clamp(20px, 3vw, 28px); font-weight: 700; letter-spacing: -.02em; } .fav-card span { color: var(--label2); font-size: clamp(15px, 2vw, 19px); } .fav-card.none { color: var(--label2); justify-content: center; }
.game-box { width: 62px; height: 62px; flex: none; border-radius: 23%; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, var(--c, var(--accent)), #1c1c1e); font-weight: 700; font-size: 26px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35), inset 0 0 0 .5px rgba(255, 255, 255, .22); } .game-box img { width: 100%; height: 100%; object-fit: cover; } .game-box.big { width: 112px; height: 112px; font-size: 44px; }
.pf-rest { display: flex; flex-direction: column; gap: 10px; margin-top: 29px; } .rest-row { display: flex; gap: 14px; align-items: center; padding: 10px 14px; animation: fadeUp .5s var(--ease) both; } .rest-row b { display: block; font-weight: 600; } .rest-row span { color: var(--label2); font-size: 14px; }
.pf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 24px; } .stat { padding: 14px 16px; } .stat b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; } .stat span { color: var(--label2); font-size: 13px; }
.pf-titles .title-list { display: flex; flex-wrap: wrap; gap: 8px; } .title-opt { border: 0; background: var(--fill); border-radius: 999px; padding: 6px 12px; color: var(--label2); font-size: 13px; font-weight: 600; transition: background .2s, transform .2s var(--spring); } .title-opt:hover { background: var(--fill2); } .title-opt.on { box-shadow: 0 0 0 2px #fff; color: #fff; }

/* ---- leaderboard / lists ---- */
.lb-tools { position: sticky; top: -8px; z-index: 2; padding: 6px 0 4px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.lb-list, .user-list, .notif-list { display: flex; flex-direction: column; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 11px 16px; animation: slideRow .5s var(--ease) both; transition: background .2s, transform .25s var(--spring); cursor: pointer; }
@keyframes slideRow { from { opacity: 0; transform: translateY(12px); } }
.lb-row:hover, .lb-row:focus-visible { background: rgba(255, 255, 255, .12); outline: none; } .lb-row:active { transform: scale(.99); }
.lb-row.me { background: rgba(var(--accent-rgb), .22); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .6); }
.rank { width: 36px; text-align: center; font-weight: 700; font-size: 18px; color: var(--label2); font-variant-numeric: tabular-nums; } .r1 .rank { font-size: 24px; } .r1 .rank, .r2 .rank, .r3 .rank { color: #fff; }
.r1 { box-shadow: inset 0 0 0 1px rgba(255, 214, 10, .55) !important; } .r2 { box-shadow: inset 0 0 0 1px rgba(210, 215, 230, .45) !important; } .r3 { box-shadow: inset 0 0 0 1px rgba(255, 159, 90, .45) !important; }
.lb-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; } .lb-name b { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lb-name span { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lb-time { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--label2); white-space: nowrap; }
.rel-tag { font-size: 12px; font-weight: 600; color: var(--label2); padding: 4px 10px; border-radius: 99px; background: var(--fill); white-space: nowrap; } .rel-tag.you { color: #fff; background: var(--accent); }
.lb-me { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 14px 20px; border-radius: 22px; background: rgba(var(--accent-rgb), .3); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); animation: fadeUp .5s both; } .lb-me b { font-size: 22px; }
.ico.done { color: var(--good); }

/* ---- saves ---- */
.save-group { margin-bottom: 14px; padding: 14px; animation: fadeUp .5s var(--ease) both; }
.save-group header { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; } .save-group h3 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.save-row { display: flex; align-items: center; gap: 14px; padding: 10px 6px; border-top: .5px solid var(--sep); } .save-meta { flex: 1; } .save-meta b { display: block; font-weight: 600; } .save-meta small { color: var(--label2); }
.slot-badge { min-width: 52px; text-align: center; padding: 8px 6px; border-radius: 12px; background: var(--fill); font-weight: 700; font-size: 13px; color: var(--label); }

/* ---- notifications ---- */
.notif { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 0; color: var(--label); text-align: left; animation: slideRow .45s var(--ease) both; transition: background .2s; } .notif:hover { background: rgba(255, 255, 255, .12); }
.notif.unread { background: rgba(var(--accent-rgb), .2); } .notif div { display: flex; flex-direction: column; gap: 2px; } .notif small { color: var(--label2); }

/* ---- friends & chat ---- */
.fr-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; }
.fr-side, .fr-main { min-height: 0; display: flex; flex-direction: column; border-radius: 28px; background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1); overflow: hidden; }
.fr-side { padding: 14px; } .fr-tabs { margin-bottom: 10px; flex: none; } .fr-tools { flex: none; margin-bottom: 10px; } .fr-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.add-row { display: flex; gap: 8px; } .add-row .btn { padding: 0 18px; }
.person, .chat-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: transparent; box-shadow: none; border: 0; cursor: pointer; text-align: left; color: var(--label); transition: background .2s; animation: slideRow .4s var(--ease) both; border-radius: 18px; }
.person:hover, .chat-row:hover, .person:focus-visible, .chat-row:focus-visible { background: rgba(255, 255, 255, .1); outline: none; } .chat-row.on { background: rgba(255, 255, 255, .17); }
.person-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; } .person-info b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .person-info span { color: var(--label2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .person-info .st.online { color: var(--good); } .person-info .st.playing { color: var(--accent); }
.chat-row.unread .person-info span { color: var(--label); font-weight: 600; }
.unread-dot { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; font-style: normal; display: grid; place-items: center; }
.group-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: rgba(120, 120, 128, .45); font-size: 22px; flex: none; }
.row-actions { display: flex; gap: 6px; }
.chat-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: .5px solid var(--sep); } .chat-head .back-list { display: none; }
.head-who { flex: 1; display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: left; min-width: 0; color: var(--label); } .head-who b { display: block; font-size: 17px; font-weight: 600; } .head-who span { font-size: 13px; color: var(--label2); } .head-who span.st.online { color: var(--good); } .head-who span.st.playing { color: var(--accent); }
.chat-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.chat-scroll .more { align-self: center; margin-bottom: 8px; }
.day-sep { text-align: center; margin: 12px 0 8px; color: var(--label2); font-size: 12px; font-weight: 600; }
.sys-msg { align-self: center; margin: 8px 0; color: var(--label2); font-size: 13px; text-align: center; }
/* iMessage-style bubbles */
.msg { display: flex; gap: 8px; max-width: 80%; animation: msgIn .35s var(--ease) both; margin-top: 8px; } .msg.cont { margin-top: 0; } .msg.mine { align-self: flex-end; flex-direction: row-reverse; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.msg-av { background: none; border: 0; padding: 0; align-self: flex-end; } .msg-av-gap { width: 32px; flex: none; } .msg-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .msg.mine .msg-col { align-items: flex-end; } .msg-name { color: var(--label2); font-size: 12px; padding-left: 12px; }
.bubble { position: relative; padding: 8px 14px 18px; border-radius: 20px; background: rgba(120, 120, 128, .38); line-height: 1.35; word-break: break-word; white-space: pre-wrap; min-width: 64px; border-bottom-left-radius: 6px; user-select: text; }
.msg.mine .bubble { background: var(--accent); color: #fff; border-radius: 20px; border-bottom-right-radius: 6px; }
.bubble time { position: absolute; right: 12px; bottom: 3px; font-size: 10px; opacity: .55; }
.chat-note { flex: none; text-align: center; font-size: 12px; color: var(--label3); padding: 4px 8px; }
.composer { flex: none; display: flex; gap: 10px; align-items: flex-end; padding: 10px 14px 14px; } .composer .input { border-radius: 22px; max-height: 130px; } .composer .send { width: 46px; height: 46px; padding: 0; border-radius: 50%; flex: none; }
.chat-empty { margin: auto; text-align: center; color: var(--label2); padding: 30px; } .chat-empty.small { padding: 20px; margin: 20px auto; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; margin-bottom: 10px; }
.pick { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 16px; background: var(--fill); border: 0; cursor: pointer; text-align: left; color: var(--label); transition: background .2s; } .pick:hover { background: var(--fill2); } .pick span { flex: 1; } .pick em { color: var(--warn); font-size: 12px; font-style: normal; }
.pick input { position: absolute; opacity: 0; } .pick .tick { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--label3); display: grid; place-items: center; color: transparent; transition: all .25s var(--spring); font-style: normal; } .pick input:checked ~ .tick { background: var(--accent); color: #fff; border-color: transparent; }
.pick.static { width: 100%; }

/* ---- customize / settings ---- */
.cust { display: flex; flex-direction: column; gap: 14px; }
.cust-sec { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; animation: fadeUp .5s var(--ease) both; } .cust > :nth-child(2) { animation-delay: .04s; } .cust > :nth-child(3) { animation-delay: .08s; } .cust > :nth-child(4) { animation-delay: .12s; } .cust > :nth-child(5) { animation-delay: .16s; }
.cust-sec h3 { font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--label2); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.preset { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; border: 0; color: var(--label); font-weight: 600; font-size: 13px; transition: transform .3s var(--spring), background .2s; }
.preset-swatch { width: 100%; height: 40px; border-radius: 14px; background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .3); }
.preset:hover { background: rgba(255, 255, 255, .12); } .preset:active { transform: scale(.96); } .preset.on { box-shadow: inset 0 0 0 2px #fff; }
.color-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; } .color-pick { display: flex; align-items: center; gap: 12px; } .color-pick b { display: block; font-weight: 600; } .color-pick code { color: var(--label2); font-size: 12px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; } .toggle-row b { display: block; font-weight: 600; } .toggle-row small { color: var(--label2); } .toggle-row.inline { gap: 10px; }
.about { text-align: center; color: var(--label3); font-size: 13px; margin-top: 8px; }

/* ---- dashboard ---- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; animation: fadeUp .45s var(--ease) both; } .stat-card .ico { font-size: 22px; color: var(--accent); margin-bottom: 6px; } .stat-card b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; } .stat-card span { color: var(--label2); font-size: 13px; }
.dash-content h3 { margin: 6px 0 12px; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--label2); font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 10px; } .bar-row { display: grid; grid-template-columns: 120px 1fr minmax(120px, auto); align-items: center; gap: 12px; } .bar { height: 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); overflow: hidden; } .bar i { display: block; height: 100%; border-radius: 10px; background: var(--accent); animation: barIn 1s var(--ease) both; transform-origin: 0 50%; } @keyframes barIn { from { transform: scaleX(0); } } .bar-row small { color: var(--label2); text-align: right; }
.user-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; animation: slideRow .45s var(--ease) both; } .user-row.pending { box-shadow: inset 0 0 0 1px rgba(255, 159, 10, .5); }
.ur-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 3px; } .ur-info b { font-weight: 600; } .ur-info small { color: var(--label2); } .ur-tags { display: flex; gap: 8px; align-items: center; } .ur-actions { display: flex; gap: 8px; flex-wrap: wrap; } .ur-titles { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

@media (max-width: 820px) {
  .panel, .panel.narrow, .cust-panel, .settings-panel, .friends-panel { left: 6px; right: 6px; top: 6px; bottom: 6px; width: auto; margin-left: 0; border-radius: 32px; }
  .panel-top { padding: 18px 16px 6px 22px; } .panel-body { padding: 6px 18px calc(24px + env(safe-area-inset-bottom)); }
  .fr-layout { grid-template-columns: 1fr; position: relative; }
  .fr-main { position: absolute; inset: 0; transform: translateX(105%); transition: transform .45s var(--ease); background: rgba(28, 28, 32, .96); z-index: 2; }
  .show-chat .fr-main { transform: none; } .show-chat .fr-side { visibility: hidden; transition: visibility 0s .45s; }
  .chat-head .back-list { display: grid; }
  .msg { max-width: 92%; }
  .pf-head { grid-template-columns: auto 1fr; } .pf-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .pf-games { grid-template-columns: 1fr; } .pf-rest { margin-top: 0; }
  .bar-row { grid-template-columns: 90px 1fr; } .bar-row small { grid-column: 1 / -1; text-align: left; }
  .lb-time { display: none; } .rank { width: 28px; }
}
@media (max-width: 480px) { .pf-avatar .avatar { --s: 96px !important; } .panel-close { width: 42px; height: 42px; } }
