/* Material Design 3 基线 tokens（非 Expressive）：
   保守圆角、标准 easing、无弹簧动效、无超大 shape、无夸张色彩。 */
:root {
  --primary: #415f91;
  --on-primary: #ffffff;
  --primary-container: #d6e3ff;
  --on-primary-container: #0b1e3c;
  --secondary: #565e71;
  --secondary-container: #dae2f9;
  --on-secondary-container: #131c2b;
  --tertiary-container: #fad8fd;
  --surface: #ffffff;
  --surface-bright: #fdfbff;
  --surface-low: #f3f4f9;
  --surface-container: #edeef4;
  --surface-high: #e7e9ef;
  --surface-highest: #e1e3ea;
  --on-surface: #1a1c20;
  --on-surface-variant: #44474f;
  --outline: #74777f;
  --outline-variant: #c4c6d0;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --scrim: #000000;

  --shape-xs: 4px;
  --shape-s: 8px;
  --shape-m: 12px;
  --shape-l: 16px;

  --e1: 0 1px 2px rgba(0,0,0,.16), 0 1px 3px 1px rgba(0,0,0,.08);
  --e2: 0 1px 2px rgba(0,0,0,.16), 0 2px 6px 2px rgba(0,0,0,.08);
  --e3: 0 4px 8px 3px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.12);

  --ease: cubic-bezier(.2, 0, 0, 1);
  --dur-s: 120ms;
  --dur-m: 200ms;

  --font-sans: Roboto, "Google Sans", "Helvetica Neue", Arial, "Noto Sans CJK SC", "WenQuanYi Micro Hei", sans-serif;
  --font-serif: "Roboto Serif", Georgia, "Noto Serif CJK SC", "Songti SC", serif;
  --font-mono: "Roboto Mono", Consolas, "WenQuanYi Micro Hei", monospace;

  --top-h: 112px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  color: var(--on-surface);
  background: var(--surface-container);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
::selection { background: #b9d3ff; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--on-surface-variant);
  transition: background var(--dur-s) var(--ease);
}
.icon-btn:hover { background: var(--surface-high); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }

.btn-tonal {
  height: 40px; padding: 0 20px; border-radius: 20px;
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-weight: 500; transition: box-shadow var(--dur-s) var(--ease), background var(--dur-s) var(--ease);
}
.btn-tonal:hover { box-shadow: var(--e1); background: #d0dcf5; }
.btn-filled {
  height: 40px; padding: 0 22px; border-radius: 20px;
  background: var(--primary); color: var(--on-primary); font-weight: 500;
  transition: box-shadow var(--dur-s) var(--ease);
}
.btn-filled:hover { box-shadow: var(--e1); }
.btn-text {
  height: 36px; padding: 0 14px; border-radius: 18px;
  color: var(--primary); font-weight: 500;
}
.btn-text:hover { background: var(--primary-container); }

.spacer { flex: 1 1 auto; }

/* toast */
#toast-layer { position: fixed; left: 24px; bottom: 24px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #303034; color: #f2f2f6; padding: 12px 18px; border-radius: var(--shape-xs);
  box-shadow: var(--e2); font-size: 13px; opacity: 0; transform: translateY(8px);
  transition: opacity var(--dur-m) var(--ease), transform var(--dur-m) var(--ease);
  max-width: 420px;
}
.toast.in { opacity: 1; transform: none; }

/* 右键菜单 */
#menu-layer { position: fixed; inset: 0; pointer-events: none; z-index: 80; }
.ctx-menu {
  position: fixed; pointer-events: auto; min-width: 200px; padding: 8px 0;
  background: var(--surface-bright); border-radius: var(--shape-s); box-shadow: var(--e3);
  border: 1px solid var(--outline-variant);
  animation: menu-in var(--dur-s) var(--ease);
}
@keyframes menu-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.ctx-item {
  display: block; width: 100%; height: 36px; padding: 0 16px; text-align: left;
  font-size: 13px; white-space: nowrap;
}
.ctx-item:hover:not(:disabled) { background: var(--surface-high); }
.ctx-item.disabled { color: var(--outline); opacity: .55; }
.ctx-item.danger { color: var(--error); }
.ctx-div { height: 1px; background: var(--outline-variant); margin: 6px 0; }

/* 模态 */
#modal-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.modal-scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,.40);
  display: flex; align-items: center; justify-content: center; pointer-events: auto;
}
.modal-card {
  width: min(520px, calc(100vw - 48px)); background: var(--surface-bright);
  border-radius: var(--shape-l); padding: 28px; box-shadow: var(--e3);
  animation: menu-in var(--dur-m) var(--ease);
}
.modal-card h2 { margin: 0 0 12px; font-size: 20px; font-weight: 500; }
.modal-card p { margin: 0 0 18px; color: var(--on-surface-variant); line-height: 1.65; font-size: 13px; }
.modal-card .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal-card code { background: var(--surface-high); padding: 1px 5px; border-radius: var(--shape-xs); font-size: 12px; }

/* 图标（内联 SVG 用） */
.ic { width: 20px; height: 20px; display: inline-block; vertical-align: middle; fill: currentColor; }
