	/* ===== Friend chat (Discord/LoL-style slide-in panel) ===== */
	.chat-panel { position: fixed; top: 58px; right: 0; bottom: 0; width: 360px; max-width: 90vw; z-index: 40;
		background: var(--bg2); border-left: 1px solid var(--border); display: flex; flex-direction: column;
		transform: translateX(102%); transition: transform .22s ease; box-shadow: -16px 0 40px rgba(0,0,0,.4); }
	.chat-panel.open { transform: none; }
	/* ===== Party (play-together) panel — mirrors the chat slide-in ===== */
	.party-panel { position: fixed; top: 58px; right: 0; bottom: 0; width: 360px; max-width: 90vw; z-index: 41;
		background: var(--bg2); border-left: 1px solid var(--border); display: flex; flex-direction: column;
		transform: translateX(102%); transition: transform .22s ease; box-shadow: -16px 0 40px rgba(0,0,0,.4);
		overflow-y: auto; }
	.party-panel.open { transform: none; }
	.pt-intro { color: var(--muted); font-size: 13px; line-height: 1.5; padding: 14px 16px 4px; }
	.pt-flash { margin: 10px 16px 0; padding: 8px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
		background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
	.pt-sec { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
		color: var(--muted2); padding: 16px 16px 6px; }
	.pt-members { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
	.pt-member { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; }
	.pt-member:hover { background: var(--card); }
	.pt-av { width: 36px; height: 36px; border-radius: 50%; background: #0a0c12 center/cover no-repeat; flex: 0 0 auto;
		border: 2px solid transparent; position: relative; }
	.pt-av.on { border-color: var(--up); }
	.pt-nm { font-size: 13.5px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.pt-crown { font-size: 14px; flex: 0 0 auto; }
	/* Play-together box */
	.pt-play { margin: 6px 16px 0; background: var(--card); border: 1px solid var(--border); border-radius: 13px; padding: 12px; }
	.pt-play.empty { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
	.pt-game { display: flex; align-items: center; gap: 11px; cursor: pointer; }
	.pt-gthumb { width: 64px; height: 36px; border-radius: 8px; background: #0a0c12 center/cover no-repeat; border: 1px solid var(--border); flex: 0 0 auto; }
	.pt-gmeta { min-width: 0; }
	.pt-glabel { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted2); }
	.pt-gname { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.pt-join { display: block; text-align: center; text-decoration: none; margin-top: 11px; background: var(--accent); color: var(--ink);
		font-weight: 800; font-size: 13.5px; padding: 10px; border-radius: 10px; transition: background .12s; }
	.pt-join:hover { background: var(--accent-hover); }
	.pt-clear { display: block; width: 100%; margin-top: 7px; cursor: pointer; background: none; border: 1px solid var(--border);
		color: var(--muted); font-weight: 700; font-size: 11.5px; padding: 6px; border-radius: 9px; }
	.pt-clear:hover { color: var(--text); border-color: var(--accent); }
	/* Invite list */
	.pt-list { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 8px; }
	.pt-frow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; }
	.pt-frow:hover { background: var(--card); }
	.pt-fmeta { flex: 1; min-width: 0; }
	.pt-fname { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.pt-fstat { font-size: 11px; color: var(--muted); }
	.pt-fstat.app { color: var(--up); font-weight: 700; }
	.pt-invite { flex: 0 0 auto; cursor: pointer; background: var(--accent-soft); color: var(--accent);
		border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); font-weight: 800; font-size: 12px;
		padding: 6px 12px; border-radius: 9px; transition: background .12s; }
	.pt-invite:hover { background: var(--accent); color: var(--ink); }
	.pt-leave { margin: 14px 16px 20px; cursor: pointer; background: none; color: var(--down);
		border: 1px solid color-mix(in srgb, var(--down) 45%, transparent); font-weight: 800; font-size: 13px;
		padding: 10px; border-radius: 10px; transition: background .12s; }
	.pt-leave:hover { background: color-mix(in srgb, var(--down) 14%, transparent); }
	/* Accept button inside an invite toast */
	.chat-toast .pt-accept { flex: 0 0 auto; cursor: pointer; background: var(--accent); color: var(--ink); border: none;
		font-weight: 800; font-size: 12.5px; padding: 7px 14px; border-radius: 9px; }
	.chat-toast .pt-accept:hover { background: var(--accent-hover); }
	.chat-head { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px 0 16px;
		border-bottom: 1px solid var(--border); flex: 0 0 auto; }
	.chat-head .ct { font-size: 16px; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.chat-head .x, .chat-head .back { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 20px;
		width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
	.chat-head .x:hover, .chat-head .back:hover { background: var(--card-hover); color: var(--text); }
	.chat-head .av { width: 34px; height: 34px; border-radius: 50%; background: #0a0c12 center/cover no-repeat; position: relative; flex: 0 0 auto; }
	.chat-head .sub { font-size: 11.5px; color: var(--muted); font-weight: 500; }
	.chat-head .steam { font-size: 11px; font-weight: 700; color: var(--accent); text-decoration: none; padding: 6px 10px;
		border: 1px solid var(--border); border-radius: 8px; white-space: nowrap; }
	.chat-head .steam:hover { background: var(--card-hover); }

	/* Friend list */
	.chat-list { flex: 1; overflow-y: auto; padding: 6px; }
	.chat-sec { font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase;
		color: var(--muted2); padding: 12px 10px 6px; }
	.chat-frow { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
	.chat-frow:hover { background: var(--card-hover); }
	.chat-av { width: 38px; height: 38px; border-radius: 50%; background: #0a0c12 center/cover no-repeat; position: relative; flex: 0 0 auto; }
	.chat-av .pip { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
		border: 2.5px solid var(--bg2); background: var(--muted2); }
	.chat-av .pip.app { background: var(--up); box-shadow: 0 0 7px var(--up); }      /* online in SboxPlays */
	.chat-av .pip.steam { background: var(--accent); }                              /* online on Steam */
	.chat-fbody { min-width: 0; flex: 1; }
	.chat-fname { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.chat-fstat { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
	.chat-fstat.app { color: var(--up); }
	.chat-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--down); color: #fff;
		font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
	.chat-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 20px; line-height: 1.6; }
	.chat-empty a { color: var(--accent); font-weight: 700; }
	/* Friend search */
	.chat-search { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; margin: 10px 12px 4px; padding: 9px 12px;
		background: var(--card); border: 1px solid var(--border); border-radius: 11px; }
	.chat-search svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; flex: 0 0 auto; }
	.chat-search input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 13.5px; }
	.chat-av .pip.sbox { background: #5aa9ff; box-shadow: 0 0 7px rgba(90,169,255,.7); }   /* playing s&box */
	.chat-fstat.sbox { color: #5aa9ff; } .chat-fstat.steam { color: var(--text); }
	.chat-frow.off { opacity: .5; } .chat-frow.off:hover { opacity: .85; }
	.chat-frow.unread { background: color-mix(in srgb, var(--accent) 10%, transparent); }

	/* Conversation */
	.chat-convo { flex: 1; display: flex; flex-direction: column; min-height: 0; }
	.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 3px; }
	.chat-day { align-self: center; font-size: 11px; color: var(--muted2); margin: 10px 0 6px; }
	.chat-msg { max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4;
		word-break: break-word; white-space: pre-wrap; }
	.chat-msg.them { align-self: flex-start; background: var(--card); border-bottom-left-radius: 5px; }
	.chat-msg.me   { align-self: flex-end; background: var(--accent); color: var(--ink); border-bottom-right-radius: 5px; }
	.chat-msg + .chat-msg.them { margin-top: 0; } .chat-msg.them + .chat-msg.me, .chat-msg.me + .chat-msg.them { margin-top: 8px; }
	.chat-msg .t { display: block; font-size: 10px; opacity: .65; margin-top: 3px; font-family: var(--mono); }
	.chat-msg.jumbo { background: transparent !important; color: var(--text) !important; font-size: 34px; line-height: 1.15; padding: 2px 4px; }
	.chat-msg.jumbo .t { font-size: 10px; }
	/* Message row: incoming carries a small avatar (grouped messages share it via a hidden spacer) */
	.chat-line { display: flex; width: 100%; gap: 8px; align-items: flex-end; margin-top: 2px; }
	.chat-line.first { margin-top: 9px; }
	.chat-line.me { justify-content: flex-end; }
	.chat-line.them { justify-content: flex-start; }
	.chat-line .chat-msg { align-self: auto; }
	.cm-av { width: 28px; height: 28px; border-radius: 50%; background: #0a0c12 center/cover no-repeat; flex: 0 0 auto; }
	.cm-av.hide { visibility: hidden; }
	.chat-inputbar { flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: flex-end; }
	.chat-inputbar textarea { flex: 1; resize: none; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
		color: var(--text); padding: 9px 13px; font-family: inherit; font-size: 14px; outline: none; max-height: 120px; line-height: 1.4; }
	.chat-inputbar textarea:focus { border-color: var(--accent); }
	.chat-send { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; border: none; background: var(--accent);
		color: var(--ink); font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
	.chat-send:hover { background: var(--accent-hover); }
	.chat-send:disabled { opacity: .4; cursor: default; }
	.chat-inputbar { position: relative; }
	.chat-emoji { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--card);
		font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: border-color .12s, background .12s; }
	.chat-emoji:hover { border-color: var(--accent); background: var(--card-hover); }
	.chat-emoji-picker { position: absolute; left: 10px; bottom: calc(100% + 8px); z-index: 10; width: 286px; max-height: 220px; overflow-y: auto;
		display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 8px; background: var(--card);
		border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
	.chat-emoji-picker button { border: none; background: transparent; cursor: pointer; font-size: 20px; padding: 4px 0; border-radius: 8px; line-height: 1.2; }
	.chat-emoji-picker button:hover { background: var(--card-hover); transform: scale(1.18); }

	/* Dock button unread badge */
	.dock-btn { position: relative; }
	.dock-btn .nbadge, .ticon .nbadge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px;
		border-radius: 8px; background: var(--down); color: #fff; font-size: 10px; font-weight: 800; line-height: 16px;
		text-align: center; border: 2px solid var(--bg2); }

	/* Toast notifications (incoming message while chat closed/elsewhere) */
	.chat-toasts { position: fixed; right: 18px; bottom: 70px; z-index: 55; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
	.chat-toast { display: flex; align-items: center; gap: 11px; width: 320px; max-width: calc(100vw - 36px); cursor: pointer;
		background: var(--card); border: 1px solid var(--border); border-radius: 13px; padding: 11px 13px;
		box-shadow: 0 12px 32px rgba(0,0,0,.45); animation: toastIn .22s ease; }
	.chat-toast:hover { border-color: var(--accent); }
	.chat-toast .av { width: 36px; height: 36px; border-radius: 50%; background: #0a0c12 center/cover no-repeat; flex: 0 0 auto; }
	.chat-toast .tn { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.chat-toast .tm { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
	@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
	@media (max-width: 480px) { .chat-panel { top: 0; width: 100vw; max-width: 100vw; } }

	/* Friend quick-actions popover (View profile / Join game / Chat) */
	.friend-menu { position: fixed; z-index: 56; display: none; min-width: 214px; background: var(--card);
		border: 1px solid var(--border); border-radius: 13px; padding: 6px; box-shadow: 0 16px 44px rgba(0,0,0,.55);
		animation: toastIn .14s ease; }
	.friend-menu.open { display: block; }
	.fm-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 11px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
	.fm-av { width: 40px; height: 40px; border-radius: 50%; background: #0a0c12 center/cover no-repeat; flex: 0 0 auto; }
	.fm-name { font-weight: 750; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.fm-stat { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
	.fm-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: none;
		color: var(--text); font-size: 13.5px; font-weight: 650; padding: 10px 11px; border-radius: 9px; cursor: pointer; text-decoration: none; }
	.fm-item:hover { background: var(--card-hover); }
	.fm-item.disabled { color: var(--muted2); cursor: default; }
	.fm-item.disabled:hover { background: none; }
	.fm-sub { margin-left: auto; font-size: 11px; color: var(--muted2); font-weight: 500; }
	footer code { background: var(--card); padding: 2px 6px; border-radius: 4px; }

