/* 跑图 / 训练赛服务器：只显示当前用户自己的服务器，不展示公共房间池。 */
.tb-console [hidden] { display: none !important; }
.tb-console button:focus-visible, .tb-console a:focus-visible, .tb-console summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 页头：标题 + 状态 + 右侧按钮 */
.tb-console-head { align-items: flex-end; }
.tb-console-title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tb-console-subtitle { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.tb-console-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tb-console-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tb-console-badge.is-online { color: var(--ok); border-color: rgba(62, 207, 142, .4); background: rgba(62, 207, 142, .1); }
.tb-console-badge.is-wait { color: var(--accent-2); border-color: rgba(245, 165, 36, .4); background: rgba(245, 165, 36, .1); }
body.tb-scheme-light .tb-console-badge.is-online { color: #047857; }
.tb-console-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tb-console-actions form { margin: 0; }
.tb-console-actions .tb-btn { padding: 10px 22px; font-size: 15px; }
.tb-console-actions.is-quiet .tb-btn { background: transparent; border-color: var(--line); color: var(--text); font-weight: 600; }
.tb-console-actions.is-quiet .tb-btn:hover { border-color: var(--err); color: var(--err); background: rgba(255, 107, 107, .08); filter: none; }
.tb-console-actions .tb-btn:disabled { opacity: .6; cursor: default; transform: none; }

/* 提示条 */
.tb-console-notice { margin: 0 0 16px; padding: 12px 16px; border: 1px solid rgba(245, 165, 36, .4); border-radius: 10px; background: rgba(245, 165, 36, .08); font-size: 14px; }
.tb-console-notice p { margin: 6px 0 0; color: var(--muted); }
.tb-console-notice small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

/* 未启动：左边启动条件，右边免费说明 */
.tb-console-start { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.tb-console-req, .tb-console-policy, .tb-console-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.tb-console-start h2 { margin: 0 0 14px; font-size: 16px; }
.tb-console-req ol { list-style: none; margin: 0; padding: 0; }
.tb-console-req li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.tb-console-req li:first-child { border-top: 0; padding-top: 2px; }
.tb-console-req i { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-style: normal; font-size: 12px; font-weight: 700; }
.tb-console-req li.is-ok i { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tb-console-req b { display: block; font-size: 14px; }
.tb-console-req small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.tb-console-req li.is-ok small { color: var(--ok); }
body.tb-scheme-light .tb-console-req li.is-ok small { color: #047857; }
.tb-console-next { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.tb-console-policy p { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.tb-console-policy p:last-child { margin-bottom: 0; }
.tb-console-policy strong { color: var(--text); }

/* 已启动：状态条 + 连接卡片 */
.tb-console-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.tb-console-stats > div { padding: 14px 20px; border-left: 1px solid var(--line); min-width: 0; }
.tb-console-stats > div:first-child { border-left: 0; }
.tb-console-stats dt { color: var(--muted); font-size: 12px; }
.tb-console-stats dd { margin: 4px 0 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-console-card { padding: 20px 22px 22px; }
.tb-console-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.tb-console label, .tb-console-label { display: block; color: var(--text); font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.tb-console-settings { margin: 0; }
.tb-console-settings small { display: block; color: var(--muted); font-size: 12px; margin-top: 8px; }
.tb-console-input { display: flex; align-items: center; min-width: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tb-console-input:focus-within { border-color: var(--accent); }
.tb-console-input input { width: 0; min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); padding: 12px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tb-console-input button { border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; padding: 0 14px; cursor: pointer; white-space: nowrap; }
.tb-console-input button.tb-eye { border-left: 0; color: var(--muted); padding: 0 10px; }
.tb-console-input button:hover { background: rgba(var(--accent-rgb), .08); }
.tb-console-input button.tb-eye:hover { color: var(--text); background: none; }
.tb-console-input button:disabled { color: var(--muted); cursor: default; background: none; }
.tb-secret-mask { flex: 1; padding: 12px; color: var(--muted); font-size: 13px; }
.tb-eye svg { display: block; }
.tb-eye[aria-pressed=true] .tb-eye-slash { display: none; }
.tb-console-connections .tb-console-input { height: 46px; box-sizing: border-box; }
.tb-console-connections .tb-console-input input, .tb-console-connections .tb-secret-mask { box-sizing: border-box; height: 44px; line-height: 20px; padding: 12px; margin: 0; }
.tb-console-connections .tb-console-input button { height: 44px; display: flex; align-items: center; justify-content: center; }
.tb-console-connections .tb-connection-hint { display: block; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 20px; }
.tb-console-feedback { min-height: 18px; color: var(--accent); font-size: 12px; margin: 4px 0 0; }

/* 地图 */
.tb-console-map { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.tb-map-live { display: inline !important; margin-left: 10px; font-weight: 400; color: var(--muted); font-size: 13px; }
.tb-map-controls { display: flex; gap: 12px; align-items: stretch; }
.tb-map-picker { position: relative; flex: 1; min-width: 0; }
.tb-map-picker summary { display: flex; align-items: center; gap: 10px; height: 46px; box-sizing: border-box; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; cursor: pointer; list-style: none; font-size: 14px; }
.tb-map-picker summary::-webkit-details-marker { display: none; }
.tb-map-picker[open] summary, .tb-map-picker summary:hover { border-color: var(--accent); }
.tb-map-picker img { width: 26px; height: 26px; object-fit: contain; }
.tb-map-chevron { display: block; flex-shrink: 0; margin-left: auto; color: var(--muted); transition: transform .15s ease; }
.tb-map-picker[open] .tb-map-chevron { transform: rotate(180deg); }
.tb-map-options { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; max-height: 340px; overflow: auto; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
body.tb-scheme-light .tb-map-options { box-shadow: 0 16px 40px rgba(14, 23, 38, .14); }
.tb-map-options button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.tb-map-options button:hover { background: var(--bg2); }
.tb-map-options button[aria-pressed=true] { background: rgba(var(--accent-rgb), .12); color: var(--accent); font-weight: 600; }
.tb-map-options small { margin: 0 0 0 auto; font-size: 12px; }
.tb-map-controls > .tb-btn { flex-shrink: 0; height: 46px; padding: 0 22px; }
.tb-map-controls > .tb-btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }

/* 标签页：局内指令 / 使用说明 */
.tb-console-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin: 32px 0 18px; }
.tb-console-tabs button { background: transparent; color: var(--muted); border: 0; padding: 12px 2px; font: inherit; font-size: 15px; cursor: pointer; box-shadow: inset 0 -2px 0 transparent; }
.tb-console-tabs button:hover { color: var(--text); }
.tb-console-tabs button[aria-selected=true] { color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.tb-console-help { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.tb-console-command { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s; }
.tb-console-command:hover { border-color: rgba(var(--accent-rgb), .6); }
.tb-console-cmd-ico { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 56px; height: 40px; padding: 0 8px; box-sizing: border-box; border-radius: 8px; background: rgba(var(--accent-rgb), .1); color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 700; }
.tb-console-command b { display: block; font-size: 15px; }
.tb-console-command small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.tb-console-go { margin-left: auto; color: var(--accent); font-size: 13px; white-space: nowrap; }
.tb-console-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.tb-console-list li { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-top: 1px solid var(--line); }
.tb-console-list li:first-child { border-top: 0; }
.tb-console-list strong { font-size: 14px; }
.tb-console-list p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.tb-console-list a { flex-shrink: 0; font-size: 13px; }
.tb-console-footnote { text-align: center; font-size: 12px; color: var(--muted); margin: 28px 0 0; }

/* 指令弹窗 */
.tb-command-dialog { color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px 16px; width: min(760px, calc(100vw - 32px)); max-height: 80vh; box-sizing: border-box; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.tb-command-dialog::backdrop { background: rgba(4, 8, 14, .66); }
body.tb-scheme-light .tb-command-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.tb-command-dialog header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tb-command-dialog h2 { font-size: 18px; margin: 0; }
.tb-command-dialog header button { width: 32px; height: 32px; background: transparent; border: 0; border-radius: 8px; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.tb-command-dialog header button:hover { color: var(--text); background: var(--bg2); }
.tb-command-dialog input { box-sizing: border-box; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); color: inherit; font: inherit; font-size: 14px; }
.tb-command-dialog input:focus { outline: none; border-color: var(--accent); }
.tb-command-dialog p { color: var(--muted); font-size: 12px; margin: 10px 0; }
.tb-command-row { display: flex; align-items: center; gap: 16px; width: 100%; background: transparent; border: 0; border-top: 1px solid var(--line); padding: 11px 6px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tb-command-row:hover { background: var(--bg2); }
.tb-command-row code { flex-shrink: 0; min-width: 110px; white-space: nowrap; color: var(--accent); font-size: 13px; font-weight: 700; }
.tb-command-row span { font-size: 13px; color: var(--muted); }
.tb-command-dialog [hidden] { display: none !important; }

@media (max-width: 760px) {
	.tb-console-start { grid-template-columns: minmax(0, 1fr); }
	.tb-console-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tb-console-stats > div:nth-child(3) { border-left: 0; }
	.tb-console-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
	.tb-console-head { align-items: flex-start; flex-direction: column; }
	.tb-console-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
	.tb-console-req, .tb-console-policy, .tb-console-card { padding: 16px; }
	.tb-console-list li { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }
	.tb-map-options { grid-template-columns: minmax(0, 1fr); }
	.tb-map-controls > .tb-btn { padding: 0 14px; }
	.tb-command-row { align-items: flex-start; flex-direction: column; gap: 4px; }
}
