/* ==========================================================================
   Design tokens — a wedding-stationery palette, not the generic
   cream+terracotta combo: deep plum ink, a dusty-rose accent, a muted
   gold flourish colour (used sparingly, for the rule/divider device),
   and a soft sage for secondary states. Matches the generated wish-card
   graphic's colours (includes/wishcard.php) so the two feel like one
   set of stationery.
   ========================================================================== */
:root {
  --paper: #faf4ec;
  --paper-deep: #f3e9dc;
  --ink: #3a2433;
  --ink-soft: #6b5563;
  --accent: #b4667a;
  --accent-deep: #8f4b5c;
  --gold: #a9834f;
  --sage: #7c8b6f;
  --line: #e4d5c8;
  --error: #a6403b;
  --success: #5c7a4f;
  --shadow: rgba(58, 36, 51, 0.10);

  /* Everything below is also theme-able (see includes/themes.php). The
     values here are the original look, so an event with no theme chosen
     is unchanged. --menu-ink / --field-ink are deliberately not set here:
     the fallbacks in the rules below keep the browser's own defaults. */
  --surface: #fffdfa;        /* cards, menu buttons */
  --surface-alt: #fff;       /* inputs, secondary buttons */
  --accent-ink: #fff5f0;     /* text on --accent */
  --link: #8f4b5c;
  --body-ink: #4a3a44;
  --label: #6b6058;
  --count: #8a8078;
  --muted: #a2968c;
  --hint-ink: #6b4a2c;
  --disabled-bg: #ddc9ce;
  --disabled-ink: #fff;
  --badge-1: #f3dfe4;
  --badge-2: #e9e6d8;
  --badge-3: #e4e8dd;
  --badge-4: #f0e3d0;
  --badge-5: #e0d7ec;
  --banner-bg: #8f4b5c;
  --banner-ink: #fff5f0;

  /* Typography — these defaults are the original look (Great Vibes names,
     Crimson Text body). Each event can override them: the guest pages emit
     a small inline <style> after this file with that event's choices
     (see includes/fonts.php). */
  --font-display: 'Great Vibes', cursive;
  --font-body: 'Crimson Text', Georgia, 'Times New Roman', serif;
  --body-weight: 400;
  --body-scale: 1;
  --names-weight: 400;
  --names-style: normal;
  --names-size: 3.1rem;
  --names-line: 1.1;
  --names-spacing: 0;
  --names-transform: none;

  /* Some typefaces run visually larger or smaller than others at the same
     size, so the root size is nudged per body font to keep text comfortable. */
  font-size: calc(17px * var(--body-scale));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: var(--body-weight);
  background: var(--paper);
  background-image: radial-gradient(ellipse 900px 500px at 50% -10%, var(--paper-deep), transparent);
  background-repeat: no-repeat;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Actual data-entry controls stay in a plain, neutral face — typing into
   a script/display serif at small phone sizes hurts legibility, and this
   is the one place function should win over the stationery styling. */
input, textarea, button {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 18px 96px;
}

.center-page {
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding-top: 24px;
  padding-bottom: 24px;
}

.hidden { display: none !important; }

/* ---- Header: hero photo (optional), couple's names in script, tagline ---- */
.site-header {
  text-align: center;
  margin-bottom: 22px;
}
.hero-photo-wrap {
  margin: -4px -2px 18px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 28px var(--shadow);
  aspect-ratio: 4 / 3;
}
.hero-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.site-header h1 {
  font-family: var(--font-display);
  font-weight: var(--names-weight);
  font-style: var(--names-style);
  font-size: calc(var(--names-size) / var(--body-scale));
  line-height: var(--names-line);
  letter-spacing: var(--names-spacing);
  text-transform: var(--names-transform);
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.site-header p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.02rem;
}

/* Signature divider device — used consistently wherever the page wants to
   mark a beat (under the header, above the footer, on the card). */
.rule-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 22px;
}
.rule-divider::before,
.rule-divider::after {
  content: '';
  height: 1px;
  width: 44px;
  background: var(--gold);
}
.rule-divider .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px var(--shadow);
}

.card h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 14px;
}

.disclaimer-text {
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--body-ink);
  margin-bottom: 14px;
}
.disclaimer-text .consent-points { margin: 8px 0 10px; padding-left: 1.2em; }
.disclaimer-text .consent-points li { margin-bottom: 6px; }
.disclaimer-text .terms-link {
  color: var(--link);
  font-style: italic;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.95rem;
}
.checkbox-row input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--accent); }
.checkbox-row label { line-height: 1.4; }

.btn-primary, .btn-secondary {
  display: inline-block;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background-color 0.15s ease, transform 0.05s ease;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-ink);
  cursor: not-allowed;
}
.btn-primary:not(:disabled):active { background: var(--accent-deep); transform: translateY(1px); }

.btn-secondary {
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:active { background: var(--paper-deep); }

.btn-link {
  background: none;
  border: none;
  color: var(--link);
  font-size: 0.95rem;
  padding: 0 0 12px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Menu: three options, each with a small colour-coded badge rather
   than a bare emoji — a considered, restrained bit of colour variety
   instead of three identical boxes. ---- */
.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.menu-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  color: var(--menu-ink, buttontext);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.02rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--shadow);
  color: inherit;
  text-decoration: none;
}
.menu-btn:active { background: var(--paper-deep); }
.menu-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
/* The coloured circle behind each menu icon (colours come from the theme). */
.menu-btn.menu-btn-video .menu-icon { background: var(--badge-1); }
.menu-btn.menu-btn-text .menu-icon { background: var(--badge-2); }
.menu-btn.menu-btn-share .menu-icon { background: var(--badge-3); }
.menu-btn.menu-btn-challenge .menu-icon { background: var(--badge-4); }
.menu-btn.menu-btn-aibooth .menu-icon { background: var(--badge-5); }
.menu-btn small {
  display: block;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin-top: 2px;
}

.field { margin-bottom: 16px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.field label {
  display: block;
  font-size: 0.9rem;
  color: var(--label);
  margin-bottom: 10px;
}
.field input[type="text"], .field input[type="tel"], .field input[type="date"], .field input[type="datetime-local"], .field textarea {
  width: 100%;
  padding: 12px;
  background: var(--surface-alt);
  color: var(--field-ink, fieldtext);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.field input[type="text"]:focus, .field input[type="tel"]:focus, .field input[type="date"]:focus, .field input[type="datetime-local"]:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field textarea { resize: vertical; }
.optional-tag { font-weight: 400; color: var(--count); }

.char-count {
  text-align: right;
  font-size: 0.85rem;
  color: var(--count);
  margin-top: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hint-text {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 6px;
}

.landscape-hint {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.landscape-icon {
  flex: none;
  width: 60px;
  height: auto;
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  margin-bottom: 8px;
}
.dropzone p { margin: 0 0 12px; color: var(--ink-soft); }
.pick-label {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
}

.camera-frame {
  position: relative;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 16 / 9;
}
.camera-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* show exactly what will be recorded, never a cropped middle */
  background: #000;
}
.pre-record-countdown {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-weight: 800;
  font-size: 6rem;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  animation: pre-record-pop 1s ease-in-out infinite;
}
@keyframes pre-record-pop {
  0% { transform: scale(0.8); opacity: 0.6; }
  30% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}
.record-countdown {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(166, 64, 58, 0.9);
  color: #fff;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.controls-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

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

#queue { margin-top: 12px; }
.queue-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.queue-item:first-child { border-top: none; }
.queue-item .name {
  font-size: 0.9rem;
  margin-bottom: 6px;
  word-break: break-all;
}
.bar-track {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.queue-item .status {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 4px;
}
.queue-item.done .status { color: var(--success); }
.queue-item.error .status { color: var(--error); }
.queue-item.error .bar-fill { background: var(--error); }

.error-text {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.keep-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--banner-bg);
  color: var(--banner-ink);
  text-align: center;
  padding: 14px 16px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  z-index: 10;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
  margin-top: 18px;
}

/* ---- Photo challenge ---- */
.challenge-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}
.challenge-tab {
  background: none;
  border: none;
  padding: 8px 4px 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.challenge-tab.active { color: var(--accent-deep); border-bottom-color: var(--accent); }

.challenge-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.challenge-row:disabled { cursor: default; opacity: 0.75; }
.challenge-row.done { border-color: var(--accent); }
.challenge-row-thumb {
  flex: none;
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 8px;
}
.challenge-row-empty {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: var(--paper-deep);
}
.challenge-row-text { flex: 1; font-size: 0.95rem; }
.challenge-row-check { color: var(--accent-deep); font-weight: 700; }

.challenge-prompt-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 4px 0 14px;
}
.challenge-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 14px;
  background: var(--paper-deep);
}
#challenge-photo-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
}

.challenge-entry-group { margin-bottom: 22px; }
.challenge-entry-prompt { font-size: 1rem; margin: 0 0 10px; }
.challenge-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.challenge-entry-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}
.challenge-entry-grid.collage { grid-template-columns: 1fr; gap: 14px; }
.challenge-entry-grid.collage .challenge-entry-item img { aspect-ratio: auto; object-fit: contain; }
.challenge-entry-name {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 4px;
}
.gallery-item-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 0.78rem;
}

/* ---- Moderator (photo approval) page ---- */
.mod-wrap {
  max-width: 1100px;
  padding: 20px 16px 60px;
}
.mod-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.mod-topbar h1 {
  font-size: 1.3rem;
  margin: 0;
}
.mod-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.mod-filter {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.mod-filter.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.mod-tile {
  position: relative;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
  text-align: left;
}
.mod-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.mod-tile-name {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 8px 0;
}
.mod-tile-prompt {
  font-size: 0.72rem;
  color: var(--ink-soft);
  padding: 0 8px 8px;
}
.mod-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  color: var(--accent-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s, transform 0.15s;
}
.mod-tile.approved { border-color: var(--accent); }
.mod-tile.approved .mod-check { opacity: 1; transform: scale(1); background: var(--accent); color: var(--accent-ink); }
.mod-tile.pending-request { opacity: 0.6; }

@media (min-width: 700px) {
  .mod-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
}

/* ---- Terms page ---- */
.terms-body h1 {
  font-family: var(--font-display);
  font-weight: var(--names-weight);
  font-style: var(--names-style);
  font-size: calc(var(--names-size) * 0.85 / var(--body-scale));
  line-height: var(--names-line);
  letter-spacing: var(--names-spacing);
  text-align: center;
  margin: 0 0 4px;
}
.terms-body .terms-subtitle { text-align: center; color: var(--ink-soft); font-style: italic; margin: 0 0 4px; }
.terms-body .card { line-height: 1.6; }
.terms-body .card p { margin: 0 0 14px; }
.terms-body .card p:last-child { margin-bottom: 0; }

/* ---- Video recording: turn-your-phone prompt + landscape layout ---- */
.rotate-prompt {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; text-align: center;
  background: rgba(0, 0, 0, 0.8); color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.05rem; line-height: 1.35;
}
.rotate-prompt svg { width: 64px; height: 64px; animation: rotate-nudge 2.4s ease-in-out infinite; }
@keyframes rotate-nudge {
  0%, 25% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}

/* Phone held sideways: use the whole screen — big picture on the left,
   buttons and name boxes in a column on the right. */
@media (orientation: landscape) and (max-height: 560px) and (pointer: coarse) {
  body.vs-sideways.video-open .site-header,
  body.vs-sideways.video-open .rule-divider,
  body.vs-sideways.video-open .site-footer,
  body.vs-sideways.video-open #video-section .card > h2,
  body.vs-sideways.video-open #video-section .card > .hint-text,
  body.vs-sideways.video-open #video-section .landscape-hint { display: none; }
  body.vs-sideways.video-open .wrap { max-width: none; padding: 0; }
  body.vs-sideways.video-open #video-section {
    position: fixed; inset: 0; z-index: 40; background: var(--paper);
    padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  }
  body.vs-sideways.video-open #video-section .card {
    height: 100%; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent;
    display: grid; grid-template-columns: minmax(0, 1fr) 270px; grid-template-rows: auto minmax(0, 1fr); column-gap: 14px;
  }
  body.vs-sideways.video-open #video-section .back-btn { grid-column: 2; grid-row: 1; justify-self: start; margin: 0 0 4px; }
  body.vs-sideways.video-open #video-section .video-layout { display: contents; }
  body.vs-sideways.video-open #video-section .video-cam { grid-column: 1; grid-row: 1 / span 2; min-height: 0; }
  body.vs-sideways.video-open #video-section .camera-frame { height: 100%; margin: 0; aspect-ratio: auto; border-radius: 10px; }
  body.vs-sideways.video-open #video-section .video-side { grid-column: 2; grid-row: 2; min-height: 0; overflow-y: auto; padding-right: 2px; }
  body.vs-sideways.video-open #video-section .controls-row { margin-bottom: 10px; }
  body.vs-sideways.video-open #video-section .field { margin-bottom: 8px; }
  body.vs-sideways.video-open .pre-record-countdown { font-size: 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pre-record-countdown { animation: none; }
  .rotate-prompt svg { animation: none; }
  .btn-primary, .btn-secondary { transition: none; }
}
.rotate-prompt small { font-size: 0.78rem; opacity: 0.75; max-width: 26ch; }


/* ---- "How do I turn my phone?" pop-up ---- */
.rotate-help-link {
  appearance: none; background: none; border: 0; padding: 4px 0; margin: 0;
  font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer;
  color: var(--accent-deep); text-align: left;
}
.rotate-prompt .rotate-help-link {
  color: #fff; background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px; padding: 10px 18px; text-decoration: none; font-size: 0.95rem; text-align: center;
}
.landscape-hint { flex-wrap: wrap; }
.landscape-hint .rotate-help-link { flex-basis: 100%; }
.landscape-hint .landscape-icon + span { flex: 1 1 0; min-width: 0; }

body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(30, 18, 26, 0.7);
}
.modal-card {
  position: relative; width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto;
  background: var(--surface); color: var(--ink);
  border-radius: 16px; padding: 22px 20px 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); outline: none;
  -webkit-overflow-scrolling: touch;
}
.modal-card h2 { margin: 0 34px 6px 0; font-size: 1.25rem; line-height: 1.25; }
.modal-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.modal-intro { margin: 0 0 14px; color: var(--ink-soft); }
.modal-close {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: var(--paper-deep); color: var(--ink);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.rh-block {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 8px;
  margin-bottom: 12px; background: var(--surface-alt);
}
.rh-block.rh-yours { border-color: var(--accent); }
.rh-block.rh-yours h3::after {
  content: 'your phone'; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.7rem; font-weight: 600; vertical-align: middle;
}
.rh-pic { display: block; width: 100%; max-width: 220px; height: auto; margin: 0 auto 6px; color: var(--ink); }
.rh-block ol { margin: 0; padding-left: 1.3em; line-height: 1.45; font-size: 0.95rem; }
.rh-block li { margin-bottom: 8px; }
.modal-foot { margin: 4px 0 14px; font-size: 0.9rem; color: var(--ink-soft); }
.modal-ok { width: 100%; }
@media (max-height: 480px) {
  .modal-card { padding: 14px 16px; }
  .rh-pic { display: none; }
}


/* ---- Selfie / back camera button ---- */
.flip-camera-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55); background: rgba(0, 0, 0, 0.55); color: #fff;
  font: 600 0.88rem/1.1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; cursor: pointer;
}
.flip-camera-btn svg { width: 22px; height: 22px; flex: none; }

/* ---- Demo mode ---- */
.demo-banner {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; text-align: center;
  background: var(--paper-deep); border: 1px dashed var(--accent); color: var(--ink);
  font: 0.9rem/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.demo-hub { display: grid; gap: 12px; margin: 0 0 16px; }
.demo-tile {
  display: flex; flex-direction: column; gap: 4px; text-decoration: none; text-align: left;
  padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.demo-tile strong { font-size: 1.05rem; }
.demo-tile span { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.35; }
.demo-tile:hover, .demo-tile:focus-visible { border-color: var(--accent); }
.demo-group-title { margin: 22px 0 10px; font-size: 1.1rem; }

.footer-terms { margin: 14px 0 0; }
.terms-button {
  display: inline-block; padding: 10px 20px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 0.9rem/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.terms-button:hover, .terms-button:focus-visible { border-color: var(--accent); }



/* ---- Video shape: square / wide, phone held upright ---- */
body.vs-square .camera-frame,
body.vs-wide .camera-frame { margin-left: auto; margin-right: auto; }
body.vs-square .camera-frame { aspect-ratio: 1 / 1; width: min(100%, 62vh, 460px); }
body.vs-wide .camera-frame { aspect-ratio: 16 / 9; width: min(100%, 110vh, 720px); }
/* what you see in the box is what is recorded: show the middle of the picture, cut to the box */
body.vs-square .camera-frame video,
body.vs-wide .camera-frame video { object-fit: cover; }
/* if this browser could not cut the picture, the review shows the whole thing */
body.vs-square.no-crop-record .camera-frame video,
body.vs-wide.no-crop-record .camera-frame video { object-fit: contain; }
.video-shape-hint { margin-top: 0; }

