/* Mathematica 12 网页复刻 · 应用外壳（app.css）
 * 依据真机截图：标题栏 23px（#F1F3F9）、菜单栏 18px+2px 分隔、工具栏 28px、
 * 笔记本区白底、底部滚动条/缩放条 17px（#F0F0F0）。
 * 真机来源：docs/reference/surfaces/notebook-empty-1920x1080.png（2026-11-19 采）。
 */

:root {
  --titlebar-bg: #f1f3f9;
  --titlebar-text: #000000;
  --menubar-bg: #ffffff;
  --menubar-border: #f0f0f0;
  --toolbar-bg: #f7f7f7;
  --toolbar-border: #e8e8e8;
  --notebook-bg: #ffffff;
  --bottombar-bg: #f0f0f0;
  --text: #000000;
  --muted: #666666;
  --prompt: #3e6a96;
  --bracket: #858585;
  --cell-line: #bfbfbf;
  --hover: #e8f1fa;
  --selection: #cce6ff;
  --ui-font: "Segoe UI", "Microsoft YaHei", "Noto Sans CJK SC", "Microsoft YaHei UI", sans-serif;
  --cell-font: "Times New Roman", "Cambria", "Nimbus Roman", "Liberation Serif", serif;
  --mono: "Consolas", "Cascadia Mono", "DejaVu Sans Mono", monospace;
  --titlebar-h: 23px;
  --menubar-h: 18px;
  --menubar-border-h: 2px;
  --toolbar-h: 28px;
  --bottombar-h: 17px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  color: var(--text);
  font: 12px/1.4 var(--ui-font);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 应用容器 ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 320px;
  background: var(--notebook-bg);
}

/* ---------- 标题栏 ---------- */
.titlebar {
  display: flex;
  align-items: center;
  flex: 0 0 var(--titlebar-h);
  height: var(--titlebar-h);
  padding: 0 0 0 4px;
  background: var(--titlebar-bg);
  color: var(--titlebar-text);
  font-size: 12px;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}

.app-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: #dd1100;
  color: #ffffff;
  font: 700 11px/1 var(--ui-font);
}
.app-icon > span { transform: translateY(-0.5px); }

.doc-title {
  margin-left: 8px;
  font-size: 13px;
  line-height: var(--titlebar-h);
  color: var(--titlebar-text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.titlebar-spacer { flex: 1 1 auto; }

.win-controls { display: flex; align-items: stretch; height: 100%; }

.win-btn {
  width: 36px;
  height: 100%;
  border: 0;
  background: transparent;
  color: #1a1a1a;
  font: 12px/1 var(--ui-font);
  cursor: default;
  padding: 0;
}
.win-btn:hover { background: #e6e9ef; }
.win-close:hover { background: #e81123; color: #fff; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  flex: 0 0 var(--toolbar-h);
  height: var(--toolbar-h);
  padding: 0 8px;
  gap: 2px;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--toolbar-border);
  user-select: none;
  overflow: hidden;
}

.tool-group { display: flex; align-items: center; gap: 1px; }

.tool-sep {
  width: 1px;
  height: 16px;
  margin: 0 6px;
  background: #dcdcdc;
  flex: 0 0 auto;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #333333;
  font: 12px/1 var(--ui-font);
  cursor: pointer;
  white-space: nowrap;
}
.tool-btn:hover { background: var(--hover); border-color: #c6dbf0; }
.tool-btn:active { background: #d7e8f8; }
.tool-btn[disabled] { color: #a0a0a0; cursor: default; background: transparent; border-color: transparent; }
.tool-icon { font-size: 13px; line-height: 1; }
.tool-text { font-size: 12px; }

/* ---------- 底部滚动条 / 缩放条 ---------- */
.bottombar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 var(--bottombar-h);
  height: var(--bottombar-h);
  background: var(--bottombar-bg);
  border-top: 1px solid #e6e6e6;
  position: relative;
  user-select: none;
}

.hscrollbar {
  position: absolute;
  left: 0;
  right: 150px;
  top: 1px;
  bottom: 0;
  background: var(--bottombar-bg);
}
.hscrollbar.no-scroll::after { content: none; }

.zoom-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 26px;
  height: 100%;
  background: var(--bottombar-bg);
}
.zoom-sep { width: 1px; height: 13px; background: #d0d0d0; }
.zoom-text { font: 12px/1 var(--cell-font); color: #1a1a1a; }
.zoom-arrow { font-size: 9px; color: #333333; }

/* ---------- 通用文本 ---------- */
.muted { color: var(--muted); }

::selection { background: var(--selection); }

/* 滚动条（贴近真机细滚动条） */
.notebook::-webkit-scrollbar { width: 12px; height: 12px; }
.notebook::-webkit-scrollbar-thumb { background: #c8c8c8; border: 3px solid #f0f0f0; border-radius: 6px; }
.notebook::-webkit-scrollbar-track { background: #f0f0f0; }

/* ---------- 状态提示（真机无状态栏；网页用自动消失的浮层，空闲时不占像素） ---------- */
.status-toast {
  position: fixed;
  left: 12px;
  bottom: 22px;
  z-index: 1200;
  max-width: 60vw;
  padding: 3px 10px;
  border: 1px solid #c8c8c8;
  background: #fdfdfd;
  color: #333333;
  font: 12px/1.5 var(--ui-font);
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.status-toast.is-visible { opacity: 1; transform: translateY(0); }
