/* ===== 主题变量:默认浅色经典 YY 绿 ===== */
:root {
  color-scheme: light;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --green: #16a34a;
  --green-strong: #15803d;
  --green-soft: #e8f7ee;
  --green-line: #b6e5c6;
  --bar-from: #1fb35a;
  --bar-to: #0f9446;
  --bg: #eef2f0;
  --main: #ffffff; /* 中间主区(公屏)底色:浅色用纯白,靠细线与两侧分区 */
  --panel: #ffffff;
  --panel-2: #f6f8f7;
  --hover: #eef5f1;
  --line: #dde5e0;
  --text: #1c2622;
  --muted: #6b7a73;
  --ink-base: #000;      /* 马甲文字与黑色混合,保证浅色下对比度 */
  --ink-mix: 58%;
  --shadow: 0 1px 2px #0000000d, 0 4px 14px #0000000a;
  /* 说话绿与喊话橙:固定色,不随主色变化,选暗主色时也能一眼看出谁在说话 */
  --speak: #16a34a;
  --shout: #ea580c;
  --danger: #e5484d;
  --status-online: #a7f3c0;
  --status-connecting: #fcd34d;
  font: var(--fs-md)/1.5 'Segoe UI Variable', 'Segoe UI', 'Microsoft YaHei UI', 'PingFang SC', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
[data-theme='dark'] {
  color-scheme: dark;
  --green: #22c55e;
  --green-strong: #4ade80;
  --green-soft: #1d3a2a;
  --green-line: #2f5e42;
  --bar-from: #17663a;
  --bar-to: #0f4d2b;
  --bg: #1a1c1f;
  --main: var(--bg);
  --panel: #232528;
  --panel-2: #1e2023;
  --hover: #2c2f33;
  --line: #34373c;
  --text: #e6e9e7;
  --muted: #9aa39e;
  --ink-base: #fff;
  --ink-mix: 100%;
  --shadow: 0 1px 2px #0005;
  --speak: #4ade80;
  --shout: #fb923c;
}

/* ===== 基础 ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; }
h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; flex: none; }
small { color: var(--muted); font-size: var(--fs-sm); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ===== 整体布局:标题栏 + 三栏 ===== */
.app {
  height: 100dvh;
  display: grid;
  grid-template: 48px minmax(0, 1fr) / 248px minmax(0, 1fr) 232px;
  grid-template-areas: 'bar bar bar' 'side main roster';
}
.app.no-roster { grid-template-columns: 248px minmax(0, 1fr) 0; }
.app.no-roster .roster { display: none; }

/* ===== 标题栏 ===== */
.titlebar {
  grid-area: bar; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 12px 0 14px; color: #fff;
  background: linear-gradient(180deg, var(--bar-from), var(--bar-to));
  box-shadow: 0 1px 0 #0000001f;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { font-size: var(--fs-lg); letter-spacing: .04em; white-space: nowrap; }
.logo { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; gap: 2px; border-radius: 8px; background: #ffffff2b; }
.logo i { width: 3px; height: 8px; border-radius: 2px; background: #fff; }
.logo i:nth-child(2) { height: 16px; } .logo i:nth-child(3) { height: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); white-space: nowrap; }
.status::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--status-connecting); }
.status.online::before { background: var(--status-online); }
.title-actions { display: flex; align-items: center; gap: 6px; }
.tb-button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #fff; }
.tb-button:hover, .tb-button[aria-pressed='true'] { background: #ffffff2e; }
#dm-open, #alerts-open { position: relative; }
.tb-button .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 99px; background: var(--danger); }
.titlebar .button.primary { background: #fff; color: var(--green-strong); }
.titlebar .button.primary:hover { background: #ecfdf3; }
.desktop-app .titlebar { padding-right: 0; }
.desktop-app .auth { top: 48px; }
.desktop-app:has(.auth:not([hidden])) .titlebar :is(.brand, .title-actions > .tb-button) { visibility: hidden; }
.guild-open { min-width: 0; }
.guild-open strong { overflow: hidden; text-overflow: ellipsis; }
.guild-open .logo { flex: none; }
.desktop-app .title-actions { align-self: stretch; flex: none; }
.desktop-app .win-controls { --close-hover: #e81123; display: flex; align-self: stretch; margin-left: 4px; }
.desktop-app .win-controls .tb-button { width: 46px; height: 100%; border-radius: 0; }
.desktop-app .win-controls svg { width: 16px; height: 16px; }
.desktop-app #win-close:hover { background: var(--close-hover); }

/* ===== 通用按钮 ===== */
.button { min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-weight: 600; white-space: nowrap; }
.button:hover:not(:disabled) { background: var(--hover); }
.button.primary { border-color: transparent; background: var(--green); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--green-strong); }
[data-theme='dark'] .button.primary { color: #062b14; }
.button.block { width: 100%; min-height: 40px; }
/* 链接当按钮用(EVE 登录、添加角色):去掉链接自带的蓝色与下划线,文字居中,与 <button> 外观一致 */
a.button { display: inline-flex; align-items: center; justify-content: center; color: inherit; text-decoration: none; }
a.button.block { display: flex; }
.ghost-icon { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: var(--fs-lg); }
.ghost-icon:hover { background: var(--hover); color: var(--text); }
.ghost-icon svg { width: 16px; height: 16px; }

/* ===== 左侧:YY 式频道树 ===== */
.sidebar, .roster { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.sidebar { grid-area: side; border-right: 1px solid var(--line); }
#sidebar-invite { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 10px 0; border-color: var(--green); color: var(--green-strong); }
#sidebar-invite:hover { background: var(--green-soft); }
#sidebar-invite svg { width: 16px; height: 16px; }
.roster { grid-area: roster; border-left: 1px solid var(--line); }
.side-head { height: 40px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 14px; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.roster .side-head .ghost-icon { flex: none; }
.roster .side-head { justify-content: flex-start; gap: 4px; white-space: nowrap; }
.count { margin-right: auto; white-space: nowrap; font-weight: 500; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.channels { flex: 1; overflow: auto; padding: 6px 6px 12px; }
.group-toggle { width: 100%; display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 6px; border: 0; background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; text-align: left; }
.group-toggle:hover { color: var(--text); }
.chevron { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.chevron.open, .legend[open] .chevron { transform: rotate(45deg); }
.room-link { width: 100%; display: flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 8px 0 calc(4px + var(--depth, 0) * 16px); border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; }
.room-link svg { width: 16px; height: 16px; color: var(--muted); }
.room-link:hover { background: var(--hover); }
.room-link.selected { background: var(--green-soft); color: var(--green-strong); font-weight: 600; }
.room-link.drop-target { background: var(--green-soft); outline: 2px solid var(--green); outline-offset: -2px; }
.room-link.selected svg { color: var(--green); }
.room-link.joined svg { color: var(--green); }
.room-link .name { flex: 1; }
.room-count { min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-xs); text-align: center; font-variant-numeric: tabular-nums; }
.tree-member { display: flex; align-items: center; gap: 7px; min-height: 26px; padding: 0 8px 0 calc(40px + var(--depth, 0) * 16px); color: var(--muted); font-size: var(--fs-sm); }
.tree-member .name { flex: 1; }
.tree-member.self .name { color: var(--text); font-weight: 600; }
.tree-member .avatar { --size: 16px; font-size: var(--fs-xs); }
/* 说话的人:名字变绿加粗 + 声波图标;跨频道喊话 / 广播改用橙色。昵称自带颜色或彩虹时不受影响 */
.tree-member.speaking .name { color: var(--speak); font-weight: 600; }
.tree-member.speaking.shouting .name { color: var(--shout); }
.speak-wave { flex: none; display: grid; color: var(--speak); }
.speak-wave svg { width: 13px; height: 13px; }
.shouting .speak-wave { color: var(--shout); }

/* ===== 马甲与头像 ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 0 6px; height: 18px; border-radius: 4px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--badge) var(--ink-mix), var(--ink-base));
  background: color-mix(in srgb, var(--badge) 18%, transparent); }
.diamond { width: 5px; height: 5px; border-radius: 1px; background: var(--badge); transform: rotate(45deg); }
.badge svg, .role-icon svg { width: 11px; height: 11px; color: var(--badge); }
/* 频道树与成员列表共用的身份小图标 */
.role-icon { flex: none; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 4px; background: color-mix(in srgb, var(--badge) 22%, transparent); }
.role-icon .diamond { width: 6px; height: 6px; }
.muted-mark { flex: none; color: var(--danger); }
.muted-mark svg { width: 13px; height: 13px; }
.room-link .lock { width: 13px; height: 13px; color: var(--muted); }
.avatar { --size: 32px; position: relative; width: var(--size); height: var(--size); flex: none; display: grid; place-items: center; border-radius: 50%; font-size: calc(var(--size) * .42); font-weight: 700;
  color: var(--avatar-ink); background: var(--avatar-bg); }
.avatar.speaking { --ring: var(--speak); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ring); }
.avatar.speaking.shouting { --ring: var(--shout); }
/* 频道树与舞台里人挨着人,外环收成紧贴头像的 2px,不挤到相邻的人 */
.tree-member .avatar.speaking, .tile .avatar.speaking { box-shadow: 0 0 0 2px var(--ring); }
.avatar.offline img { filter: grayscale(1); opacity: .55; }
.visitor { --avatar-ink: var(--muted); --avatar-bg: var(--panel-2); }

/* ===== 左下:Discord 式个人面板 ===== */
.user-panel { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-top: 1px solid var(--line); background: var(--panel-2); }
.voice-link { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; border-bottom: 1px solid var(--line); }
.voice-link > div { flex: 1; min-width: 0; }
.voice-link strong { display: block; color: var(--green-strong); font-size: var(--fs-sm); }
.voice-link small { display: block; }
.me { display: flex; align-items: center; gap: 8px; }
.me > div { flex: 1; min-width: 0; }
.me strong { display: block; font-size: var(--fs-sm); }
.panel-buttons { display: flex; gap: 2px; }
.panel-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.panel-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.panel-btn.off { color: var(--danger); }
.panel-btn.hang { color: var(--danger); }

/* ===== 中间主区 ===== */
.main { grid-area: main; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--main); }
.room-head { height: 48px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.room-head svg { color: var(--green); }
.room-head strong { font-size: var(--fs-lg); }
.room-head .crumb { color: var(--muted); font-size: var(--fs-sm); }
.room-head .desc { max-width: 40%; color: var(--muted); font-size: var(--fs-sm); }
.room-head .spacer { flex: 1; }
.room-notice { flex: none; display: flex; align-items: flex-start; gap: 8px; padding: 4px 16px; background: var(--green-soft); font-size: var(--fs-sm); }
.room-notice .text-button { flex: 1; min-width: 0; min-height: 26px; display: flex; align-items: center; gap: 8px; padding: 0; color: var(--text); text-align: left; }
.room-notice svg, .room-notice .ghost-icon { flex: none; }
.room-notice svg { width: 16px; height: 16px; color: var(--green); }
.room-notice [aria-expanded='true'] .truncate { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30dvh; overflow-y: auto; }

/* 频道内成员舞台:语音状态一眼可见 */
.stage { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.stage-empty { flex: 1 1 14em; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); }
.stage-empty .grow { flex: 1; }
.stage-empty .button { flex: none; }
.tile { min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; }
.tile:hover { background: var(--hover); }
.tile .who { max-width: min(12em, 45vw); font-size: var(--fs-sm); font-weight: 600; }
.volume { width: 100%; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-xs); }
.volume input { flex: 1; min-width: 0; height: 4px; accent-color: var(--green); }
.volume span { width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

/* 公屏 */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; overflow: auto; padding: 12px 16px 4px; }
.message { --avatar-width: 36px; position: relative; display: flex; gap: 10px; padding: 0 36px 0 8px; border-radius: 8px; font-size: var(--fs-sm); }
.message + .message { margin-top: 16px; }
.message:hover { background: var(--hover); }
.message.mention { background: var(--green-soft); border-left: 3px solid var(--green); }
.message .avatar { --size: var(--avatar-width); margin-top: 2px; }
.message > div { min-width: 0; }
.message header { display: flex; align-items: center; gap: 6px; }
.message header strong { font-size: var(--fs-md); }
.message time { flex: none; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.message p { margin-top: 2px; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.continued { margin-top: 2px; }
.message.continued p { margin: 0; }
.message.continued > time { flex: 0 0 var(--avatar-width); text-align: center; opacity: 0; }
.message.continued:hover > time { opacity: 1; }
.message-actions { position: absolute; top: 0; right: 4px; z-index: 1; display: flex; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: var(--shadow); opacity: 0; pointer-events: none; }
.message:hover .message-actions, .message:focus-within .message-actions { opacity: 1; pointer-events: auto; }
.empty { margin: 32px auto; color: var(--muted); text-align: center; font-size: var(--fs-sm); }
.invite-card { display: grid; justify-items: center; gap: 8px; width: fit-content; max-width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.invite-card h3 { color: var(--text); font-size: var(--fs-md); }
.composer { flex: none; display: flex; gap: 8px; padding: 8px 16px 12px; }
.composer input, .modal input, .modal select { width: 100%; min-width: 0; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.composer input:focus, .modal input:focus, .modal select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }

/* 底部按住说话栏 */
/* 用网格固定比例 + 容器查询,按钮文字不换行、不被挤变形 */
.ptt-bar { flex: none; container-type: inline-size; padding: 6px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.ptt-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; }
.talk-button { min-width: 0; height: 32px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; touch-action: none; user-select: none; transition: background .12s, border-color .12s, transform .06s; }
.talk-button .label { overflow: hidden; text-overflow: ellipsis; }
.talk-button svg { width: 15px; height: 15px; color: var(--green); }
.talk-button:hover:not(:disabled) { border-color: var(--green-line); background: var(--green-soft); }
.talk-button.active { border-color: var(--green); background: var(--green); color: #fff; transform: scale(.98); }
.talk-button.active svg { color: #fff; }
.talk-group { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(72px, 40%); }
.talk-group .talk-button { border-radius: 8px 0 0 8px; }
.talk-group select { min-width: 0; height: 32px; padding: 0 4px 0 8px; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: var(--panel); font-size: var(--fs-sm); text-overflow: ellipsis; }
kbd { flex: none; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel); color: var(--muted); font: var(--fs-xs)/16px ui-monospace, Consolas, monospace; }
@container (max-width: 560px) { .talk-button kbd { display: none; } .talk-button { padding: 0 6px; font-size: var(--fs-sm); } }
@container (max-width: 400px) { .ptt-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } .talk-button.wide { grid-column: 1 / -1; } }
.talk-button.active kbd { color: var(--green-strong); }

/* ===== 右侧成员列表(按马甲分组) ===== */
.members { flex: 1; overflow: auto; padding: 4px 6px 12px; }
.role-group { margin: 12px 8px 4px; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; }
.member-row { width: 100%; display: flex; align-items: center; gap: 9px; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
button.member-row:hover { background: var(--hover); }
.member-row.offline .member-name { color: var(--muted); }
.member-row .avatar { --size: 30px; }
.member-name { flex: 1; min-width: 0; }
.member-name strong, .member-name small { display: block; }
.member-name strong { font-size: var(--fs-sm); font-weight: 600; }
.member-name small { font-size: var(--fs-xs); }
.legend { flex: none; margin: 0 8px 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: var(--fs-sm); }
.legend summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; color: var(--muted); font-weight: 600; }
.legend summary::-webkit-details-marker { display: none; }
.legend summary:hover { color: var(--text); }
#legend-roles { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: start; gap: 6px; margin-top: 8px; }
#legend-roles .badge { justify-self: start; }
#legend-roles small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.45; }

/* ===== 弹窗与提示 ===== */
dialog { width: min(400px, calc(100% - 32px)); padding: 20px; border: 0; border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #0000004d; }
dialog:modal { max-height: calc(100dvh - 64px); margin: auto; overflow: auto; overscroll-behavior: contain; }
#settings-dialog, #guild-dialog, #room-dialog, #eve-dialog { width: min(720px, calc(100% - 32px)); }
dialog::backdrop { background: #0b1a1166; backdrop-filter: blur(2px); }
.dm-window { position: fixed; inset: auto 0 var(--statusbar-height, 36px) auto; z-index: 4; margin: 0; width: 360px; height: 460px; max-height: calc(100dvh - var(--statusbar-height, 36px)); padding: 8px; }
.dm-window[open] { display: flex; flex-direction: column; }
.dm-window .modal-title { gap: 8px; }
.dm-window .modal-title > :not(h2) { flex: none; }
.dm-window .modal-title h2 { flex: 1; }
@media (max-width: 680px) { .dm-window { width: 100%; max-width: 100%; } }
.modal { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; overflow-wrap: anywhere; }
.modal-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* 模态弹窗的标题栏吸顶:内容滚动时标题与关闭按钮始终可见。内边距从弹窗挪到 .modal 上(顶部由标题栏自己的内边距承担),这样吸顶位置不取决于浏览器把滚动容器的内边距算在哪一侧;标题栏左右用负外边距贴到弹窗边缘不露缝,仍在 .modal 的内边距之内,不算溢出 */
dialog:modal:has(.modal-title) { padding: 0; }
dialog:modal:has(.modal-title) > .modal { padding: 0 20px 20px; }
dialog:modal .modal-title { position: sticky; top: 0; z-index: 1; margin: 0 -20px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.modal-title .close { flex: none; width: 28px; height: 28px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.modal-title .close:hover { background: var(--hover); }
.modal-title h2 { font-size: var(--fs-lg); }
.modal label { display: grid; gap: 6px; font-size: var(--fs-sm); font-weight: 600; }
.modal p { color: var(--muted); font-size: var(--fs-sm); }
.dialog-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.dialog-column { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px; min-width: 0; }
.dialog-column fieldset { min-inline-size: 0; }
.dialog-column h3 { font-size: var(--fs-md); }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (width < 720px) { .dialog-columns { grid-template-columns: minmax(0, 1fr); } }
.notice { position: fixed; z-index: 25; inset: auto auto 84px 50%; transform: translateX(-50%); width: auto; max-width: calc(100vw - 32px); margin: 0; padding: 9px 16px; border: 0; border-radius: 99px; background: #1c2622; color: #fff; font-size: var(--fs-sm); box-shadow: 0 8px 24px #0004; }
audio { display: none; }

/* ===== 响应式 ===== */
@media (max-width: 1080px) {
  .app, .app.no-roster { grid-template-columns: 220px minmax(0, 1fr) 0; }
  .roster { display: none; }
  .app.show-roster .roster { display: flex; position: fixed; z-index: 4; top: 48px; right: 0; bottom: var(--statusbar-height); width: 260px; box-shadow: -8px 0 24px #0003; }
}
@media (max-width: 680px) {
  body { overflow: auto; }
  .app, .app.no-roster { height: auto; min-height: 100dvh; grid-template: 48px auto 1fr / minmax(0, 1fr); grid-template-areas: 'bar' 'side' 'main'; }
  .desktop-app .win-controls .tb-button { width: 32px; }
  .sidebar { min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .channels { max-height: 38dvh; }
  .main { min-height: 70dvh; }
  .messages { max-height: 70dvh; }
  .room-head .desc, .status { display: none; }
  .ptt-bar { position: sticky; bottom: 0; }
}


/* ===== 右键菜单 ===== */
.context-menu { position: fixed; z-index: 10; min-width: 168px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 10px 30px #0003; }
.context-menu header { padding: 4px 8px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); }
.context-menu header strong { color: var(--text); }
.context-menu:has([data-menu^='move-']) { max-height: calc(100dvh - 16px); overflow-y: auto; }
.context-menu button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: var(--fs-sm); }
.context-menu button:hover, .context-menu button:focus-visible { background: var(--green-soft); color: var(--green-strong); outline: none; }
.context-menu button.danger { color: var(--danger); }
.context-menu button.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.context-menu hr { margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
.roster-tip { flex: none; margin: 0 14px 6px; color: var(--muted); font-size: var(--fs-xs); }

/* ===== 频道层级、模式、麦序 ===== */
.room-link .chevron { width: 12px; height: 12px; flex: none; display: grid; place-items: center; border: 0; transform: none; color: var(--muted); }
.room-link .chevron::before { content: ''; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.room-link .chevron.open::before { transform: rotate(45deg); }
.chevron-space { width: 12px; flex: none; }
.mode-tag { flex: none; padding: 0 5px; border-radius: 4px; font-size: var(--fs-xs); font-weight: 600; line-height: 16px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); }
.mode-tag.chair { color: #c2410c; background: #fff1e6; border-color: #fed7aa; }
.mode-tag.queue { color: #1d4ed8; background: #e8efff; border-color: #c7d6fe; }
[data-theme='dark'] .mode-tag.chair { color: #fdba74; background: #3a2618; border-color: #5c3a1e; }
[data-theme='dark'] .mode-tag.queue { color: #93b4ff; background: #1c2742; border-color: #2c3d66; }
.room-head .mode-tag { font-size: var(--fs-xs); }
.queue-no { flex: none; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #2563eb; color: #fff; font-size: var(--fs-xs); line-height: 16px; text-align: center; }

.queue-panel { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.queue-head { display: flex; align-items: center; gap: 8px; }
.queue-head .grow { flex: 1; }
.queue-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.queue-list li { display: flex; align-items: center; gap: 6px; max-width: 200px; padding: 3px 8px 3px 4px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel-2); font-size: var(--fs-sm); }
.queue-list li.head { border-color: var(--green); background: var(--green-soft); color: var(--green-strong); font-weight: 600; }
.queue-list .no { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--line); font-size: var(--fs-xs); }
.queue-list li.head .no { background: var(--green); color: #fff; }
.mic-time { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.mic-time.locked { color: var(--danger); }
.queue-empty { margin-top: 6px; color: var(--muted); font-size: var(--fs-sm); }
.queue-admin { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.chip { height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font-size: var(--fs-sm); font-weight: 600; }
.chip:hover { border-color: var(--green-line); background: var(--green-soft); }
.chip.primary { border-color: transparent; background: var(--green); color: #fff; }
.chip.danger { color: var(--danger); }

/* ===== 语音设置弹窗 ===== */
.seg { display: flex; gap: 6px; margin: 0; padding: 0; border: 0; }
.seg legend { margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; }
.seg label { position: relative; flex: 1; display: grid; place-items: center; min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 99px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--green); background: var(--green-soft); color: var(--green-strong); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.seg input { position: absolute; top: 50%; left: 0; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; }
.vad-row { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: var(--fs-sm); }
.vad-row input { grid-column: 1 / -1; margin: 0; accent-color: var(--green); }
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--green); transition: width .05s; }
.meter b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); }
.keys { display: grid; gap: 6px; }
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px auto; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.key-capture { height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font: var(--fs-sm) ui-monospace, Consolas, monospace; }
.key-capture.waiting { border-color: var(--green); color: var(--green-strong); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }
.text-button { border: 0; background: transparent; color: var(--muted); font-size: var(--fs-sm); }
.text-button:hover { color: var(--green-strong); }
.room-head .ghost-icon { flex: none; }
.room-head .desc, #room-status { min-width: 0; }
.obs-row { display: grid; gap: 4px; }

/* ===== 黑名单 ===== */
.ban-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.ban-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.ban-row > div { flex: 1; min-width: 0; }
.ban-row strong, .ban-row small { display: block; }

/* ===== 连接质量信号格 ===== */
.quality { display: flex; align-items: center; gap: 4px; min-height: 14px; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.quality:empty { display: none; }
.signal { display: inline-flex; align-items: flex-end; gap: 1px; height: 10px; }
.signal i { width: 3px; border-radius: 1px; background: var(--line); }
.signal i:nth-child(1) { height: 4px; } .signal i:nth-child(2) { height: 7px; } .signal i:nth-child(3) { height: 10px; }
.signal.s3 i { background: var(--green); }
.signal.s2 i:nth-child(-n+2) { background: #f59e0b; }
.signal.s1 i:nth-child(1) { background: var(--danger); }
.checks { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; font-size: var(--fs-sm); }
.checks legend { margin-bottom: 6px; font-weight: 600; }
.checks label { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
.checks input, .guild-edit input[type=checkbox], .alert-form input[type=checkbox], .eve-modal input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--green); }

/* ===== 登录窗口 ===== */
.auth { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(6px); }
.auth-card { width: min(380px, 100%); max-height: 100%; overflow: auto; border-radius: 16px; background: var(--panel); box-shadow: 0 24px 70px #0003; }
.auth-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; color: #fff; background: linear-gradient(160deg, var(--bar-from), var(--bar-to)); }
.auth-brand .logo { width: 40px; height: 40px; border-radius: 12px; }
.auth-brand strong { display: block; font-size: var(--fs-lg); letter-spacing: .04em; }
.auth-brand small { color: #ffffffcc; }
.auth-card footer { padding: 0 16px 16px; text-align: center; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.auth-tabs button { height: 42px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 600; }
.auth-tabs button[aria-selected='true'] { color: var(--green-strong); border-bottom-color: var(--green); }
.auth-form { display: grid; gap: 12px; padding: 18px 22px 22px; }
.auth-form label { display: grid; gap: 5px; font-size: var(--fs-sm); font-weight: 600; }
.auth-form label.inline, .guild-edit label.inline, .alert-form label.inline, .eve-modal label.inline { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.auth-form input:not([type=checkbox]) { width: 100%; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.auth-form input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.auth-form input[type=checkbox] { accent-color: var(--green); }
.auth-form p { color: var(--muted); font-size: var(--fs-sm); }
.auth-form .text-button { justify-self: center; }
.invite-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 8px; align-items: end; }
.invite-form label { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
.invite-form select { min-height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
@media (max-width: 400px) { .invite-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ban-row .button + .button { margin-left: -4px; }

/* ===== 隐藏程序内滚动条(仍可用滚轮或触控板滚动) ===== */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

/* ===== 头像、昵称、等级、活跃 ===== */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.big { --size: 64px; }
.uname { font-weight: inherit; }
.uname.rainbow { background: linear-gradient(90deg, #f43f5e, #f59e0b, #22c55e, #3b82f6, #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.lv { display: inline-flex; align-items: center; gap: 1px; margin-right: 4px; font-size: var(--fs-xs); font-style: normal; line-height: 1; white-space: nowrap; color: var(--muted); }
.lv i { font-style: normal; letter-spacing: -1px; }
.lv-crown { color: #e11d48; } .lv-sun { color: #f59e0b; } .lv-moon { color: #eab308; } .lv-star { color: #facc15; text-shadow: 0 0 1px #a16207; }
.active-dot { display: inline-block; flex: none; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: #facc15; box-shadow: 0 0 0 2px color-mix(in srgb, #facc15 30%, transparent); vertical-align: middle; }
.member-name strong { display: flex; align-items: center; }
.member-name small { display: flex; align-items: center; }

/* 自己的面板:点击头像和名字查看资料 */
.me-card { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 2px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.me-card:hover { background: var(--hover); }
.me-card > span:last-child { min-width: 0; }
.me-card strong { display: block; font-size: var(--fs-sm); }

/* ===== 资料卡 ===== */
.profile-card { position: fixed; z-index: 11; width: min(280px, calc(100% - 16px)); overflow: hidden auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 16px 40px #0003; }
.pc-banner { height: 56px; background: linear-gradient(120deg, var(--green), var(--green-strong)); }
[data-theme='dark'] .pc-banner { background: linear-gradient(120deg, color-mix(in srgb, var(--green) 65%, var(--bg)), color-mix(in srgb, var(--green) 32%, var(--bg))); }
.pc-head { display: flex; align-items: flex-start; gap: 10px; padding: 0 14px; }
.pc-head .avatar { margin-top: calc(var(--size) / -2); border: 3px solid var(--panel); }
.pc-head > div { min-width: 0; padding-top: 4px; }
.pc-head strong { display: flex; align-items: center; font-size: var(--fs-lg); }
.pc-role { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.pc-body { display: grid; gap: 8px; padding: 10px 14px 14px; }
.pc-level { display: flex; align-items: center; gap: 6px; }
.pc-level .lv { font-size: var(--fs-sm); color: var(--text); font-weight: 600; }
.pc-bio { padding: 8px 10px; border-radius: 8px; background: var(--panel-2); font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pc-tags span { padding: 1px 8px; border-radius: 99px; background: var(--green-soft); color: var(--green-strong); font-size: var(--fs-sm); }
.pc-actions { display: flex; gap: 6px; }
.pc-actions:empty { display: none; }

/* ===== 编辑资料 ===== */
.avatar-edit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.avatar-edit .button { display: inline-flex; align-items: center; cursor: pointer; }
.modal textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font: inherit; resize: vertical; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.swatches legend { max-width: 100%; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; }
.swatch span { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--c, var(--text)); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.swatch.rainbow-swatch span { background: linear-gradient(135deg, #f43f5e, #f59e0b, #22c55e, #3b82f6, #a855f7); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--green); }
.swatch input:disabled + span { opacity: .3; cursor: not-allowed; }
.swatch > svg { position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; pointer-events: none; }
.swatch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }

/* ===== 界面主色:设置 --accent 后,整套配色由它推导 ===== */
:root[style*="--accent"] {
  --green: var(--accent);
  --green-strong: color-mix(in srgb, var(--accent) 78%, #000);
  --green-soft: color-mix(in srgb, var(--accent) 12%, #fff);
  --green-line: color-mix(in srgb, var(--accent) 35%, #fff);
  --bar-from: color-mix(in srgb, var(--accent) 90%, #fff);
  --bar-to: color-mix(in srgb, var(--accent) 80%, #000);
}
[data-theme='dark'][style*="--accent"] {
  --green-strong: color-mix(in srgb, var(--accent) 65%, #fff);
  --green-soft: color-mix(in srgb, var(--accent) 22%, #232528);
  --green-line: color-mix(in srgb, var(--accent) 45%, #232528);
  --bar-from: color-mix(in srgb, var(--accent) 60%, #000);
  --bar-to: color-mix(in srgb, var(--accent) 42%, #000);
}
.accent-row { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; gap: 8px; }
.accent-row .follow-swatch { display: flex; align-items: center; max-width: 100%; }
.follow-swatch span { flex: none; }
.accent-row .follow { color: var(--text); font-size: var(--fs-sm); font-weight: 500; }
.custom-swatch span { background: var(--panel-2); }
.custom-swatch.selected span { background: var(--c); outline: 2px solid var(--green); }

/* ===== 公会资料、频道号、频道图片、分享 ===== */
.guild-open { display: flex; align-items: center; gap: 10px; padding: 2px 6px 2px 2px; border: 0; border-radius: 10px; background: transparent; color: #fff; }
.guild-open:hover { background: #ffffff22; }
.guild-open strong { font-size: var(--fs-lg); letter-spacing: .04em; white-space: nowrap; }
.logo { overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.guild-no { padding: 1px 8px; border: 1px solid #ffffff55; border-radius: 6px; background: #00000022; color: #fff; font: var(--fs-sm)/18px ui-monospace, Consolas, monospace; white-space: nowrap; }
.guild-no:hover { background: #00000040; }
.modal .guild-no { border-color: var(--line); background: var(--panel-2); color: var(--muted); }
.room-thumb { width: 22px; height: 22px; flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 6px; background: var(--green-soft); }
.room-thumb img { width: 100%; height: 100%; object-fit: cover; }
.room-thumb.big { width: 64px; height: 64px; border-radius: 14px; }
.guild-head { display: flex; align-items: center; gap: 12px; }
.guild-head > div { min-width: 0; }
.guild-head strong { display: block; margin-bottom: 4px; font-size: var(--fs-lg); }
.guild-intro { padding: 10px 12px; border-radius: 8px; background: var(--panel-2); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text) !important; font-size: var(--fs-sm) !important; }
.guild-edit.readonly { grid-template-columns: minmax(0, 1fr); }
.guild-edit.readonly .edit-fields { display: none; }
.guild-edit label.button { justify-self: start; max-width: 100%; display: inline-flex; align-items: center; cursor: pointer; }
.guild-edit > button, .term-row small { grid-column: 1 / -1; }
.term-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.share-text { margin: 0; padding: 12px; border-radius: 8px; background: var(--panel-2); font-size: var(--fs-sm); line-height: 1.6; font-family: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 680px) { .guild-no { display: none; } }

/* ===== 原生质感:界面文字不可选、默认箭头、图片不可拖 ===== */
body { -webkit-user-select: none; user-select: none; cursor: default; }
input, textarea, [contenteditable], .message p, .pc-bio, .guild-intro, .share-text { -webkit-user-select: text; user-select: text; }
input, textarea { cursor: text; }
img { -webkit-user-drag: none; }

.tooltip { position: fixed; z-index: 30; max-width: 240px; padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--panel); font-size: var(--fs-sm); line-height: 1.5; pointer-events: none; box-shadow: var(--shadow); animation: fade-in .12s ease-out; right: 8px; width: fit-content; overflow-wrap: anywhere; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.97); } }
dialog[open] { animation: pop-in .14s ease-out; }
dialog[open]::backdrop { animation: fade-in .14s ease-out; }
.context-menu:not([hidden]), .profile-card:not([hidden]) { animation: pop-in .12s ease-out; transform-origin: top left; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after, ::backdrop { animation: none !important; transition: none !important; } }

/* ===== YY 式左下角「我的语音」与喊话栏 ===== */
.me-card > span:last-child { min-width: 0; overflow: hidden; }
.me-sub { display: flex; align-items: center; gap: 4px; min-width: 0; }
.voice-controls { display: flex; align-items: center; gap: 4px; }
.voice-controls .panel-btn { width: 30px; height: 30px; flex: none; }
.mic-btn { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--green); }
.mic-btn svg { width: 16px; height: 16px; }
.mic-btn:hover:not(:disabled) { border-color: var(--green-line); }
.mic-btn.off { color: var(--danger); }
.mic-btn.talking { border-color: var(--speak); background: var(--green-soft); }
.mic-meter { flex: 1; min-width: 12px; height: 4px; overflow: hidden; border-radius: 4px; background: var(--line); }
.mic-meter i { display: block; width: 0; height: 100%; background: var(--speak); transition: width .05s linear; }
.mic-btn.off .mic-meter { background: var(--muted); }
.mic-btn.off .mic-meter i { visibility: hidden; }
.shout-bar { display: flex; align-items: center; gap: 8px; padding: 0 16px 6px; }
.shout-bar[hidden] { display: none; }
.shout-label { flex: none; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-sm); }
.shout-label svg { width: 14px; height: 14px; }
.shout-bar .talk-group { flex: none; display: flex; }
.shout-bar .talk-button { padding: 0 10px; }
.shout-bar .talk-group select { width: 110px; }

/* ===== 底部状态栏(参照 YY) ===== */
.app { grid-template-rows: 48px minmax(0, 1fr) 36px; grid-template-areas: 'bar bar bar' 'side main roster' 'foot foot foot'; }
.statusbar { grid-area: foot; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--panel); border-top: 1px solid var(--line); }
.sb-main { flex: 1 0 auto; min-width: 0; display: flex; align-items: center; gap: 2px; }
.sb-avatar { flex: none; padding: 2px; border: 0; border-radius: 50%; background: transparent; }
.sb-avatar .avatar { --size: 24px; }
.statusbar .panel-btn { flex: none; }
.statusbar .mic-btn { flex: none; width: 88px; justify-content: flex-start; }
.sb-status { flex: 1; width: 0; overflow: hidden; display: flex; align-items: center; gap: 4px; margin-left: 4px; color: var(--muted); font-size: var(--fs-sm); }
.sb-status svg { width: 14px; height: 14px; flex: none; }
.sb-status.talking { color: var(--green-strong); }
.sb-status.talking.shouting { color: var(--shout); }
.sb-status.blocked svg { color: var(--danger); }
.sb-shout { min-width: 0; display: flex; align-items: center; gap: 6px; }
.sb-shout[hidden] { display: none; }
.sb-shout .talk-group { display: flex; min-width: 0; }
.sb-shout .target { max-width: 110px; background: var(--hover); color: var(--text); }
.sb-shout .target:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 12%, var(--hover)); }
.sb-link { min-width: 0; display: flex; align-items: center; gap: 4px; color: var(--green-strong); font-size: var(--fs-sm); }
.sb-link:empty { display: none; }
.sb-room { min-width: 0; display: flex; align-items: center; gap: 4px; max-width: 140px; }
.sb-room svg { width: 14px; height: 14px; flex: none; }
/* 转发模式:状态栏里本机到语音服务器的信号格与延迟 */
.sb-quality { display: flex; align-items: center; gap: 4px; flex: none; white-space: nowrap; }
@media (max-width: 1080px) { .sb-shout kbd { display: none; } }
@media (max-width: 680px) {
  .app, .app.no-roster { grid-template-rows: 48px auto 1fr auto; grid-template-areas: 'bar' 'side' 'main' 'foot'; }
  .statusbar { position: sticky; bottom: 0; z-index: 3; flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
  .sb-main { flex: 0 1 auto; }
  .sb-link { flex: 1; justify-content: flex-end; }
  .statusbar .talk-mode { max-width: 110px; }
  .sb-shout { order: 3; width: 100%; }
  .sb-status { display: none; }
  .statusbar .mic-btn { width: 72px; }
}

/* ===== YY 式工具栏按钮:无边框、透明底、16px 图标 + 12px 文字;悬停浅底,按下加深并下移 1px ===== */
.tool, .statusbar .panel-btn, .statusbar .mic-btn, .sb-shout .talk-button, .room-head .ghost-icon {
  height: 26px; min-width: 26px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px;
  border: 0; border-radius: 4px; background: transparent; color: var(--text); font-size: var(--fs-sm); font-weight: 400; white-space: nowrap; transition: background .1s; }
.statusbar .panel-btn, .room-head .ghost-icon { width: 26px; padding: 0; color: var(--muted); }
.tool svg, .statusbar .panel-btn svg, .statusbar .mic-btn svg, .room-head .ghost-icon svg { width: 16px; height: 16px; flex: none; }
.tool:hover:not(:disabled), .statusbar .panel-btn:hover:not(:disabled), .statusbar .mic-btn:hover:not(:disabled), .sb-shout .talk-button:hover:not(:disabled), .room-head .ghost-icon:hover { background: var(--hover); color: var(--text); }
.tool:active:not(:disabled), .statusbar .panel-btn:active:not(:disabled), .statusbar .mic-btn:active:not(:disabled), .sb-shout .talk-button:active:not(:disabled), .room-head .ghost-icon:active {
  background: color-mix(in srgb, var(--text) 13%, transparent); transform: translateY(1px); }
.statusbar .mic-btn { color: var(--green); }
.statusbar .mic-btn.off, .statusbar .panel-btn.off, .statusbar .panel-btn.hang { color: var(--danger); }
.statusbar .mic-btn.talking { background: var(--green-soft); }
.sb-shout .talk-button.active { background: var(--shout); color: #fff; transform: translateY(1px); }
.sb-shout .talk-button kbd { padding: 0 4px; font-size: var(--fs-xs); line-height: 14px; }
.statusbar :disabled { opacity: .45; }
/* 下拉按钮:文字后带小三角 */
.tool.drop::after { content: ''; flex: none; margin-top: 3px; border: 3.5px solid transparent; border-top-color: currentColor; opacity: .6; }
.tool.drop .truncate { min-width: 0; }
.talk-mode { flex: none; color: var(--muted); }
/* 触屏上的「点击说话」:按住说话的实体按钮;手指按下与说话中用说话绿描边 */
.statusbar .tap-talk { flex: none; height: 30px; padding: 0 12px; }
.statusbar .tap-talk.active, .statusbar .tap-talk:active:not(:disabled) { border-color: var(--speak); background: color-mix(in srgb, var(--speak) 18%, transparent); color: var(--speak); transform: none; }
/* 按钮组之间的短细竖线 */
.sb-sep, .sb-shout::before, .sb-link::before { content: ''; flex: none; width: 1px; height: 16px; margin: 0 4px; background: var(--line); }
/* 主按钮保持实心,更矮、圆角更小 */
.composer .button.primary, .stage .button.primary { min-height: 30px; height: 30px; padding: 0 14px; border-radius: 4px; font-size: var(--fs-sm); }
.composer input { min-height: 30px; border-radius: 4px; font-size: var(--fs-sm); }
/* 列表更紧凑:12px 字号 */
.room-link { min-height: 26px; gap: 6px; font-size: var(--fs-sm); }
.tree-member { min-height: 26px; font-size: var(--fs-sm); }
.member-row { padding: 3px 8px; }
.member-name strong { font-size: var(--fs-sm); }
@media (max-width: 680px) { .sb-shout::before, .sb-sep { display: none; } }

/* 任务 19:频道未读、新消息分隔线、跳到最新、正在输入 */
.room-link.unread .name { color: var(--text); font-weight: 700; }
.unread-count { flex: none; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--green); color: #fff; font-size: var(--fs-xs); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.unread-count.mention { background: var(--danger, #e5484d); }
.new-divider { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--green); font-size: var(--fs-xs); font-weight: 600; }
.new-divider::before { content: ''; flex: 1; border-top: 1px solid var(--green); }
.new-divider + .message { margin-top: 0; }
.composer { position: relative; }
/* 给「正在输入」留出一行,不压住最后一条消息 */
.messages { padding-bottom: 22px; }
.composer .typing { position: absolute; bottom: 100%; left: 16px; max-width: calc(100% - 32px); padding: 0 6px; border-radius: 4px; background: var(--main); color: var(--muted); font-size: var(--fs-xs); line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.composer .jump-latest { position: absolute; bottom: calc(100% + 4px); right: 16px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); box-shadow: var(--shadow); color: var(--green); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.composer .jump-latest:hover { background: var(--green-soft); }

/* 任务 20:作战通知 */
.tb-button .count-badge { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: var(--fs-xs); font-weight: 700; line-height: 16px; text-align: center; }
.alert-banner { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--green-line); background: var(--green-soft); }
.alert-banner > svg { flex: none; width: 20px; height: 20px; color: var(--green); }
.alert-banner.urgent { border-bottom-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 12%, var(--main)); }
.alert-banner.urgent > svg { color: var(--danger); animation: alert-pulse 1s ease-in-out infinite; }
@keyframes alert-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .alert-banner.urgent > svg { animation: none; } }
.ab-main { flex: 1; min-width: 0; display: grid; }
.ab-main strong { font-size: var(--fs-md); }
.ab-main small { color: var(--muted); font-size: var(--fs-xs); }
.ab-actions { flex: none; display: flex; align-items: center; gap: 6px; }
.ab-actions .button { min-height: 28px; height: 28px; padding: 0 10px; font-size: var(--fs-sm); white-space: nowrap; }
@media (max-width: 680px) { .alert-banner { flex-wrap: wrap; } .ab-actions { width: 100%; flex-wrap: wrap; } }
#alerts-dialog { width: min(640px, calc(100vw - 32px)); }
.alerts-modal .modal-title h2 { flex: 1; }
.alert-form { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.alert-form textarea { resize: vertical; }
.alert-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.alert-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-bottom: 6px; }
.alert-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; }
.alert-pick legend { width: 100%; margin-bottom: 6px; padding: 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
/* 胶囊式多选:隐藏原生勾选框,选中后主色填充 */
.alert-form .alert-pick label.inline { position: relative; max-width: 12em; height: 28px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); color: var(--text); font-size: var(--fs-sm); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.alert-form .alert-pick label.inline:hover { border-color: var(--green-line); background: var(--green-soft); }
.alert-form .alert-pick input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.alert-form .alert-pick label.inline:has(input:checked) { border-color: var(--green); background: var(--green); color: #fff; }
.alert-form .alert-pick label.inline:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.alert-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.alert-list { display: grid; gap: 8px; max-height: 55vh; overflow: auto; }
.alert-card { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 8px; }
.alert-card.urgent { border-left-color: var(--danger); }
.alert-card.ended { opacity: 0.6; }
.alert-card header { display: flex; align-items: center; gap: 8px; min-width: 0; }
.alert-card header small { flex: none; color: var(--muted); font-size: var(--fs-xs); }
.mode-tag.urgent { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.ac-meta, .ac-roster p { color: var(--muted); font-size: var(--fs-xs); }
.ac-note { font-size: var(--fs-sm); white-space: pre-wrap; }
.ac-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-stats .stat { padding: 1px 8px; border-radius: 99px; background: var(--panel-2); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.ac-stats .stat.ack { background: var(--green-soft); color: var(--green); }
.ac-stats .stat.omw { background: color-mix(in srgb, #3b82f6 14%, transparent); color: #3b82f6; }
.ac-stats .stat.no { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.ac-roster summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); }
.ac-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.webhooks { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.webhooks h3 { font-size: var(--fs-md); }
.webhooks small { color: var(--muted); }
.webhooks small.error { color: var(--danger); }
.webhook-form { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
.webhook-form input, .webhook-form select { min-height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
/* 窄屏下标题栏按钮收窄,给作战通知按钮让出空间 */
@media (max-width: 480px) { .tb-button { width: 28px; } }
/* 自己的资料卡:编辑资料、退出登录并排 */
.pc-actions.self { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pc-actions .button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.button.danger { color: var(--danger); }
.button.danger:hover { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
/* 注册页说明:没有邀请链接时提示,并给出回到登录的入口 */
.auth-note { padding: 8px 10px; border-radius: 8px; background: var(--green-soft); color: var(--text); font-size: var(--fs-sm); line-height: 1.5; }
.auth-note .text-button { display: inline; padding: 0; color: var(--green); font-size: var(--fs-sm); font-weight: 600; }
/* 多条作战通知:横幅「还有 N 条」、列表分组 */
.ab-main .ab-more { justify-self: start; padding: 0; color: var(--green); font-size: var(--fs-xs); font-weight: 600; }
.alert-banner.urgent .ab-more { color: var(--danger); }
.alert-group { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.alert-ended { display: grid; gap: 8px; }
.alert-ended > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.alert-ended[open] > summary { margin-bottom: 0; }
/* 作战通知按钮带文字,窄屏只留图标 */
#alerts-open { width: auto; grid-auto-flow: column; gap: 4px; padding: 0 8px; }
#alerts-open .tb-label { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
#alerts-open .count-badge { position: static; }
@media (max-width: 900px) { #alerts-open { width: 32px; padding: 0; } #alerts-open .tb-label { display: none; } #alerts-open .count-badge { position: absolute; } }
@media (max-width: 480px) { #alerts-open { width: 28px; } }

/* 任务 21:聊天升级 */
.message-actions .ghost-icon { width: 28px; height: 28px; }
.reply-quote { display: flex; align-items: center; gap: 4px; max-width: 100%; margin: 2px 0; padding: 0; border: 0; background: none; color: var(--muted); font-size: var(--fs-xs); text-align: left; cursor: pointer; }
.reply-quote svg { flex: none; width: 13px; height: 13px; }
.reply-quote b { flex: none; color: var(--text); font-weight: 600; }
.reply-quote:hover span { color: var(--text); }
.reply-quote.deleted { cursor: default; font-style: italic; }
.reply-quote.deleted:hover span { color: var(--muted); }
.msg-image { display: block; margin-top: 4px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); cursor: zoom-in; }
.msg-image img { display: block; width: auto; height: auto; max-width: 100%; max-height: 280px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.reaction span { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.reaction:hover { border-color: var(--green-line); }
.reaction.mine { border-color: var(--green); background: var(--green-soft); }
.reaction.mine span { color: var(--green); }
.mention-tag { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); font-weight: 600; }
.mention-tag.me { background: color-mix(in srgb, var(--green) 24%, transparent); }
@keyframes msg-flash { from { background: color-mix(in srgb, var(--green) 25%, transparent); } }
.message.flash { animation: msg-flash 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) { .message.flash { animation: none; outline: 2px solid var(--green); } }
.composer { flex-wrap: wrap; }
.composer .attach { flex: none; align-self: center; }
.draft-bar { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.draft-reply, .draft-image { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; padding: 2px 4px 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-xs); }
.draft-reply svg { flex: none; width: 13px; height: 13px; }
.draft-image img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; }
.draft-image.uploading img { opacity: 0.5; }
.draft-bar .ghost-icon { width: 22px; height: 22px; }
.mention-picker { position: absolute; bottom: calc(100% + 4px); left: 16px; z-index: 5; display: grid; width: min(280px, calc(100% - 32px)); max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.mention-picker button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: var(--fs-sm); text-align: left; }
.mention-picker button .avatar { --size: 22px; }
.mention-picker button.active, .mention-picker button:hover { background: var(--hover); }
.mention-all { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; }
.react-picker { position: fixed; z-index: 12; display: flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); box-shadow: var(--shadow); }
.react-picker button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; font-size: var(--fs-lg); }
.react-picker button:hover { background: var(--hover); }
/* 看图弹窗:选择器带上 dialog,才压得过通用的 dialog(宽 400px)与 dialog:modal(overflow: auto、max-height) */
dialog.image-dialog { width: fit-content; max-width: 92vw; max-height: calc(100dvh - 80px); padding: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; }
.image-dialog::backdrop { background: rgb(0 0 0 / 75%); }
dialog.image-dialog img { display: block; width: auto; height: auto; max-width: 92vw; max-height: calc(100dvh - 80px); border-radius: 8px; cursor: zoom-out; }
dialog.image-dialog .close { position: absolute; top: -36px; right: 0; background: rgb(0 0 0 / 45%); color: #fff; }
.draft-bar[hidden], .mention-picker[hidden], .react-picker[hidden] { display: none; }
.composer textarea[name=text] { flex: 1; min-width: 0; height: 30px; max-height: 120px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: inherit; font: inherit; font-size: var(--fs-sm); line-height: 16px; resize: none; }
.composer textarea[name=text]:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.composer textarea[name=text]:disabled { opacity: .6; }
.composer .attach, .composer [type=submit] { align-self: flex-end; }
.msg-link { color: var(--green); text-decoration: underline; overflow-wrap: anywhere; }
/* 缩略图跟着消息正文的可用宽度等比缩小(公屏最宽 360px,私聊小窗与手机更窄),不靠 overflow 切边 */
.msg-image { width: fit-content; max-width: min(360px, 100%); }
/* EVE 集成 */
.eve-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.eve-row > input, .eve-row > select { flex: 1; min-width: 0; }
.eve-row .button { flex: none; }
.eve-row label.inline { flex: 1; min-width: 0; }
.eve-name { flex: 1; min-width: 0; font-weight: 600; }
.eve-list, .eve-section, #eve-policy { display: grid; gap: 8px; min-width: 0; }
.eve-item { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.eve-item > .truncate { flex: 1; min-width: 0; }
.eve-item select { flex: none; width: auto; max-width: 40%; min-height: 30px; }
.eve-item .text-button, .eve-item .ghost-icon { flex: none; }
.eve-main { flex: none; padding: 0 6px; border-radius: 4px; background: var(--green-soft); color: var(--green); font-size: var(--fs-xs); }
.pc-eve { display: grid; gap: 4px; font-size: var(--fs-sm); }
.pc-eve summary { color: var(--muted); cursor: pointer; }
.pc-eve .eve-item { padding: 4px 8px; }
/* 任务 27:游戏身份 + 昵称、外部接口令牌 */
.name-nick { color: var(--muted); font-weight: 400; }
.uname.truncate { min-width: 0; }
.bot-token-form { display: grid; gap: 10px; }
.bot-token-form > label { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
.bot-token-new { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--green-line); border-radius: 8px; background: var(--green-soft); font-size: var(--fs-sm); }
.bot-token-new[hidden] { display: none; }
.ban-row small.bot-scopes { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
