:root { color-scheme: dark; font-family: Arial, Helvetica, sans-serif; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #111; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.camera-screen { position: fixed; inset: 0; overflow: hidden; background: #17191d; }
#camera { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s ease; }
#camera.ready { opacity: 1; }
.top-bar { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 58px; padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: linear-gradient(#000c, transparent); text-shadow: 0 1px 3px #000; }
.top-bar strong, .top-bar span { display: block; }
#buildingLabel { font-size: clamp(.95rem, 2.3vw, 1.25rem); }
#surveyLabel { margin-top: 2px; color: #ddd; font-size: .75rem; }
.status-group { display: flex; align-items: center; gap: 10px; }
.status { font-size: .78rem; }
.status.location-ok::before { content: "● "; color: #42d879; }
.status.location-missing::before { content: "● "; color: #ffcc52; }
.small-button, .text-button { border: 1px solid #fff8; border-radius: 0; padding: 7px 11px; background: #17191dcc; color: #fff; }
.capture { position: absolute; z-index: 2; top: 50%; display: grid; width: clamp(84px, 12vw, 120px); min-height: clamp(112px, 25vh, 166px); place-items: center; align-content: center; gap: 9px; border: 5px solid #fff; border-radius: 0; color: #fff; box-shadow: 0 4px 18px #0009; text-shadow: 0 1px 2px #0008; transform: translateY(-50%); }
.capture:active { transform: translateY(-50%) scale(.96); }
.capture:disabled { opacity: .42; cursor: wait; }
.capture-bad { left: max(18px, env(safe-area-inset-left)); background: #c52026; }
.capture-good { right: max(18px, env(safe-area-inset-right)); background: #168b45; }
.camera-mark { position: relative; width: 42px; height: 30px; border: 3px solid currentColor; }
.camera-mark::before { content: ""; position: absolute; left: 12px; top: 5px; width: 14px; height: 14px; border: 3px solid currentColor; border-radius: 50%; }
.camera-mark::after { content: ""; position: absolute; left: 4px; top: -8px; width: 15px; height: 7px; border: 3px solid currentColor; border-bottom: 0; }
.capture strong { font-size: clamp(.95rem, 2.4vw, 1.2rem); letter-spacing: .06em; }
.camera-message { position: absolute; left: 50%; bottom: 48px; z-index: 2; max-width: 48%; margin: 0; padding: 8px 12px; background: #000b; text-align: center; transform: translateX(-50%); }
.counts { position: absolute; z-index: 2; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; display: flex; overflow: hidden; border: 1px solid #fff8; background: #111d; transform: translateX(-50%); }
.counts span { padding: 7px 13px; }
.bad-count { color: #ff9a9d; }
.good-count { color: #8aeeae; border-left: 1px solid #fff6; }
.rotate-message { display: none; }
.panel-dialog { width: min(92vw, 570px); max-height: 92vh; border: 1px solid #ffffff52; border-radius: 0; padding: 0; background: #f7f4ed; color: #1c2024; box-shadow: 0 18px 60px #000b; }
#setupDialog { width: min(92vw, 760px); }
.panel-dialog::backdrop { background: #050607d9; }
.panel { padding: clamp(18px, 4vw, 32px); }
.panel h1, .panel h2 { margin: 0 0 10px; line-height: 1.05; }
.panel p { line-height: 1.42; }
.panel label:not(.confirm) { display: grid; gap: 5px; margin: 15px 0; font-weight: 700; }
.panel input, .panel textarea { width: 100%; border: 2px solid #73777b; border-radius: 0; padding: 11px; background: #fff; color: #111; }
.panel textarea { resize: vertical; }
.confirm { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0; font-size: .9rem; line-height: 1.35; }
.confirm input { width: 20px; height: 20px; flex: 0 0 auto; margin: 0; }
.privacy-note { padding: 10px; background: #e5e1d8; font-size: .78rem; }
.primary-button, .secondary-button { border: 2px solid #17191d; border-radius: 0; padding: 11px 17px; font-weight: 800; }
.primary-button { background: #17191d; color: #fff; }
.secondary-button { background: transparent; color: #17191d; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.response-dialog { width: min(94vw, 900px); }
.response-layout { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr); gap: 24px; align-items: center; }
#photoPreview { display: block; width: 100%; max-height: 68vh; object-fit: contain; border: 3px solid #24272b; }
.choice-badge { display: inline-block; margin: 0 0 10px !important; padding: 6px 10px; color: #fff; font-weight: 900; letter-spacing: .08em; }
.choice-badge.good { background: #168b45; }
.choice-badge.bad { background: #c52026; }
.submit-status { min-height: 1.2em; margin: 4px 0; font-size: .86rem; }
.submit-status.error { color: #a20d15; font-weight: 700; }
@media (orientation: portrait) {
  .rotate-message { position: absolute; z-index: 8; inset: 0; display: grid; place-content: center; gap: 8px; padding: 28px; background: #17191df2; text-align: center; }
  .rotate-message strong { font-size: 1.4rem; }
}
@media (max-height: 500px) {
  .top-bar { min-height: 48px; padding-top: 7px; padding-bottom: 7px; }
  .camera-message { bottom: 42px; font-size: .78rem; }
  .panel { padding: 16px; }
  .panel p { margin: 7px 0; }
  .panel label:not(.confirm) { margin: 9px 0; }
  #setupForm { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; align-items: start; }
  #setupForm h1, #setupForm p, #setupForm label, #setupForm button { margin: 0; }
  #setupForm > p:first-of-type { align-self: center; font-size: .88rem; }
  #setupForm .confirm, #setupForm .privacy-note { font-size: .72rem; }
  #setupForm .primary-button, #setupForm .text-button { grid-column: 1 / -1; padding-top: 9px; padding-bottom: 9px; }
}
@media (max-width: 680px) {
  .response-layout { grid-template-columns: 42% 1fr; gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { #camera { transition: none; } }
