/* ==========================================================================
   Giao diện xã hội của thế giới chung (social-ui.mjs): menu lại gần người chơi, khung chat, bảng nhóm, thẻ lời mời.
   Cùng phong cách kính tối với bảng lớp học ngoại ngữ (class.css).
   ========================================================================== */

.sws-glass { background: rgba(13, 20, 33, .92); color: #e8eef7; border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .65); backdrop-filter: blur(10px); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.sws-glass * { box-sizing: border-box; }
.sws-in { animation: sws-in .2s ease-out; }
@keyframes sws-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Ảnh đại diện chữ cái: màu theo tên (biến --h) */
.sws-ava { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; font-weight: 800; color: #fff; text-transform: uppercase;
  background: linear-gradient(135deg, hsl(var(--h, 160) 65% 50%), hsl(calc(var(--h, 160) + 35) 65% 36%)); }
.sws-x { border: 0; background: none; color: #93a4bd; font-size: 15px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; flex: none; }
.sws-x:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sws-x:disabled { opacity: .3; cursor: default; background: none; }

/* --- Menu lại gần --- */
#sw-social-menu { width: 300px; overflow: hidden; }
.sws-menu-hd { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), transparent); }
.sws-menu-hd .sws-ava { width: 42px; height: 42px; font-size: 17px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
.sws-name { font-size: 15px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sws-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.sws-chip { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 8px; }
.sws-chip.is-friend { background: rgba(16, 185, 129, .16); color: #6ee7b7; }
.sws-chip.is-in { background: rgba(245, 158, 11, .16); color: #fcd34d; }
.sws-chip.is-out { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
.sws-chip.is-group { background: rgba(139, 92, 246, .18); color: #c4b5fd; }
.sws-chip.is-other { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
.sws-actions { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.sws-act { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; transition: background .12s; }
.sws-act:hover, .sws-act:focus-visible { background: rgba(255, 255, 255, .07); outline: none; }
.sws-act:disabled { cursor: default; opacity: .55; background: none; }
.sws-tile { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; flex: none; }
.sws-tile.t-emerald { background: rgba(16, 185, 129, .16); color: #34d399; }
.sws-tile.t-sky { background: rgba(56, 189, 248, .16); color: #38bdf8; }
.sws-tile.t-violet { background: rgba(139, 92, 246, .18); color: #a78bfa; }
.sws-tile.t-pink { background: rgba(236, 72, 153, .18); color: #f472b6; }
.sws-tile.t-amber { background: rgba(245, 158, 11, .16); color: #fbbf24; }
.sws-tile.t-gray { background: rgba(148, 163, 184, .12); color: #94a3b8; }
.sws-act-text { flex: 1; min-width: 0; }
.sws-act-label { display: block; font-size: 14px; font-weight: 600; color: #f1f5f9; }
.sws-act-hint { display: block; font-size: 12px; color: #93a4bd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sws-kbd { flex: none; min-width: 22px; text-align: center; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 700; color: #cbd5e1;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.sws-foot { padding: 7px 14px; font-size: 11.5px; color: #64748b; border-top: 1px solid rgba(255, 255, 255, .06); }
.sws-foot b { color: #94a3b8; }

/* --- Khung chat --- */
#sw-chat { width: min(360px, calc(100vw - 32px)); height: min(440px, calc(100vh - 140px)); display: flex; flex-direction: column; overflow: hidden; }
.sws-chat-hd { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent); }
.sws-chat-title { font-size: 14px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.sws-chat-title small { font-size: 11.5px; font-weight: 500; color: #93a4bd; }
/* Đầu khung chat khi đang nói chuyện với một người: ảnh + tên + trạng thái, nút Gọi / Kết bạn */
.sws-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sws-who .sws-ava { width: 34px; height: 34px; font-size: 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }
.sws-who-text { min-width: 0; display: flex; flex-direction: column; }
.sws-who-name { font-size: 14px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sws-who .sws-chips { margin-top: 2px; }
.sws-who .sws-chip { font-size: 10.5px; padding: 1px 7px; }
.sws-who-sub { font-size: 11px; font-weight: 500; color: #93a4bd; }
.sws-peer { display: flex; gap: 6px; flex: none; }
.sws-peer:empty { display: none; }
.sws-pbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  transition: transform .08s, background .12s; }
.sws-pbtn:hover:not(:disabled) { transform: translateY(-1px); }
.sws-pbtn:active:not(:disabled) { transform: scale(.94); }
.sws-pbtn:disabled { cursor: default; }
.sws-pbtn.t-emerald { background: rgba(16, 185, 129, .18); color: #34d399; }
.sws-pbtn.t-violet { background: rgba(139, 92, 246, .2); color: #a78bfa; }
.sws-pbtn.t-pink { background: rgba(236, 72, 153, .2); color: #f472b6; }
.sws-pbtn.t-amber { background: rgba(245, 158, 11, .2); color: #fbbf24; animation: sws-pulse 1.6s ease-in-out infinite; }
.sws-pbtn.t-gray { background: rgba(148, 163, 184, .12); color: #94a3b8; }
.sws-pbtn.t-sky { background: rgba(56, 189, 248, .16); color: #38bdf8; }
.sws-pbtn:hover:not(:disabled).t-emerald { background: rgba(16, 185, 129, .3); }
.sws-pbtn:hover:not(:disabled).t-violet { background: rgba(139, 92, 246, .32); }
@keyframes sws-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .45); } 50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); } }
/* Thanh đang gọi */
.sws-call { top: calc(70px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px; max-width: calc(100vw - 24px); z-index: 5; }
.sws-call.hidden { display: none; }
.sws-call-ic { display: inline-flex; color: #34d399; flex: none; }
.sws-call.is-ringing .sws-call-ic { color: #fbbf24; animation: sws-ring 1s ease-in-out infinite; }
@keyframes sws-ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.sws-call-who { font-size: 13px; font-weight: 600; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sws-call-who em { font-style: normal; font-weight: 500; color: #93a4bd; }
.sws-call-m { display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; }
.sws-call-m::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #475569; transition: background .15s, box-shadow .15s; }
.sws-call-m.is-speaking::before { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .3); }
.sws-call-time { font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #cbd5e1; background: rgba(255, 255, 255, .07); border-radius: 999px; padding: 5px 8px; flex: none; }
.sws-call-time:empty { display: none; }
.sws-call-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: rgba(255, 255, 255, .1); color: #e2e8f0; transition: background .12s, transform .08s; }
.sws-call-btn:hover { background: rgba(255, 255, 255, .18); }
.sws-call-btn:active { transform: scale(.92); }
.sws-call-btn[hidden] { display: none; }
.sws-call-btn .sws-call-slash { display: none; }
.sws-call-btn.is-off { background: rgba(239, 68, 68, .2); color: #fca5a5; }
.sws-call-btn.is-off .sws-call-slash { display: inline; }
.sws-call-btn.is-speaking { box-shadow: 0 0 0 3px rgba(52, 211, 153, .45); }
.sws-call-btn.is-hang { background: #ef4444; color: #fff; }
.sws-call-btn.is-hang:hover { background: #dc2626; }
.sws-tabs { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; border-bottom: 1px solid rgba(255, 255, 255, .06); scrollbar-width: none; touch-action: pan-x; overscroll-behavior-x: contain; }
.sws-tabs::-webkit-scrollbar { display: none; }
.sws-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 4px 10px 4px 4px; background: rgba(255, 255, 255, .06);
  color: #cbd5e1; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sws-tab .sws-ava { width: 22px; height: 22px; font-size: 11px; }
.sws-tab:hover { background: rgba(255, 255, 255, .1); }
.sws-tab.is-on { background: rgba(37, 99, 235, .9); color: #fff; }
.sws-tab-x { width: 18px; height: 18px; margin-right: -4px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; opacity: .6; }
.sws-tab-x:hover { opacity: 1; background: rgba(255, 255, 255, .18); }
.sws-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.sws-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; user-select: text; }
.sws-empty { margin: auto; text-align: center; color: #64748b; font-size: 13px; line-height: 1.5; }
.sws-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.sws-row .sws-ava { width: 26px; height: 26px; font-size: 12px; }
.sws-row.is-me { flex-direction: row-reverse; }
.sws-msg { max-width: 78%; display: flex; flex-direction: column; }
.sws-row.is-me .sws-msg { align-items: flex-end; }
.sws-from { font-size: 11px; color: #93a4bd; margin: 0 4px 2px; }
.sws-bubble { padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; background: rgba(255, 255, 255, .08); color: #e8eef7; border-bottom-left-radius: 4px; }
.sws-row.is-me .sws-bubble { background: #2563eb; color: #fff; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.sws-row.is-cont .sws-ava { visibility: hidden; }
.sws-time { font-size: 10.5px; color: #64748b; margin: 2px 4px 0; }
.sws-ft { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sws-form { display: flex; gap: 8px; }
.sws-form input { flex: 1; min-width: 0; height: 40px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #fff;
  padding: 0 12px; font: inherit; font-size: 14px; outline: none; }
.sws-form input::placeholder { color: #7c8aa0; }
.sws-form input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .25); }
.sws-send { width: 40px; height: 40px; border-radius: 12px; border: 0; background: #2563eb; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
.sws-send:hover { background: #1d4ed8; }
.sws-hint { margin-top: 6px; font-size: 11px; color: #64748b; text-align: center; }

/* --- Bảng nhóm --- */
#sw-group { width: 240px; padding: 12px; }
.sws-group-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sws-group-hd b { font-size: 13.5px; color: #fff; }
.sws-group-hd small { font-size: 11.5px; color: #93a4bd; font-weight: 500; margin-left: 4px; }
.sws-leave { border: 0; background: rgba(239, 68, 68, .14); color: #fca5a5; font: inherit; font-size: 11.5px; font-weight: 600; border-radius: 8px; padding: 3px 8px; cursor: pointer; }
.sws-leave:hover { background: rgba(239, 68, 68, .25); }
.sws-member { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 10px; font-size: 13px; color: #e2e8f0; }
.sws-member .sws-ava { width: 26px; height: 26px; font-size: 12px; }
.sws-member span.n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sws-member em { font-style: normal; font-size: 11px; color: #93a4bd; }
.sws-kick { border: 0; background: none; color: #fca5a5; font: inherit; font-size: 11.5px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.sws-kick:hover { background: rgba(239, 68, 68, .15); }

/* --- Thẻ lời mời / xin vào nhóm --- */
.sws-invite { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; font-size: 13.5px; max-width: min(460px, calc(100vw - 32px)); }
.sws-invite .t { flex: 1; color: #e2e8f0; }
.sws-yes, .sws-no { border: 0; border-radius: 9px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; flex: none; }
.sws-yes { background: #10b981; color: #fff; }
.sws-yes:hover { background: #059669; }
.sws-no { background: rgba(255, 255, 255, .1); color: #cbd5e1; }
.sws-no:hover { background: rgba(255, 255, 255, .16); }

/* Ẩn bằng class "hidden" của Tailwind: selector #id ở trên (display: flex) mạnh hơn nên phải ghi rõ */
#sw-chat.hidden, #sw-social-menu.hidden, #sw-group.hidden { display: none; }

/* Thả hoa đăng (Đỉnh Thác Tình Yêu): hộp nhập điều ước + nhãn điều ước trên đèn của mình */
.sw-lantern-box { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 10, 20, .35); }
.sw-lantern-card { width: min(380px, 100%); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.sw-lantern-hd { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.sw-lantern-card label { font-size: 13px; color: rgba(232, 238, 247, .8); }
.sw-lantern-card label small { color: rgba(232, 238, 247, .5); }
.sw-lantern-card input { height: 42px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #fff; padding: 0 12px; font: inherit; font-size: 14px; outline: none; }
.sw-lantern-card input:focus { border-color: #ffb15c; box-shadow: 0 0 0 3px rgba(255, 177, 92, .2); }
.sw-lantern-ft { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: rgba(232, 238, 247, .65); }
.sw-lantern-go { flex: none; border: 0; border-radius: 12px; padding: 9px 18px; font: inherit; font-weight: 700; color: #3a1d06; background: linear-gradient(135deg, #ffd38a, #ff9a5c); cursor: pointer; }
.sw-lantern-go:disabled { opacity: .5; cursor: default; }
.sw-wish { position: absolute; left: 0; top: 0; max-width: 220px; padding: 5px 11px; border-radius: 12px; background: rgba(40, 18, 8, .72); color: #ffe7c2;
  font-size: 13px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; opacity: 0; transition: opacity .3s; }


/* Bản đồ nhỏ + bạn bè đang online (minimap.mjs): góc trên trái, dưới thanh tiêu đề */
.swm { position: absolute; top: 64px; left: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; z-index: 5; }
.swm > * { pointer-events: auto; }
.swm [hidden] { display: none !important; }
.swm-card { padding: 6px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; border-radius: 18px; }
.swm-hd { width: 100%; display: flex; align-items: center; gap: 5px; padding: 0 2px; }
.swm-title { width: 100%; text-align: center; font-size: 12px; font-weight: 700; color: rgba(232, 238, 247, .85); letter-spacing: .02em; }
.swm-canvas { display: block; border-radius: 50%; }
.swm-friends-btn, .swm-hide, .swm-show, .swm-big-btn { height: 26px; min-width: 26px; padding: 0 7px; border-radius: 999px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background: rgba(255, 255, 255, .08); color: #e8eef7; font: 600 12px/1 system-ui, sans-serif; cursor: pointer; transition: background .15s; }
.swm-friends-btn:hover, .swm-hide:hover, .swm-show:hover, .swm-big-btn:hover { background: rgba(255, 255, 255, .16); }
.swm-friends-btn.has { background: rgba(74, 222, 128, .18); color: #bbf7d0; }
.swm-people-btn.has { background: rgba(96, 165, 250, .18); color: #bfdbfe; }
.swm-dev { font-size: 12px; }
.swm-tally { margin: 2px 0 6px; font-size: 12px; color: #cbd5e1; }
.swm-hide, .swm-big-btn { font-size: 16px; padding: 0; }
.swm-pill { display: flex; gap: 6px; padding: 5px; border-radius: 999px; }
.swm-show { padding: 0 8px; }
.swm-panel { width: min(400px, calc(100vw - 24px)); max-height: min(520px, calc(100vh - 150px)); max-height: min(520px, calc(100dvh - 150px)); overflow-y: auto; padding: 10px; border-radius: 16px; display: flex; flex-direction: column; gap: 6px; }
.swm-panel-hd { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #fff; padding: 0 2px 4px; }
.swm-empty { margin: 4px 2px; font-size: 12.5px; color: rgba(232, 238, 247, .6); }
.swm-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.swm-ava { width: 30px; height: 30px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
  color: #052e16; background: linear-gradient(135deg, #86efac, #4ade80); }
.swm-row-text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.swm-name { font-size: 14px; font-weight: 600; color: #fff; overflow-wrap: anywhere; } /* tên đầy đủ, dài thì xuống dòng */
.swm-act { margin-top: 3px; align-self: flex-start; max-width: 100%; padding: 2px 8px; border-radius: 999px; background: rgba(96, 165, 250, .16); color: #dbeafe; font-size: 11.5px; font-weight: 600; overflow-wrap: anywhere; }
/* nút (Đến, Kết bạn, Nhắn…) xuống hàng riêng dưới tên — không ép tên / thông tin co lại */
.swm-acts { flex: 1 0 100%; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding-left: 40px; }
.swm-row-text small { font-size: 11px; color: rgba(232, 238, 247, .6); }
.swm-chat, .swm-go { flex: none; height: 30px; padding: 0 14px; border-radius: 999px; border: 0; font: 600 12px/1 system-ui, sans-serif; cursor: pointer; }
.swm-chat { background: #38bdf8; color: #082f49; }
.swm-chat:hover { background: #7dd3fc; }
.swm-go { background: rgba(255, 255, 255, .1); color: #e8eef7; }
.swm-go:hover { background: rgba(255, 255, 255, .18); }
.swm.is-compact { top: 58px; left: 10px; }
.swm.is-compact .swm-card { padding: 4px 4px 6px; border-radius: 14px; }
.swm-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.swm-sp { flex: 1; }
.swm-canvas { cursor: zoom-in; }
/* Bản đồ lớn (phím B / bấm bản đồ nhỏ) */
.swm-big { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 10, 20, .45); }
.swm-big-card { padding: 12px; border-radius: 20px; display: flex; flex-direction: column; gap: 10px; max-width: 100%; }
.swm-big-hd { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 15px; padding: 0 2px; }
.swm-big-hd b { white-space: nowrap; }
.swm-legend { flex: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; font-size: 12px; color: rgba(232, 238, 247, .75); }
.swm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.swm-legend span::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.swm-big-canvas { display: block; border-radius: 12px; }
@media (max-width: 640px) { .swm-big-hd b { display: none; } .swm-legend { justify-content: flex-start; } }

/* Khung chat thu nhỏ: nút tròn góc dưới phải, chấm số tin chưa đọc (social-ui minimize) */
.sws-mini { position: absolute; right: 16px; bottom: 24px; width: 52px; height: 52px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center;
  color: #e8eef7; cursor: pointer; pointer-events: auto; box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .6); }
.sws-mini[hidden] { display: none; }
.sws-mini svg { width: 24px; height: 24px; }
.sws-mini:hover { color: #fff; filter: brightness(1.15); }
.sws-mini .sws-badge { position: absolute; top: -2px; right: -2px; }
.sws-mini .sws-badge:empty { display: none; }
.sws-mini.has-new { animation: sws-mini-pulse 1.6s ease-in-out infinite; }
@keyframes sws-mini-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .55); } 50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); } }
.sw-touch .sws-mini { bottom: auto; top: calc(116px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); width: 44px; height: 44px; }

/* Nút emoji + bảng chọn Emoji / Sticker / GIF (chat-picker.mjs) */
.sws-emo { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); font-size: 19px; cursor: pointer; }
.sws-emo:hover, .sws-emo.is-on { background: rgba(255, 255, 255, .14); }
.swp { margin: 0 10px 8px; border-radius: 14px; background: rgba(8, 13, 24, .92); border: 1px solid rgba(255, 255, 255, .1); overflow: hidden; }
.swp[hidden] { display: none; }
.swp-tabs { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.swp-tab { flex: 1; height: 30px; border-radius: 9px; border: 0; background: transparent; color: #a9b6c9; font: 600 12.5px system-ui, sans-serif; cursor: pointer; }
.swp-tab.is-on { background: rgba(59, 130, 246, .22); color: #fff; }
.swp-body { height: 196px; overflow-y: auto; padding: 6px; }
.swp-load { padding: 20px 8px; text-align: center; color: #8c9ab0; font-size: 12.5px; }
.swp-emoji { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px; }
.swp-emoji button { height: 34px; border: 0; border-radius: 8px; background: transparent; font-size: 21px; cursor: pointer; }
.swp-emoji button:hover { background: rgba(255, 255, 255, .1); }
.swp-packs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.swp-pack { flex: none; width: 38px; height: 38px; padding: 3px; border-radius: 9px; border: 1px solid transparent; background: rgba(255, 255, 255, .05); cursor: pointer; }
.swp-pack.is-on { border-color: #3b82f6; background: rgba(59, 130, 246, .18); }
.swp-pack img { width: 100%; height: 100%; object-fit: contain; }
.swp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; }
.swp-grid.is-gif { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.swp-item { aspect-ratio: 1; padding: 4px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .04); cursor: pointer; }
.swp-item:hover { background: rgba(255, 255, 255, .12); }
.swp-item img { width: 100%; height: 100%; object-fit: contain; }
.swp-sec { margin: 4px 2px 6px; font-size: 11.5px; font-weight: 700; color: #a9b6c9; }
/* Sticker / GIF trong tin nhắn: không nền bong bóng */
.sws-bubble.is-media { padding: 0; background: transparent !important; box-shadow: none; }
.sws-bubble.is-media img { display: block; max-width: 132px; max-height: 132px; border-radius: 10px; }
.sws-bubble.is-gif img { max-width: 180px; max-height: 160px; }
/* Cảnh báo trình vẽ phần mềm (software-render.mjs): máy vẽ 3D bằng CPU → hướng dẫn bật tăng tốc phần cứng.
   Trên cùng mọi lớp (sảnh, màn tải, HUD) — lúc chờ tải là lúc người chơi đọc được. */
.sw-swr { position: fixed; z-index: 80; top: calc(16px + env(safe-area-inset-top, 0px)); left: 50%; translate: -50% 0;
  width: min(480px, calc(100vw - 32px)); padding: 14px 16px; font-size: 13.5px; line-height: 1.5; box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .6); }
.sw-swr-hd { display: flex; gap: 10px; align-items: flex-start; }
.sw-swr-ic { flex: none; font-size: 20px; line-height: 1.2; }
.sw-swr-tx { min-width: 0; }
.sw-swr-tx b { display: block; font-size: 15px; color: #fff; }
.sw-swr-tx small { display: block; margin-top: 2px; font-size: 12.5px; color: rgba(232, 238, 247, .75); }
.sw-swr-steps { margin: 10px 0 0; padding-left: 52px; list-style: decimal; display: flex; flex-direction: column; gap: 4px; }
.sw-swr-steps b { color: #fcd34d; font-weight: 600; user-select: text; }
.sw-swr-note { margin: 8px 0 0 30px; font-size: 12px; color: rgba(232, 238, 247, .6); }
.sw-swr-ft { display: flex; justify-content: flex-end; margin-top: 10px; }
.sw-swr-ok { border: 0; border-radius: 999px; padding: 7px 18px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  background: linear-gradient(90deg, #34d399, #2dd4bf); color: #064e3b; }
.sw-swr-ok:hover { filter: brightness(1.1); }

/* Cột nút góc dưới phải (shop-hub.mjs), từ trên xuống: ❓ Hướng dẫn, 🛍️ Cửa hàng, 📚 Học & giải trí, 💬 chat — chung một cột nên không đè nhau */
.sw-dock { position: absolute; right: 16px; bottom: 24px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; z-index: 5; }
.sw-dock > * { pointer-events: auto; }
.sw-dock .sws-mini { position: relative; right: auto; bottom: auto; top: auto; }
/* 📚 Học & giải trí (seat-apps): vào cột, cùng cỡ với các nút khác */
.sw-dock .swa-toggle, .sw-touch .sw-dock .swa-toggle { position: relative; right: auto; bottom: auto; top: auto; width: 52px; height: 52px; }
.sw-touch .sw-dock .swa-toggle { width: 44px; height: 44px; }
/* Khung chat đang mở (góc dưới phải): cột lên trên khung chat — chỉ còn nút Học & giải trí (Cửa hàng, Hướng dẫn ẩn) */
body.sw-chat-open .sw-dock { bottom: calc(min(440px, 100vh - 140px) + 36px); }
body.sw-touch.sw-chat-open .sw-dock { display: none; }
.sw-shop { position: relative; }
body.sw-chat-open .sw-shop, body.sw-chat-open .sw-help-btn, body.sw-chat-open .sw-todo, .sw-dock.is-off .sw-shop, .sw-dock.is-off .sw-help-btn, .sw-dock.is-off .sw-todo { display: none; }
.sw-shop-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1;
  cursor: pointer; box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .6); transition: transform .15s; }
.sw-shop-btn:hover, .sw-shop-btn.is-on { transform: scale(1.06); filter: brightness(1.15); }
.sw-shop-menu { position: absolute; right: 64px; bottom: 0; width: 236px; padding: 8px; border-radius: 16px; display: flex; flex-direction: column; gap: 2px; }
.sw-shop-menu[hidden] { display: none; }
.sw-shop-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: rgba(232, 238, 247, .7); }
.sw-shop-pts { padding: 2px 8px; border-radius: 999px; background: rgba(251, 191, 36, .16); color: #fde68a; font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sw-shop-pts[hidden] { display: none; }
.sw-shop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: transparent; color: #e8eef7; text-align: left; cursor: pointer; }
.sw-shop-item:hover, .sw-shop-item:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
.sw-shop-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; background: rgba(255, 255, 255, .08); }
.sw-shop-tx { display: flex; flex-direction: column; min-width: 0; }
.sw-shop-tx b { font-size: 14px; font-weight: 600; }
.sw-shop-tx small { font-size: 11.5px; color: rgba(232, 238, 247, .6); }
/* Cảm ứng: cột ở mép phải phía trên (tránh cần điều khiển, như nút chat thu nhỏ trước đây), cùng thứ tự như máy tính */
.sw-touch .sw-dock { bottom: auto; top: calc(116px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); gap: 8px; }
.sw-touch .sw-dock .sws-mini { top: auto; right: auto; }
.sw-touch .sw-shop-btn { width: 44px; height: 44px; font-size: 20px; }
.sw-touch .sw-shop-menu { right: 54px; top: 0; bottom: auto; }

/* Nút ❓ Hướng dẫn (help-ui.mjs): đầu cột nút góc dưới phải; popup cách điều khiển */
.sw-help-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1;
  cursor: pointer; box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .6); transition: transform .15s; }
.sw-help-btn:hover { transform: scale(1.06); filter: brightness(1.15); }
.sw-touch .sw-help-btn { width: 44px; height: 44px; font-size: 19px; }
.sw-helpbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 6, 23, .45); }
.sw-helpbox-card { width: min(560px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; color: #e8eef7; }
.sw-helpbox-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: 16px; }
.sw-helpbox-body { overflow: auto; padding: 6px 16px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.sw-helpbox-body section { min-width: 0; }
.sw-helpbox-body h3 { margin: 12px 0 6px; font-size: 13px; font-weight: 700; color: #fde68a; }
.sw-helpbox-row { display: flex; gap: 10px; padding: 5px 0; font-size: 13px; line-height: 1.45; border-bottom: 1px dashed rgba(255, 255, 255, .07); }
.sw-helpbox-row .k { flex: 0 0 44%; color: #fff; font-weight: 600; }
.sw-helpbox-row .d { flex: 1; color: rgba(232, 238, 247, .78); }
.sw-helpbox kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .35);
  font: 600 11.5px/1.5 ui-monospace, Consolas, monospace; text-align: center; color: #fff; }
@media (max-width: 560px) { .sw-helpbox-body { grid-template-columns: 1fr; } }

/* Đặt trạng thái (player-status.mjs): trong Cài đặt › Nhân vật (nền sáng) và popup khi đang ngồi — phím J (nền tối) */
.sws-st-box, .sws-st-card { --st-ink: #1f2937; --st-mute: #6b7280; --st-chip: #f3f4f6; --st-line: #e5e7eb; --st-now: #eff6ff; --st-now-ink: #1e3a8a; }
.sws-st-card { --st-ink: #e8eef7; --st-mute: rgba(232, 238, 247, .65); --st-chip: rgba(255, 255, 255, .08); --st-line: rgba(255, 255, 255, .16); --st-now: rgba(96, 165, 250, .16); --st-now-ink: #dbeafe; }
.sws-st-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--st-ink); }
.sws-st-hint { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: var(--st-mute); }
.sws-st-now { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--st-now); color: var(--st-now-ink); font-size: 13px; }
.sws-st-presets { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.sws-st-chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--st-line); background: var(--st-chip); color: var(--st-ink); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.sws-st-chip:hover { border-color: #34d399; }
.sws-st-chip.is-on { background: rgba(52, 211, 153, .2); border-color: #34d399; }
.sws-st-form { margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.sws-st-icon, .sws-st-input { height: 36px; border-radius: 10px; border: 1px solid var(--st-line); background: var(--st-chip); color: var(--st-ink); font: inherit; font-size: 14px; }
.sws-st-icon { padding: 0 4px; font-size: 16px; }
.sws-st-input { flex: 1; min-width: 0; padding: 0 12px; outline: none; }
.sws-st-input:focus { border-color: #34d399; }
.sws-st-save { height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: #10b981; color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.sws-st-save:hover { background: #059669; }
.sws-st-clear { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--st-mute); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sws-st-clear[hidden] { display: none; }
.sws-st-pop { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 6, 23, .35); }
.sws-st-card { position: relative; width: min(420px, 100%); padding: 18px 18px 14px; border-radius: 18px; color: var(--st-ink); }
.sws-st-x { position: absolute; top: 10px; right: 10px; }

/* Nút 📋 Việc cần làm (todo-ui.mjs): ngay trên nút chat; bảng nổi cạnh cột nút (máy tính) / kéo lên từ dưới (cảm ứng) */
.sw-todo { position: relative; }
.sw-todo-btn { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center; font-size: 23px; line-height: 1;
  cursor: pointer; box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .6); transition: transform .15s; }
.sw-todo-btn:hover, .sw-todo-btn.is-on { transform: scale(1.06); filter: brightness(1.15); }
.sw-touch .sw-todo-btn { width: 44px; height: 44px; font-size: 19px; }
.sw-todo-badge { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #8b5cf6; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px rgba(13, 20, 33, .92); font-variant-numeric: tabular-nums; }
.sw-todo-badge[hidden] { display: none; }
.sw-todo-panel { position: fixed; right: 84px; bottom: 24px; z-index: 30; width: 360px; max-width: calc(100vw - 100px); max-height: min(580px, calc(100vh - 120px)); max-height: min(580px, calc(100dvh - 120px));
  display: flex; flex-direction: column; overflow: hidden; animation: sws-in .2s ease-out; }
.sw-todo-panel[hidden] { display: none; }
.sw-todo-panel.is-sheet { left: 0; right: 0; bottom: 0; width: auto; max-width: none; max-height: 78vh; max-height: 78dvh; z-index: 60; border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.sw-todo-hd { display: flex; align-items: center; gap: 8px; padding: 12px 10px 8px 16px; font-size: 15px; }
.sw-todo-hd b { font-weight: 700; }
.sw-todo-count { margin-left: auto; font-size: 12px; color: rgba(232, 238, 247, .65); font-variant-numeric: tabular-nums; }
.sw-todo-prog { display: flex; align-items: center; gap: 10px; padding: 0 16px 8px; font-size: 12px; font-weight: 700; color: #c4b5fd; font-variant-numeric: tabular-nums; }
.sw-todo-prog[hidden] { display: none; }
.sw-todo-bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.sw-todo-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b5cf6, #6366f1); transition: width .3s; }
.sw-todo-bar i.is-all { background: #22c55e; }
.sw-todo-form { display: flex; gap: 8px; padding: 4px 16px 10px; }
.sw-todo-input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06);
  color: #fff; font-size: 14px; outline: none; }
.sw-todo-input:focus { border-color: #8b5cf6; background: rgba(255, 255, 255, .09); }
.sw-todo-add { flex: none; width: 40px; height: 40px; border: 0; border-radius: 11px; background: #8b5cf6; color: #fff; font-size: 20px; cursor: pointer; }
.sw-todo-add:hover { background: #7c3aed; }
.sw-todo-body { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 12px; overscroll-behavior: contain; }
.sw-todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sw-todo-item { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 10px; }
.sw-todo-item:hover { background: rgba(255, 255, 255, .05); }
.sw-todo-item.is-focus { background: rgba(139, 92, 246, .16); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .45); }
.sw-todo-check { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid rgba(255, 255, 255, .35); background: transparent; color: #fff;
  font-size: 13px; font-weight: 800; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sw-todo-check:hover { border-color: #a78bfa; }
.sw-todo-item.is-done .sw-todo-check { background: #22c55e; border-color: #22c55e; }
.sw-todo-title { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; color: #e8eef7; overflow-wrap: anywhere; }
.sw-todo-item.is-done .sw-todo-title { color: rgba(232, 238, 247, .45); text-decoration: line-through; }
.sw-todo-room { display: block; font-size: 11px; color: rgba(232, 238, 247, .5); text-decoration: none; }
.sw-todo-ic { flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; font-size: 15px; cursor: pointer; opacity: .45; transition: opacity .15s, background .15s; }
.sw-todo-ic:hover, .sw-todo-ic:focus-visible { opacity: 1; background: rgba(255, 255, 255, .08); outline: none; }
.sw-todo-ic.is-on { opacity: 1; background: rgba(139, 92, 246, .3); }
.sw-touch .sw-todo-ic { opacity: .8; width: 36px; height: 36px; }
.sw-todo-donehd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 4px 4px; }
.sw-todo-fold, .sw-todo-clear { border: 0; background: none; padding: 4px 2px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sw-todo-fold { color: rgba(232, 238, 247, .7); }
.sw-todo-clear { color: #fca5a5; }
.sw-todo-fold:hover, .sw-todo-clear:hover { text-decoration: underline; }
.sw-todo-empty { padding: 14px 16px 18px; text-align: center; font-size: 13px; line-height: 1.5; color: rgba(232, 238, 247, .65); }
.sw-todo-empty p { margin: 0 0 4px; }
.sw-todo-login { display: inline-block; margin-top: 8px; padding: 8px 16px; border-radius: 10px; background: #8b5cf6; color: #fff; font-weight: 600; text-decoration: none; }
.sw-todo-cheer { margin: 2px 4px 8px; padding: 8px 10px; border-radius: 10px; background: rgba(34, 197, 94, .14); color: #86efac; font-size: 13px; font-weight: 600; text-align: center; }

/* Kênh Thế giới (tab 🌍 đầu khung chat): chấm báo tin mới trên nút thu nhỏ, nút ⋯ từng tin, menu nhắn riêng / ẩn / báo cáo */
.sws-ava.is-world { background: linear-gradient(135deg, #0ea5e9, #10b981); font-size: 13px; }
.sws-mini.has-dot::after { content: ''; position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%; background: #38bdf8; box-shadow: 0 0 0 2px rgba(13, 20, 33, .92); }
.sws-more { flex: none; align-self: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: #93a4bd; font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s; }
.sws-row:hover .sws-more, .sws-more:focus-visible { opacity: 1; }
.sws-more:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sw-touch .sws-more { opacity: .7; }
@media (hover: none) { .sws-more { opacity: .7; } }
.sws-wmenu { position: absolute; z-index: 5; min-width: 200px; padding: 6px; border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.sws-wmenu-hd { padding: 4px 10px 6px; font-size: 12px; font-weight: 700; color: rgba(232, 238, 247, .65); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sws-wmenu-item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: #e8eef7; font-size: 13.5px; text-align: left; cursor: pointer; }
.sws-wmenu-item:hover, .sws-wmenu-item:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
.sws-wmenu-item.is-danger { color: #fca5a5; }
.sws-unhide { padding: 5px 10px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: transparent; color: #cbd5e1; font-size: 12px; cursor: pointer; }
.sws-unhide:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sws-form input:disabled { opacity: .6; cursor: not-allowed; }

/* Thẻ thông tin người chơi (player-card.mjs) — bố cục như màn đổi nhân vật: phủ cả màn hình (nền tối mờ), nhân vật 3D
   lớn bên trái, thẻ thông tin NỀN TRẮNG chữ tối bên phải cho dễ đọc. Tiền tố swpc- (swp- là của Tiệm Thú Cưng, shop.css). */
.swpc-pop { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; color: #fff; animation: sws-in .2s ease-out;
  background: radial-gradient(90% 80% at 30% 40%, rgba(51, 78, 122, .78), rgba(8, 13, 26, .9)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.swpc-pop * { box-sizing: border-box; }
.swpc-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 32px 8px; }
.swpc-title { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.swpc-sub { font-size: 13px; color: rgba(255, 255, 255, .7); }
.swpc-close { flex: none; padding: 9px 18px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.swpc-close:hover { background: rgba(255, 255, 255, .22); }
.swpc-main { flex: 1; min-height: 0; display: flex; gap: 24px; padding: 4px 32px 28px; }
.swpc-stage { position: relative; flex: 55; min-width: 0; min-height: 0; cursor: grab; touch-action: none; }
.swpc-stage:active { cursor: grabbing; }
.swpc-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.swpc-stage-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; color: rgba(255, 255, 255, .75); pointer-events: none; }
.swpc-card { flex: 45; max-width: 540px; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 24px; background: #fff; color: #0f172a;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6); }
.swpc-loading { margin: auto; padding: 24px; font-size: 14px; color: #64748b; text-align: center; }
.swpc-banner { flex: none; height: 118px; background: linear-gradient(135deg, #34d399, #22d3ee 55%, #818cf8) center / cover no-repeat; }
.swpc-head { flex: none; display: flex; align-items: flex-end; gap: 14px; padding: 0 22px; margin-top: -40px; }
.swpc-ava { position: relative; flex: none; width: 88px; height: 88px; }
.swpc-ava > img:first-child, .swpc-ava > span { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 4px solid #fff; background: #e2e8f0;
  display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; color: #334155; box-shadow: 0 6px 16px -6px rgba(15, 23, 42, .35); }
.swpc-ava .swpc-eff { position: absolute; max-width: none; pointer-events: none; object-fit: contain; }
.swpc-names { min-width: 0; padding-bottom: 2px; }
.swpc-names h2 { margin: 0; font-size: 21px; font-weight: 800; color: #0f172a; overflow-wrap: anywhere; line-height: 1.25; }
.swpc-names h2 small { font-size: 13px; font-weight: 600; color: #059669; }
.swpc-names p { margin: 2px 0 0; font-size: 13px; color: #475569; }
.swpc-names .swpc-joined { font-size: 12px; color: #94a3b8; }
.swpc-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 22px 12px; overscroll-behavior: contain; }
.swpc-body section { margin-top: 16px; }
.swpc-body h3 { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #059669; }
.swpc-body p { margin: 0; font-size: 14.5px; line-height: 1.6; color: #1e293b; white-space: pre-line; overflow-wrap: anywhere; }
.swpc-body p.is-empty { color: #94a3b8; font-style: italic; }
.swpc-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.swpc-facts span { padding: 5px 11px; border-radius: 999px; background: #f1f5f9; font-size: 13px; color: #334155; }
.swpc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.swpc-stats div { padding: 10px 12px; border-radius: 14px; background: #f8fafc; box-shadow: inset 0 0 0 1px #e2e8f0; }
.swpc-stats b { display: block; font-size: 16px; color: #0f172a; font-variant-numeric: tabular-nums; }
.swpc-stats span { font-size: 12.5px; color: #64748b; }
.swpc-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.swpc-tabs button { padding: 6px 12px; border: 0; border-radius: 999px; background: #f1f5f9; color: #334155; font-size: 13px; font-weight: 600; cursor: pointer; }
.swpc-tabs button small { color: #94a3b8; }
.swpc-tabs button.is-on { background: #10b981; color: #fff; }
.swpc-tabs button.is-on small { color: rgba(255, 255, 255, .8); }
.swpc-tabs button:disabled { opacity: .45; cursor: default; }
.swpc-gifts { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.swpc-gift { position: relative; margin: 0; padding: 10px 6px 8px; border-radius: 14px; background: #f8fafc; border: 1px solid #e2e8f0; text-align: center; }
.swpc-gift img, .swpc-gift > span { display: block; width: 100%; height: 60px; object-fit: contain; font-size: 30px; line-height: 60px; }
.swpc-gift figcaption { margin-top: 4px; font-size: 12px; line-height: 1.3; color: #334155; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.swpc-gift.r-rare { border-color: #7dd3fc; background: #f0f9ff; }
.swpc-gift.r-epic { border-color: #c4b5fd; background: #f5f3ff; }
.swpc-gift.is-active { box-shadow: 0 0 0 2px #10b981; }
.swpc-gift em { position: absolute; top: 5px; left: 5px; padding: 1px 7px; border-radius: 999px; background: #10b981; color: #fff; font-size: 10px; font-weight: 700; font-style: normal; }
.swpc-actions { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px 18px; border-top: 1px solid #f1f5f9; }
.swpc-btn { flex: 1; min-width: 140px; height: 44px; border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; color: #0f172a; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.swpc-btn:hover { background: #f8fafc; }
.swpc-btn.is-main { border: 0; background: linear-gradient(90deg, #34d399, #2dd4bf); color: #022c22; box-shadow: 0 8px 20px -8px rgba(16, 185, 129, .6); }
.swpc-btn.is-main:hover { filter: brightness(1.06); }
@media (max-width: 760px) {
  .swpc-top { padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 4px; }
  .swpc-title { font-size: 18px; }
  .swpc-sub { display: none; }
  .swpc-close { padding: 7px 14px; font-size: 13px; }
  .swpc-main { flex-direction: column; gap: 8px; padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .swpc-stage { flex: none; height: 32vh; height: 32dvh; }
  .swpc-card { flex: 1; max-width: none; border-radius: 20px; }
  .swpc-banner { height: 76px; }
  .swpc-head { margin-top: -32px; padding: 0 16px; }
  .swpc-ava { width: 70px; height: 70px; }
  .swpc-names h2 { font-size: 18px; }
  .swpc-body { padding: 6px 16px 10px; }
  .swpc-actions { padding: 10px 16px 12px; }
  .swpc-btn { min-width: 0; height: 42px; }
}

/* Ảnh đại diện có khung hiệu ứng + thú cưng 2D cạnh bên (player-looks.mjs) — dùng ở bảng xếp hạng, bản đồ, khung chat,
   kênh Thế giới. Lớp kích thước của từng chỗ (sws-ava, swm-ava, swr-ava…) đi kèm; chưa có ảnh thì chữ cái đầu. */
.swl-ava { position: relative; overflow: visible !important; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; }
.swl-ava .swl-photo { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #1e293b; }
.swl-ava .swl-eff { position: absolute; max-width: none; object-fit: contain; pointer-events: none; z-index: 1; }
.swl-ava .swl-pet { position: absolute; right: -58%; bottom: -14%; width: 72%; height: 72%; object-fit: contain; pointer-events: none; z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.swl-ava.has-pet { margin-right: 13px; }
.swl-ava.swr-ava { color: #fff; font-weight: 700; font-size: 13px; background: linear-gradient(135deg, hsl(var(--h, 160) 65% 50%), hsl(calc(var(--h, 160) + 35) 65% 36%)); }
.swl-ava.has-eff { margin: 3px; }
.swl-ava.has-eff.has-pet { margin: 3px 16px 3px 3px; }
/* thẻ thông tin: thú cưng 2D cạnh ảnh, nút / form sửa hồ sơ (chính chủ) */
.swpc-ava .swpc-pet { position: absolute; right: -34px; bottom: -6px; width: 52px; height: 52px; object-fit: contain; pointer-events: none; z-index: 2; filter: drop-shadow(0 3px 3px rgba(15, 23, 42, .3)); }
.swpc-head:has(.swpc-pet) .swpc-names { margin-left: 28px; }
.swpc-edit { margin-top: 4px; padding: 4px 10px; border: 1px solid #a7f3d0; border-radius: 999px; background: #ecfdf5; color: #047857; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.swpc-edit:hover { background: #d1fae5; }
.swpc-form { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.swpc-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.swpc-field > span { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #059669; }
.swpc-field > span em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: #94a3b8; }
.swpc-field input, .swpc-field select, .swpc-field textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; color: #0f172a;
  font: inherit; font-size: 14.5px; outline: none; user-select: text; -webkit-user-select: text; }
.swpc-field textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.swpc-field input:focus, .swpc-field select:focus, .swpc-field textarea:focus { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.swpc-field small { align-self: flex-end; font-size: 11.5px; color: #94a3b8; }
.swpc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.swpc-err { margin: 0; padding: 8px 12px; border-radius: 10px; background: #fef2f2; color: #b91c1c; font-size: 13px; }
@media (max-width: 480px) { .swpc-row2 { grid-template-columns: 1fr; } }

/* Hồ sơ & cài đặt (#sw-settings): như thẻ Xem thông tin — nền tối mờ, nhân vật 3D của mình bên trái, thẻ trắng bên phải
   có hàng tab (🪪 Hồ sơ → 👤 Nhân vật → cài đặt). Màn hẹp: nhân vật ở trên (chỉ tab Hồ sơ / Nhân vật), thẻ ở dưới. */
.sws-hub:not(.hidden) { display: flex; flex-direction: column; color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; animation: sws-in .2s ease-out; }
.sws-hub-bg { position: absolute; inset: 0; background: radial-gradient(90% 80% at 30% 40%, rgba(51, 78, 122, .8), rgba(8, 13, 26, .92));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sws-hub-top { position: relative; z-index: 1; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 32px 8px; }
.sws-hub-title { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.sws-hub-sub { font-size: 13px; color: rgba(255, 255, 255, .7); }
.sws-hub-main { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; gap: 24px; padding: 4px 32px 28px; }
.sws-hub-stage { flex: 42; }
.sws-hub-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 4px 12px; border-radius: 999px; background: rgba(0, 0, 0, .3); font-size: 12px;
  color: rgba(255, 255, 255, .8); pointer-events: none; }
.sws-hub.no-profile .sws-hub-stage { display: none; }
.sws-hub-card { flex: 58; max-width: 640px; min-width: 0; min-height: 0; margin-left: auto; display: flex; flex-direction: column; overflow: hidden; border-radius: 24px;
  background: #fff; color: #0f172a; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6); }
.sws-hub.no-profile .sws-hub-card { margin: 0 auto; }
.sws-hub-tabs { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 10px; border-bottom: 1px solid #f1f5f9; }
.sws-hub-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 999px; background: #f1f5f9; color: #334155;
  font-size: 13.5px; font-weight: 650; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.sws-hub-tab:hover { background: #e2e8f0; color: #0f172a; }
.sws-hub-tab[aria-selected="true"] { background: #10b981; color: #fff; box-shadow: 0 6px 14px -6px rgba(16, 185, 129, .7); }
.sws-hub-tab[hidden] { display: none; }
.sws-hub-tab:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }
.sws-hub-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; overscroll-behavior: contain; }
/* tab Hồ sơ: thẻ thông tin của mình sát mép (như popup), nút dưới cùng dính đáy khung cuộn */
.sws-hub[data-tab="profile"] .sws-hub-body { padding: 0; }
.swpc-inline { display: flex; flex-direction: column; min-height: 100%; }
.swpc-inline .swpc-body { flex: none; overflow: visible; }
.swpc-inline .swpc-actions { position: sticky; bottom: 0; z-index: 2; margin-top: auto; background: #fff; }
.swpc-inline .swpc-loading { padding: 48px 24px; }

/* nút Hồ sơ & cài đặt = ảnh đại diện của mình (khung hiệu ứng + thú 2D bên trái — nút sát mép phải) + bánh răng nhỏ */
#sw-settings-btn.is-me { position: relative; width: auto; height: auto; padding: 0; border-radius: 50%; background: transparent; box-shadow: none; }
#sw-settings-btn.is-me:hover .sw-me-ava { transform: scale(1.06); }
.sw-me-ava { width: 40px; height: 40px; color: #fff; font-weight: 800; font-size: 16px; transition: transform .15s;
  background: linear-gradient(135deg, hsl(var(--h, 160) 65% 50%), hsl(calc(var(--h, 160) + 35) 65% 36%)); box-shadow: 0 0 0 2px #fff, 0 6px 14px -4px rgba(0, 0, 0, .45); }
.swl-ava.sw-me-ava .swl-pet { right: auto; left: -60%; }
.swl-ava.sw-me-ava.has-pet { margin-right: 0; margin-left: 14px; }
.swl-ava.sw-me-ava.has-eff.has-pet { margin: 3px 3px 3px 17px; }
.sw-me-gear { position: absolute; right: -5px; bottom: -5px; z-index: 3; width: 19px; height: 19px; border-radius: 50%; background: #fff; color: #334155;
  display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); pointer-events: none; }

@media (max-width: 760px) {
  .sws-hub-top { padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 4px; }
  .sws-hub-title { font-size: 18px; }
  .sws-hub-sub { display: none; }
  .sws-hub-main { flex-direction: column; gap: 8px; padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .sws-hub-stage { flex: none; height: 28vh; height: 28dvh; }
  .sws-hub[data-tab]:not([data-tab="profile"]):not([data-tab="avatar"]) .sws-hub-stage { display: none; }
  .sws-hub-card { flex: 1; max-width: none; margin: 0; border-radius: 20px; }
  .sws-hub-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 10px 10px 8px; }
  .sws-hub-tabs::-webkit-scrollbar { display: none; }
  .sws-hub-tab { padding: 7px 12px; font-size: 13px; }
  .sws-hub-body { padding: 16px; }
  .sw-me-ava { width: 34px; height: 34px; font-size: 14px; }
}
/* Tin nhắn chờ (người lạ chào lần đầu), kiểu Facebook: thanh trên chỗ ô nhập (thay ô nhập) — Chặn / Bỏ qua / Đồng ý */
.sws-reqbar { padding: 10px 2px 2px; color: #e8eef7; }
.sws-reqbar-t { font-size: 12.5px; line-height: 1.45; color: #a8b6c8; text-align: center; }
.sws-reqbar-t b { color: #e8eef7; }
.sws-reqbar-b { margin-top: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sws-ft.is-request .sws-form, .sws-ft.is-request .sws-hint { display: none; }
.sws-req-btn { min-height: 36px; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; background: rgba(255, 255, 255, .04); color: #e8eef7; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.sws-req-btn:hover, .sws-req-btn:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
.sws-req-btn.is-main { border-color: transparent; background: #2563eb; color: #fff; }
.sws-req-btn.is-main:hover { background: #1d4ed8; }
.sws-req-btn.is-danger { color: #fca5a5; border-color: rgba(252, 165, 165, .35); }
.sws-note { align-self: center; max-width: 92%; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: #a8b6c8; font-size: 12px; text-align: center; }
