/* TermToGo · 终端页（5.9）。颜色取自设计稿 tokens.css 的 --term-* */
.app.tt { background: var(--term-bg); color: var(--term-fg); --fg: var(--term-fg); --muted: var(--term-dim); padding-bottom: 0; }
.ttbar { height: 44px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 4px; border-bottom: 1px solid oklch(100% 0 0 / .07); position: relative; z-index: 8; }
.ttbar .ibtn { color: var(--term-fg); }
.ttbar .ibtn:active { background: oklch(100% 0 0 / .08); }
.sname { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px; border-radius: 8px; font-weight: 700; font-size: 16px; font-family: var(--font-mono); min-width: 0; max-width: calc(100% - 150px); color: var(--term-fg); }
.sname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sname svg { width: 16px; height: 16px; color: var(--term-dim); }
.sname:active { background: oklch(100% 0 0 / .08); }
.stdot { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; flex: none; }
.stdot .dot { width: 9px; height: 9px; }
.stdot .warn-mark { width: 16px; height: 16px; }
.bubble { position: absolute; top: calc(100% + 4px); right: 8px; z-index: 30; background: var(--surface); color: var(--fg); border-radius: 10px; padding: 8px 12px; font-size: 13px; white-space: nowrap; box-shadow: 0 8px 24px oklch(0% 0 0 / .35); animation: fade .15s; }
.app.tt .bubble { --fg: oklch(22% 0.02 240); background: oklch(98% 0 0); color: oklch(22% 0.02 240); }
.selbar { position: absolute; inset: 0; background: oklch(24% 0.02 245); display: flex; align-items: center; gap: 4px; padding: 0 6px; z-index: 3; }
.selbar .t { flex: 1; text-align: center; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selbar .tlink { color: var(--term-fg); height: 36px; font-size: 15px; }
.selbar .tlink.accent { color: var(--term-green); }
.selbar .tlink:disabled { opacity: .4; }

#term-wrap { flex: 1; min-height: 0; position: relative; overflow: hidden; }
#term { position: absolute; top: 4px; left: 6px; right: 0; bottom: 0; transform-origin: 0 0; }
.xterm .xterm-viewport { background: var(--term-bg) !important; overflow-x: hidden !important; scrollbar-width: none; }
.xterm .xterm-viewport::-webkit-scrollbar { display: none; }
.xterm .xterm-scrollable-element > .scrollbar { display: none !important; }
.xterm { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* 接收系统键盘的输入层：放在光标位置，输入法候选框会出现在光标附近；始终看不见 */
#kin { position: absolute; z-index: 4; margin: 0; padding: 0; border: 0; outline: 0; resize: none; overflow: hidden;
  background: transparent; color: transparent; caret-color: transparent; white-space: pre;
  font-family: var(--font-mono); font-size: 16px; line-height: 1; width: 2px; height: 1em; min-width: 2px; left: 0; top: 0; }
/* 补全候选面板 */
#cands[hidden] { display: none !important; }
#cands { position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 6; max-height: 46%; overflow-y: auto;
  background: oklch(24% 0.012 250); border: 1px solid oklch(100% 0 0 / .14); border-radius: 12px;
  box-shadow: 0 10px 30px oklch(0% 0 0 / .5); padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; overscroll-behavior: contain; }
#cands .c { padding: 7px 11px; border-radius: 8px; background: oklch(32% 0.012 250); font: 500 13.5px var(--font-mono); color: var(--term-fg); }
#cands .c.on { background: var(--accent-fill); color: #fff; font-weight: 700; }
#cands .hd { flex: 1 0 100%; font-size: 11.5px; color: var(--term-dim); padding: 0 2px 2px; }
/* 自己画的滚动条：右边缘按住上下拖可以快速定位 */
#sbar { position: absolute; top: 4px; bottom: 4px; right: 0; width: 28px; z-index: 5; pointer-events: none; opacity: 0; transition: opacity .3s; }
#sbar.on { opacity: 1; transition: none; }
#sbar .th { position: absolute; right: 3px; width: 5px; min-height: 36px; border-radius: 3px; background: oklch(80% 0.01 250 / .55); }
#sbar.scrub .th { width: 8px; right: 2px; background: oklch(85% 0.01 250 / .9); }
#sbar .lb { position: absolute; right: 16px; transform: translateY(-50%); padding: 3px 8px; border-radius: 6px; white-space: nowrap; background: oklch(25% 0.01 250 / .92); color: var(--term-fg); font: 500 12px var(--font-mono); display: none; }
#sbar.scrub .lb { display: block; }
.pill { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); height: 34px; padding: 0 14px; border-radius: 17px; background: oklch(98% 0 0); color: oklch(22% 0.02 240); font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 18px oklch(0% 0 0 / .4); display: flex; align-items: center; gap: 6px; z-index: 5; animation: fade .15s; white-space: nowrap; }
.pill.new { background: var(--accent-fill); color: var(--on-fill); }
.zoomhint { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 12px; background: oklch(0% 0 0 / .72); color: oklch(98% 0 0); font-family: var(--font-mono); font-size: 15px; font-weight: 600; z-index: 6; pointer-events: none; white-space: nowrap; }
.tbanner { position: absolute; left: 0; right: 0; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 13.5px; background: color-mix(in oklch, var(--wait) 22%, var(--term-bg)); color: var(--term-fg); animation: fade .15s; }
.tbanner.warn { background: color-mix(in oklch, var(--warn) 20%, var(--term-bg)); }
.tbanner.info { background: oklch(28% 0.012 250); color: var(--term-dim); }
.tbanner .warn-mark { width: 15px; height: 15px; }
.tbanner button { margin-left: auto; font-weight: 700; height: 28px; padding: 0 6px; white-space: nowrap; }
.toverlay { position: absolute; inset: 0; z-index: 7; background: oklch(17% 0.012 250 / .9); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 32px; gap: 6px; }
.toverlay h2 { font-family: var(--font-display); font-size: 19px; margin: 8px 0 2px; color: oklch(98% 0 0); }
.toverlay p { color: var(--term-dim); margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; }
.toverlay .btn.secondary { background: oklch(100% 0 0 / .1); color: var(--term-fg); }
.toverlay.clear { background: transparent; pointer-events: none; }
.tend { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; background: oklch(24% 0.012 250); border-top: 1px solid oklch(100% 0 0 / .1); padding: 12px 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tend b { flex: 1; font-size: 15px; white-space: nowrap; }
.tend .btn { height: 38px; padding: 0 14px; font-size: 14.5px; border-radius: 10px; }
.tend .btn.secondary { background: oklch(100% 0 0 / .1); color: var(--term-fg); }
/* 输入框 5.9.2 */
.compose { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px 8px 4px; background: oklch(22% 0.012 250); border-top: 1px solid oklch(100% 0 0 / .07); }
.compose[hidden] { display: none; }
.compose textarea { flex: 1; min-height: 40px; max-height: 140px; resize: none; border-radius: 12px; border: 1px solid oklch(100% 0 0 / .12); background: var(--term-bg); color: var(--term-fg); padding: 9px 12px; font-size: 16px; line-height: 1.4; font-family: var(--font-ui); }
.compose textarea:focus { outline: none; border-color: var(--accent); }
.compose .snd { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-fill); color: var(--on-fill); display: grid; place-items: center; flex: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.compose .snd svg { width: 20px; height: 20px; }
.compose .snd:disabled { background: oklch(100% 0 0 / .1); color: var(--term-dim); }
.compose .x { width: 32px; height: 40px; color: var(--term-dim); display: grid; place-items: center; flex: none; }
.compose .x svg { width: 18px; height: 18px; }
/* 快捷键栏 5.9.1 */
.kbar { flex: none; height: 44px; display: flex; align-items: center; background: oklch(24% 0.012 250); border-top: 1px solid oklch(100% 0 0 / .07); }
.kbar .keys { flex: 1; display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 0 8px; height: 100%; scrollbar-width: none; min-width: 0; }
.kbar .keys::-webkit-scrollbar { display: none; }
.kbar .keys { --fl: 0px; --fr: 0px; -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); }
.kbar .keys.more-r { --fr: 36px; }
.kbar .keys.more-l { --fl: 36px; }
.kbar .fixed { display: flex; gap: 2px; padding: 0 4px 0 6px; border-left: 1px solid oklch(100% 0 0 / .1); height: 100%; align-items: center; }
.kbar .fixed .ibtn { width: 40px; height: 40px; color: var(--term-fg); }
.kbar .fixed .ibtn[aria-pressed="true"] { color: var(--term-green); }
.kbar .fixed .ibtn svg { width: 21px; height: 21px; }
.kbar.off .keys, .kbar.off #phr { opacity: .4; }
.k { height: 34px; min-width: 40px; padding: 0 10px; border-radius: 8px; background: oklch(32% 0.012 250); color: var(--term-fg); font: 500 14px var(--font-mono); flex: none; box-shadow: 0 1px 0 oklch(0% 0 0 / .4); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.k.down { background: oklch(46% 0.012 250); }
.k[aria-pressed="true"] { background: var(--term-fg); color: var(--term-bg); font-weight: 700; }
.k.lock { box-shadow: 0 0 0 2px var(--term-green); }
.safe-b { flex: none; height: var(--sab); background: oklch(24% 0.012 250); }
.app.tt.kb .safe-b { height: 0; }
.phr .cell { font-size: 15.5px; }
/* 横屏：顶部栏缩成 32 高 */
@media (orientation: landscape) and (max-height: 500px) {
  .ttbar { height: 32px; }
  .ttbar .ibtn, .stdot { height: 32px; }
  .sname { height: 28px; font-size: 14px; }
  .kbar { height: 40px; }
  .k { height: 30px; }
}
.xterm .xterm-scrollable-element { background: transparent !important; }
