/* CMPA Check web: the page around the app (the app draws itself on a canvas inside #app). Colours match ui/Theme.kt. */
:root {
  --bg: #F9F9FF; --fg: #191C20; --muted: #43474E; --primary: #2E6BB2; --on-primary: #fff;
  --tonal: #D8E3F8; --on-tonal: #111C2B; --card: #fff; --line: #C3C6CF;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111318; --fg: #E2E2E9; --muted: #C3C6CF; --primary: #A7C8FF; --on-primary: #003061;
          --tonal: #3C4758; --on-tonal: #D8E3F8; --card: #1D2024; --line: #43474E; }
}
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
#app { position: fixed; inset: 0; }

#splash {
  position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: var(--bg); text-align: center; padding: 24px; transition: opacity .3s;
}
#splash img { border-radius: 22px; }
#splash p { margin: 0; color: var(--muted); max-width: 22em; }
#splash.problem p { color: var(--fg); }
#splash.gone { opacity: 0; pointer-events: none; }
#splash a { color: var(--primary); font-weight: 600; }

/* Sheets: plain HTML over the app for the camera, photo picker and sharing */
.sheet {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .45);
}
.sheet-box {
  width: 100%; max-width: 560px; box-sizing: border-box; display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
.sheet-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.sheet textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; background: var(--bg); color: var(--fg); resize: vertical;
}
.btn {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border: 0; border-radius: 24px;
  background: var(--primary); color: var(--on-primary); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  position: relative; overflow: hidden;
}
.btn.tonal { background: var(--tonal); color: var(--on-tonal); }
.btn.ghost { background: transparent; color: var(--primary); }
.hidden-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }

/* Barcode scanner: camera full screen, a frame to aim with, controls at the bottom */
.sheet.scan { background: #000; align-items: stretch; }
.sheet.scan .sheet-box { max-width: none; height: 100%; border-radius: 0; padding: 0; background: #000; position: relative; gap: 0; }
.sheet.scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 10%; right: 10%; top: 32%; aspect-ratio: 2.2 / 1; border: 3px solid #fff; border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
}
.scan-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 10px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .75) 30%);
}
.scan-hint { margin: 0; color: #fff; text-align: center; }
.scan-bar .row { display: flex; gap: 10px; }
.scan-typed {
  flex: 1; min-width: 0; min-height: 48px; box-sizing: border-box; border: 0; border-radius: 24px; padding: 0 18px;
  font: inherit; font-size: 16px; background: rgba(255, 255, 255, .92); color: #191C20;
}
.sheet.scan .btn.ghost { color: #fff; }

#toast {
  position: fixed; z-index: 20; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%);
  max-width: 90vw; padding: 10px 16px; border-radius: 12px; background: #2E3035; color: #F0F0F7; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
