﻿/*
  QR-Queue homepage — the circle hero.

  Scoped to body.home, so the dashboard, take page, ticket page and sign-in are
  untouched. Everything here reproduces the "circle ticket" moment from the
  reference page (dev.ultraerp.com/circle): a glass sphere floating inside a slowly
  rotating aurora, wrapped by a thick progress ring, with radar pulses leaving it.

  Palette: taken from the reference's own light theme — slate background, blue
  accent. The page is deliberately monochrome-plus-one so the sphere is the only
  saturated thing on screen. Accent-coloured primitives from styles.css (.btn-primary,
  badges, checkmarks) are re-pointed to blue inside body.home so this page reads as
  one object, while every other page keeps its own identity.

  No images: the whole hero is gradients, blur and one SVG ring.
*/

/* --------------------------------------------------------------- palette --- */

body.home {
  /* Left at the original grey on purpose. The page wash sits on top and is fully
     opaque from its first stop, so this colour never shows through — changing it
     would alter nothing visually while quietly diverging from the rest of the app. */
  --h-bg: #f1f5f9;
  --h-ink: #0f172a;
  --h-soft: #475569;
  --h-faint: #64748b;
  --h-line: rgba(15, 23, 42, 0.12);
  --h-card: #ffffff;

  --h-blue-1: #3b82f6;
  --h-blue-2: #8b5cf6;
  --h-blue-3: #06b6d4;
  --h-blue-4: #2563eb;
  --h-accent: #2563eb;
  --h-accent-2: #1d4ed8;
  --h-glow: rgba(59, 130, 246, 0.52);

  /*
    The blue scene's own tint, and the reason the blue page looked flatter than the
    purple one.

    This variable feeds `.svc-menu::before`, the soft radial wash that sits directly
    behind the demo panel. The three non-queue scenes each declare it (violet, orange,
    teal); the blue page never did, so var(--svc-tint, transparent) resolved to
    transparent and that whole layer rendered nothing. The body gradient was there the
    whole time — what was missing was this second, closer layer that gives the content
    area its depth.

    Matched to the sibling scenes: same 0.14 alpha, in the brand blue rather than a
    deeper navy, so it reads as the same family of wash at the same strength.
  */
  --svc-tint: rgba(59, 130, 246, 0.14);

  color: var(--h-ink);
  font-family: "Inter", -apple-system, "PingFang HK", "PingFang TC",
    "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

/* ------------------------------------------------------------ page wash --- */

/*
  The page background, painted on the body so it sits behind every section rather
  than inside one panel.

  Three layers: two radials light the top of the page, and a vertical wash carries
  the colour from pale blue at the header to near-white at the fold. The wash is the
  part that had gone missing — with only the radials, the base colour took over a
  few hundred pixels down and the page read as flat grey.

  background-image and background-color are declared separately, never through the
  `background` shorthand: the per-scene rules in svc-scenes.css override the image,
  and the shorthand would reset background-attachment with it, dropping the gradient
  back to scrolling with the document.

  Fixed attachment matters. A body gradient scrolls away with the content, so by the
  time a visitor reaches the demo panel the wash has left the screen.

  `queue` is listed alongside `:not([data-svc])` because selecting the Queue card
  sets data-svc="queue"; without it, clicking Queue would drop this rule and the page
  would fall back to the bare scene colour.
*/
body.home:not([data-svc]),
body.home[data-svc="queue"] {
  background-color: var(--h-bg);
  /*
    The vertical wash is sized in pixels, not percentages.

    With background-attachment: fixed, a percentage stop resolves against the
    *viewport*, so a 100% gradient ends at the bottom of the screen and the colour
    simply stops there — on a tall page the wash would run out halfway down and the
    rest of the page went flat grey. A fixed pixel length covers the whole viewport
    at every scroll position, so the colour keeps deepening as far as the eye can see.
  */
  background-image:
    radial-gradient(1150px 640px at 50% -8%, rgba(96, 165, 250, 0.3), transparent 62%),
    radial-gradient(840px 540px at 94% 2%, rgba(129, 140, 248, 0.22), transparent 60%),
    linear-gradient(180deg, #e4eefc 0%, #eef5fc 520px, #f8fbfd 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* --- re-point the shared accent primitives to blue, this page only --- */

body.home .site-head {
  background: rgba(241, 245, 249, 0.86);
  border-bottom-color: var(--h-line);
}

body.home .nav a:hover { color: var(--h-accent); }

body.home .btn-primary {
  background: linear-gradient(180deg, var(--h-blue-1), var(--h-blue-4));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}
body.home .btn-primary:hover { background: var(--h-accent-2); }

body.home .btn-ghost {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--h-line);
  color: var(--h-ink);
}
body.home .btn-ghost:hover { border-color: var(--h-blue-1); background: #fff; }

body.home .btn-soft {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.24);
  color: var(--h-accent-2);
}
body.home .btn-soft:hover { background: rgba(59, 130, 246, 0.18); }

body.home .eyebrow,
body.home .card-tag,
body.home .ind-who { color: var(--h-accent); }

body.home .card-icon { background: rgba(59, 130, 246, 0.12); color: var(--h-accent-2); }

body.home .tier-badge {
  background: var(--h-accent);
  color: #fff;
}
body.home .tier-hot {
  border-color: var(--h-blue-1);
  box-shadow: 0 12px 34px rgba(59, 130, 246, 0.18);
}

body.home .tier li::before,
body.home .card ul li::before,
body.home .faq summary::after { color: var(--h-accent); }

body.home .stat { border-left-color: var(--h-blue-1); }

body.home .ind-quote {
  border-left-color: var(--h-blue-1);
  background: rgba(59, 130, 246, 0.07);
}

body.home .field input:focus,
body.home .field select:focus {
  border-color: var(--h-blue-1);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

body.home .plan-opt.is-on {
  border-color: var(--h-accent);
  background: rgba(59, 130, 246, 0.06);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.13);
}
body.home .plan-opt:hover { border-color: var(--h-blue-1); }
body.home .plan-opt input { accent-color: var(--h-accent); }

body.home .form-msg.ok {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--h-accent-2);
}

body.home .site-foot { background: #0b1220; }

/* ------------------------------------------------------------------ hero --- */

.hero-circle {
  position: relative;
  overflow: hidden;
  padding: 2.4rem 0 3rem;
}

.hero-grid {
  position: relative;
  display: grid;
  gap: 1.8rem;
  align-items: center;
}

@media (min-width: 62rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3.2rem;
  }
}

.hero-copy { text-align: center; }

@media (min-width: 62rem) {
  .hero-copy { text-align: left; }
}

.hero-title {
  margin: 0.65rem 0 0;
  font-size: clamp(1.9rem, 5.4vw, 3.15rem);
  line-height: 1.14;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--h-ink);
}

.hero-title em {
  font-style: normal;
  background: linear-gradient(100deg, var(--h-blue-4), var(--h-blue-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 1rem auto 0;
  max-width: 33rem;
  font-size: 1rem;
  line-height: 1.72;
  color: var(--h-soft);
}

@media (min-width: 62rem) {
  .hero-sub { margin-left: 0; }
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin-top: 1.55rem;
}

@media (min-width: 62rem) {
  .hero-cta { justify-content: flex-start; }
}

.hero-note {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  color: var(--h-faint);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  justify-content: center;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 62rem) {
  .hero-chips { justify-content: flex-start; }
}

.hero-chips li {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--h-line);
  color: var(--h-soft);
}

/* ----------------------------------------------------------------- stage --- */

/*
  Every size derives from --ring so the composition scales as one object on a phone
  instead of the sphere shrinking while the glow stays huge.

  292 / 282 / 310 / 250 are the reference's px values at --ring: 292px.
*/
.circle-stage {
  --ring: clamp(224px, 66vw, 292px);
  --bubble: calc(var(--ring) * 0.856);
  --pulse: calc(var(--ring) * 0.966);
  --aurora: calc(var(--ring) * 1.062);
  --stage: calc(var(--ring) * 1.34);
  --ring-stroke: #2563eb;
  --track-stroke: rgba(15, 23, 42, 0.12);

  position: relative;
  width: var(--stage);
  height: var(--stage);
  margin: 0 auto;
  display: grid;
  place-items: center;
  isolation: isolate;
}

/* --- rotating aurora behind the sphere --- */
.aurora-glow {
  position: absolute;
  width: var(--aurora);
  height: var(--aurora);
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.72;
  z-index: 0;
  background: conic-gradient(
    from 0deg,
    var(--h-blue-1) 0deg,
    var(--h-blue-4) 110deg,
    var(--h-blue-2) 195deg,
    var(--h-blue-3) 275deg,
    var(--h-blue-1) 360deg
  );
  -webkit-mask-image: radial-gradient(circle, #000 46%, transparent 78%);
  mask-image: radial-gradient(circle, #000 46%, transparent 78%);
  animation: homeSpinPulse 7s linear infinite;
  transition: opacity 0.6s ease, filter 0.6s ease;
}

/* --- expanding radar rings --- */
.pulse-ring {
  position: absolute;
  width: var(--pulse);
  height: var(--pulse);
  border-radius: 50%;
  border: 2.5px solid rgba(96, 165, 250, 0.7);
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  animation: homeRadarPulse 2.9s ease-out infinite;
}

.pulse-ring.delay { animation-delay: 1.45s; }

/* --- floating group (ring + sphere move together) --- */
.bubble-float-group {
  position: relative;
  width: var(--ring);
  height: var(--ring);
  display: grid;
  place-items: center;
  z-index: 2;
  animation: homeFloat 4.5s ease-in-out infinite;
}

/* the entrance hop, applied once by JS */
.bubble-float-group.is-entering {
  animation:
    homeTicketHop 0.72s cubic-bezier(0.22, 1.35, 0.36, 1) forwards,
    homeFloat 4.5s ease-in-out 0.75s infinite;
}

/* --- progress ring --- */
.progress-ring-svg {
  position: absolute;
  inset: 0;
  width: var(--ring);
  height: var(--ring);
  transform: rotate(-90deg);
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

.progress-ring-track {
  fill: none;
  stroke: var(--track-stroke);
  stroke-width: 11;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--ring-stroke);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 854.51;
  stroke-dashoffset: 854.51;
  filter: drop-shadow(0 0 10px var(--h-glow));
  transition: stroke-dashoffset 1.5s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.5s ease;
}

/* --- the glass sphere --- */
.ticket-bubble {
  position: relative;
  width: var(--bubble);
  height: var(--bubble);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  user-select: none;

  background: radial-gradient(
    circle at 30% 28%,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(255, 255, 255, 0.76) 58%,
    rgba(241, 245, 249, 0.62) 100%
  );
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    inset 0 0 26px rgba(255, 255, 255, 0.9),
    0 0 32px var(--h-glow),
    0 22px 48px rgba(15, 23, 42, 0.14);

  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

/* Specular highlight — the one detail that makes it read as a sphere rather than a
   flat disc. */
.ticket-bubble::before {
  content: "";
  position: absolute;
  top: 13%;
  left: 17%;
  width: 24%;
  height: 11%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  transform: rotate(-35deg);
  filter: blur(2px);
}

.bubble-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.62rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 23, 42, 0.16);
  color: var(--h-soft);
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.bubble-label {
  margin-top: 0.42rem;
  font-size: 0.71rem;
  letter-spacing: 0.02em;
  color: var(--h-faint);
}

.bubble-number {
  font-size: clamp(2.5rem, 9vw, 3.5rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.05;
  color: var(--h-ink);
  text-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.bubble-status {
  margin-top: 0.6rem;
  font-size: 0.73rem;
  font-weight: 800;
  padding: 0.28rem 0.68rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid var(--ring-stroke);
  color: var(--ring-stroke);
  box-shadow: 0 0 12px var(--h-glow);
  transition: all 0.4s ease;
}

/* --- the "your turn" state --- */

/*
  Named `is-called`, NOT `state-called`.

  styles.css owns a global `.state-called` for the customer ticket page:
      .state-called { background: var(--g-100); border: 1px solid var(--g-300); }
  Reusing that name here made the whole stage pick up a pale-green panel and a green
  outline — visible as a green box around the circle. A page-scoped name avoids it and
  keeps the ticket page untouched.
*/
.circle-stage.is-called .aurora-glow {
  opacity: 0.96;
  filter: blur(40px);
}

.circle-stage.is-called .pulse-ring {
  border-width: 3.5px;
  border-color: rgba(37, 99, 235, 0.85);
  box-shadow: 0 0 28px var(--h-glow);
  animation-duration: 1.5s;
}

.circle-stage.is-called .pulse-ring.delay { animation-delay: 0.75s; }

.circle-stage.is-called .ticket-bubble {
  border: 2.5px solid var(--ring-stroke);
  animation: homeSuccessGlow 1.6s ease-in-out infinite;
}

.circle-stage.is-called .bubble-badge {
  background: var(--h-ink);
  border-color: var(--h-ink);
  color: #fff;
}

.circle-stage.is-called .bubble-status {
  background: var(--ring-stroke);
  border-color: var(--ring-stroke);
  color: #fff;
  box-shadow: 0 0 22px var(--h-glow);
  animation: homeNextZoom 1.15s ease-in-out infinite;
}

/* --- keyframes: same shapes and timings as the reference --- */

@keyframes homeSpinPulse {
  0%   { transform: rotate(0deg) scale(0.94); }
  50%  { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(0.94); }
}

@keyframes homeRadarPulse {
  0%   { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.42); opacity: 0; }
}

@keyframes homeFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@keyframes homeTicketHop {
  0%   { transform: scale(0.62) translateY(24px); opacity: 0; }
  45%  { transform: scale(1.12) translateY(-22px); opacity: 1; }
  70%  { transform: scale(0.96) translateY(5px); }
  86%  { transform: scale(1.03) translateY(-6px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes homeSuccessGlow {
  0%, 100% {
    box-shadow:
      inset 0 0 30px rgba(255, 255, 255, 0.9),
      0 0 44px var(--h-glow),
      0 0 70px var(--h-glow);
  }
  50% {
    box-shadow:
      inset 0 0 44px rgba(255, 255, 255, 0.9),
      0 0 65px var(--h-glow),
      0 0 95px var(--h-glow);
  }
}

@keyframes homeNextZoom {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.14); }
}

/* Caption under the stage. Tiny on purpose: it must never compete with the sphere. */
.circle-caption {
  margin: 0.3rem auto 0;
  max-width: 23rem;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--h-faint);
}

/* ------------------------------------------------------- section polish --- */

body.home section { padding: 3.4rem 0; }

body.home .section-head h2,
body.home #faq h2 {
  font-size: clamp(1.42rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--h-ink);
}

body.home .section-head p,
body.home .lead { color: var(--h-soft); }

body.home .card,
body.home .ind,
body.home .tier,
body.home .panel,
body.home .aside-card {
  background: var(--h-card);
  border-color: var(--h-line);
}

body.home .card h3,
body.home .ind h3 { color: var(--h-ink); }
body.home .card p,
body.home .ind p { color: var(--h-soft); }

/* Checkmark bullets: the source copy is a list of short sentences, so a bullet reads
   faster than four stacked paragraphs. */
body.home .card ul {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
  color: var(--h-soft);
}

body.home .card ul li {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

body.home .card ul li::before {
  content: "✓";
  font-weight: 800;
  flex: none;
}

/* Steps read better as a numbered rail than as six identical cards. */
body.home .steps { gap: 0.75rem; }

body.home .step {
  background: var(--h-card);
  border-color: var(--h-line);
}

body.home .step-num {
  background: linear-gradient(180deg, var(--h-blue-1), var(--h-blue-4));
  color: #fff;
}

body.home .step h3 { color: var(--h-ink); }
body.home .step p { color: var(--h-soft); }

/* The results band keeps the dark treatment; it separates the two long white runs. */
body.home .dark {
  background: #0b1220;
}

body.home .tier .btn { margin-top: auto; }
body.home .tier ul { margin-bottom: 1.1rem; }
body.home .tier li { color: var(--h-soft); }
body.home .tier h3,
body.home .tier-price { color: var(--h-ink); }
body.home .tier-price small { color: var(--h-faint); }

body.home .faq { border-top-color: var(--h-line); }
body.home .faq details { border-bottom-color: var(--h-line); }
body.home .faq summary { color: var(--h-ink); }
body.home .faq p { color: var(--h-soft); }

body.home .field label { color: var(--h-ink); }
body.home .field input,
body.home .field select {
  background: #fff;
  border-color: var(--h-line);
  color: var(--h-ink);
}
body.home .field-hint { color: var(--h-faint); }

body.home .plan-opt { background: #fff; border-color: var(--h-line); }
body.home .plan-opt-name { color: var(--h-ink); }
body.home .plan-opt-note { color: var(--h-faint); }

body.home .divider span { color: var(--h-faint); }
body.home .google-btn {
  background: #fff;
  border-color: var(--h-line);
  color: var(--h-ink);
}
body.home .google-btn:hover { border-color: var(--h-blue-1); }

body.home .aside-card h3 { color: var(--h-ink); }
body.home .aside-card ol { color: var(--h-soft); }
body.home .aside-card li strong { color: var(--h-ink); }
body.home .aside-card .fine { color: var(--h-faint); border-top-color: var(--h-line); }

body.home .final-cta { background: #fff; border-top-color: var(--h-line); }
body.home .final-cta h2 { color: var(--h-ink); }
body.home .final-cta p { color: var(--h-soft); }

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 40rem) {
  .hero-circle { padding: 1.5rem 0 2.1rem; }

  /* On a phone the sphere comes first: it is what the page is selling. */
  .hero-grid {
    display: flex;
    flex-direction: column-reverse;
    gap: 1.3rem;
  }

  .circle-stage {
    --ring: clamp(206px, 64vw, 252px);
    --stage: calc(var(--ring) * 1.28);
  }

  body.home section { padding: 2.6rem 0; }
}

/* ------------------------------------------------------- reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .aurora-glow,
  .pulse-ring,
  .bubble-float-group,
  .bubble-float-group.is-entering,
  .circle-stage.is-called .ticket-bubble,
  .circle-stage.is-called .bubble-status {
    animation: none !important;
  }

  .progress-ring-fill { transition: none; }
}

/* ==========================================================================
   Three-step flow — what happens between the door and a number.

   Sits above the circle hero and tells the whole story in three animated panels.
   Everything is CSS; the QR is a 21x21 grid of divs, so the page still has no
   images at all.

   COLOUR IS NOT DECORATION. It carries the queue category:

       A team · 1-2 people  →  blue
       B team · 3-4 people  →  pink

   The QR in step 1 is the sign on the counter, so it is drawn twice: the blue
   card is the A-team code, the pink one is the B-team code. Step 3 repeats the
   same rule — choosing 1-2 people yields a blue A number, choosing 3-4 yields a
   pink B number. The demo cycles through both so a visitor sees the rule rather
   than being told it.
   ========================================================================== */

@property --qr-tint {
  syntax: "<color>";
  inherits: true;
  initial-value: #2563eb;
}

.flow-steps {
  position: relative;
  padding: 2.6rem 0 1.4rem;
}

.flow-steps .section-head {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}

/* ------------------------------------------------------------- the rail --- */

.flow-rail {
  position: relative;
  display: grid;
  gap: 2.1rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 60rem) {
  .flow-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }

  .flow-rail::before {
    content: "";
    position: absolute;
    top: 7.6rem;
    left: 11%;
    right: 11%;
    height: 2px;
    background: linear-gradient(
      90deg,
      rgba(37, 99, 235, 0) 0%,
      rgba(37, 99, 235, 0.26) 20%,
      rgba(236, 72, 153, 0.26) 62%,
      rgba(236, 72, 153, 0) 100%
    );
    pointer-events: none;
  }
}

.flow-step { position: relative; text-align: center; }

.flow-visual {
  position: relative;
  height: 15.6rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--h-line);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.flow-visual::after {
  content: "";
  position: absolute;
  inset: auto 0 -45% 0;
  height: 70%;
  background: radial-gradient(ellipse at 50% 100%, rgba(59, 130, 246, 0.11), transparent 70%);
  pointer-events: none;
}

.flow-num {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--h-blue-1), var(--h-blue-4));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 0.7rem;
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.32);
}

.flow-copy h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--h-ink);
  letter-spacing: -0.01em;
}

.flow-copy p {
  margin: 0.45rem auto 0;
  max-width: 22rem;
  font-size: 0.87rem;
  line-height: 1.65;
  color: var(--h-soft);
}

/* Legend: one line stating the rule the animation is demonstrating. */
.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  align-items: center;
  justify-content: center;
  margin: 1.9rem auto 0;
  padding: 0;
  list-style: none;
  font-size: 0.79rem;
  color: var(--h-soft);
}

.flow-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.flow-legend b {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
}

.flow-legend .is-a b { background: #2563eb; }
.flow-legend .is-b b { background: #ec4899; }

/* ------------------------------------------------------ step 1: one QR --- */

/*
  A single QR code, floating. Nothing else.

  Earlier drafts put two cards on a shop counter (one per team), which read as
  "two devices to buy". The product is one printed code; the team colours are a
  result of the party size chosen in step 3, not an input here. Keeping step 1 to
  one object also makes the three panels read as a sequence rather than a set.
*/

.qr-solo {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  animation: flowQrFloat 4.6s ease-in-out infinite;
}

/* the soft shadow that sells "floating above a surface" */
.qr-solo::after {
  content: "";
  position: absolute;
  bottom: -1.1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 5.4rem;
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.13);
  filter: blur(3px);
  animation: flowQrShadow 4.6s ease-in-out infinite;
}

.qr-card {
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  grid-template-rows: repeat(21, 1fr);
  width: 7.4rem;
  height: 7.4rem;
  padding: 0.42rem;
  border-radius: 10px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.07),
    0 14px 30px rgba(15, 23, 42, 0.14),
    0 0 22px rgba(37, 99, 235, 0.22);
}

.qr-mod { border-radius: 0.5px; background: #2563eb; }
.qr-mod.is-off { background: transparent; }
/* --------------------------------------------- step 2: phone scanning --- */

.phone-mock {
  position: relative;
  width: 7.9rem;
  height: 13.1rem;
  border-radius: 1.35rem;
  padding: 0.42rem;
  background: linear-gradient(180deg, #0f172a, #1e293b);
  box-shadow:
    0 20px 44px rgba(15, 23, 42, 0.24),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.14);
  animation: flowPhoneSettle 6s ease-in-out infinite;
}

.phone-notch {
  position: absolute;
  top: 0.68rem;
  left: 50%;
  transform: translateX(-50%);
  width: 2.5rem;
  height: 0.22rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  z-index: 3;
}

.phone-screen {
  position: relative;
  height: 100%;
  border-radius: 1rem;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(59, 130, 246, 0.2), transparent 60%),
    #0b1220;
  display: grid;
  place-items: center;
}

/* The camera preview shows the A card being scanned, then the B card — the
   tint follows so the viewer connects "colour = team" across both steps. */
.cam-qr {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
  width: 4.2rem;
  height: 4.2rem;
  padding: 0.28rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  opacity: 0.94;
}

.cam-qr i {
  border-radius: 0.5px;
  animation: flowTintCycle 11s ease-in-out infinite;
}

.cam-qr i.is-off { background: transparent !important; }

.scan-line {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #38bdf8 20%, #60a5fa 50%, #38bdf8 80%, transparent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.85);
  animation: flowScanSweep 2.9s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.cam-corner {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(96, 165, 250, 0.9);
  border-radius: 3px;
}

.cam-corner.tl { top: 0.75rem; left: 0.75rem; border-right: 0; border-bottom: 0; }
.cam-corner.tr { top: 0.75rem; right: 0.75rem; border-left: 0; border-bottom: 0; }
.cam-corner.bl { bottom: 0.75rem; left: 0.75rem; border-right: 0; border-top: 0; }
.cam-corner.br { bottom: 0.75rem; right: 0.75rem; border-left: 0; border-top: 0; }

.cam-hint {
  position: absolute;
  bottom: 1.85rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.58);
}

/* ------------------------------------------ step 3: the take-number page --- */

.take-mock {
  position: relative;
  width: 8.5rem;
  height: 12.6rem;
  border-radius: 1.1rem;
  padding: 0.8rem 0.55rem;
  background: #fff;
  border: 1px solid var(--h-line);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.take-title {
  font-size: 0.52rem;
  font-weight: 700;
  color: var(--h-faint);
  letter-spacing: 0.04em;
}

/* Six party sizes in two rows, so the 1-2 and 3-4 groups are visually separate. */
.take-sizes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.22rem;
  width: 100%;
  margin-top: 0.5rem;
}

.take-sizes span {
  display: grid;
  place-items: center;
  height: 1.2rem;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid transparent;
  font-size: 0.55rem;
  font-weight: 800;
  color: var(--h-soft);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/*
  Step 3 is driven by a state class on .take-mock, not by a CSS keyframe loop.
  Reason: the "called" moment has to fire a sound at exactly the same instant the
  glow appears. Two independent timelines (CSS animation + JS timer) would drift
  apart within a minute, so the JS cycle is the single clock and CSS only styles
  each named state.

  States:  is-picking -> is-issued -> is-waiting -> is-called -> is-bteam
*/
.take-mock.is-picking .take-sizes span:nth-child(1),
.take-mock.is-picking .take-sizes span:nth-child(2),
.take-mock.is-issued .take-sizes span:nth-child(1),
.take-mock.is-issued .take-sizes span:nth-child(2),
.take-mock.is-waiting .take-sizes span:nth-child(1),
.take-mock.is-waiting .take-sizes span:nth-child(2),
.take-mock.is-called .take-sizes span:nth-child(1),
.take-mock.is-called .take-sizes span:nth-child(2) {
  background: rgba(37, 99, 235, 0.14);
  border-color: #2563eb;
  color: #1d4ed8;
}

.take-mock.is-bteam .take-sizes span:nth-child(3),
.take-mock.is-bteam .take-sizes span:nth-child(4) {
  background: rgba(236, 72, 153, 0.14);
  border-color: #ec4899;
  color: #be185d;
}

.take-btn {
  position: relative;
  margin-top: 0.55rem;
  width: 100%;
  padding: 0.34rem 0;
  border-radius: 999px;
  color: #fff;
  font-size: 0.52rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  transition: background 0.35s ease;
}

.take-mock.is-bteam .take-btn {
  background: linear-gradient(180deg, #f472b6, #ec4899);
}

/* The tap ripple fires once on entering is-issued, then stays hidden. */
.take-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid currentColor;
  opacity: 0;
}

.take-mock.is-issued .take-btn::after {
  animation: flowTapRipple 0.9s ease-out 1;
}

/* ---- the A02 / B03 result card ---- */

.take-result {
  position: absolute;
  inset: 0;
  border-radius: 1.1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1.2, 0.36, 1),
    box-shadow 0.35s ease;
  pointer-events: none;
}

.take-mock.is-issued .take-result,
.take-mock.is-waiting .take-result,
.take-mock.is-called .take-result,
.take-mock.is-bteam .take-result {
  opacity: 1;
  transform: scale(1);
}

.take-mock.is-bteam .take-result {
  background: #fff;
}

.take-result .res-team {
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  color: #fff;
  background: #2563eb;
  transition: background 0.3s ease;
}

.take-mock.is-bteam .take-result .res-team {
  background: #ec4899;
}

.take-result .res-no {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #2563eb;
  transition: color 0.3s ease;
}

.take-mock.is-bteam .take-result .res-no {
  color: #ec4899;
}

.take-result .res-sub {
  font-size: 0.46rem;
  font-weight: 700;
  color: var(--h-faint);
  transition: color 0.3s ease;
}

/* Waiting: a thin progress bar with no percentage, because a demo has no real
   queue behind it — showing a fake "3 of 7" would be a lie in a marketing page. */
.take-progress {
  width: 3.6rem;
  height: 0.2rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.16);
  overflow: hidden;
  margin-top: 0.28rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.take-mock.is-waiting .take-progress,
.take-mock.is-called .take-progress {
  opacity: 1;
}

.take-progress i {
  display: block;
  height: 100%;
  width: 22%;
  border-radius: 999px;
  background: #2563eb;
  transition: width 1s linear;
}

.take-mock.is-waiting .take-progress i { width: 68%; }
.take-mock.is-called .take-progress i { width: 100%; }

/* Called: the card lifts, glows, and the subtitle becomes the instruction. */
.take-mock.is-called .take-result {
  box-shadow:
    0 0 0 2px #2563eb,
    0 0 22px rgba(59, 130, 246, 0.55),
    0 0 44px rgba(59, 130, 246, 0.32);
  animation: flowCalledPulse 1.4s ease-in-out infinite;
}

.take-mock.is-called .take-result .res-sub {
  color: #1d4ed8;
  font-weight: 800;
}

/* Small badge that only exists in the called state. */
.res-called {
  display: none;
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1d4ed8;
}

.take-mock.is-called .res-called { display: block; }
.take-mock.is-called .res-sub { display: none; }

/* ------------------------------------------------------------- keyframes --- */

@keyframes flowQrFloat {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50%      { transform: translateY(-9px) rotate(1.2deg); }
}

/* The shadow shrinks as the card rises, which is what makes it read as floating
   rather than sliding. */
@keyframes flowQrShadow {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.13; }
  50%      { transform: translateX(-50%) scale(0.86); opacity: 0.07; }
}

/* Card tint for the camera preview: blue for the A half, pink for the B half. */
@keyframes flowTintCycle {
  0%, 6%    { background: #2563eb; }
  46%, 52%  { background: #2563eb; }
  56%, 92%  { background: #ec4899; }
  96%, 100% { background: #2563eb; }
}

/*
  These four are no longer used: step 3 became state-class driven so the sound and
  the "called" glow fire on the same frame. Kept as a note rather than silent
  deletion in case an earlier cached HTML still references the 11s loop.
*/

@keyframes flowTapRipple {
  0%   { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.55); }
}

@keyframes flowCalledPulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px #2563eb,
      0 0 22px rgba(59, 130, 246, 0.5),
      0 0 44px rgba(59, 130, 246, 0.28);
  }
  50% {
    box-shadow:
      0 0 0 2px #2563eb,
      0 0 32px rgba(59, 130, 246, 0.72),
      0 0 62px rgba(59, 130, 246, 0.42);
  }
}

/* --------------------------------------------------- sound toggle button --- */

/* One small pill in the flow header. Off by default; the choice is remembered. */
.flow-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  max-width: 40rem;
  margin: 0 auto;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  flex: none;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--h-line);
  color: var(--h-soft);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.sound-toggle:hover { border-color: var(--h-blue-1); color: var(--h-ink); }

.sound-toggle[aria-pressed="true"] {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--h-accent-2);
}

.sound-toggle svg { flex: none; }

/* The wave arcs only show when sound is on, so the icon states the mode. */
.sound-toggle .wave { opacity: 0; transition: opacity 0.2s ease; }
.sound-toggle[aria-pressed="true"] .wave { opacity: 1; }

/* A small slash across the speaker when off. */
.sound-toggle .slash { opacity: 1; transition: opacity 0.2s ease; }
.sound-toggle[aria-pressed="true"] .slash { opacity: 0; }

/* ==========================================================================
   Waiting-state easter egg.

   A small ghost sits in the corner of the take-number panel and only appears
   while the demo is in the long "is-waiting" state — exactly the moment a real
   guest is standing around with nothing to do. It is deliberately:

     * small (2.1rem) and low-contrast, so it never competes with A02;
     * pointer-interactive only inside its own box, so it cannot steal the
       click that the demo itself needs;
     * silent (a tiny hop, no sound) so it does not add to the noise budget;
     * absent after the demo leaves the waiting state, so the "called" moment
       stays the loudest thing on the panel.

   Clicking it pops a counter and a one-line reaction; three clicks and it
   waves goodbye. Nothing is stored — it resets on reload, which is right for a
   marketing page.
   ========================================================================== */

.take-sprite {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transform: translateY(0.4rem) scale(0.75);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1.3, 0.36, 1);
  z-index: 6;
  font-family: inherit;
}

/* Only while waiting. Everything else in the cycle hides it. */
.take-mock.is-waiting .take-sprite {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: spriteIdleHop 2.6s ease-in-out infinite;
}

/* Hover lifts it out of the panel slightly; focus keeps parity with keyboard use. */
.take-sprite:hover,
.take-sprite:focus-visible {
  transform: translateY(-1px) scale(1.08);
  animation-play-state: paused;
  outline: none;
}

.take-sprite:focus-visible {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.55);
}

/* The body: a squashed teardrop with a blue gradient, matching the panels. */
.sprite-body {
  position: absolute;
  inset: 0.18rem;
  border-radius: 52% 48% 44% 56% / 58% 56% 44% 42%;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #93c5fd 42%, #3b82f6 100%);
  box-shadow:
    inset 0 0 6px rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(37, 99, 235, 0.32);
  transition: transform 0.16s ease;
}

.take-sprite:active .sprite-body { transform: scale(0.9); }

/* Two dot eyes and a tiny smile — no facial detail beyond that, so at 2rem it
   still reads as friendly rather than creepy. */
.sprite-eye {
  position: absolute;
  top: 46%;
  width: 0.16rem;
  height: 0.2rem;
  border-radius: 50%;
  background: #0f172a;
}

.sprite-eye.l { left: 36%; }
.sprite-eye.r { right: 36%; }

.sprite-mouth {
  position: absolute;
  top: 62%;
  left: 50%;
  transform: translateX(-50%);
  width: 0.34rem;
  height: 0.17rem;
  border-radius: 0 0 999px 999px;
  background: #0f172a;
  opacity: 0.72;
}

/* Reaction bubble. Sits above the sprite, so it never covers the number. */
.sprite-bubble {
  position: absolute;
  right: 0;
  bottom: 2.5rem;
  min-width: 3.6rem;
  max-width: 8rem;
  padding: 0.28rem 0.45rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0.25rem) scale(0.9);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.22, 1.3, 0.36, 1);
  pointer-events: none;
}

/* the little tail */
.sprite-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0.7rem;
  border: 4px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.9);
}

.sprite-bubble.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* A tick of celebration when clicked, replacing the idle hop for one beat. */
.take-sprite.is-poked {
  animation: spritePoke 0.55s cubic-bezier(0.22, 1.4, 0.36, 1) 1;
}

@keyframes spriteIdleHop {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-4px) scale(1.04); }
}

@keyframes spritePoke {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-9px) scale(1.16) rotate(-8deg); }
  65%  { transform: translateY(-3px) scale(1.02) rotate(6deg); }
  100% { transform: translateY(0) scale(1) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .take-mock.is-waiting .take-sprite,
  .take-sprite.is-poked {
    animation: none !important;
  }
}

@keyframes flowPhoneSettle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(-1deg); }
}

@keyframes flowScanSweep {
  0%       { top: 2.1rem; opacity: 0; }
  12%      { opacity: 1; }
  50%      { top: 9.7rem; opacity: 1; }
  88%      { opacity: 1; }
  100%     { top: 2.1rem; opacity: 0; }
}

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 59.99rem) {
  .flow-visual { height: 13.8rem; }

  .flow-step + .flow-step::before {
    content: "";
    position: absolute;
    top: -1.15rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0.7rem;
    background: rgba(37, 99, 235, 0.24);
    border-radius: 999px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qr-solo,
  .qr-solo::after,
  .phone-mock,
  .scan-line,
  .cam-qr i,
  .take-sizes span,
  .take-btn,
  .take-btn::after,
  .take-result,
  .take-result .res-team,
  .take-result .res-no {
    animation: none !important;
  }

  /* Still frame: A02 in blue, so the rule is visible without movement. */
  .take-result { opacity: 1; }
  .take-result .res-team { background: #2563eb; }
  .take-result .res-no { color: #2563eb; }
  .take-sizes span:nth-child(1),
  .take-sizes span:nth-child(2) {
    background: rgba(37, 99, 235, 0.14);
    border-color: #2563eb;
    color: #1d4ed8;
  }
}
