/* 硬核识客 · 直播间观众身份查询
   主题令牌：只用变量，不写死颜色；深浅两套都验过。 */

:root {
  --brand: #ff6b00;
  --brand-weak: rgba(255, 107, 0, .14);
  --brand-strong: #e85f00;
  --ok: #22a06b;
  --warn: #d9930a;
  --err: #e0483d;
  --info: #3d7de0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .16);
}

html[data-theme="dark"] {
  --bg: #0e1014;
  --bg-soft: #13161b;
  --card: #171b21;
  --card-2: #1d222a;
  --line: #262c36;
  --line-soft: #1f242c;
  --text: #eef1f5;
  --text-2: #a8b1be;
  --text-3: #6f7885;
  --hover: rgba(255, 255, 255, .045);
  --mask-bg: rgba(255, 107, 0, .12);
  --mask-line: rgba(255, 107, 0, .32);
}

html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-2: #f7f8fa;
  --line: #e5e8ee;
  --line-soft: #eef0f4;
  --text: #1b2027;
  --text-2: #5c6673;
  --text-3: #8b95a3;
  --hover: rgba(16, 24, 40, .04);
  --mask-bg: rgba(255, 107, 0, .09);
  --mask-line: rgba(255, 107, 0, .26);
  --shadow: 0 10px 30px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }

.app {
  display: grid;
  grid-template-areas: "top top" "side main";
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  min-height: 62px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--brand-weak);
  color: var(--brand);
  flex: 0 0 auto;
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-copy h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.brand-copy p { margin: 2px 0 0; font-size: 12px; color: var(--text-3); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.member-btn, .theme-btn, .ghost-btn, .stop-btn, .icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.member-btn:hover, .theme-btn:hover, .ghost-btn:hover, .stop-btn:hover, .icon-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.member-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px; font-size: 13px; font-weight: 550;
  white-space: nowrap;
}
.member-btn svg { width: 15px; height: 15px; }
.member-btn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-weak); }

.theme-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; font-size: 13px;
  white-space: nowrap;
}
.theme-icon { width: 14px; height: 14px; display: inline-block; }
.theme-icon::before {
  content: ""; display: block; width: 13px; height: 13px; border-radius: 50%;
  background: currentColor; box-shadow: inset -4px -3px 0 0 var(--card);
}

.icon-btn {
  width: 32px; height: 32px; padding: 0;
  display: inline-grid; place-items: center;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------- 侧栏 */

.sidebar {
  grid-area: side;
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.sidebar-head { display: none; }

.conn-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px 13px;
}
.conn-line {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-3);
}
.conn-state { display: inline-flex; align-items: center; gap: 6px; }
.conn-state b { font-size: 12px; color: var(--text-2); font-weight: 550; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3); display: inline-block;
}
.dot.green { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 160, 107, .16); }
.dot.amber { background: var(--warn); box-shadow: 0 0 0 3px rgba(217, 147, 10, .16); }
.dot.red { background: var(--err); box-shadow: 0 0 0 3px rgba(224, 72, 61, .16); }

.stop-btn {
  width: 100%; height: 32px; margin-top: 11px;
  font-size: 12.5px; border-radius: var(--radius-sm);
}

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-3); padding: 0 3px;
}
.side-count { color: var(--text-2); }

.room-list { display: flex; flex-direction: column; gap: 6px; }

.room-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.room-item:hover { background: var(--hover); }
.room-item.active { border-color: var(--brand); background: var(--brand-weak); }
.room-item .room-name {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
  font-size: 13px; color: var(--text);
}
.room-item .room-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room-item .room-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.room-item .room-text { flex: 1; min-width: 0; }

.room-kill {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: var(--text-3);
  display: grid; place-items: center; cursor: pointer; opacity: 0;
  transition: opacity .15s;
}
.room-item:hover .room-kill { opacity: 1; }
.room-kill:hover { color: var(--err); border-color: var(--line); }
.room-kill svg { width: 12px; height: 12px; }

.room-empty {
  padding: 14px 10px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.7; color: var(--text-3); text-align: center;
}

.side-note { margin: auto 0 0; font-size: 11px; color: var(--text-3); text-align: center; }

/* ---------------------------------------------------------------- 主区 */

.main {
  grid-area: main;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 16px 0;
}

.toolbar { display: flex; align-items: center; gap: 9px; }

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 40px;
  padding-left: 34px;
  padding-right: 4px;
}
.search-box:focus-within { border-color: var(--brand); }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-3); pointer-events: none;
}
.search-box input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; background: transparent; outline: none;
  font-size: 13px;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box button {
  flex: 0 0 auto; height: 32px; padding: 0 15px;
  border: 0; border-radius: 9px;
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 550; cursor: pointer;
}
.search-box button:hover { background: var(--brand-strong); }
.search-box button:disabled { opacity: .6; cursor: progress; }

.ghost-btn {
  flex: 0 0 auto; height: 40px; padding: 0 13px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; border-radius: var(--radius);
}
.ghost-btn svg { width: 14px; height: 14px; }

.online-sum {
  flex: 0 0 auto; font-size: 12.5px; color: var(--text-3);
  white-space: nowrap; padding: 0 2px;
}
.online-sum b { color: var(--text); font-weight: 600; }

.notice {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 9px 12px;
  border: 1px solid var(--mask-line); background: var(--mask-bg);
  border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-2);
}
.notice span { flex: 1; min-width: 0; }

.mode-bar {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px;
}
.mode-nav {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 10px;
}
.mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--text-2); font-size: 13px; cursor: pointer;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--brand); color: #fff; font-weight: 550; }
.mode-count {
  min-width: 18px; padding: 0 5px; height: 17px; line-height: 17px;
  border-radius: 9px; font-size: 11px; text-align: center;
  background: var(--hover); color: var(--text-3);
}
.mode-btn.active .mode-count { background: rgba(255, 255, 255, .22); color: #fff; }
.mode-hint { font-size: 12px; color: var(--text-3); }

.tip {
  margin: 10px 0 0; padding: 9px 12px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.6; color: var(--text-3);
}
.tip b { color: var(--text-2); font-weight: 600; margin-right: 6px; }

.list-head, .row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 108px 96px 34px;
  align-items: center;
  gap: 12px;
}
.list-head {
  padding: 12px 14px 8px;
  font-size: 11.5px; color: var(--text-3);
  border-bottom: 1px solid var(--line-soft);
}
.list-head[hidden] { display: none; }

.content {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 6px 0 18px;
  scrollbar-width: thin;
}
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* ---------------------------------------------------------------- 行 */

.row {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
}
.row:hover { background: var(--hover); }
.row.masked { background: var(--mask-bg); border-color: var(--mask-line); }
.row.masked:hover { background: var(--mask-bg); border-color: var(--brand); }

.avatar {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--card-2); color: var(--text-2);
  font-size: 14px; font-weight: 600; overflow: hidden;
  border: 1px solid var(--line-soft);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.name-cell { min-width: 0; }
.name-line {
  display: flex; align-items: center; gap: 7px; min-width: 0;
}
.display-name {
  font-size: 13.5px; color: var(--text); font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.real-name {
  font-size: 13.5px; color: var(--brand); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.name-arrow { color: var(--text-3); font-size: 11px; flex: 0 0 auto; }
.name-sub {
  margin-top: 3px; font-size: 11.5px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 19px; padding: 0 7px; border-radius: 6px;
  font-size: 11px; flex: 0 0 auto;
  background: var(--card-2); color: var(--text-3);
  border: 1px solid var(--line-soft);
}
.badge.mask { background: var(--brand-weak); color: var(--brand); border-color: var(--mask-line); }
.badge.ok { color: var(--ok); border-color: rgba(34, 160, 107, .3); background: rgba(34, 160, 107, .1); }
.badge.anon { color: var(--text-3); }

.fans-cell, .level-cell { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.fans-cell.none { color: var(--text-3); }
.fans-heart { color: #e6b422; }

.mini-actions { display: flex; justify-content: flex-end; }
.resolve-btn {
  height: 26px; padding: 0 10px;
  border: 1px solid var(--mask-line); background: var(--card);
  color: var(--brand); border-radius: 7px;
  font-size: 11.5px; cursor: pointer; white-space: nowrap;
}
.resolve-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.resolve-btn:disabled { opacity: .6; cursor: progress; color: var(--text-3); border-color: var(--line); }

/* 空态 */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 64px 24px; text-align: center;
}
.empty-icon {
  width: 54px; height: 54px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--brand-weak); color: var(--brand);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty h2 { margin: 0; font-size: 17px; font-weight: 650; }
.empty h2 span { color: var(--brand); }
.empty p { margin: 0; font-size: 13px; color: var(--text-3); max-width: 460px; line-height: 1.7; }
.empty .empty-hint { font-size: 12px; color: var(--text-3); }

/* 历史 */
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding: 12px 4px; }
.hist-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 13px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
}
.hist-card:hover { border-color: var(--brand); }
.hist-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { font-size: 11.5px; color: var(--text-3); }
.hist-nums { display: flex; gap: 12px; font-size: 12px; color: var(--text-2); }
.hist-nums b { color: var(--text); }

/* ---------------------------------------------------------------- 详情面板 */

.inspector {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(360px, 92vw);
  background: var(--bg-soft);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  z-index: 40;
}
.inspector[hidden] { display: none; }
.insp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 15px; border-bottom: 1px solid var(--line);
}
.insp-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.insp-body { flex: 1; overflow-y: auto; padding: 14px 15px 26px; }

.insp-hero { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.insp-hero .avatar { width: 46px; height: 46px; border-radius: 12px; font-size: 16px; }
.insp-hero .hero-name { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.insp-hero .hero-sub { margin-top: 4px; font-size: 12px; color: var(--text-3); }

.kv { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px 10px; font-size: 12.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.section-title {
  margin: 18px 0 9px; font-size: 12px; color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.chat-item, .gift-item {
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--card-2); font-size: 12.5px; color: var(--text-2);
  margin-bottom: 6px; line-height: 1.55; overflow-wrap: anywhere;
}
.gift-item { color: var(--brand); }

.insp-note {
  margin-top: 16px; padding: 9px 11px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  font-size: 11.5px; color: var(--text-3); line-height: 1.65;
}

/* ---------------------------------------------------------------- 弹窗 */

.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8, 10, 14, .55);
  display: grid; place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  position: relative;
  width: min(440px, 100%);
  max-height: 86vh; overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal-close { position: absolute; top: 12px; right: 12px; }

.modal-title { font-size: 17px; font-weight: 650; margin: 0 0 4px; }
.modal-sub { font-size: 12.5px; color: var(--text-3); margin: 0 0 16px; line-height: 1.6; }

.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--card-2); border-radius: 9px; border: 1px solid var(--line); margin-bottom: 14px; }
.tabs button {
  height: 27px; padding: 0 14px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.tabs button.active { background: var(--brand); color: #fff; font-weight: 550; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.field input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); outline: none; font-size: 13px;
}
.field input:focus { border-color: var(--brand); }

.primary-btn {
  width: 100%; height: 40px; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.primary-btn:hover { background: var(--brand-strong); }
.primary-btn:disabled { opacity: .6; cursor: progress; }

.form-msg { min-height: 18px; font-size: 12px; color: var(--err); margin: 8px 0 0; }
.form-msg.ok { color: var(--ok); }

.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.plan {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px;
  text-align: center; background: var(--card);
}
.plan b { display: block; font-size: 13px; }
.plan .price { margin-top: 5px; font-size: 15px; color: var(--brand); font-weight: 650; }
.plan .desc { margin-top: 4px; font-size: 11px; color: var(--text-3); }

.member-state {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius); margin-bottom: 14px;
  background: var(--card-2); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-2);
}
.member-state b { color: var(--text); }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.helper { font-size: 11.5px; color: var(--text-3); line-height: 1.65; margin-top: 8px; }

/* ---------------------------------------------------------------- toast */

.toast-wrap {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 90;
  pointer-events: none;
}
.toast {
  padding: 10px 16px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text); font-size: 13px; box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
  max-width: 80vw;
}
.toast.err { border-color: rgba(224, 72, 61, .5); color: var(--err); }
.toast.ok { border-color: rgba(34, 160, 107, .5); color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.backdrop { display: none; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 880px) {
  .app { grid-template-areas: "top" "main"; grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-grid; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(280px, 84vw);
    z-index: 50; transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 6px;
  }
  .backdrop { display: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; z-index: 45; border: 0; background: rgba(8, 10, 14, .5); }
  .list-head { display: none; }
  .row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; }
  .fans-cell, .level-cell { display: none; }
  .online-sum { display: none; }
  .main { padding: 12px 12px 0; }
}

@media (max-width: 560px) {
  .brand-copy p { display: none; }
  .brand-copy h1 { font-size: 15px; }
  .member-btn { padding: 0 10px; }
  .member-btn span { max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
  .theme-btn #themeText { display: none; }
  .theme-btn { padding: 0 10px; }
  .toolbar { gap: 7px; }
  .ghost-btn span { display: none; }
  .ghost-btn { padding: 0 11px; }
}

@media (min-width: 881px) {
  .only-mobile { display: none; }
}

/* ---------------------------------------------------------------- 单机版补充 */

.pin {
  flex: 0 0 auto; display: inline-block;
  padding: 1px 6px; font-size: 11px; line-height: 16px;
  font-weight: 500; vertical-align: 1px;
  border-radius: 5px; color: var(--brand);
  background: var(--brand-weak); border: 1px solid var(--mask-line);
}

.hist-del {
  margin-top: 2px; align-self: flex-start;
  height: 24px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 7px;
  background: transparent; color: var(--text-3);
  font-size: 11.5px; cursor: pointer;
}
.hist-del:hover { border-color: var(--err); color: var(--err); }
