:root {
  --accent: #00E676;
  --accent-dim: rgba(0, 230, 118, 0.14);
  --bg: #0d0f12;
  --card: #161a20;
  --border: #262c36;
  --text: #e6edf3;
  --muted: #8b949e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* 頂部狀態列 */
#top-bar {
  position: sticky;
  top: 0;
  background: rgba(13, 15, 18, 0.92);
  backdrop-filter: blur(10px);
  padding: 10px 16px;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { text-align: left; }
.app-title { font-size: 16px; font-weight: 700; letter-spacing: 0.3px; }
#status { font-size: 12px; color: var(--accent); margin-top: 2px; }
#lang-toggle {
  background: #1f242d;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
#lang-toggle:active { background: #2d3440; }

/* 相機預覽區 */
#camera-container {
  position: relative;
  width: 100%;
  height: 44vh;
  background: #000;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
video { width: 100%; height: 100%; object-fit: cover; }

/* Omni 風格對準框（帶四角準星線） */
#reticle {
  position: absolute;
  width: 46%;
  height: 34%;
  border: 1.5px dashed rgba(0, 230, 118, 0.75);
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

/* 懸浮按鈕 */
.camera-controls {
  position: absolute;
  bottom: 14px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  padding: 0 12px;
  box-sizing: border-box;
}
.cam-btn {
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: rgba(22, 26, 32, 0.85);
  backdrop-filter: blur(6px);
  transition: 0.2s;
}
.cam-btn:active { transform: scale(0.97); }
.cam-btn.active {
  background: var(--accent);
  color: #09120d;
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(0, 230, 118, 0.4);
}
.cam-btn.torch-on {
  background: #ffab40;
  color: #121212;
  border-color: #ffab40;
}
.cam-btn:disabled { opacity: 0.4; }

/* 面板與卡片 */
.panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 50px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
}
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

/* Omni 數據主視覺區 */
.omni-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 14px;
  background: #101318;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.metric-primary { flex: 1; }
.metric-title {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  letter-spacing: 1px;
}
.metric-value {
  font-size: 38px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
  line-height: 1.1;
  margin-top: 2px;
}
.metric-divider {
  width: 1px;
  height: 46px;
  background: var(--border);
  margin: 0 14px;
}
.metric-secondary {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.metric-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.sub-label {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sub-val {
  font-size: 15px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}

/* 光譜進度尺規 */
.spectrum-wrap { margin-top: 14px; }
.spectrum-bar {
  position: relative;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #c69c6d 0%, #8d5b3c 35%, #4e342e 70%, #1c1412 100%);
  border: 1px solid #384152;
}
.spectrum-marker {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 18px;
  background: var(--accent);
  border: 1.5px solid #0d0f12;
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 8px var(--accent);
  transition: left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.spectrum-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  margin-top: 5px;
}

.tech-readout {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.highlight { color: var(--text); font-weight: 600; }
.hint-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

/* 暗盒圖解折疊區 */
.guide-details { padding: 0; overflow: hidden; }
.guide-summary {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--accent);
}
.guide-summary::-webkit-details-marker { display: none; }
.guide-summary::after { content: "▼"; font-size: 11px; color: var(--muted); transition: transform 0.2s; }
.guide-details[open] .guide-summary::after { transform: rotate(180deg); }
.guide-content { padding: 0 16px 16px 16px; border-top: 1px solid var(--border); }
.guide-desc { font-size: 13px; color: #cbd5e1; margin: 10px 0; }
.svg-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.svg-box { background: #101318; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.guide-list { margin: 0; padding-left: 18px; font-size: 13px; color: #cbd5e1; line-height: 1.6; }
.guide-list li { margin-bottom: 6px; }

/* 表單樣式 */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="date"], input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  background: #101318;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 15px;
  -webkit-appearance: none;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

button.action-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #09120d;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}
button.action-btn:disabled { background: #262c36; color: #6e7681; }
button.secondary-btn { background: #1f2937; color: var(--text); border: 1px solid var(--border); }
button.secondary-btn:disabled { background: #161a20; color: #484f58; }

.record-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--muted); }
.text-btn { background: none; border: none; color: #FF5252; font-size: 13px; cursor: pointer; padding: 4px 8px; }

/* 對照表 */
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

/* Toast */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1f242d;
  color: var(--text);
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 1000;
  pointer-events: none;
  border: 1px solid var(--border);
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
