/* easycpp 浅色教学主题
   编辑器用「透明 textarea + 底层高亮镜像层」实现语法高亮。
   因此下面这几条是硬约束，改的时候别动：
     1. .code-view 和 .editor 的 font-family / font-size / line-height / padding /
        letter-spacing / tab-size / box-sizing 必须完全一致，否则文字会错位。
     2. 代码高亮里不能用 italic / bold —— 斜体字形宽度可能和正体不同，一用就错位。
        所以注释只用灰色，不加倾斜。font-synthesis:none 兜底禁止浏览器合成字形。
*/

:root{
  --page:#f1f3f7;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --fg:#1e293b;
  --fg-2:#64748b;
  --fg-3:#94a3b8;
  --line:#e2e8f0;
  --line-2:#cbd5e1;
  --acc:#1672f8;
  --acc-dark:#1d4ed8;
  --acc-soft:#eff6ff;
  --ok:#16a34a;
  --ok-soft:#f0fdf4;
  --warn:#d97706;
  --warn-soft:#fffbeb;
  --err:#dc2626;
  --err-soft:#fef2f2;
  --r:14px;

  /* 编辑器度量：改这两个值要同时改 JS 里 lineHeightPx/paddingTopPx 的读法（都是运行时读计算样式，安全） */
  --fs:15px; --lh:24px; --pad:14px;
}

*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;}
body{
  height:100vh; height:100dvh;
  display:flex; flex-direction:column;
  background:var(--page); color:var(--fg);
  font-family:-apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  font-size:16px; line-height:1.5;
  overflow:hidden;
  overscroll-behavior:none;
}
.hidden{display:none !important;}
body.keyboard-viewport{height:var(--editor-height,100dvh);}

/* ---------------- 顶栏 ---------------- */
.top{
  flex:0 0 auto; display:flex; align-items:center; gap:10px;
  padding:10px 14px; padding-top:calc(10px + env(safe-area-inset-top));
  background:var(--surface); border-bottom:1px solid var(--line);
}
.logo{font-weight:700; font-size:23px; letter-spacing:-.6px; color:#111827;}
.brand-mark{color:var(--acc); font:600 25px/1 Consolas,monospace; letter-spacing:-3px; margin-right:3px;}
.dot{width:9px; height:9px; border-radius:50%; background:var(--line-2); margin-left:auto;}
.dot-ok{background:var(--ok);}
.dot-warn{background:var(--warn);}
.dot-err{background:var(--err);}
.dot-wait{background:var(--line-2);}
.icon-btn{
  border:0; background:transparent; color:var(--fg-2); font-size:22px; line-height:1;
  width:44px; height:44px; border-radius:12px; cursor:pointer;
}
.icon-btn:active{background:var(--surface-2);}
.file-button{border:0;background:var(--acc-soft);color:var(--acc);border-radius:10px;padding:9px 10px;font:inherit;font-size:14px;white-space:nowrap;cursor:pointer;min-height:44px;}
.file-button span{font-size:9px;margin-left:3px;}
.publication-notice{flex:0 0 auto;border:0;border-bottom:1px solid #d6e7ff;padding:10px 14px;background:var(--acc-soft);color:var(--acc-dark);text-align:left;font:inherit;font-size:14px;cursor:pointer;}
.file-actions{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0;}
.file-actions .mini{flex:1 1 130px;white-space:normal;height:auto;min-height:44px;padding:10px;}
.file-preview{max-height:200px;overflow:auto;background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:12px;white-space:pre;font:13px/1.6 Consolas,monospace;tab-size:4;}
.file-title{overflow-wrap:anywhere;}

/* ---------------- 提示条 ---------------- */
.notice{
  flex:0 0 auto; padding:9px 14px; font-size:13.5px; line-height:1.5;
  background:var(--warn-soft); color:#92400e; border-bottom:1px solid #fde68a;
}
.notice-err{background:var(--err-soft); color:#991b1b; border-bottom-color:#fecaca;}

/* ---------------- 编辑器 ---------------- */
.stage{
  position:relative; flex:1 1 auto; min-height:0; display:flex;
  background:var(--surface);
}
.gutter{
  flex:0 0 auto; min-width:2.8em; overflow:hidden;
  background:var(--surface-2); border-right:1px solid var(--line);
  padding-top:var(--pad); padding-bottom:var(--pad); text-align:right;
  font-family:"JetBrains Mono","Roboto Mono","Cascadia Mono",Consolas,"Courier New",monospace;
  font-size:var(--fs); line-height:var(--lh); font-weight:400; font-synthesis:none;
  color:var(--fg-3); user-select:none; -webkit-user-select:none;
}
.gutter span{display:block; height:var(--lh); line-height:var(--lh); padding-right:9px;}
.gutter span.cur{color:var(--acc); background:var(--acc-soft); font-weight:600;}

.editor-scroll{position:relative; flex:1; min-width:0; overflow:hidden;}

.backdrop{position:absolute; inset:0; overflow:hidden; pointer-events:none;}
.hl-bar{
  position:absolute; left:0; right:0; height:var(--lh);
  background:var(--acc-soft); border-left:3px solid var(--acc);
  display:none;
}
.code-view{
  margin:0; padding:var(--pad);
  font-family:"JetBrains Mono","Roboto Mono","Cascadia Mono",Consolas,"Courier New",monospace;
  font-size:var(--fs); line-height:var(--lh); font-weight:400;
  font-synthesis:none; font-variant-ligatures:none;
  letter-spacing:normal; tab-size:4; -moz-tab-size:4;
  white-space:pre; color:var(--fg);
  transform-origin:0 0; will-change:transform;
}

.editor{
  position:absolute; inset:0; width:100%; height:100%; margin:0;
  padding:var(--pad); border:0; outline:0; resize:none;
  font-family:"JetBrains Mono","Roboto Mono","Cascadia Mono",Consolas,"Courier New",monospace;
  font-size:var(--fs); line-height:var(--lh); font-weight:400;
  font-synthesis:none; font-variant-ligatures:none;
  letter-spacing:normal; tab-size:4; -moz-tab-size:4;
  white-space:pre; overflow:auto;
  overscroll-behavior-x:contain;
  touch-action:pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling:touch;
  background:transparent; color:var(--fg); caret-color:var(--acc);
}
/* 高亮开启时，textarea 自己的文字透明，只留光标，看到的是底下的彩色镜像层 */
.hl-on .editor{color:transparent;}
.hl-on .editor::selection{background:rgba(37,99,235,.22);}
/* 关掉高亮（大文件或用户手动关闭）就正常显示文字 */
.plain .backdrop{display:none;}
.plain .editor{color:var(--fg); background:var(--surface);}
/* 中文输入法拼字过程中必须让用户看见候选字，否则打中文全瞎 */
.composing .backdrop{visibility:hidden;}
.composing .editor{color:var(--fg); background:var(--surface);}

/* 可选的逐行检查：右侧专用按钮栏，不遮挡长代码；高亮与输入区度量一致。 */
.line-check-enabled{--lh:32px;}
.line-check-enabled .editor{right:44px;width:calc(100% - 44px);}
.line-check-enabled .backdrop{right:44px;}
.line-check-markers{position:absolute;top:0;bottom:0;right:0;width:44px;overflow:hidden;pointer-events:none;background:var(--surface);}
.line-ai-btn{border:0;border-radius:8px;background:var(--acc-soft);color:var(--acc);font:600 13px/1 system-ui,sans-serif;min-width:36px;min-height:28px;cursor:pointer;touch-action:manipulation;pointer-events:auto;}
.line-check-markers .line-ai-btn{position:absolute;right:4px;max-height:32px;}
.line-ai-btn[data-status="correct"]{background:var(--ok-soft);color:var(--ok);font-size:21px;}
.line-ai-btn[data-status="incorrect"],.line-ai-btn[data-status="uncertain"]{background:var(--err);color:#fff;font-size:23px;}
.line-ai-btn[data-status="checking"]{color:var(--fg-2);cursor:wait;}
.syntax-action .line-ai-btn:disabled:not([data-status="checking"]){opacity:.45;cursor:default;}
.line-check-review{position:absolute;inset:0;z-index:3;overflow:auto;background:var(--surface);padding:var(--pad) 0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
.line-review-open .gutter,.line-review-open .backdrop{visibility:hidden;}
.line-review-open .editor{opacity:0;pointer-events:none;}
.syntax-row{display:grid;grid-template-columns:var(--review-gutter,42px) minmax(0,1fr) 44px;min-height:var(--lh);font-size:var(--fs);line-height:var(--lh);}
.syntax-number{background:var(--surface-2);color:var(--fg-3);text-align:right;padding-right:9px;border-right:1px solid var(--line);font-family:Consolas,monospace;user-select:none;}
.syntax-source{display:block;white-space:pre;overflow-x:auto;scrollbar-width:none;overscroll-behavior-x:contain;tab-size:4;font-family:"JetBrains Mono","Roboto Mono","Cascadia Mono",Consolas,"Courier New",monospace;padding:0 var(--pad);font-synthesis:none;font-variant-ligatures:none;}
.syntax-source::-webkit-scrollbar{display:none;}
.syntax-action{display:flex;align-items:flex-start;justify-content:center;}
.syntax-action .line-ai-btn{height:var(--lh);}
.syntax-target{background:var(--acc-soft);}
.syntax-card{margin:4px 8px 8px calc(var(--review-gutter,42px) + 8px);padding:12px;border:1px solid #fecaca;border-radius:12px;background:#fff8f8;font-size:14px;line-height:1.55;overflow-wrap:anywhere;}
.syntax-card strong{color:#b91c1c;}
.syntax-card p{white-space:pre-wrap;margin:6px 0;}
.syntax-card pre{font:13px/1.6 Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere;padding:8px;margin:5px 0 8px;background:var(--surface);border-radius:7px;tab-size:4;}
.syntax-card small,.syntax-suggestion-label{color:var(--fg-2);font-size:12px;}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}

/* ---------------- 高亮配色 ---------------- */
.tok-com{color:#94a3b8;}                  /* 注释：只用灰色，不能斜体 */
.tok-pre{color:#d97706;}                  /* 预处理指令 */
.tok-str{color:#16a34a;}                  /* 字符串 */
.tok-num{color:#db2777;}                  /* 数字 */
.tok-kw{color:#9333ea;}                   /* 关键字 */
.tok-type{color:#2563eb;}                 /* STL 类型与对象 */
.tok-fn{color:#0d9488;}                   /* 常用函数 */

/* ---------------- 底部操作栏 ---------------- */
.dock{
  flex:0 0 auto; background:var(--surface); border-top:1px solid var(--line);
  padding:12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow:0 -4px 24px rgba(15,23,42,.025);
}
.cur-line{
  display:flex; align-items:center; gap:12px; margin-bottom:12px;
  font-size:13px; color:var(--fg-2); min-height:20px;
}
.cur-label{white-space:nowrap; padding-right:10px; border-right:1px solid var(--line);}
.cur-label b{color:var(--acc); font-size:15px;}
.cur-text{
  flex:1; min-width:0; font-family:"JetBrains Mono",Consolas,monospace; font-size:13px;
  color:var(--fg); white-space:pre; overflow:hidden; text-overflow:ellipsis;
  background:var(--surface-2); border-radius:9px; padding:8px 10px;
}
.view-line{flex:none; border:0; padding:8px 4px; min-height:36px; background:transparent; color:var(--acc); font:inherit; cursor:pointer;}
.view-line:focus-visible{outline:2px solid var(--acc); border-radius:6px;}
.talk{
  width:100%; display:flex; align-items:center; justify-content:center; gap:10px;
  min-height:72px; border:0; border-radius:14px; cursor:pointer;
  background:linear-gradient(115deg,#2385ff,#1264ef); color:#fff;
  font-size:16px; font-weight:600; font-family:inherit;
  box-shadow:0 3px 10px rgba(37,99,235,.15);
  user-select:none; -webkit-user-select:none; touch-action:manipulation;
}
.talk:active{transform:translateY(1px); box-shadow:0 2px 8px rgba(37,99,235,.28);}
.talk:disabled{background:#cbd5e1; box-shadow:none; color:#f8fafc;}
.talk-ic{display:flex; flex:0 0 26px;}
.talk-ic svg{width:26px; height:26px;}
.talk-tx{text-align:left; white-space:nowrap; line-height:1.35;}
.talk-sub{display:block; margin-top:3px; font-size:12px; font-weight:400; opacity:.9;}
.input-modes{display:flex; gap:8px; min-width:0;}
.input-modes .talk{flex:1; min-width:0;}
.keyboard-toggle{flex:0 0 112px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; border:1px solid var(--line); border-radius:14px; background:var(--surface); color:var(--fg); font-family:inherit; cursor:pointer; touch-action:manipulation;}
.keyboard-toggle svg{width:26px; height:26px; color:var(--acc);}
.keyboard-toggle span{display:block; font-size:12px; white-space:nowrap;}
.keyboard-toggle.keyboard-active{color:var(--acc); background:var(--acc-soft); border-color:var(--acc); box-shadow:inset 0 0 0 1px var(--acc);}

.dock-row{display:flex; gap:8px; margin-top:10px;}
.mini{
  flex:1; min-height:46px; border:1px solid var(--line-2); border-radius:13px;
  background:var(--surface); color:var(--fg); font-size:15px; font-family:inherit;
  cursor:pointer; padding:0 10px; white-space:nowrap;
}
.mini:active{background:var(--surface-2);}
.mini:disabled{opacity:.45;}
#btnUndo{position:relative; touch-action:none; user-select:none; -webkit-touch-callout:none;}
#btnUndo.reset-hold{border-color:var(--acc); background:var(--acc-soft);}
#btnUndo.reset-ready{border-color:var(--warn); color:var(--warn);}
#btnUndo.reset-hold::after{content:attr(data-reset-hint); position:absolute; bottom:calc(100% + 12px); left:0; z-index:15; padding:9px 12px; border-radius:10px; background:var(--fg); color:white; font-size:13px; white-space:nowrap; pointer-events:none; box-shadow:0 3px 12px #0002;}
.dock-row .indent-btn{flex:0 0 44px; min-width:44px; padding:0;display:flex;align-items:center;justify-content:center;}
.indent-btn svg{display:block;width:24px;height:24px;flex:none;pointer-events:none;}
@media(max-width:380px){
  .dock-row{gap:6px;}
  .dock-row .mini:not(.indent-btn){padding:0 6px; font-size:14px;}
}
.mini-primary{background:var(--acc); border-color:var(--acc); color:#fff; font-weight:600;}
.mini-primary:active{background:var(--acc-dark);}
.dock-row #btnRun{background:var(--acc-soft); color:var(--acc); border-color:#d6e7ff;}
button:focus-visible,.edit-context:focus-visible{outline:2px solid var(--acc); outline-offset:3px;}
@media(max-width:360px){
  .dock{padding-left:12px; padding-right:12px;}
  .keyboard-toggle{flex-basis:102px;}
  .talk{gap:7px; font-size:15px;}
}

/* ---------------- 底部抽屉 ---------------- */
.scrim{position:fixed; inset:0; background:rgba(15,23,42,.14); z-index:20;}
.sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:21;
  background:var(--surface); border-radius:24px 24px 0 0;
  box-shadow:0 -8px 40px rgba(15,23,42,.1);
  max-height:74vh; display:flex; flex-direction:column;
  padding-bottom:env(safe-area-inset-bottom);
  animation:sheetUp .18s ease-out;
}
@keyframes sheetUp{from{transform:translateY(14px); opacity:.6;}to{transform:translateY(0); opacity:1;}}
.sheet-head{
  flex:0 0 auto; display:flex; align-items:center; gap:8px;
  padding:12px 10px 8px 18px; border-bottom:1px solid var(--line);
}
.sheet-title{flex:1; min-width:0; font-weight:650; font-size:18px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.sheet-body{flex:1 1 auto; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:14px 18px 18px;}

/* ---------------- 候选卡 ---------------- */
.cand{
  display:block; width:100%; text-align:left;
  border:1.5px solid var(--line); border-radius:14px; background:var(--surface);
  padding:13px 14px; margin-bottom:10px; cursor:pointer; font-family:inherit;
  min-height:60px;
}
.cand:active{border-color:var(--acc); background:var(--acc-soft);}
.cand-label{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--fg-2); margin-bottom:7px;}
.cand-idx{
  width:20px; height:20px; border-radius:50%; background:var(--acc-soft); color:var(--acc);
  font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; flex:0 0 auto;
}
.cand-code{
  display:block; font-family:"JetBrains Mono",Consolas,monospace; font-size:14px;
  line-height:1.55; white-space:pre-wrap; word-break:break-word; color:var(--fg);
}
.preview-note{font-size:12px; color:var(--fg-2); margin:8px 0 12px;}
.cand-range{display:block; font-size:12px; color:var(--fg-2); margin-bottom:7px;}
.code-preview{display:block; min-width:0; text-align:left; font:14px/1.65 "JetBrains Mono",Consolas,monospace;}
.preview-line{display:grid; grid-template-columns:30px minmax(0,1fr); align-items:start;}
.preview-number{color:var(--fg-3); text-align:right; padding-right:8px; user-select:none;}
.preview-line code{font:inherit; white-space:pre-wrap; overflow-wrap:anywhere; tab-size:4; min-width:0;}
.sheet-actions{display:flex; gap:8px; margin-top:4px;}
.run-actions{flex-wrap:wrap; margin-bottom:12px;}
.run-actions .mini{flex:1 0 auto;}
.sheet-note{font-size:13px; color:var(--fg-2); margin:14px 0 8px;}

/* 修改要求与代码上下文放在同一面板，键盘展开时仍可对照。 */
.edit-context{flex:0 1 auto; min-height:66px; max-height:160px; overflow:auto; background:var(--surface-2); border:1px solid var(--line); border-radius:10px; margin-bottom:12px; padding:5px 0;}
.context-line{display:flex; min-width:100%; width:max-content; font:13px/22px Consolas,monospace; padding-right:12px;}
.context-number{flex:0 0 38px; text-align:right; padding-right:10px; color:var(--fg-3); user-select:none;}
.context-line code{font:inherit; white-space:pre; tab-size:4;}
.context-current{background:var(--acc-soft); box-shadow:inset 3px 0 var(--acc);}
.context-current .context-number{color:var(--acc);}
.sheet-editing{bottom:var(--input-bottom,0px); max-height:calc(var(--input-height,100dvh) - 8px);}
.sheet-editing .sheet-body{display:flex; flex-direction:column; min-height:0; padding-top:10px; padding-bottom:10px;}
.sheet-editing .sheet-note{flex:none; display:block; margin:0 0 6px;}
.sheet-editing .input{flex:none; resize:none;}
.sheet-editing .sheet-actions{flex:none;}

/* ---------------- 打字输入 ---------------- */
.input{
  width:100%; border:1.5px solid var(--line); border-radius:13px; background:var(--surface);
  padding:12px; font-size:16px; font-family:inherit; color:var(--fg); resize:vertical; outline:none;
}
.input:focus{border-color:var(--acc);}
.input-mono{font-family:"JetBrains Mono",Consolas,monospace; font-size:14px;}

/* ---------------- 输出与报错 ---------------- */
.out{
  background:#0f172a; color:#e2e8f0; border-radius:13px; padding:13px;
  font-family:"JetBrains Mono",Consolas,monospace; font-size:13.5px; line-height:1.6;
  white-space:pre-wrap; word-break:break-word; margin:0; min-height:56px;
  max-height:34vh; overflow:auto;
}
.out:empty::before{content:"（还没有输出）"; color:#64748b;}
.out-err{background:#3f1d1d; color:#fecaca;}
.diags{display:flex; flex-direction:column; gap:8px; margin-top:12px;}
.diag{
  display:block; width:100%; text-align:left; cursor:pointer; font-family:inherit;
  background:var(--err-soft); border:1px solid #fecaca; color:#991b1b;
  border-radius:12px; padding:11px 13px; font-size:13.5px; line-height:1.5; min-height:48px;
}
.diag:active{border-color:var(--err);}
.diag-warn{background:var(--warn-soft); border-color:#fde68a; color:#92400e;}
.diag-loc{font-weight:700; margin-right:6px;}
.diag-msg{font-family:"JetBrains Mono",Consolas,monospace; font-size:12.5px; word-break:break-word;}
.run-meta{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px;}
.chip{
  font-size:12.5px; padding:5px 10px; border-radius:9px;
  background:var(--surface-2); color:var(--fg-2); border:1px solid var(--line);
}
.chip-ok{background:var(--ok-soft); color:#166534; border-color:#bbf7d0;}
.chip-err{background:var(--err-soft); color:#991b1b; border-color:#fecaca;}
.chip-warn{background:var(--warn-soft); color:#92400e; border-color:#fde68a;}

/* ---------------- 更多/帮助面板 ---------------- */
.row-item{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:13px 0; border-bottom:1px solid var(--line); font-size:15px;
}
.row-item:last-child{border-bottom:0;}
.row-item .k{color:var(--fg-2); font-size:13.5px;}
.switch{position:relative; width:52px; height:32px; flex:0 0 auto;}
.switch input{opacity:0; width:100%; height:100%; margin:0; cursor:pointer;}
.slider{
  position:absolute; inset:0; border-radius:999px; background:var(--line-2);
  transition:background .15s; pointer-events:none;
}
.slider::after{
  content:""; position:absolute; top:3px; left:3px; width:26px; height:26px;
  border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(15,23,42,.25);
  transition:transform .15s;
}
.switch input:checked + .slider{background:var(--acc);}
.switch input:checked + .slider::after{transform:translateX(20px);}
.help-list{margin:6px 0 0; padding-left:18px; color:var(--fg-2); font-size:14px; line-height:1.9;}
.help-list code{
  background:var(--surface-2); border:1px solid var(--line); border-radius:6px;
  padding:2px 6px; font-family:"JetBrains Mono",Consolas,monospace; font-size:12.5px; color:var(--acc-dark);
}
h4.sec{margin:18px 0 4px; font-size:14px; color:var(--fg);}
h4.sec:first-child{margin-top:0;}

/* ---------------- 轻提示 ---------------- */
.toast{
  position:fixed; left:50%; transform:translateX(-50%);
  bottom:calc(env(safe-area-inset-bottom) + 190px); z-index:40;
  max-width:86vw; padding:11px 16px; border-radius:13px;
  background:rgba(15,23,42,.92); color:#f8fafc; font-size:14px; line-height:1.5;
  box-shadow:0 6px 24px rgba(15,23,42,.28); pointer-events:none;
  animation:toastIn .18s ease-out;
}
.toast-ok{background:rgba(22,101,52,.94);}
.toast-err{background:rgba(153,27,27,.94);}
@keyframes toastIn{from{opacity:0; transform:translate(-50%,8px);}to{opacity:1; transform:translate(-50%,0);}}

/* ---------------- 首次引导 ---------------- */
.guide{position:fixed; inset:0; z-index:50; background:rgba(15,23,42,.42);
        display:flex; align-items:center; justify-content:center; padding:22px;}
.guide-card{
  background:var(--surface); border-radius:20px; padding:26px 22px 20px;
  width:min(420px,100%); box-shadow:0 16px 48px rgba(15,23,42,.3); text-align:center;
}
.guide-ic{font-size:40px; line-height:1; margin-bottom:12px;}
.guide-step h3{margin:0 0 8px; font-size:18px; line-height:1.45;}
.guide-step p{margin:0; color:var(--fg-2); font-size:14.5px; line-height:1.6;}
.guide-actions{display:flex; gap:10px; margin-top:22px;}

/* ---------------- 横屏/大屏：稍微放宽 ---------------- */
@media (min-width:820px){
  :root{--fs:16px; --lh:26px; --pad:18px;}
  .dock{display:grid; grid-template-columns:1fr auto; gap:10px 12px; align-items:center;}
  .cur-line{grid-column:1; grid-row:1; margin-bottom:0; min-width:0;}
  .input-modes{grid-column:2; grid-row:1 / span 2; width:342px;}
  .talk{min-height:110px;}
  .dock-row{grid-column:1; grid-row:2; margin-top:0;}
  .mini{flex:0 1 auto; padding:0 18px;}
}

/* 输入法压缩可视高度时，保留主指令入口并给代码和分析留出空间。 */
@media(max-height:560px){
  .dock{padding-top:6px;padding-bottom:calc(6px + env(safe-area-inset-bottom));}
  .cur-line{margin-bottom:5px;}.cur-text{padding-top:3px;padding-bottom:3px;}
  .input-modes .talk{min-height:46px;padding:7px 12px;}
  .keyboard-toggle{gap:2px;}.keyboard-toggle svg{width:20px;height:20px;}
  .dock-row{margin-top:5px;}.dock-row .mini{min-height:36px;}
}
.compact-editor .dock{padding-top:6px;padding-bottom:calc(6px + env(safe-area-inset-bottom));}
.compact-editor .cur-line{margin-bottom:5px;}.compact-editor .cur-text{padding-top:3px;padding-bottom:3px;}
.compact-editor .input-modes .talk{min-height:46px;padding:7px 12px;}
.compact-editor .keyboard-toggle{gap:2px;}.compact-editor .keyboard-toggle svg{width:20px;height:20px;}
.compact-editor .dock-row{margin-top:5px;}.compact-editor .dock-row .mini{min-height:36px;}
.compact-editor .syntax-card{padding:8px 10px;font-size:13px;line-height:1.45;margin-bottom:5px;}
.compact-editor .syntax-card p{margin:4px 0;}
.compact-editor .syntax-card pre{padding:5px 7px;margin:3px 0 4px;}
.compact-editor .syntax-card small{display:none;}
/* Online account status stays outside the horizontally scrolling code surface. */
.cloud-bar{display:flex;align-items:center;gap:8px;padding:7px 14px;background:#f3f6fc;border-bottom:1px solid #e3e9f3;font-size:12px;flex-shrink:0;min-height:36px}
.cloud-bar a{color:#315fe9;text-decoration:none;max-width:35%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cloud-bar button{border:0;background:none;color:#6c788d;font:inherit;flex:1;min-width:0;text-align:left;cursor:pointer;padding:3px 0}
.cloud-bar .save-error{color:#a83a36}
#aiUsage{white-space:nowrap;color:#4566ab;font-variant-numeric:tabular-nums}
.cloud-conflict{position:fixed;z-index:1000;left:5%;right:5%;top:20%;max-height:70vh;overflow:auto;padding:24px;border:1px solid #c5d2ec;border-radius:18px;background:white;box-shadow:0 10px 80px #24304750;font-size:15px}
.cloud-conflict p{line-height:1.6;color:#64718a}
.cloud-conflict button{display:block;width:100%;padding:12px;margin:8px 0;border:1px solid #c5d2ec;background:#f4f7fc;border-radius:10px;font:inherit;color:#315fe9}
.publication-entry{display:block;margin:8px 0;max-width:100%;overflow-wrap:anywhere;text-align:left}
