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

:root {
  --blue:   #0060ae;
  --blue-d: #004f93;
  --green:  #27ae60;
  --bg:     #f0f4f8;
  --card:   #ffffff;
  --txt:    #1a2a3a;
  --muted:  #6b7f93;
  --border: #dde4ec;
  --r:      12px;
  --sh:     0 2px 10px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ─── SCREENS ─────────────────────────────────────────────────── */
[data-screen] {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
[data-screen][hidden] { display: none !important; }

/* ─── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  flex-shrink: 0;
}
.topbar-title { font-size: 17px; font-weight: 600; flex: 1; }
.icon-btn {
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px;
}
.icon-btn:active { background: rgba(255,255,255,.2); }

/* ─── LAYOUT ──────────────────────────────────────────────────── */
.pad { padding: 16px; flex: 1; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.spacer { height: 12px; }
.spacer-lg { height: 24px; }
.mt { margin-top: 16px !important; }
.mt-sm { margin-top: 8px !important; }

/* ─── HOME ────────────────────────────────────────────────────── */
.event-badge {
  background: var(--card);
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: var(--sh);
  display: flex;
  align-items: center;
  gap: 6px;
}
.event-badge .lbl { color: var(--muted); flex-shrink: 0; }
.event-badge .val { font-weight: 600; color: var(--blue); }

/* ─── BIG BUTTONS ─────────────────────────────────────────────── */
.big-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 18px 16px;
  border-radius: var(--r);
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  transition: transform .1s, opacity .1s;
}
.big-btn:active { transform: scale(.97); opacity: .88; }
.big-btn .ico { font-size: 34px; margin-bottom: 2px; }
.big-btn .hint { font-size: 12px; font-weight: 400; opacity: .72; }
.big-btn.primary { background: var(--blue); color: #fff; }
.big-btn.outline {
  background: var(--card); color: var(--blue);
  border: 2px solid var(--blue); box-shadow: var(--sh);
}
.big-btn.ghost   { background: transparent; color: var(--muted); font-weight: 400; font-size: 14px; }
.big-btn.success { background: var(--green); color: #fff; }

/* ─── CAMERA ──────────────────────────────────────────────────── */
.cam-wrap {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cam-wrap video {
  width: 100%;
  flex: 1;
  object-fit: cover;
  display: block;
}

.cam-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  width: 40px; height: 40px;
  border-radius: 50%; border: none;
  background: rgba(0,0,0,.55);
  color: #fff; font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}

/* QR viewfinder */
.qr-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  pointer-events: none;
}
.qr-frame {
  width: 220px; height: 220px;
  border: 3px solid rgba(255,255,255,.85);
  border-radius: 16px;
  box-shadow: 0 0 0 2000px rgba(0,0,0,.42);
}
.qr-hint {
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
  text-align: center;
  padding: 0 32px;
}

/* Shutter button */
.cam-bottom {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  display: flex; justify-content: center;
}
.shutter {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  border: 4px solid rgba(255,255,255,.4);
  cursor: pointer;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s;
}
.shutter:active { transform: scale(.9); }
.shutter-file   { border-style: dashed; border-color: rgba(255,255,255,.6); }

/* ─── PROCESSING ──────────────────────────────────────────────── */
.center {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; padding: 32px 24px; text-align: center;
}
.spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.prog-wrap  { width: 100%; max-width: 280px; }
.prog-bar   { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.prog-fill  { height: 100%; background: var(--blue); border-radius: 3px; transition: width .3s; }
.prog-msg   { font-size: 14px; color: var(--muted); margin-top: 8px; }
.hint-small { font-size: 12px; color: var(--muted); max-width: 260px; }

/* ─── CARDS / FORM ────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--sh);
  margin-bottom: 12px;
}
.card-hd {
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .6px; margin-bottom: 10px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.field { margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 11px;
  color: var(--muted); font-weight: 500; margin-bottom: 3px;
}
.field input,
.field select,
.select-full {
  width: 100%; padding: 9px 11px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 15px; color: var(--txt); background: var(--bg);
  -webkit-appearance: none;
  transition: border-color .15s;
  user-select: auto;
  -webkit-user-select: auto;
}
.field input:focus,
.field select:focus { outline: none; border-color: var(--blue); background: #fff; }

/* ─── PHOTO THUMB ─────────────────────────────────────────────── */
.thumb {
  width: 100%; max-height: 160px;
  object-fit: contain; border-radius: var(--r);
  margin-bottom: 12px; background: #000;
}

/* ─── RESULT SCREENS ──────────────────────────────────────────── */
.result-icon { font-size: 64px; }
h2 { font-size: 22px; font-weight: 700; }
.sub { font-size: 14px; color: var(--muted); line-height: 1.5; }
