/* Mobile first, edge-to-edge: content respects the safe areas (notch, home indicator), light and dark theme. */

:root {
  color-scheme: light dark;
  --bg: #f2f2ef;
  --surface: #ffffff;
  --text: #16181a;
  --muted: #5d6266;
  --border: #e1e1dc;
  --accent: #1d7a3d;
  --accent-text: #ffffff;
  --ok-bg: #e2f3e7;
  --ok-text: #14532d;
  --warn-bg: #fdecea;
  --warn-text: #8a1c12;
  --hint-bg: #fff5d1;
  --hint-text: #5c4400;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --surface: #1b1e21;
    --text: #eceeef;
    --muted: #a3a9ae;
    --border: #2c3034;
    --accent: #2f9e57;
    --ok-bg: #16301f;
    --ok-text: #9be3b3;
    --warn-bg: #3a1714;
    --warn-text: #ffb4aa;
    --hint-bg: #332a0c;
    --hint-text: #f3d77a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

main {
  flex: 1;
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + 20px)
    calc(var(--safe-right) + 20px)
    calc(var(--safe-bottom) + 24px)
    calc(var(--safe-left) + 20px);
}

/* With a sticky action bar the content must not end up under it. */
body.has-actions main { padding-bottom: calc(var(--safe-bottom) + 112px); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

button.lang {
  display: inline-block;
  width: auto;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 { margin: 2px 0 20px; font-size: 1.75rem; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 1.1rem; }

p { margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: 2px; }

.card {
  margin-bottom: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card > :last-child { margin-bottom: 0; } /* no empty strip at the bottom of a card */

.muted { color: var(--muted); }
.small { margin: 8px 0 0; font-size: 0.9rem; }

.steps { margin: 0; padding-left: 1.25rem; }

.terms h2, .terms h3, .terms h4 { margin: 18px 0 8px; }
.terms h2:first-child, .terms h3:first-child { margin-top: 0; }
.terms ul, .terms ol { padding-left: 1.25rem; }
.terms li + li { margin-top: 4px; }
.steps li + li { margin-top: 6px; }
.locations { margin: 8px 0 0; padding-left: 1.25rem; }
.locations li + li { margin-top: 6px; }

/* Buttons: large, thumb-friendly targets */
button, .button {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 650;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

button.secondary, .button.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

/* Sticky bottom action bar in the thumb zone, above the home indicator */
.actions {
  position: fixed;
  inset: auto 0 0 0;
  padding:
    12px
    calc(var(--safe-right) + 20px)
    calc(var(--safe-bottom) + 12px)
    calc(var(--safe-left) + 20px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.actions > * { max-width: 30rem; margin: 0 auto; }

.consent {
  display: flex;
  gap: 14px;
  align-items: center; /* the whole card row is the tap target, checkbox centred with the text */
  cursor: pointer;
}

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

.banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 550;
}

.banner.ok { color: var(--ok-text); background: var(--ok-bg); }
.banner.warn { color: var(--warn-text); background: var(--warn-bg); }
.banner.warn button { margin-top: 12px; }

.hint { color: var(--hint-text); background: var(--hint-bg); }

/* The code for coming back: always black on white, also in dark mode, so scanners can read it */
.code { text-align: center; }

.pin {
  margin: 4px 0 14px;
  font-size: 2.6rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

.qr {
  width: min(72vw, 260px);
  margin: 0 auto 14px;
  padding: 12px;
  background: #fff;
  border-radius: 16px;
}

.qr svg { display: block; width: 100%; height: auto; }

.until { margin: 0; font-size: 1.1rem; }

.spinner {
  width: 40px;
  height: 40px;
  margin: 8px auto 16px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.center { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
