:root {
  --bg: #f3f5fa;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5c6370;
  --border: #d6dbe5;
  --accent: #1f4fd8;
  --accent-text: #ffffff;
  --error: #c62828;
  --ok: #1b8a4b;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --card: #1b1e25;
    --text: #e9ebf0;
    --muted: #a0a7b4;
    --border: #343946;
    --accent: #5b82ff;
    --error: #ff6b6b;
    --ok: #3ccf7f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 24px 16px;
}

.card {
  max-width: 480px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
}

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { margin: 0 0 8px; }
.eyebrow { margin: 0; font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); margin: 0; }
header { margin-bottom: 20px; }

form { display: grid; gap: 16px; }
label, .file-field { display: grid; gap: 6px; font-weight: 500; }
.label-text { font-weight: 500; }
.req { color: var(--error); }

input:not([type="checkbox"]):not([type="file"]),
select {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
input:focus-visible, select:focus-visible, button:focus-visible, .dropzone:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
  padding: 24px 12px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  word-break: break-word;
}
.dropzone.drag, .dropzone.has-file { border-color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.check { grid-template-columns: auto 1fr; align-items: start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; }

.error { color: var(--error); min-height: 0; }
.error:empty { display: none; }
.form-error { margin: 0; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  padding: 14px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: progress; }
.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

#success { text-align: center; padding: 16px 0; }
.tick {
  width: 64px; height: 64px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 32px;
}

[hidden] { display: none !important; }

/* QR poster page */
.qr-page { display: grid; gap: 24px; justify-items: center; }
.controls { max-width: 560px; width: 100%; display: grid; gap: 12px; }
.controls h1 { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.poster {
  width: 100%;
  max-width: 560px;
  background: #fff;
  color: #111;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
}
.poster h2 { font-size: 2rem; margin: 8px 0; }
.poster .muted { color: #444; }
.poster img { width: min(320px, 100%); height: auto; margin: 16px auto; display: block; }
.poster .eyebrow { color: #1f4fd8; }
.steps { font-weight: 600; }
.url { font-family: ui-monospace, monospace; font-size: .85rem; color: #444; word-break: break-all; }

@media print {
  body { background: #fff; padding: 0; }
  .no-print { display: none !important; }
  .poster { border: 0; max-width: none; }
  .poster h2 { font-size: 2.6rem; }
  .poster img { width: 11cm; }
}
