/* Palette: the only place colours are defined. Contrast checked to WCAG AA. */
:root {
  /* Colours taken from the backgrounds of the shop's pin buttons. */
  --ink: #1A1A1A;        /* text: 12.0:1 on cream */
  --paper: #FFFFFF;      /* input boxes and cards */
  --cream: #E5D4C0;      /* page background (cream pin) */
  --berry: #D42A2F;      /* buttons, white text 5.0:1 (red pin) */
  --rust: #B4633D;       /* accents only, never small text (rust pin) */
  --banana: #DEDD52;     /* 20% screen, ink text 12.1:1 (yellow pin) */
  --pink: #C9C5E0;       /* 10% screen, ink text 10.4:1 (lavender pin) */
  --muted: #4A4A4A;      /* small notes: 6.0:1 on cream */
  --line: #D9D9D9;
  --ok: #1E7B34;
  --warn: #B26A00;
  --bad: #C8102E;
  --off: #8A8A8A;

  --serif: "Iowan Old Style", "Palatino", "Georgia", serif;
  --sans: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 14px;
  --tap: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* A solid strip pinned to the top edge: iOS 26 then skips its blur there. */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 16px;
  background: var(--edge, var(--cream));
  z-index: 2147483647;
  pointer-events: none;
}

main { min-height: 100%; }

/* The top strip takes the colour of the confirmation screen behind it. */
body.edge-10 { --edge: var(--pink); }
body.edge-20 { --edge: var(--banana); }

[hidden] { display: none !important; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px clamp(20px, 6vw, 72px) 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

h1, h2, h3, .youre-in, .tier, .pct { font-family: var(--serif); font-weight: 700; }
h2 { font-size: 34px; margin: 0 0 8px; text-align: center; }
h3 { font-size: 24px; margin: 0 0 12px; }

/* Logo and headline, at the top of the form */
.logo {
  width: min(560px, 80vw);
  height: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.headline { font-size: clamp(34px, 5vw, 48px); margin: 0; text-align: center; }
.sub { margin: -8px 0 0; text-align: center; color: var(--muted); }
.form .logo { width: min(360px, 60vw); align-self: center; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600;
  min-height: var(--tap); padding: 0 28px;
  border-radius: var(--radius); border: 2px solid var(--ink);
  background: var(--paper); color: var(--ink);
  cursor: pointer; touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--berry); border-color: var(--berry); color: #FFFFFF; }
.btn-ghost { background: var(--paper); }
.btn-xl { font-size: 28px; min-height: 84px; min-width: 320px; }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Form */
.form form { width: min(640px, 100%); display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; }
.req, .opt { font-weight: 400; color: var(--muted); font-size: 16px; margin-left: 6px; }
input[type=email], input[type=text], input[type=tel], input[type=password], input[type=number] {
  font: inherit; font-size: 22px; /* 16px or more stops iOS zooming on focus */
  min-height: var(--tap); padding: 0 16px;
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); width: 100%;
}
.check { display: flex; gap: 14px; align-items: flex-start; font-size: 17px; line-height: 1.4; }
.check input { width: 32px; height: 32px; flex: 0 0 32px; margin: 0; accent-color: var(--berry); }
.age { font-size: 20px; align-items: center; }
.sms { gap: 12px; }
.fine { font-size: 16px; color: var(--muted); margin: 0; }
.links a { color: var(--ink); }
.error { color: var(--bad); font-size: 17px; font-weight: 600; }
.save-error { font-size: 20px; }
.actions { display: flex; gap: 16px; justify-content: space-between; margin-top: 8px; }
.actions .btn { flex: 1; }
.actions .btn-primary { flex: 2; }

/* Confirmation */
.confirm { background: var(--pink); gap: 12px; text-align: center; }
.confirm.tier-20 { background: var(--banana); }
.youre-in { font-size: clamp(48px, 8vw, 80px); margin: 0; }
.tier { font-size: clamp(40px, 6vw, 64px); margin: 0; }
.seller-note { margin: 8px 0 0; font-size: 24px; }
.seller-area {
  margin-top: 28px; padding-top: 20px; border-top: 3px dashed var(--rust);
  display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(560px, 100%);
}
.seller-label { margin: 0; font-size: 26px; }
#done { width: 100%; }

/* PIN */
.pin input { max-width: 320px; text-align: center; letter-spacing: 0.4em; font-size: 32px; }
.pin .actions { width: min(420px, 100%); }

/* Seller panel */
.seller { justify-content: flex-start; align-items: stretch; max-width: 880px; margin: 0 auto; }
.seller-head { display: flex; align-items: center; justify-content: space-between; }
.logo-small { height: 64px; width: auto; }
.card { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); padding: 20px 24px; }
.card .btn { margin-top: 8px; }
.net { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 8px; }
.stats div { background: #F4F4F4; border-radius: 10px; padding: 10px 14px; }
.stats dt { font-size: 15px; color: var(--muted); }
.stats dd { margin: 0; font-size: 30px; font-weight: 700; }
.muted { color: var(--muted); font-size: 17px; }
#settings-form { display: flex; flex-direction: column; gap: 14px; }
.recent { width: 100%; border-collapse: collapse; font-size: 17px; }
.recent th, .recent td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.recent td:first-child { white-space: nowrap; }
.purge { display: flex; gap: 12px; align-items: center; }
.purge input { width: 120px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0 8px; }

/* Status dot: shown on every screen, bottom right */
.dot, .status-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--off); }
.status-dot { position: fixed; right: 14px; bottom: 14px; width: 12px; height: 12px; opacity: 0.85; }
.dot.ok, .status-dot.ok { background: var(--ok); }
.dot.pending, .status-dot.pending { background: var(--warn); }
.dot.bad, .status-dot.bad { background: var(--bad); }
.dot.off, .status-dot.off { background: var(--off); }

@media (orientation: landscape) and (max-height: 820px) {
  .screen { padding-top: 28px; padding-bottom: 28px; gap: 16px; }
  .logo { width: min(440px, 50vw); }
}
