/* Light, high-contrast theme on purpose: the app is used outdoors, often in sunlight. */
:root {
  color-scheme: light;
  --text: #16181a;
  --muted: #4f565c;
  --bg: #ffffff;
  --surface: #f2f3f4;
  --border: #c4c9ce;
  --accent: #0a6b3d;
  --accent-dark: #075530;
  --accent-tint: #e6f2eb;
  --danger: #b42318;
  --danger-dark: #8f1c12;
  --danger-tint: #fdeceb;
  --warn-tint: #fff3d1;
  --warn-border: #b7791f;
  --warn-text: #6b4400;
  --focus: #1d4ed8;
  --radius: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

a {
  color: var(--accent-dark);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[tabindex="-1"]:focus {
  outline: none;
}

h1 {
  margin: 8px 0 12px;
  font-size: 1.625rem;
  line-height: 1.2;
}

h2 {
  margin: 32px 0 8px;
  font-size: 1.1875rem;
  line-height: 1.3;
}

h3 {
  margin: 20px 0 6px;
  font-size: 1.0625rem;
}

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 4px;
}

.muted {
  color: var(--muted);
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.hint:empty {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Layout */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand svg {
  flex: none;
  color: var(--accent);
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.notice {
  margin: 0;
  padding: 12px 16px;
  background: var(--danger-tint);
  border-bottom: 1px solid var(--danger);
  color: var(--danger-dark);
  font-weight: 600;
}

.noscript {
  padding: 16px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid var(--text);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.btn-call {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn-call:hover {
  border-color: var(--danger-dark);
  background: var(--danger-dark);
}

.btn-small {
  min-height: 44px;
  padding: 6px 14px;
  font-size: 0.9375rem;
}

.btn-large {
  min-height: 56px;
  font-size: 1.125rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

.menu {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}

.link-danger {
  padding: 12px 0;
  border: 0;
  background: none;
  color: var(--danger);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.delete-row {
  margin-top: 40px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Check steps */

.step-count {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.step-nav {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.step-nav .btn-primary {
  flex: 1;
}

.checklist {
  margin: 16px 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.checklist li {
  margin: 0;
}

.checklist li + li {
  border-top: 1px solid var(--border);
}

.checklist label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  cursor: pointer;
}

.checklist input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.checklist label:has(input:checked) {
  background: var(--accent-tint);
  font-weight: 600;
}

.checklist-danger input {
  accent-color: var(--danger);
}

.checklist-danger label:has(input:checked) {
  background: var(--danger-tint);
}

.checklist .time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 400;
  white-space: nowrap;
}

.emergency {
  margin: 16px 0;
  padding: 16px;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-tint);
}

.emergency ul {
  margin: 12px 0 0;
}

.emergency p:last-child {
  margin-bottom: 0;
}

.warning {
  padding: 12px 14px;
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  background: var(--warn-tint);
}

.walk {
  margin: 20px 0 8px;
}

/* The canvas sits exactly on top of the video and has the same size in pixels. */
.walk-view {
  position: relative;
  margin-bottom: 12px;
}

.walk-view video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #000;
}

.walk-view canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.walk-status {
  margin: 0;
  font-weight: 600;
}

.walk-status:empty {
  display: none;
}

.questions {
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.questions li {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  padding: 0;
  font-weight: 600;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  position: relative;
  flex: 1 1 5.5rem;
}

.choice input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
}

.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.choice input:checked + span {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.choice input[value="incorrect"]:checked + span {
  border-color: var(--danger);
  background: var(--danger);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choices-stack {
  flex-direction: column;
}

.choices-stack .choice {
  flex: none;
}

.choices-stack .choice span {
  justify-content: flex-start;
  padding: 8px 14px;
}

/* Result */

.result {
  margin: 16px 0;
  padding: 16px;
  border: 2px solid;
  border-radius: var(--radius);
}

.result h2 {
  margin: 4px 0 8px;
  font-size: 1.375rem;
}

.result p {
  margin: 0;
}

.result .result-note {
  font-size: 0.875rem;
}

.result .result-incomplete {
  margin-top: 10px;
  font-weight: 600;
}

.result-emergency {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.result-suspected {
  border-color: var(--warn-border);
  background: var(--warn-tint);
}

.result-none {
  border-color: var(--border);
  background: var(--surface);
}

.steps li + li {
  margin-top: 8px;
}

/* Forms */

.field {
  margin: 20px 0;
}

.field > label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: inherit;
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible {
  border-color: var(--focus);
}

.error {
  color: var(--danger);
  font-weight: 600;
}

/* Incident list and record */

.incidents {
  margin: 12px 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.incidents li {
  margin: 0;
}

.incidents a {
  display: block;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.incidents a:hover {
  background: var(--surface);
}

.incidents span {
  display: block;
}

.incident-name {
  font-weight: 600;
}

.level {
  font-size: 0.9375rem;
  font-weight: 600;
}

.level-emergency {
  color: var(--danger);
}

.level-suspected {
  color: var(--warn-text);
}

.level-none {
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
}

.section-head h2 {
  margin: 0 0 8px;
}

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.timeline .time {
  color: var(--muted);
  margin-right: 6px;
}

@media (max-width: 420px) {
  .details {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .details dd {
    margin-bottom: 10px;
  }
}
