/* PC 客户端外壳：把整站装进一个固定窗口里，外面是桌面背景。 */

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(1200px 620px at 22% 12%, #2b3a5c 0%, transparent 62%),
    radial-gradient(900px 560px at 82% 88%, #1f3350 0%, transparent 60%),
    linear-gradient(150deg, #16202f 0%, #1b2a40 46%, #101826 100%);
}

.app-shell {
  width: min(1180px, calc(100vw - 40px));
  height: min(720px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: #f6f8fc;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .07),
    0 28px 80px rgba(4, 10, 20, .55),
    0 2px 10px rgba(4, 10, 20, .3);
}

/* ---- 标题栏 ---- */
.shell-titlebar {
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
  background: linear-gradient(180deg, #232f45, #1c2638);
  color: #cdd8ea;
  user-select: none;
}
.shell-logo {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: #dbe6f7; letter-spacing: .04em;
}
.shell-logo svg { width: 15px; height: 15px; flex: 0 0 15px; color: #6fc6f2; }
.shell-title {
  flex: 1 1 auto; min-width: 0;
  font-size: 12px; color: rgba(205, 216, 234, .6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.shell-win-ctrl { display: flex; align-items: center; gap: 2px; }
.shell-win-ctrl button {
  width: 34px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 5px;
  background: transparent; color: #b6c3d8;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.shell-win-ctrl button svg { width: 12px; height: 12px; flex: 0 0 12px; }
.shell-win-ctrl button:hover { background: rgba(255, 255, 255, .1); color: #eaf1fb; }
.shell-win-ctrl .win-close:hover { background: #c8402f; color: #fff; }

/* ---- 内容区 ---- */
.shell-body {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: #f4f7fc;
}
.shell-body > .screen {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 外壳内不再有整页滚动 */
html, body { height: 100%; }

/* 最大化：铺满视口 */
.app-shell.maximized {
  width: 100vw; height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

/* 最小化：收起成一个任务条小块，点一下回来 */
body.shell-min .app-shell {
  height: 38px;
  width: min(420px, calc(100vw - 40px));
  cursor: pointer;
}
body.shell-min .shell-body { display: none; }
body.shell-min .shell-win-ctrl { pointer-events: auto; }

/* 关闭：显示遮罩，可重新打开 */
.shell-closed-mask {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 16, 26, .82);
  backdrop-filter: blur(6px);
}
.shell-closed-mask .reopen {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: #cbd8ea; font-size: 13.5px;
}
.shell-closed-mask button {
  padding: 10px 26px; border: 0; border-radius: 10px;
  background: #3d6cf0; color: #fff; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(61, 108, 240, .35);
}
.shell-closed-mask button:hover { background: #2f5ada; }

@media (max-width: 900px) {
  .app-shell { width: 100vw; height: 100vh; border-radius: 0; box-shadow: none; }
  .shell-title { display: none; }
}

/* ===== 登录：PC 客户端左右分栏 ===== */
.screen-auth {
  display: block;
  padding: 0;
  background: #fff;
}

/* 关键：.hidden 必须能压过上面的 display，否则登录后大厅被登录页盖住 */
.screen-auth.hidden,
.screen-auth.hidden * {
  display: none !important;
}
.auth-split {
  display: grid;
  /* 右栏不再写死 452px：宽屏给 32%，下限 380、上限 460，
     这样左品牌区始终占 2/3 左右，不会一边空一边挤 */
  grid-template-columns: 1fr clamp(380px, 32%, 460px);
  height: 100%;
  min-height: 0;
}

/* 左：品牌区 */
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 0 56px;
  background:
    radial-gradient(680px 420px at 18% 22%, rgba(107, 154, 255, .34), transparent 66%),
    radial-gradient(520px 380px at 82% 84%, rgba(58, 208, 196, .22), transparent 62%),
    linear-gradient(150deg, #1e2b45 0%, #243557 52%, #1a2440 100%);
  color: #eaf1fb;
  overflow: hidden;
}
.auth-brand::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 22% 68%, rgba(255,255,255,.06) 0 1px, transparent 1px),
    radial-gradient(circle at 76% 32%, rgba(255,255,255,.05) 0 1px, transparent 1px);
  background-size: 62px 62px, 78px 78px;
  pointer-events: none;
}
.brand-mark {
  width: 62px; height: 62px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(255,255,255,.16), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 14px 34px rgba(6, 14, 28, .35);
  position: relative; z-index: 1;
}
.brand-mark svg { width: 40px; height: 40px; }
.brand-name {
  margin: 4px 0 0;
  font-size: 34px; font-weight: 800; letter-spacing: .1em;
  color: #fff; position: relative; z-index: 1;
}
.brand-slogan {
  margin: 0; font-size: 13.5px; letter-spacing: .04em;
  color: rgba(214, 227, 247, .72);
  position: relative; z-index: 1;
}
.brand-points {
  margin: 18px 0 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 11px;
  position: relative; z-index: 1;
}
.brand-points li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: rgba(222, 233, 248, .82);
}
.brand-points i {
  width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%;
  background: #3ad0c4; box-shadow: 0 0 0 3px rgba(58, 208, 196, .18);
}
.brand-foot {
  position: absolute; left: 56px; bottom: 24px;
  margin: 0; font-size: 11.5px; letter-spacing: .06em;
  color: rgba(190, 206, 230, .42); z-index: 1;
}

/* 右：表单区 */
.auth-pane {
  position: relative;
  display: flex; flex-direction: column;
  justify-content: center;
  /* 右侧不再是死白：浅冷色渐变 + 一点柔光，和左边深色品牌区衔接上，
     上下留白就不会显得空 */
  background:
    radial-gradient(520px 340px at 78% 12%, rgba(59,110,240,.07), transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #f7f9fe 55%, #eef2fb 100%);
  padding: 26px 40px 30px;
  overflow-y: auto;
}
/* 给登录块一个视觉承载：靠 content 的宽度收窄一点，避免横向拉太开 */
.auth-pane > * { max-width: 372px; width: 100%; margin-left: auto; margin-right: auto; }
.auth-pane-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 18px;
}
.auth-pane-head > b {
  flex: 1 1 auto;
  font-size: 17px; font-weight: 700; color: #1d2637; letter-spacing: .02em;
}
.auth-pane .auth-icon {
  position: static;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(30, 42, 68, .1);
  border-radius: 9px;
  background: rgba(30, 42, 68, .03);
  color: #6b788f; cursor: pointer;
}
.auth-pane .auth-icon:hover { background: rgba(61, 108, 240, .09); color: #3d6cf0; }
.auth-pane .auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-pane .field input { height: 42px; }
.auth-pane .btn-block { height: 44px; margin-top: 4px; font-size: 15px; letter-spacing: .18em; }
.auth-pane .auth-links { display: flex; justify-content: space-between; margin-top: 4px; }
.auth-pane .error { margin: 2px 0 0; min-height: 16px; }

@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-pane { padding: 24px 22px; }
}

/* ===== 标题栏：窄版切换按钮 ===== */
.shell-mode {
  width: 30px; height: 24px; margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 5px;
  background: transparent; color: #9fb0c8; cursor: pointer;
  transition: background .14s, color .14s;
}
.shell-mode svg { width: 15px; height: 15px; flex: 0 0 15px; }
.shell-mode:hover { background: rgba(255, 255, 255, .1); color: #eaf1fb; }
.shell-mode.on { background: rgba(61, 108, 240, .3); color: #9dc0ff; }
.shell-title { margin-right: 8px; }

/* ===== 窄版副窗口：283px 竖条 ===== */
body.narrow .app-shell {
  width: 283px;
  height: min(660px, calc(100vh - 40px));
  border-radius: 10px;
}
body.narrow .shell-titlebar { padding: 0 6px 0 10px; gap: 6px; }
body.narrow .shell-title { display: none; }

/* 顶栏压缩成竖排 */
body.narrow .lobby-header {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 10px 9px;
}
body.narrow .lobby-id { gap: 8px; }
body.narrow .lobby-id-text { min-width: 0; }
body.narrow .lobby-name { font-size: 13px; }
body.narrow .lobby-search { display: none; }
body.narrow .top-acts { justify-content: flex-end; }
body.narrow .top-ico { width: 28px; height: 28px; flex-basis: 28px; border-radius: 8px; }
body.narrow .top-ico svg { width: 14px; height: 14px; flex-basis: 14px; }

/* 导航只留几个，横滑 */
body.narrow .main-nav { overflow-x: auto; scrollbar-width: none; padding: 0; }
body.narrow .main-nav::-webkit-scrollbar { display: none; }
body.narrow .main-nav .lobby-nav-item { padding: 9px 10px 10px; font-size: 12.5px; white-space: nowrap; }
body.narrow .main-nav .lobby-nav-item.active::after { left: 10px; right: 10px; }
body.narrow .nav-refresh { display: none; }

/* 主区变单列：频道卡在上，侧栏在下 */
body.narrow .lobby-body {
  display: block;
  padding: 10px;
  overflow-y: auto;
}
body.narrow .lobby-main { display: block; }
body.narrow .cat-tabs { gap: 5px; margin-bottom: 8px; }
body.narrow .cat-tab { padding: 5px 10px; font-size: 12px; }
body.narrow .lobby-head { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 10px; }
body.narrow .lobby-head h2 { font-size: 14.5px; }
body.narrow .create-row { display: flex; gap: 6px; }
body.narrow .create-row input { flex: 1 1 auto; min-width: 0; height: 32px; font-size: 12.5px; }
body.narrow .create-row button { flex: 0 0 auto; padding: 0 12px; height: 32px; font-size: 12.5px; }

body.narrow .channel-list { grid-template-columns: 1fr !important; gap: 8px; }
body.narrow .channel-card .cover { height: 96px; }
body.narrow .channel-card .cc-title { font-size: 13px; }

body.narrow .lobby-side {
  margin-top: 10px;
  padding: 10px;
  border-radius: 11px;
}
body.narrow .side-title { font-size: 12px; margin-bottom: 6px; }
body.narrow .my-chan { padding: 6px 6px; }
body.narrow .my-chan-icon { width: 26px; height: 26px; flex-basis: 26px; border-radius: 7px; font-size: 12px; }
body.narrow .my-chan-text b { font-size: 12px; }
body.narrow .my-chan-text i { font-size: 10.5px; }
body.narrow .side-action { height: 32px; font-size: 12.5px; }

/* 窄版下房间页也压成一列 */
body.narrow .room-body.room-wide { grid-template-columns: 1fr !important; }
body.narrow .room-bar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px; }
body.narrow .room-stats { flex-wrap: wrap; gap: 5px; }
body.narrow .rs-chip { padding: 3px 8px; font-size: 11px; }
body.narrow .chat-toolbar { padding: 7px 8px; gap: 4px; }
body.narrow .tool-btn { width: 28px; height: 28px; flex-basis: 28px; }
body.narrow .tool-btn svg { width: 14px; height: 14px; flex-basis: 14px; }

/* 窄版：登录页不分栏（283px 放不下两栏） */
body.narrow .auth-split { grid-template-columns: 1fr !important; }
body.narrow .auth-brand { display: none !important; }
body.narrow .auth-pane { padding: 18px 26px 24px; }
body.narrow .auth-pane-head {
  justify-content: center;
  margin-bottom: 24px;
}
body.narrow .auth-pane-head > b {
  flex: 0 0 auto;
  font-size: 16px; letter-spacing: .08em; text-align: center;
}
body.narrow .auth-pane-head .auth-icon {
  position: absolute; top: 0; right: 0;
}
body.narrow .auth-pane .auth-links {
  justify-content: center; gap: 30px;
}
body.narrow .auth-pane .field input { height: 44px; }

/* ===== 无边框模式：自绘标题栏当窗口栏用 ===== */
body.frameless .shell-titlebar {
  display: flex !important;
  height: 36px !important;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 12px;
  background: #1b2233;
  color: #dfe6f2;
  cursor: default;
  user-select: none;
}
body.frameless .shell-titlebar.dragging { cursor: grabbing; }
body.frameless .shell-logo { color: #9fc0ff; }
body.frameless .shell-title { color: #cfd8e8; font-size: 12.5px; }
body.frameless .shell-win-ctrl button {
  width: 44px; height: 36px; border: 0; background: transparent;
  color: #c3cddd; display: inline-flex; align-items: center; justify-content: center;
}
body.frameless .shell-win-ctrl button:hover { background: rgba(255,255,255,.09); }
body.frameless .shell-win-ctrl button[data-win="close"]:hover { background: #e23b3b; color: #fff; }
body.frameless #btn-narrow { color: #c3cddd; }
body.frameless #btn-narrow:hover { background: rgba(255,255,255,.09); }
body.frameless .shell-resize-grip {
  position: fixed; right: 0; bottom: 0; width: 14px; height: 14px;
  cursor: nwse-resize; z-index: 9999;
}
body.frameless .shell-resize-grip::after {
  content: ''; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px;
  border-right: 2px solid #b9c3d4; border-bottom: 2px solid #b9c3d4;
}
body.frameless .shell-resize-edge { pointer-events: auto; }
body.frameless.narrow .shell-resize-edge { display: none; }

/* 备案号（有号才显示，见 js/site-info.js） */
.icp-badge {
  position: fixed; left: 50%; bottom: 6px; transform: translateX(-50%);
  font-size: 11px; line-height: 1; color: #8a94a6; text-decoration: none;
  background: rgba(255, 255, 255, .82); padding: 3px 8px; border-radius: 9px;
  z-index: 9; letter-spacing: .2px;
}
.icp-badge:hover { color: #3554d1; }
body.narrow .icp-badge { font-size: 10px; bottom: 4px; }

/* 自绘标题栏：图标随窗口状态切换 */
.shell-win-ctrl button .ico-restore { display: none; }
body.win-maxed .shell-win-ctrl button .ico-max { display: none; }
body.win-maxed .shell-win-ctrl button .ico-restore { display: block; }
#btn-narrow .ico-wide { display: none; }
body.narrow #btn-narrow .ico-narrow { display: none; }
body.narrow #btn-narrow .ico-wide { display: block; }
body.narrow #btn-narrow { color: #7fb0ff; }

/* 客户端性能：WebView2 在软件合成时 backdrop-filter 非常吃 CPU（大面积模糊会让点击发闷）。
   客户端里统一降级为纯半透明底色，视觉差异很小，交互明显跟手。 */
body.in-client *,
body.in-client *::before,
body.in-client *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
/* 让长列表各自独立绘制，滚动/输入不牵动整页重排 */
body.in-client #chat-list { contain: content; }
body.in-client #member-list { contain: content; }
body.in-client #rm-tree-sub { contain: content; }
html.force-repaint body { will-change: transform; }
