:root {
  --bg: #07130e;
  --glass: rgba(7, 19, 14, 0.72);
  --glass-strong: rgba(7, 19, 14, 0.88);
  --text: #f7fff9;
  --muted: #b9c9bf;
  --yellow: #f6c84c;
  --green: #41d17d;
  --orange: #ffb35c;
  --red: #ff6b6b;
  --blue: #8ed9ff;
  --border: rgba(255,255,255,0.18);
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow: hidden; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }
.glass { background: var(--glass); border: 1px solid var(--border); backdrop-filter: blur(12px); box-shadow: 0 14px 40px rgba(0,0,0,0.28); }
.card { width: min(92vw, 480px); border-radius: 28px; padding: 24px; background: linear-gradient(160deg, rgba(22, 62, 43, 0.96), rgba(7, 19, 14, 0.96)); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,0.36); }
.welcome-screen, .error-screen { display: grid; place-items: center; padding: 18px; background: radial-gradient(circle at top, rgba(246,200,76,0.22), transparent 34%), linear-gradient(180deg, #143823, #07130e); }
.eyebrow { color: var(--yellow); text-transform: uppercase; letter-spacing: .08em; font-weight: 800; font-size: 12px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(34px, 7vw, 54px); line-height: 1.02; margin-bottom: 12px; }
h2 { font-size: 18px; margin-bottom: 4px; }
.lead { color: #e6f7ec; font-size: 18px; line-height: 1.5; }
.step-list { padding-left: 22px; color: #eaf6ee; line-height: 1.7; }
.fineprint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.primary-btn, .secondary-btn, .warning-btn, .icon-btn { border: 0; border-radius: 999px; min-height: 48px; padding: 12px 18px; font-weight: 800; color: #07130e; cursor: pointer; }
.primary-btn { background: var(--yellow); }
.secondary-btn { background: rgba(255,255,255,0.12); color: var(--text); border: 1px solid var(--border); }
.warning-btn { background: var(--orange); }
.icon-btn { width: 48px; padding: 0; background: rgba(255,255,255,0.12); color: var(--text); font-size: 28px; }
.full-width { width: 100%; }
.ar-screen { background: #000; }
#camera-video, #ar-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#camera-video { z-index: 1; background: #000; }
#ar-canvas { z-index: 2; }
.top-bar { position: absolute; z-index: 8; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; border-radius: 22px; padding: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mode-label { margin-bottom: 4px; color: var(--yellow); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
#sub-instruction { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.status-stack { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.status-pill { font-size: 11px; font-weight: 900; border-radius: 999px; padding: 6px 8px; background: rgba(255,255,255,0.12); color: var(--muted); text-align: center; }
.status-pill.ok { background: rgba(65, 209, 125, 0.22); color: #a8ffc8; }
.status-pill.warn { background: rgba(255, 179, 92, 0.24); color: #ffd3a6; }
.status-pill.fail { background: rgba(255, 107, 107, 0.24); color: #ffc2c2; }
.guide-pill { position: absolute; z-index: 8; top: 40%; left: 50%; transform: translateX(-50%); width: min(84vw, 420px); border-radius: 999px; padding: 12px 16px; text-align: center; font-weight: 900; color: #fff; }
.result-card { position: absolute; z-index: 8; left: 12px; right: 12px; bottom: 236px; border-radius: 22px; padding: 12px 14px; }
.result-title { margin: 0 0 4px; font-weight: 900; color: var(--yellow); }
.result-body { margin: 0; color: #e6f7ec; font-size: 13px; line-height: 1.4; }
.bottom-panel { position: absolute; z-index: 8; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); border-radius: 26px; padding: 14px; }
.time-row, .action-row, .quick-row { display: flex; align-items: center; gap: 10px; }
.time-row { justify-content: space-between; margin-bottom: 12px; }
.time-label { color: var(--muted); font-size: 11px; margin: 0; }
#selected-time-label { font-size: 30px; font-variant-numeric: tabular-nums; }
.time-slider, #azimuth-offset, #fov-slider { width: 100%; accent-color: var(--yellow); min-height: 36px; }
.time-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: -4px; }
.quick-row { margin: 10px 0; overflow-x: auto; padding-bottom: 2px; }
.quick-row button { white-space: nowrap; min-height: 38px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.1); color: var(--text); font-weight: 800; padding: 8px 12px; }
.action-row { justify-content: space-between; flex-wrap: wrap; }
.drawer { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,0.35); display: flex; align-items: flex-end; padding: 12px; }
.drawer-card { width: 100%; border-radius: 28px; padding: 18px; }
.drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.control-label { display: block; font-weight: 900; margin: 16px 0 6px; }
select { width: 100%; min-height: 48px; border-radius: 16px; padding: 10px 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.1); color: var(--text); }
.error-card { text-align: center; }

.diagnostics-panel { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.diagnostics-panel h3 { margin: 0 0 6px; font-size: 15px; }
.diagnostics-box { width: 100%; min-height: 190px; border-radius: 16px; border: 1px solid var(--border); background: rgba(0,0,0,0.24); color: var(--text); padding: 10px 12px; resize: vertical; font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.45; }
.mini-action-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.mini-action-row .secondary-btn { min-height: 40px; padding: 9px 14px; }
@media (min-width: 740px) {
  .bottom-panel, .top-bar, .result-card { width: min(680px, calc(100vw - 24px)); left: 50%; right: auto; transform: translateX(-50%); }
}

.field-qa-panel { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.field-qa-panel h3 { margin: 0 0 6px; font-size: 15px; }
.text-input, .notes-box { width: 100%; border-radius: 16px; border: 1px solid var(--border); background: rgba(255,255,255,0.1); color: var(--text); padding: 11px 12px; }
.text-input::placeholder, .notes-box::placeholder { color: rgba(247,255,249,0.52); }
.qa-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.field-qa-checklist { display: grid; gap: 8px; margin: 12px 0 4px; }
.qa-check-row { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; padding: 9px 10px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,0.07); color: #e6f7ec; font-size: 12px; line-height: 1.35; }
.qa-check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--yellow); }
.notes-box { resize: vertical; line-height: 1.45; min-height: 88px; }
@media (min-width: 560px) {
  .qa-grid { grid-template-columns: 1fr 1fr; }
}
.drawer-card { max-height: calc(100dvh - 24px); overflow-y: auto; -webkit-overflow-scrolling: touch; }

.field-guide-panel { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.field-guide-panel h3 { margin: 0 0 6px; font-size: 15px; }
.guide-list, .trouble-list { margin: 10px 0 12px; padding-left: 20px; color: #e6f7ec; font-size: 12px; line-height: 1.45; }
.guide-list li, .trouble-list li { margin-bottom: 6px; }
.guide-details { border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,0.07); padding: 10px 12px; margin: 10px 0; }
.guide-details summary { cursor: pointer; font-weight: 900; color: var(--yellow); }
.draft-status { margin: 8px 0 0; border-radius: 14px; border: 1px solid var(--border); background: rgba(255,255,255,0.07); padding: 9px 10px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.draft-status[data-tone="ok"] { color: #a8ffc8; background: rgba(65, 209, 125, 0.16); }
.draft-status[data-tone="warn"] { color: #ffd3a6; background: rgba(255, 179, 92, 0.16); }
.draft-status[data-tone="fail"] { color: #ffc2c2; background: rgba(255, 107, 107, 0.16); }
