/* Heaven Camping — colours, fonts and logo taken from heavensurfhouse.com
   (dark green buttons, cream background, Oswald headings, Georgia text). */
@import url('fonts/fonts.css');

:root {
  --bg: #f7f5e1;
  --card: #ffffff;
  --ink: #111111;
  --ink-2: #2e2f2c;
  --muted: #5f6360;
  --line: #dcd8bf;
  --field: #fffef7;
  --green: #0c4426;
  --green-2: #093420;
  --green-soft: #e6efe9;
  --leaf: #7ed350;
  --sea: #3275b0;
  --sea-soft: #e7f0f8;
  --ok: #1f6b3c;
  --ok-soft: #e4f2e8;
  --warn: #8a5200;
  --warn-soft: #fff1d6;
  --err: #b3261e;
  --err-soft: #fdecea;
  --radius: 6px;
  --head: 'Oswald', 'Arial Narrow', 'Roboto Condensed', Arial, sans-serif;
  --text: Georgia, 'Times New Roman', serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.no-scroll, html.no-scroll body { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid rgba(12, 68, 38, .45); outline-offset: 2px; }

/* ---------- header */
.top {
  background: #fff;
  border-bottom: 1px solid #d4d4d4;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
}
.top__inner { max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { flex: none; display: block; line-height: 0; }
.brand__logo { width: 72px; height: auto; display: block; }
.top__text { flex: 1; min-width: 0; }
.top__title { font: 400 21px/1.1 var(--head); margin: 0; letter-spacing: .2px; color: var(--ink); }
@media (max-width: 380px) { .top__title { font-size: 19px; } .brand__logo { width: 62px; } }
.top__place { margin: 3px 0 0; font: italic 13.5px/1.2 var(--text); color: var(--muted); }
.lang {
  flex: none; position: relative; display: flex; align-items: center; gap: 4px; color: var(--green);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 6px 0 9px; background: #fff;
}
.lang svg { width: 17px; height: 17px; flex: none; }
.lang select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; padding: 8px 18px 8px 2px;
  font: 500 14px/1 var(--ui); color: var(--green); cursor: pointer; max-width: 112px;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: right 6px center, right 2px center; background-size: 4px 4px; background-repeat: no-repeat;
}
@media (min-width: 560px) {
  .brand__logo { width: 92px; }
  .top__title { font-size: 26px; }
}

/* ---------- layout */
.wrap { max-width: 680px; margin: 18px auto 0; padding: 0 16px 24px; }
.card {
  background: var(--card); border-radius: var(--radius); border: 1px solid #e6e2c4;
  padding: 18px 16px; margin: 0 0 14px;
}
.card h2, .rules h2 {
  margin: 0 0 8px; font: 400 21px/1.2 var(--head); letter-spacing: .2px; display: flex; align-items: center; gap: 10px;
}
.step {
  width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff;
  display: inline-grid; place-items: center; font: 500 15px/1 var(--head); flex: none;
}
.hint { margin: 0 0 14px; color: var(--muted); font-size: 15px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 13px; margin-top: 12px; }
@media (min-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .field--wide { grid-column: 1 / -1; }
  .card { padding: 22px 22px; }
}

/* ---------- document type */
.doctype { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 10px; }
.doctype label {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 46px; margin: 0;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--field); cursor: pointer;
  font: 400 17px/1.1 var(--head); letter-spacing: .3px; color: var(--ink-2);
}
.doctype input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.doctype label:has(input:checked) { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.doctype label:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(12, 68, 38, .25); }

/* ---------- fields */
.field label, .field .label {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  font: 400 16px/1.2 var(--head); letter-spacing: .2px; color: var(--ink-2); margin: 0 0 6px;
}
.req { color: var(--sea); }
input:not([type="radio"]):not([type="file"]) {
  width: 100%; min-height: 48px; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--field);
  font: 16px/1.3 var(--ui); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
input[type="date"] { min-height: 48px; display: block; }
input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(12, 68, 38, .14); }
.has-error input { border-color: var(--err); background: #fff; }
.field-error { color: var(--err); font: 14px/1.4 var(--ui); margin: 5px 0 0; }
.field-note { color: var(--muted); font-size: 13.5px; margin: 5px 0 0; }

.badge:empty { display: none; }
.badge {
  font: 600 11.5px/1 var(--ui); padding: 4px 8px; border-radius: 999px; margin-left: auto; letter-spacing: .2px;
}
.badge--mrz { background: var(--ok-soft); color: var(--ok); }
.badge--check { background: var(--warn-soft); color: var(--warn); }
.badge--line, .badge--profile { background: var(--sea-soft); color: var(--sea); }
.field:has(.badge--check) input { border-color: #e2b354; }

.stepper { display: flex; align-items: stretch; gap: 6px; }
.stepper input { text-align: center; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__btn {
  flex: none; width: 48px; border: 1.5px solid var(--line); background: #fff; border-radius: var(--radius);
  font: 500 22px/1 var(--ui); color: var(--green); cursor: pointer;
}
.stepper__btn:active { background: var(--green-soft); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.segmented label {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 0;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--field); cursor: pointer;
  font: 400 17px/1 var(--head); color: var(--ink-2);
}
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented label:has(input:checked) { border-color: var(--green); background: var(--green); color: #fff; }
.segmented label:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(12, 68, 38, .25); }
.has-error .segmented label { border-color: var(--err); }

.stay-summary {
  margin: -2px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--green-soft); color: var(--green);
  font: 400 16px/1.3 var(--head); letter-spacing: .2px;
}

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px;
  padding: 12px 18px; border-radius: var(--radius); border: 1.5px solid transparent; cursor: pointer;
  font: 400 18px/1.1 var(--head); letter-spacing: .4px; text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.985); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-2); }
.btn--ghost { background: #fff; color: var(--green); border-color: var(--green); }
.btn--big { min-height: 58px; font-size: 20px; }
.btn--submit { width: 100%; min-height: 58px; font-size: 21px; margin-top: 4px; }
.btn--submit:disabled { opacity: .7; cursor: progress; }
.btn--submit.is-sending span::before {
  content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 9px; vertical-align: -2px;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
.linkbtn {
  background: none; border: 0; padding: 4px 0; color: var(--green); font: 15px/1.3 var(--text);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.scan-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .scan-actions { grid-template-columns: 1.4fr 1fr; } }

/* ---------- saved ID */
.saved {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; margin: 0 0 12px;
  border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); font-size: 15px;
}
.saved svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }

/* ---------- scans */
.scans { display: grid; gap: 14px; margin-bottom: 12px; }
.scans:empty { display: none; }
.scan { border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.scan__side { margin: 0; padding: 8px 12px; font: 400 16px/1.2 var(--head); letter-spacing: .3px; color: var(--green); background: var(--green-soft); }
.scan__media { position: relative; background: #1d1f1c; line-height: 0; }
.scan__media img { width: 100%; height: auto; display: block; max-height: 70vh; object-fit: contain; }
.scan.is-busy .scan__media img { filter: brightness(.55) saturate(.6); min-height: 160px; object-fit: cover; }
.scan__boxes { position: absolute; inset: 0; }
.scan.is-busy .scan__boxes { display: none; }
.box {
  position: absolute; padding: 0; border: 2px solid rgba(126, 211, 80, .95); background: rgba(126, 211, 80, .12);
  border-radius: 3px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.box.is-used { border-color: #3ccf7f; background: rgba(60, 207, 127, .22); }
.box.is-active { border-color: #fff; background: rgba(255, 255, 255, .3); box-shadow: 0 0 0 3px rgba(12, 68, 38, .85); }
.scan__busy {
  display: none; position: absolute; inset: 0; color: #fff; line-height: 1.35;
  flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px;
}
.scan.is-busy .scan__busy { display: flex; }
.scan__busy p { margin: 8px 0 0; font: 400 19px/1.2 var(--head); letter-spacing: .3px; }
.scan__busy .scan__busy-s { margin-top: 2px; font: italic 14px/1.3 var(--text); opacity: .85; }
.scan.is-busy .scan__media::after {
  content: ""; position: absolute; left: 6%; right: 6%; height: 3px; top: 10%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--leaf), transparent);
  animation: sweep 1.6s ease-in-out infinite alternate;
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sweep { from { top: 12%; } to { top: 86%; } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .btn--submit.is-sending span::before { animation-duration: 2.4s; }
  .scan.is-busy .scan__media::after { animation: none; }
}

.scan__body { padding: 12px 12px 10px; }
.scan__status { margin: 0 0 10px; font-size: 14.5px; color: var(--ink-2); padding: 9px 11px; border-radius: var(--radius); background: var(--warn-soft); }
.scan__status.is-ok { background: var(--ok-soft); color: #174f2d; }
.scan__status.is-partial { background: var(--sea-soft); color: #1d4a72; }
.lines-box > summary.lines-title {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; padding: 4px 0;
  font: 400 16px/1.3 var(--head); letter-spacing: .2px; color: var(--green);
}
.lines-box > summary.lines-title::-webkit-details-marker { display: none; }
.lines-box > summary.lines-title::before { content: "▸"; font-size: 12px; transition: transform .15s; }
.lines-box[open] > summary.lines-title::before { transform: rotate(90deg); }
.lines-box[open] > summary.lines-title { margin-bottom: 6px; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.line {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  min-height: 44px; padding: 8px 11px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--field);
  -webkit-tap-highlight-color: transparent;
}
.line:active { background: var(--green-soft); }
.line__text { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 600 15px/1.3 var(--ui); }
.line--weak .line__text { color: var(--muted); font-weight: 500; }
.line__tag { flex: none; font: 600 11.5px/1 var(--ui); color: #fff; background: var(--green); padding: 4px 8px; border-radius: 999px; }
.mrz { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.mrz summary { cursor: pointer; }
.mrz pre {
  margin: 6px 0 0; padding: 8px 10px; background: var(--field); border-radius: var(--radius); border: 1px solid var(--line);
  font: 12px/1.5 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all;
}
.scan__remove { margin-top: 8px; color: var(--muted); font-size: 14px; }

/* ---------- welcome banner */
.banner { background: #fff; border-radius: var(--radius); border: 1px solid #e6e2c4; border-left: 5px solid var(--green); padding: 16px; margin: 0 0 14px; }
.banner__title { margin: 0 0 4px; font: 400 22px/1.2 var(--head); }
.banner__text { margin: 0 0 6px; color: var(--ink-2); }

/* ---------- rules */
.rules { background: #fff; border: 1px solid #e6e2c4; border-left: 5px solid var(--sea); border-radius: var(--radius); padding: 16px 16px 8px; margin: 0 0 16px; }
.rules h2 { font-size: 19px; color: var(--sea); }
.rules ul { margin: 6px 0 0; padding-left: 20px; }
.rules li { margin: 0 0 8px; font-weight: 700; font-size: 15px; color: var(--ink); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: var(--err); background: var(--err-soft); padding: 10px 12px; border-radius: var(--radius); margin: 10px 0 0; font: 600 15px/1.4 var(--ui); }
.privacy { color: var(--muted); font-size: 13.5px; text-align: center; margin: 12px 4px 0; font-style: italic; }

/* ---------- done */
.done { text-align: center; padding: 30px 18px; outline: none; }
.done__icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }
.done__icon svg { width: 34px; height: 34px; }
.done h2 { justify-content: center; font-size: 26px; margin-bottom: 8px; }
.done p { color: var(--ink-2); margin: 0 auto 10px; max-width: 460px; }
.done .btn { margin-top: 10px; }

.foot { text-align: center; color: var(--muted); font-size: 13.5px; padding: 6px 16px max(22px, env(safe-area-inset-bottom)); }
.foot a { color: var(--green); }

/* ---------- bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(10, 14, 11, .5); opacity: 0; transition: opacity .2s; }
.sheet__panel {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 14px 14px 0 0; padding: 18px 16px max(16px, env(safe-area-inset-bottom));
  transform: translateY(30px); opacity: 0; transition: transform .22s ease, opacity .22s ease;
}
.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet.is-open .sheet__panel { transform: none; opacity: 1; }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet__panel { border-radius: 14px; } }
.sheet__title { margin: 0 0 10px; font: 400 21px/1.2 var(--head); }
.sheet__words { display: flex; flex-wrap: wrap; gap: 6px; }
.word {
  border: 1.5px solid var(--green); background: var(--green-soft); color: var(--green); border-radius: var(--radius);
  padding: 7px 10px; font: 600 15px/1.2 var(--ui); cursor: pointer; min-height: 40px;
}
.word[aria-pressed="false"] { background: #fff; color: #b2ad98; border-color: var(--line); text-decoration: line-through; }
.sheet__hint { margin: 8px 0 12px; font-size: 14px; color: var(--muted); font-style: italic; }
.sheet__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 54px;
  padding: 9px 11px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--field); cursor: pointer;
}
.pick:hover, .pick:focus-visible { border-color: var(--green); }
.pick__name { font: 400 16px/1.2 var(--head); color: var(--ink); }
.pick__value { font: 12.5px/1.3 var(--ui); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pick__value:empty::before { content: "—"; }
.sheet__cancel { width: 100%; margin-top: 12px; }

/* ---------- camera with a document frame */
.camera { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; --ratio: 1.585; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera__shade { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.camera__frame {
  position: relative; width: min(92vw, calc((100vh - 230px) * var(--ratio)), 900px); aspect-ratio: var(--ratio);
  border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .58); border: 2px solid rgba(255, 255, 255, .85);
}
.camera__frame .c { position: absolute; width: 34px; height: 34px; border: 4px solid var(--leaf); }
.camera__frame .tl { left: -4px; top: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.camera__frame .tr { right: -4px; top: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.camera__frame .bl { left: -4px; bottom: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.camera__frame .br { right: -4px; bottom: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.camera__mrz {
  display: none; position: absolute; left: 6%; right: 6%; bottom: 7%; height: 22%;
  border: 1.5px dashed rgba(255, 255, 255, .55); border-radius: 6px;
  font: 600 clamp(12px, 3.4vw, 22px)/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 2px;
  color: rgba(255, 255, 255, .55); align-items: center; justify-content: center; overflow: hidden; white-space: nowrap;
}
.camera--mrz .camera__mrz { display: flex; }
.camera__top { position: absolute; left: 0; right: 0; top: 0; padding: max(14px, env(safe-area-inset-top)) 18px 14px; text-align: center; }
.camera__title { margin: 0; font: 400 21px/1.25 var(--head); letter-spacing: .3px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.camera__tips { margin: 4px 0 0; font: italic 14.5px/1.3 var(--text); opacity: .9; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.camera__bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px max(22px, env(safe-area-inset-bottom));
}
.camera__btn {
  width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.camera__btn svg { width: 24px; height: 24px; }
.camera__btn[aria-pressed="true"] { background: #fff; color: #111; }
.camera__btn[hidden] { display: grid !important; visibility: hidden; }
.camera__shutter {
  width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--leaf); cursor: pointer;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .25);
}
.camera__shutter:active { transform: scale(.94); }
.camera__review {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; padding: 24px 18px;
}
.camera__review img { max-width: 100%; max-height: 55vh; border-radius: 10px; }
.camera__q { margin: 0; font: 400 20px/1.3 var(--head); text-align: center; max-width: 480px; }
.camera__review-bar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.camera__review .btn--ghost { background: transparent; color: #fff; border-color: #fff; }

/* ---------- toast */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 80;
  transform: translate(-50%, 20px); opacity: 0; transition: opacity .2s, transform .2s;
  background: #1d1f1c; color: #fff; padding: 11px 16px; border-radius: 10px; font: 600 14.5px/1.4 var(--ui);
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
