/* CAD 看图工具 v1.0.0 — 样式（方向 B：苹果简约浅色，见 design/direction-approved.md）
   手机优先：大留白、黑白灰骨架、克制蓝色点缀；工具条单手可达（底部）。
   中文优先字体栈：系统字体 → 苹方/微软雅黑 → Noto Sans SC。 */
:root {
  --bg: #ffffff;
  --bg-muted: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #d2d2d7;
  --accent: #0071e3;
  --accent-soft: #e8f1fc;
  --danger: #dc2626;
  --radius: 14px;
  --toolbar-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 28px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.02em; }
h2 { font-size: 22px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
button {
  font: inherit; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 999px; padding: 10px 18px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px); z-index: 20;
}
.brand { font-weight: 700; font-size: 18px; }
.lang-switch button { padding: 6px 12px; font-size: 14px; }
.lang-switch button.active { background: var(--text); color: #fff; border-color: var(--text); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.hero { padding: 40px 0 24px; }
.hero .tagline { font-size: 19px; color: var(--muted); margin-bottom: 20px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.hero-steps { color: var(--muted); font-size: 15px; }
.hero-free { font-size: 14px; color: var(--muted); }
.features { display: grid; gap: 12px; padding: 8px 0 24px; }
.feature {
  background: var(--bg-muted); border-radius: var(--radius);
  padding: 18px;
}
.feature h3 { margin-bottom: 4px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }

.plans { display: grid; gap: 12px; padding-bottom: 32px; }
.plan-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px;
}
.plan-price { font-size: 26px; font-weight: 700; margin: 4px 0 8px; }
.plan-card ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.plan-perday { color: var(--muted); font-size: 14px; }
.buy-note, .wechat-note { font-size: 14px; color: var(--muted); }
.login-block { padding-bottom: 40px; }
.login-block .wechat-btn { width: 100%; margin-top: 8px; }
footer { border-top: 1px solid var(--border); padding: 20px 16px; color: var(--muted); font-size: 14px; }

/* ---- 查看器 ---- */
#viewer-section { padding: 0; }
.viewer-topbar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.viewer-topbar button { padding: 8px 14px; font-size: 14px; }
.quota-line { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#viewer-stage {
  position: relative; width: 100%;
  height: calc(100dvh - 118px); min-height: 320px;
  overflow: hidden; background: #fff;
  touch-action: none; overscroll-behavior: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none;
}
#viewer-canvas, #overlay-canvas {
  position: absolute; inset: 0; display: block;
  touch-action: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none;
}
#mode-hint {
  position: absolute; left: 12px; top: 10px; z-index: 5;
  background: rgba(255,255,255,0.92); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted);
  max-width: calc(100% - 24px); pointer-events: none;
}
#measure-readout {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 76px; z-index: 5;
  background: var(--text); color: #fff; border-radius: 999px;
  padding: 8px 16px; font-size: 14px; max-width: calc(100% - 24px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#degraded-badge {
  position: absolute; right: 12px; top: 10px; z-index: 5;
  background: #fff7ed; border: 1px solid #fdba74; color: #9a3412;
  border-radius: 999px; padding: 6px 12px; font-size: 13px;
}
#notice {
  position: absolute; left: 50%; transform: translateX(-50%); top: 56px; z-index: 8;
  background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b;
  border-radius: 10px; padding: 10px 14px; font-size: 14px; max-width: calc(100% - 24px);
}
.toolbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.96); border-top: 1px solid var(--border);
  overflow-x: auto;
}
.toolbar button { flex: 1 0 auto; padding: 10px 12px; font-size: 14px; white-space: nowrap; }
.toolbar button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.measure-actions { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.side-panel {
  border-top: 1px solid var(--border); padding: 16px;
  max-height: 40vh; overflow-y: auto; background: var(--bg-muted);
}
.side-panel h4 { margin: 14px 0 4px; font-size: 15px; }
.side-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 15px; }
.side-panel dt { color: var(--muted); }
.side-panel dd { margin: 0; }
.side-panel ul { margin: 4px 0; padding-left: 20px; font-size: 15px; }
.demo-note { background: #fef3c7; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.unit-box { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 15px; }
.unit-box label { display: block; margin-bottom: 6px; }
.unit-box select, .unit-box input {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
}
.unit-warn { color: #991b1b; font-size: 14px; }
.modal {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4); padding: 20px;
}
.modal-card { background: #fff; border-radius: var(--radius); padding: 22px; max-width: 480px; }
.annotate-panel {
  position: absolute; left: 12px; right: 12px; bottom: 76px; z-index: 6;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.annotate-panel input[type="text"] {
  width: 100%; font: inherit; padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 10px;
}
.color-pick { display: flex; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.annotate-actions { display: flex; gap: 8px; }

@media (min-width: 720px) {
  .features { grid-template-columns: repeat(3, 1fr); }
  .plans { grid-template-columns: repeat(4, 1fr); }
  h1 { font-size: 36px; }
  #viewer-stage { height: calc(100dvh - 118px); }
}
