/* =========================================================
   游戏大厅 2026-10-27
   好友收进「好友」按钮 → 侧滑面板（列表 / 聊天二合一）
   ========================================================= */

:root {
  --bg: #eef1f8;
  --ink: #14161f;
  --ink-2: #4a5064;
  --muted: #8b91a5;
  --line: rgba(20, 22, 31, 0.08);
  --line-strong: rgba(20, 22, 31, 0.14);
  --surface: #fff;
  --surface-2: #f6f7fb;
  --surface-3: #eef1f8;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-soft: rgba(79, 70, 229, 0.1);
  --a: #0ea472;
  --a-soft: rgba(14, 164, 114, 0.12);
  --danger: #e0483c;
  --radius: 20px;
  --shadow: 0 24px 50px -30px rgba(24, 30, 62, 0.35);
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(20, 22, 31, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-orbs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}
.bg-orbs span:nth-child(1) {
  width: 480px;
  height: 480px;
  top: -180px;
  left: -120px;
  background: radial-gradient(circle, #b9b6ff, transparent 70%);
}
.bg-orbs span:nth-child(2) {
  width: 420px;
  height: 420px;
  top: 40px;
  right: -140px;
  background: radial-gradient(circle, #a9e6dc, transparent 70%);
}
.bg-orbs span:nth-child(3) {
  width: 520px;
  height: 520px;
  bottom: -260px;
  left: 40%;
  background: radial-gradient(circle, #ffd9c2, transparent 70%);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 26px calc(40px + var(--safe-b));
}

/* ---------------- 顶部渐变卡 ---------------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 20px 22px;
  background: linear-gradient(135deg, #4f46e5 0%, #6d3fe0 45%, #8b3fd1 100%);
  box-shadow: 0 26px 50px -28px rgba(79, 70, 229, 0.9);
  margin-bottom: 18px;
}
.hero::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  right: -90px;
  top: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.32), transparent 65%);
  pointer-events: none;
}

.hero-head {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.logo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 21px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.brand-text h1 {
  margin: 0;
  font-size: 18px;
  color: #fff;
  letter-spacing: 0.3px;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.72);
}

.hero-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  font: 600 12px var(--mono);
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
}
.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7df0bb;
  box-shadow: 0 0 0 3px rgba(125, 240, 187, 0.22);
}

.friend-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: 600 12.5px var(--font);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}
.friend-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}
.friend-btn .fb-icon {
  font-size: 13px;
}
.fb-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ff4d4f;
  color: #fff;
  font: 600 10px/17px var(--mono);
  text-align: center;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.55);
}
.fb-badge.hidden {
  display: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}
.icon-btn.is-off {
  opacity: 0.5;
}

.me {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.me-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #4f46e5;
  background: #fff;
}
.me-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.me-nick {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  font: 600 15px var(--font);
  padding: 0;
  outline: none;
  border-bottom: 1px dashed transparent;
  min-width: 0;
}
.me-nick:focus {
  border-bottom-color: rgba(255, 255, 255, 0.55);
}
.me-code {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 6px;
}
.me-code b {
  font-family: var(--mono);
  letter-spacing: 1.2px;
  color: #fff;
  font-size: 11.5px;
}
.me-copy {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  background: #fff;
  color: var(--primary);
  font: 600 12.5px var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.me-copy:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.6);
}
.me-copy:active {
  transform: scale(0.97);
}

/* ---------------- 内容区 ---------------- */

.layout {
  display: block;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head.mt {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--line-strong);
}
.panel-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.2px;
}
.panel-head .sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.count-badge {
  flex: 0 0 auto;
  font: 600 11px/1 var(--mono);
  color: var(--ink-2);
  background: var(--surface-3);
  padding: 6px 10px;
  border-radius: 999px;
}

/* ---------------- 游戏卡片 ---------------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease,
    border-color 0.2s ease;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: 0 26px 44px -30px rgba(79, 70, 229, 0.95);
}
.game-card:active {
  transform: translateY(-1px) scale(0.995);
}

.gc-cover {
  position: relative;
  height: 118px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--c1, #6366f1), var(--c2, #8b5cf6));
  overflow: hidden;
}
.gc-cover::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -50px;
  bottom: -90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.gc-emoji {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18));
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.game-card:hover .gc-emoji {
  transform: scale(1.08) rotate(-3deg);
}
.gc-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 7px;
  font: 600 10px/1.4 var(--font);
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
}

.gc-body {
  padding: 13px 15px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.gc-body h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.gc-body p {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
}
.gc-play {
  margin-top: auto;
  padding-top: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gc-play::after {
  content: "→";
  transition: transform 0.18s ease;
}
.game-card:hover .gc-play::after {
  transform: translateX(3px);
}

.game-card.is-soon {
  background: var(--surface-2);
  border-style: dashed;
  cursor: default;
}
.game-card.is-soon:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}
.game-card.is-soon .gc-cover {
  background: linear-gradient(135deg, #e7e9f2, #eff1f8);
}
.game-card.is-soon .gc-emoji {
  opacity: 0.65;
  font-size: 38px;
}
.game-card.is-soon:hover .gc-emoji {
  transform: none;
}
.game-card.is-soon .gc-play {
  color: var(--muted);
  font-weight: 500;
}
.game-card.is-soon .gc-play::after {
  content: "";
}

/* ---------------- 其他项目 ---------------- */

.mini-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mini-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink-2);
  font-size: 12.5px;
  transition: all 0.16s ease;
}
.mini-link:hover {
  background: #fff;
  color: var(--primary);
  border-color: rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.hub-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------- 好友面板 ---------------- */

.friend-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 18, 28, 0.36);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.sheet-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 388px;
  max-width: 92vw;
  background: var(--surface);
  box-shadow: -30px 0 60px -40px rgba(16, 18, 28, 0.7);
  border-left: 1px solid rgba(255, 255, 255, 0.8);
  transform: translateX(102%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.friend-sheet.open {
  pointer-events: auto;
}
.friend-sheet.open .sheet-backdrop {
  opacity: 1;
}
.friend-sheet.open .sheet-panel {
  transform: none;
}

.fs-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.friend-sheet.mode-list #fsListView {
  display: flex;
}
.friend-sheet.mode-chat #fsChatView {
  display: flex;
}

.fs-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  border-bottom: 1px solid var(--line);
}
.fs-head h2 {
  margin: 0;
  font-size: 16px;
}
.fs-count {
  font: 600 11px/1 var(--mono);
  color: var(--ink-2);
  background: var(--surface-3);
  padding: 5px 9px;
  border-radius: 999px;
}
.fs-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.fs-close:hover {
  background: var(--surface-3);
}

.add-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}
.add-row input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-2);
  padding: 0 13px;
  font: 700 13.5px var(--mono);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.add-row input::placeholder {
  font: 400 12.5px var(--font);
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.add-row input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.btn-add {
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  padding: 0 17px;
  font: 600 13px var(--font);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  cursor: pointer;
  white-space: nowrap;
}
.btn-add:active {
  transform: scale(0.97);
}

.friend-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px calc(14px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.friend-list:empty {
  flex: 0 0 auto;
}
.friend-list::-webkit-scrollbar {
  width: 6px;
}
.friend-list::-webkit-scrollbar-thumb {
  background: rgba(20, 22, 31, 0.14);
  border-radius: 99px;
}

.friend {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.friend:hover {
  background: var(--surface-2);
  border-color: var(--line);
}
.f-avatar {
  position: relative;
  flex: 0 0 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}
.f-avatar i {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #c7ccda;
  border: 2px solid #fff;
}
.f-avatar i.on {
  background: var(--a);
}
.f-main {
  min-width: 0;
  flex: 1;
}
.f-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.f-top b {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.f-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.f-unread {
  flex: 0 0 auto;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font: 600 10.5px/19px var(--mono);
  text-align: center;
}

.friend-empty {
  padding: 6px 24px 30px;
  text-align: center;
  color: var(--muted);
}
.friend-empty.hidden {
  display: none;
}
.fe-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.friend-empty p {
  margin: 0 0 5px;
  font-size: 13px;
  color: var(--ink-2);
}
.friend-empty span {
  font-size: 11.5px;
  line-height: 1.7;
  display: block;
}
.friend-empty b {
  font-family: var(--mono);
  color: var(--ink-2);
  letter-spacing: 1px;
}

/* ---------------- 聊天视图 ---------------- */

.chat-head {
  gap: 10px;
}
.fs-back {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}
.fs-back:hover {
  background: var(--surface-3);
}
.chat-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.chat-title b {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-title span {
  font-size: 10.5px;
  color: var(--muted);
}
.chat-title span.on {
  color: var(--a);
}
.chat-invite {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  font: 600 12px var(--font);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  cursor: pointer;
  white-space: nowrap;
}
.chat-invite:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: #fbfbfe;
}
.chat-body::-webkit-scrollbar {
  width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
  background: rgba(20, 22, 31, 0.12);
  border-radius: 99px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 80%;
}
/* 只有新到的消息播放入场动画，避免整段重渲染时整个列表抖动 */
.msg.is-new {
  animation: msgIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.msg .bubble {
  padding: 9px 13px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg.them {
  align-self: flex-start;
}
.msg.them .bubble {
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.msg.mine {
  align-self: flex-end;
  align-items: flex-end;
}
.msg.mine .bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg .meta {
  font-size: 10px;
  color: var(--muted);
  padding: 0 4px;
}
.msg.sys {
  align-self: center;
  max-width: 92%;
  text-align: center;
}
.msg.sys .bubble {
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  color: var(--ink-2);
  font-size: 11.5px;
  border-radius: 10px;
}
.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: #fff;
}
.chat-input input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-2);
  padding: 0 13px;
  font: 400 13.5px var(--font);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.chat-input input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.chat-input button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  padding: 0 17px;
  font: 600 13px var(--font);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  cursor: pointer;
}
.chat-input button:active {
  transform: scale(0.97);
}

/* ---------------- 邀请横幅 ---------------- */

.invite-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -18px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(79, 70, 229, 0.3);
  box-shadow: 0 24px 50px -24px rgba(79, 70, 229, 0.6);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: all 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: calc(100vw - 24px);
}
.invite-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.ib-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  flex: 0 0 auto;
}
.ib-text {
  font-size: 13px;
  line-height: 1.5;
  min-width: 0;
}
.ib-text small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.ib-text small span {
  font-family: var(--mono);
  letter-spacing: 1px;
  color: var(--ink-2);
}
.ib-actions {
  display: flex;
  gap: 8px;
  margin-left: 6px;
}
.ib-accept {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font: 600 12.5px var(--font);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  cursor: pointer;
  white-space: nowrap;
}
.ib-ignore {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font: 500 12.5px var(--font);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

/* ---------------- toast ---------------- */

.toast-stack {
  position: fixed;
  bottom: calc(24px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 17px;
  border-radius: 999px;
  background: rgba(20, 22, 31, 0.9);
  color: #fff;
  font-size: 12.5px;
  animation: toastIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 90vw;
  text-align: center;
}
.toast.error {
  background: rgba(190, 48, 38, 0.95);
}
.toast.out {
  animation: toastOut 0.22s ease forwards;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

.hidden {
  display: none !important;
}

/* ---------------- 在线好友条 ---------------- */

.online-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  box-shadow: 0 18px 34px -30px rgba(24, 30, 62, 0.6);
  backdrop-filter: blur(10px);
}
.os-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding-right: 14px;
  border-right: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
}
.os-head b {
  font-weight: 650;
  color: var(--ink);
}
.os-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 0 3px var(--a-soft);
}
.os-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--a-soft);
  color: #0b7a55;
  font: 650 11px/18px var(--mono);
  text-align: center;
}
.os-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}
.os-list::-webkit-scrollbar {
  display: none;
}
.of-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 5px 6px 5px 5px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: var(--surface-2);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.of-chip:hover {
  background: #fff;
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.of-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font: 700 13px var(--font);
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}
.of-avatar i {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c7ccda;
  border: 2px solid #fff;
}
.of-avatar i.on {
  background: var(--a);
}
.of-avatar i.busy {
  background: #f0a91b;
}
.of-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 118px;
}
.of-main b {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.of-main em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.of-main em.busy {
  color: #b06f00;
}
.of-invite {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 0;
  background: var(--primary-soft);
  color: var(--primary);
  font: 700 13px/1 var(--font);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.of-invite:hover {
  background: var(--primary);
  color: #fff;
}

/* ---------------- 好友状态标签 ---------------- */

.f-top .f-state {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.f-top .f-state.on {
  color: #0b7a55;
  background: var(--a-soft);
}
.f-top .f-state.busy {
  color: #b06f00;
  background: rgba(240, 169, 27, 0.14);
}
.f-avatar i.busy {
  background: #f0a91b;
}
.chat-title span.busy {
  color: #b06f00;
}
.msg .meta .acked {
  color: var(--primary);
  font-weight: 600;
}

/* 大表情：整条消息只有表情时放大显示 */
.msg .bubble.big {
  background: transparent;
  border: 0;
  padding: 0 2px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 1px;
}

/* ---------------- 表情面板 ---------------- */

.emoji-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0 !important;
  border-radius: 12px !important;
  border: 1.5px solid var(--line-strong) !important;
  background: var(--surface-2) !important;
  color: var(--ink) !important;
  font-size: 19px !important;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.emoji-btn:hover,
.emoji-btn.is-on {
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
}
.emoji-panel {
  position: relative;
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 0;
  overflow-y: auto;
  padding: 0 10px;
  border-top: 1px solid transparent;
  background: #fff;
}
.emoji-panel.show {
  display: grid;
  max-height: 178px;
  padding: 10px;
  border-top-color: var(--line);
}
.emoji-cell {
  display: grid;
  place-items: center;
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.emoji-cell:hover {
  background: var(--primary-soft);
  transform: scale(1.12);
}
.emoji-cell:active {
  transform: scale(0.94);
}

/* ---------------- 选游戏邀请 ---------------- */

.game-picker {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.game-picker.show {
  display: flex;
  pointer-events: auto;
}
.gp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 18, 28, 0.42);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
}
.gp-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 84vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 40px 80px -40px rgba(16, 18, 28, 0.85);
  animation: gpIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes gpIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
}
.gp-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.gp-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.2px;
}
.gp-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.gp-head p b {
  color: var(--ink);
}
.gp-off {
  color: #b06f00;
}
.gp-head .fs-close {
  margin-left: auto;
}
.gp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gp-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.gp-item:hover:not(:disabled) {
  background: #fff;
  border-color: rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}
.gp-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.gp-emoji {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 10px 18px -12px var(--c1);
}
.gp-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gp-body b {
  font-size: 13.5px;
}
.gp-body em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gp-go {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
}
.gp-none {
  margin: 0;
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.gp-foot {
  margin-top: 12px;
}
.gp-cancel {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 600 12.5px/1 var(--font);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.gp-cancel:hover {
  background: #fff;
  color: var(--ink);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
  .app {
    padding: 12px 14px calc(28px + var(--safe-b));
  }
  .hero {
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 12px;
  }
  .panel {
    padding: 16px;
    border-radius: 18px;
  }
  .gc-cover {
    height: 104px;
  }
}

@media (max-width: 640px) {
  .brand-text p {
    display: none;
  }
  .logo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    font-size: 19px;
  }
  .brand-text h1 {
    font-size: 16.5px;
  }
  .pill {
    height: 30px;
    padding: 0 9px;
  }
  .friend-btn {
    height: 32px;
    padding: 0 10px;
  }
  .friend-btn .fb-text {
    display: none;
  }
  .me {
    padding: 9px 10px;
    gap: 10px;
  }
  .game-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .game-card {
    flex-direction: row;
    align-items: stretch;
  }
  .gc-cover {
    width: 96px;
    height: auto;
    flex: 0 0 96px;
  }
  .gc-emoji {
    font-size: 34px;
  }
  .gc-tag {
    top: 8px;
    left: 8px;
    font-size: 9px;
    padding: 2px 6px;
  }
  .gc-body {
    padding: 12px 14px;
  }
  .gc-play {
    padding-top: 6px;
  }

  /* 好友面板全屏 */
  .sheet-panel {
    width: 100%;
    max-width: none;
    border-left: 0;
  }
  .friend-sheet .sheet-backdrop {
    display: none;
  }
  body.sheet-open {
    overflow: hidden;
  }
  .invite-banner {
    top: auto;
    bottom: calc(14px + var(--safe-b));
    left: 12px;
    right: 12px;
    transform: translateY(16px);
    max-width: none;
    flex-wrap: wrap;
  }
  .invite-banner.show {
    transform: none;
  }
  .ib-text {
    flex: 1;
    min-width: 120px;
  }
  .ib-actions {
    width: 100%;
  }
  .ib-accept,
  .ib-ignore {
    flex: 1;
    padding: 11px 12px;
  }
  .toast-stack {
    bottom: calc(84px + var(--safe-b));
  }

  /* 在线好友条：纵向两行，横向滚动 */
  .online-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    padding: 11px 12px;
    border-radius: 16px;
  }
  .os-head {
    border-right: 0;
    padding-right: 0;
  }
  .of-main {
    max-width: 96px;
  }
  .of-invite {
    width: 26px;
    height: 26px;
  }

  /* 表情面板铺满 */
  .emoji-panel {
    grid-template-columns: repeat(7, 1fr);
  }
  .emoji-panel.show {
    max-height: 182px;
    padding: 8px;
  }
  .emoji-cell {
    height: 40px;
    font-size: 21px;
  }
  .msg .bubble.big {
    font-size: 30px;
  }

  /* 选游戏：底部弹层 */
  .game-picker {
    align-items: flex-end;
    padding: 0;
  }
  .gp-card {
    max-width: none;
    max-height: 80vh;
    border-radius: 22px 22px 0 0;
    padding: 18px 16px calc(20px + var(--safe-b));
  }
  .gp-item {
    padding: 12px;
  }
}

@media (max-width: 360px) {
  .pill {
    display: none;
  }
}


/* ---------------- file:// 提示 ---------------- */
.file-warn {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 14px 0 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.6;
  box-shadow: 0 16px 30px -22px rgba(79, 70, 229, 0.9);
}
.file-warn b {
  font-weight: 700;
}
.file-warn span {
  color: rgba(255, 255, 255, 0.9);
}
.file-warn code {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
}
.file-warn.hidden {
  display: none;
}
