/* 共用設計系統：深色為主，全部本機資產（現場可完全離線） */

:root {
  --bg: #0f1115;
  --bg-panel: #171a21;
  --bg-input: #0c0e12;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --text-dim: #9aa3b2;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.15);
  --ok: #34c98e;
  --warn: #f5b83d;
  --err: #f0564f;
  --radius: 10px;
  --font: "PingFang TC", "Microsoft JhengHei UI", "Microsoft JhengHei", "Noto Sans TC",
    "Heiti TC", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3 { margin: 0 0 8px; font-weight: 700; }
h1 { font-size: 20px; }
h2 { font-size: 15px; color: var(--text-dim); letter-spacing: 0.05em; }

a { color: var(--accent); text-decoration: none; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

button, .btn {
  font-family: var(--font);
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.1); }
button.danger { background: transparent; border-color: var(--err); color: var(--err); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* 行內 SVG 圖示（本機資產、不用 emoji：跨平台渲染一致） */
.ico { width: 14px; height: 14px; vertical-align: -2px; flex: none; }
.ico.lead { margin-right: 5px; }

input, select, textarea {
  font-family: var(--font);
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* 鍵盤操作的可見焦點（滑鼠點擊不顯示，避免干擾視覺） */
button:focus-visible, .btn:focus-visible, .chip:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.disabled { opacity: 0.4; cursor: not-allowed; }
.chip .soon { font-size: 11px; color: var(--text-dim); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: rgba(52, 201, 142, 0.12); }
.pill.warn { color: var(--warn); background: rgba(245, 184, 61, 0.12); }
.pill.err { color: var(--err); background: rgba(240, 86, 79, 0.12); }
.pill.dim { color: var(--text-dim); background: rgba(154, 163, 178, 0.12); }

.dim { color: var(--text-dim); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
table.grid th { color: var(--text-dim); font-weight: 500; white-space: nowrap; }
table.grid input { width: 100%; padding: 4px 8px; font-size: 13px; }

.meter {
  height: 10px;
  border-radius: 5px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.meter > div {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--ok) 0%, var(--ok) 70%, var(--warn) 85%, var(--err) 100%);
  transition: width 0.12s linear;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* 觸控裝置：目標尺寸拉到 44px、輸入字級 16px（避免 iOS 聚焦自動縮放頁面） */
@media (pointer: coarse) {
  button, .chip { min-height: 44px; }
  .btn { min-height: 44px; display: inline-flex; align-items: center; }
  select, textarea,
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]) {
    min-height: 44px;
    font-size: 16px;
  }
}

/* 使用者要求減少動態效果時，停用裝飾性動畫 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
