/* ==========================================================================
   Kiosk Frontend - Global Styles
   Neutral, dark, bold, fitness-appropriate default.
   Re-skin a deployment by overriding the CSS variables below (or by
   shipping a per-gym stylesheet that redefines this block after load).
   ========================================================================== */

:root {
  /* Brand palette - override these per deployment */
  --brand-primary: #ff4d2e;        /* accent / call-to-action */
  --brand-primary-ink: #ffffff;    /* text/icons ON --brand-primary; recomputed per gym in js/branding.js */
  --brand-primary-dark: #d93c22;
  --brand-primary-rgb: 255, 77, 46;    /* same color as --brand-primary, as r,g,b - keep in sync, used for glows/alpha */
  --brand-secondary: #2e7dff;      /* secondary accent */
  --brand-secondary-rgb: 46, 125, 255; /* same color as --brand-secondary, as r,g,b - keep in sync */
  --brand-bg: #0b0c0f;             /* app background */
  --brand-surface: #16181d;        /* card / panel background */
  --brand-surface-raised: #1e2129; /* elevated panel background */
  --brand-border: #2a2d36;
  --brand-text: #f5f6f8;
  --brand-text-muted: #9aa0ac;
  --brand-success: #29c46a;
  --brand-success-rgb: 41, 196, 106;
  --brand-danger: #ff5555;
  --brand-warning: #ffb020;
  --brand-warning-rgb: 255, 176, 32;   /* same color as --brand-warning, as r,g,b - keep in sync */

  /* Type scale */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-size-base: 20px;
  --font-size-sm: 16px;
  --font-size-lg: 28px;
  --font-size-xl: 40px;
  --font-size-xxl: 64px;
  --font-size-hero: clamp(2.5rem, 8vw, 5rem); /* attract-screen hero per kiosk-ui-ux hard rule 4 */

  /* Spacing / sizing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 40px;
  --space-xl: 64px;
  --radius: 16px;
  --radius-lg: 28px;
  --radius-full: 999px;
  --touch-min: 64px;    /* minimum touch target, well above 48px floor */
  --touch-min-lg: 72px; /* numeric pad / phone-first keys */
}

/* ==========================================================================
   Kiosk lockdown - applies on every page (kiosk-ui-ux hard rule 5).
   Mounted-iPad + phone check-in behavior: no text selection outside inputs,
   no callout/context menus, no rubber-band overscroll, no double-tap zoom.
   ========================================================================== */

html {
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  background: var(--brand-bg);
  color: var(--brand-text);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Allow text selection inside inputs and agreement bodies */
input, textarea, .selectable {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

h1, h2, h3, p {
  margin: 0 0 var(--space-sm) 0;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--brand-primary);
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  text-align: center;
}

.screen--top {
  justify-content: flex-start;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.container--wide {
  max-width: 960px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--brand-surface-raised);
  color: var(--brand-text);
  font-size: var(--font-size-lg);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
  width: 100%;
  /* Several buttons are <a> (Back to Kiosk / Done); without this they carry
     the browser's default underline through the middle of the label. */
  text-decoration: none;
}

/* Result screens put their single action straight into .screen, where the
   width:100% above stretched it edge to edge. Match the message column so
   the button reads as a button rather than a banner. */
.screen > .btn {
  max-width: 480px;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-primary);
  color: var(--brand-primary-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-primary-dark);
}

.btn-secondary {
  background: transparent;
  border-color: var(--brand-border);
  color: var(--brand-text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  min-height: 48px;
}

.btn-lg {
  font-size: var(--font-size-xl);
  padding: var(--space-md) var(--space-lg);
  min-height: 96px;
}

.btn-row {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
}

.btn-row .btn {
  flex: 1;
}

/* ---- Cards / panels ---- */

.card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: 100%;
}

.panel {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

/* ---- Forms ---- */

.field {
  text-align: left;
  margin-bottom: var(--space-md);
}

.field label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--brand-text-muted);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius);
  border: 2px solid var(--brand-border);
  background: var(--brand-surface-raised);
  color: var(--brand-text);
  font-size: var(--font-size-base);
  padding: 0 var(--space-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field textarea {
  padding: var(--space-sm);
  min-height: 120px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.field-hint {
  font-size: var(--font-size-sm);
  color: var(--brand-text-muted);
  margin-top: var(--space-xs);
}

.field-error {
  font-size: var(--font-size-sm);
  color: var(--brand-danger);
  margin-top: var(--space-xs);
  font-weight: 600;
}

/* Inline validation: the field wrapper picks up .has-error (set by signup.js
   alongside the existing .field-error text) so the input border itself
   flags the problem, not just the caption underneath it. */
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--brand-danger);
  background-color: rgba(255, 85, 85, 0.07);
}

.field-row {
  display: flex;
  gap: var(--space-sm);
}

.field-row .field {
  flex: 1;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  text-align: left;
  margin-bottom: var(--space-md);
  min-height: 48px;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--brand-primary);
}

.checkbox-field label {
  cursor: pointer;
  padding-top: 4px;
}

.form-error-banner {
  background: rgba(255, 85, 85, 0.12);
  border: 1px solid var(--brand-danger);
  color: var(--brand-danger);
  border-radius: var(--radius);
  padding: var(--space-sm);
  margin-bottom: var(--space-md);
  text-align: left;
}

.notice-banner {
  background: rgba(255, 176, 32, 0.12);
  border: 1px solid var(--brand-warning);
  color: var(--brand-warning);
  border-radius: var(--radius);
  padding: var(--space-sm);
  margin-bottom: var(--space-md);
  text-align: left;
}

/* ---- Attract screen (home) ----
   Full-bleed brand gradient, slow ambient drift (CSS-only), huge hero,
   "tap to get started" affordance, and the two big tappable action cards. */

.screen--attract {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.attract-bg {
  position: absolute;
  inset: -15%;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 20%, rgba(var(--brand-primary-rgb), 0.14), transparent 55%),
    radial-gradient(circle at 80% 75%, rgba(var(--brand-secondary-rgb), 0.1), transparent 55%),
    linear-gradient(160deg, var(--brand-bg) 0%, #000 100%);
  background-size: 130% 130%, 130% 130%, 100% 100%;
  /* Calm, barely-there drift - long duration and a small travel range so it
     reads as ambient, not animated; a "professional gym lobby", not signage
     that's constantly in motion. */
  animation: attract-drift 48s ease-in-out infinite alternate;
}

@keyframes attract-drift {
  0% { background-position: 0% 0%, 100% 100%, 0 0; }
  100% { background-position: 10% 6%, 92% 94%, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .attract-bg {
    animation: none;
  }
}

.attract-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.home-eyebrow {
  color: var(--brand-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.home-logo {
  font-size: var(--font-size-hero);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: var(--space-md);
  text-wrap: balance;
}

/* The gym's logo, sat behind the action cards instead of stacked above them.
   As a hero image it ate the vertical budget the cards needed and pushed the
   check-in QR off a landscape screen; as a watermark it still identifies the
   kiosk while "Join Now" carries the instruction on its own.

   Note this reads faintly with a dark logo on the dark default theme - a
   light-on-dark logo variant is what makes it land. */
.attract-watermark {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-repeat: no-repeat;
  background-position: center;
  /* Deliberately larger than the card cluster it sits behind - at card size
     it was entirely occluded and only showed in the gap between the two.
     Oversized, it bleeds past the edges and reads as a backdrop. */
  background-size: min(135vmin, 1250px) auto;
  opacity: 0.22;
  pointer-events: none;
}

/* Always-on check-in QR panel on the idle screen. Not a button - members
   scan it directly, so it must read as signage rather than something to
   tap. The QR keeps a white quiet zone regardless of gym branding, since
   dark-on-dark codes don't scan. */
.home-checkin {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brand-surface);
  border: 2px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
}

/* Title and caption are pushed away from the code rather than crowding it:
   the QR is what a member's eye and camera need to land on, and the words
   above and below are read once and then ignored. */
.home-checkin-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

/* Corner-anchored "Join Now". Small on purpose - check-in is the main event
   and most people arriving are already members - but still a full-size touch
   target, since a shrunken primary action on a mounted iPad is a dead tap. */
.home-join-btn {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--touch-min);
  padding: 0 var(--space-md);
  border-radius: var(--radius-full);
  border: 2px solid var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.12);
  color: var(--brand-text);
  font-size: var(--font-size-base);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, background 0.15s ease;
}

.home-join-btn:active {
  transform: scale(0.96);
  background: rgba(var(--brand-primary-rgb), 0.22);
}

.home-join-btn-arrow {
  color: var(--brand-primary);
  font-size: var(--font-size-lg);
  line-height: 1;
}

/* Size lives inline on the element in index.html - see the comment there.
   Keeping it out of here avoids two sources of truth for the same box. */
.home-checkin-qr {
  max-width: 100%;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px;
}

.home-checkin-desc {
  margin-top: var(--space-lg);
  font-size: 18px;
  color: var(--brand-text-muted, var(--text-muted));
  text-align: center;
}

/* Drop-in checkout outcome, shown when Stripe redirects back to the kiosk
   with ?dropin=. Success is deliberately NOT the brand accent: the accent is
   reserved for primary actions, and this is a status message, not something
   to tap. Tapping anywhere on it dismisses (it also times out on its own) -
   a shared screen must never hold one visitor's message in front of the
   next. */
.home-dropin-banner {
  max-width: 40ch;
  margin: 0 auto var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  border: 2px solid var(--brand-success);
  background: rgba(var(--brand-success-rgb), 0.14);
  color: var(--brand-text);
  /* Read from 2-3 feet away, same floor as .home-checkin-desc. */
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  transition: transform 90ms ease;
}

/* Instant feedback on tap - no dead taps, even on a dismissible banner. */
.home-dropin-banner:active {
  transform: scale(0.98);
}

.home-dropin-banner.is-canceled {
  border-color: var(--brand-warning);
  background: rgba(var(--brand-warning-rgb), 0.14);
}

.settings-link {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-text-muted);
  opacity: 0.35;
  text-decoration: none;
  font-size: 24px;
  touch-action: manipulation;
}

.settings-link:active {
  opacity: 0.8;
}

/* ---- Wizard shell ----
   The wizard screen is a 3-region column: a fixed header (step label +
   progress + banners), a scrollable body (the field groups), and a pinned
   footer nav - so Back/Continue are always visible without scrolling the
   whole page, even when a step has a lot of fields. */

.screen--wizard {
  /* Unlike the min-height:100vh on the base .screen, this needs to be a
     hard height cap: the header/nav must stay fixed and only wizard-body
     may scroll, so the flex column itself can't grow past the viewport. */
  height: 100vh;
  height: 100dvh;
  padding: 0;
  justify-content: flex-start;
  align-items: stretch;
  text-align: initial;
}

.wizard-header {
  flex: 0 0 auto;
  padding: max(var(--space-md), env(safe-area-inset-top)) var(--space-lg) 0;
}

.wizard-body {
  flex: 1 1 auto;
  /* Flex items default to min-height:auto, which would let this grow to
     fit its content and push the pinned header/nav off-screen instead of
     scrolling internally - min-height:0 is what makes overflow-y:auto win. */
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 var(--space-lg) var(--space-md);
}

/* Small, subtle gym logo shown next to the step label - must not compete
   with the form; falls back to just the label when a gym has no logo. */
.wizard-brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.wizard-logo {
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.wizard-step-label {
  color: var(--brand-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 0;
}

.progress-bar {
  display: flex;
  gap: var(--space-xs);
  width: 100%;
  max-width: 560px;
  margin: 0 auto var(--space-lg) auto;
}

.progress-step {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--brand-border);
  transition: background 0.2s ease;
}

.progress-step.is-complete,
.progress-step.is-active {
  background: var(--brand-primary);
}

.step-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.step-subtitle {
  color: var(--brand-text-muted);
  margin-bottom: var(--space-lg);
}

/* The bar stays full-bleed so its top border reads as a real footer edge,
   but the buttons are pushed into the same 720px column as the step content
   above them. Letting them span the full width made Continue a runaway
   banner on anything wider than an iPad, with Back stranded in the far
   corner - the two controls belong under the content they act on. */
.wizard-nav {
  flex: 0 0 auto;
  display: flex;
  gap: var(--space-sm);
  padding:
    var(--space-md)
    max(var(--space-lg), calc((100% - 720px) / 2))
    max(var(--space-md), env(safe-area-inset-bottom));
  border-top: 1px solid var(--brand-border);
  background: var(--brand-bg);
}

.wizard-nav .btn-secondary {
  flex: 0 0 auto;
  width: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.wizard-nav .btn-primary {
  flex: 1;
}

/* Cancel is the quietest control in the nav on purpose: it's an escape
   hatch, not a suggestion. Still 48px tall (the floor for a secondary
   target) and separated from Back so it can't be hit by accident. */
.wizard-nav .wizard-cancel {
  flex: 0 0 auto;
  width: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

/* ---- Plan cards ----
   Big selectable cards: the whole card is tappable, and the selected state
   is unmistakable (filled radio + colored border + tinted background). */

.plan-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.plan-card {
  text-align: left;
  border: 2px solid var(--brand-border);
  background: var(--brand-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  min-height: 96px;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.plan-card:active {
  transform: scale(0.98);
}

.plan-card.is-selected {
  border-color: var(--brand-primary);
  background: linear-gradient(180deg, rgba(var(--brand-primary-rgb), 0.08), var(--brand-surface));
}

.plan-card-check {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--brand-border);
  position: relative;
}

.plan-card.is-selected .plan-card-check {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
}

.plan-card.is-selected .plan-card-check::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 8px;
  border-left: 3px solid var(--brand-primary-ink);
  border-bottom: 3px solid var(--brand-primary-ink);
  transform: translate(-50%, -65%) rotate(-45deg);
}

.plan-card-main {
  flex: 1;
  min-width: 0;
}

.plan-card-name {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: 4px;
}

.plan-card-desc {
  color: var(--brand-text-muted);
  font-size: var(--font-size-sm);
}

.plan-card-price {
  font-size: var(--font-size-lg);
  font-weight: 800;
  white-space: nowrap;
  text-align: right;
}

.plan-card-fee {
  color: var(--brand-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 400;
  display: block;
}

/* ---- Agreement / document body ---- */

.agreement-body {
  background: var(--brand-surface-raised);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  max-height: 40vh;
  overflow-y: auto;
  text-align: left;
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

/* ---- Signature pad ----
   Large (>=40% viewport height), landscape-friendly, with an explicit
   "sign here" hint and an obvious clear/retry action. */

.signature-wrap {
  margin-bottom: var(--space-md);
}

.signature-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  color: var(--brand-text-muted);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.signature-canvas {
  width: 100%;
  height: 40vh;
  min-height: 260px;
  max-height: 420px;
  display: block;
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--brand-border);
  touch-action: none;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-xs);
}

/* ---- Status / spinner / QR ---- */

.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid var(--brand-border);
  border-top-color: var(--brand-primary);
  animation: spin 0.9s linear infinite;
  margin: 0 auto var(--space-md) auto;
}

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

.qr-wrap {
  background: #fff;
  border-radius: var(--radius);
  padding: var(--space-md);
  display: inline-block;
  margin: 0 auto var(--space-lg) auto;
  line-height: 0;
}

.qr-wrap canvas {
  display: block;
  /* >= 50% of the shorter viewport side (kiosk-ui-ux device-mode rule),
     with headroom so it reads as signage rather than a website widget. */
  width: min(64vmin, 640px);
  height: min(64vmin, 640px);
}

.qr-instruction {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

/* ---- PIN pad (check-in) ---- */

.pin-display {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.pin-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--brand-border);
  background: transparent;
}

.pin-dot.is-filled {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  max-width: 380px;
  margin: 0 auto;
}

.pin-key {
  min-height: var(--touch-min-lg);
  border-radius: var(--radius);
  background: var(--brand-surface-raised);
  border: 2px solid var(--brand-border);
  font-size: var(--font-size-xl);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, background 0.15s ease;
}

.pin-key:active {
  transform: scale(0.95);
  background: var(--brand-surface);
}

.pin-key--action {
  font-size: var(--font-size-base);
  color: var(--brand-text-muted);
}

/* ---- Result states ----
   Success states celebrate briefly (a short pop/settle on the icon) then
   the controller auto-returns home; failure/expired icons stay static. */

.result-icon {
  font-size: 96px;
  margin-bottom: var(--space-md);
  line-height: 1;
}

.result-icon--celebrate {
  animation: celebrate-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes celebrate-pop {
  0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .result-icon--celebrate {
    animation: none;
  }
}

.result-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.result-message {
  color: var(--brand-text-muted);
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-lg);
}

/* No waiver on file: check-in still succeeds, but say so loudly enough
   that the member (and whoever is at the desk) notices. */
.waiver-missing-note {
  color: #ffb020;
  font-weight: 700;
  border: 2px solid #ffb020;
  border-radius: 12px;
  padding: var(--space-sm) var(--space-md);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Idle timeout modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  z-index: 100;
}

.modal-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.modal-countdown {
  font-size: var(--font-size-xxl);
  font-weight: 800;
  color: var(--brand-primary);
  margin: var(--space-sm) 0 var(--space-lg) 0;
}

/* ---- Device pairing (kiosk-checkin) ---- */

.pairing-input {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 var(--space-sm);
  border-radius: var(--radius);
  border: 2px solid var(--brand-border);
  background: var(--brand-surface-raised);
  color: var(--brand-text);
  font-size: var(--font-size-base);
  margin-bottom: var(--space-md);
  text-align: center;
}

/* ---- Signage (kiosk-checkin QR screen) ---- */

.screen--signage {
  justify-content: center;
}

/* ---- Utility ---- */

/* Auto-return notice on dead-end screens (success, timeout, error). Sits
   under the manual button as a quiet status line - it tells the member the
   kiosk will reset itself without competing with the action above it. */
.return-countdown {
  margin-top: var(--space-md);
  min-height: 1.4em; /* reserve the line so the button never shifts */
  color: var(--brand-text-muted);
  font-size: var(--font-size-base);
  opacity: 0.75;
}

.text-muted { color: var(--brand-text-muted); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.small-print {
  font-size: var(--font-size-sm);
  color: var(--brand-text-muted);
}

/* --- Document-declared fields (see document_fields_service) --------------
   A paper agreement puts a "______" beside each clause to initial. The kiosk
   equivalent is one large checkbox per clause, so these rows carry whole
   paragraphs of legal text rather than short captions - hence the generous
   line-height and the checkbox pinned to the top of the row rather than
   centered against text that may run several lines. */

/* Bounded, not page-growing: a real membership agreement carries 14 clauses to
   initial, and letting them extend the page would push the signature pad and
   Continue button arbitrarily far down as a gym adds clauses. Capping the
   height keeps every document the same shape on screen, and scrolling stays
   inside this panel - the page itself never scrolls to reach an action. */
.doc-fields:not(:empty) {
  margin-bottom: var(--space-md);
  text-align: left;
  max-height: 38vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Same surface as the document panel above it, so the clauses read as the
     other half of one document rather than loose text under a box - and so
     the sticky count below has something opaque to sit on. */
  background: var(--brand-surface-raised);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

/* ---- Document beside its clauses ----
   A real agreement carries both the legal text AND a list of clauses to
   initial - one gym's is 15 of them. Stacked, each panel got barely a third
   of the screen, both scrolled, and the member met two cramped boxes and a
   signature pad in a single view.

   On a wide screen they sit side by side instead. The wizard lives in a
   720px column (right for a single form field, far too narrow for two
   panels), so the pair widens beyond it here - by less than the slack the
   body's own padding leaves at 1024px, the narrowest screen this applies to,
   so it can never cause a sideways scroll. Below that it stacks exactly as
   before. */
.doc-split {
  display: grid;
  gap: var(--space-md);
  align-items: start;
  margin-bottom: var(--space-md);
}

.doc-split > .agreement-body,
.doc-split > .doc-fields:not(:empty) {
  margin-bottom: 0;
}

@media (min-width: 1024px) {
  /* Only when there are clauses to put in the second column - a document
     with none keeps the full width for its text. */
  .doc-split:has(.doc-fields:not(:empty)) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: calc(100% + 200px);
    margin-left: -100px;
  }

  /* Roughly double the stacked height: the panels no longer compete for the
     same vertical space, so the constraint is the signature pad below. */
  .doc-split:has(.doc-fields:not(:empty)) > .agreement-body,
  .doc-split:has(.doc-fields:not(:empty)) > .doc-fields:not(:empty) {
    max-height: 54vh;
  }
}

/* The running "(3 of 15)" count is the only signal that more clauses exist
   below the fold, so it must not scroll away with them. */
.doc-ack-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--brand-surface-raised);
  /* Pulled up over the panel's top padding and given that padding back as its
     own, so when it pins there is no transparent strip above it for the first
     clause to show through. Vertical only - a negative side margin would make
     the panel scroll sideways. */
  margin-top: calc(var(--space-md) * -1);
  margin-bottom: var(--space-sm);
  padding: var(--space-md) 0 var(--space-xs);
}

/* Always-visible track: iOS hides overlay scrollbars until a scroll starts,
   which leaves a clipped clause looking like a layout bug rather than an
   invitation to scroll. The running "(3 of 14)" count carries the same signal
   in words for anyone who still misses it. */
.doc-fields::-webkit-scrollbar {
  width: 8px;
}

.doc-fields::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
}

.doc-fields::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-full);
}

.doc-field {
  margin-bottom: var(--space-md);
}

.doc-field-label {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: var(--space-sm);
}

.doc-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Whole chip is the target, not just the box - kiosk rule 3. */
.doc-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--touch-min);
  padding: 0 var(--space-md);
  border: 2px solid var(--brand-border);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.doc-option:active {
  transform: scale(0.97);
}

.doc-option:has(input:checked) {
  border-color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.12);
}

.doc-option input {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  accent-color: var(--brand-primary);
}

.doc-field-input {
  width: 100%;
}

.doc-ack {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  min-height: var(--touch-min);
  padding: var(--space-sm) 0;
  line-height: 1.5;
  cursor: pointer;
  border-top: 1px solid var(--brand-border);
  -webkit-tap-highlight-color: transparent;
}

.doc-ack input {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--brand-primary);
}


/* A blank in the legal text that the member's own details fill in
   ({{full_name}} etc.). Mirrors the PDF: their name written onto a ruled
   line, exactly where the paper form had a "______" to fill in. */
.merge-filled {
  font-weight: 700;
  border-bottom: 2px solid currentColor;
  padding: 0 0.2em;
  white-space: nowrap;
}

.merge-blank {
  display: inline-block;
  min-width: 11em;
  border-bottom: 2px solid currentColor;
  opacity: 0.5;
}
