/* Patient kiosk. Sized for an iPad on a stand, read at arm's length. */
body.kiosk {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  font-size: 20px;
  background:
    radial-gradient(90% 70% at 0% 0%, var(--sage-100), transparent 60%),
    radial-gradient(70% 60% at 100% 100%, var(--sand-200), transparent 65%),
    var(--paper);
  position: relative;
  overflow-x: hidden;
}
body.kiosk input { -webkit-user-select: text; user-select: text; }

/* Large, faint leaf mark from the logo in the corner. */
body.kiosk::before {
  content: "";
  position: fixed;
  right: -16vmin;
  bottom: -18vmin;
  width: 78vmin;
  height: 78vmin;
  background: url("/static/brand/logo-mark.png") center / contain no-repeat;
  opacity: 0.055;
  transform: rotate(-14deg);
  pointer-events: none;
  z-index: 0;
}
/* Page content sits above the watermark. Full-screen layers keep their own positioning. */
body.kiosk > :where(:not(.overlay):not(.attract)) { position: relative; z-index: 1; }
body.kiosk > .mode-banner { z-index: 30; }

.kiosk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 48px 0;
  min-height: 100px;
}
.brand-logo { height: 76px; width: auto; display: block; }
.clinic-pill {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green-800);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--sage-200);
  padding: 8px 16px;
  border-radius: 999px;
}

#kiosk-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 48px 52px;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}

/* ------------------------------------------------------------ screens */
.screen { display: flex; flex-direction: column; gap: 22px; }
.screen.center { align-items: center; text-align: center; }

/* Every screen eases in, its parts following one another. */
.screen > * { animation: rise 0.55s var(--ease-out) both; }
.screen > *:nth-child(2) { animation-delay: 0.06s; }
.screen > *:nth-child(3) { animation-delay: 0.12s; }
.screen > *:nth-child(4) { animation-delay: 0.18s; }
.screen > *:nth-child(5) { animation-delay: 0.24s; }
.screen > *:nth-child(n + 6) { animation-delay: 0.3s; }

.screen h1 {
  font-size: clamp(2rem, 4.4vw, 2.9rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
  outline: none;
  color: var(--green-900);
}
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 32em; line-height: 1.45; text-wrap: pretty; }
.fine { font-size: 0.9rem; color: var(--ink-soft); }
.eyebrow {
  font-size: 1rem;
  font-weight: 700;
  color: var(--sage-500);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.pulse-text { animation: pulse-text 1.8s ease-in-out infinite; }
@keyframes pulse-text { 50% { opacity: 0.45; } }

/* ------------------------------------------------------------ welcome */
.welcome { display: grid; gap: 10px; margin-bottom: 10px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px), (orientation: portrait) {
  .choices { grid-template-columns: 1fr; }
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 270px;
  padding: 30px 30px 32px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s var(--ease-out), box-shadow 0.2s ease;
}
.choice:active { transform: scale(0.975); }
.choice:focus-visible { outline: 4px solid #e8a33d; outline-offset: 4px; }

.choice-primary {
  color: #fff;
  background: linear-gradient(150deg, var(--green-600), var(--green-800) 70%);
  box-shadow: var(--shadow-brand);
}
.choice-secondary {
  color: var(--green-900);
  background: var(--surface);
  border-color: var(--sage-200);
  box-shadow: var(--shadow-md);
}

.choice-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
}
.choice-primary .choice-icon { background: rgba(255, 255, 255, 0.16); }
.choice-secondary .choice-icon { background: var(--sage-100); color: var(--green-700); }

.choice-text { display: grid; gap: 6px; padding-right: 52px; }
.choice-title { font-size: 1.7rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
.choice-sub { font-size: 1.05rem; opacity: 0.82; }

.choice-arrow {
  position: absolute;
  right: 28px;
  bottom: 30px;
  font-size: 1.5rem;
  opacity: 0.75;
  animation: nudge 2.6s ease-in-out infinite;
}
@keyframes nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateX(6px); } }

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 6px;
}
.privacy-note .icon { color: var(--sage-500); }

/* --------------------------------------------------------------- form */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 40px 40px;
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 680px;
}
.screen:not(.center) > .panel { align-self: center; }
.panel h1 { font-size: clamp(1.8rem, 3.6vw, 2.3rem); }
#form-slot { margin-top: 10px; }

.back-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px 12px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.back-link:active { background: var(--sand-200); }
.back-link:focus-visible { outline: 3px solid #e8a33d; }

.stack { display: grid; gap: 18px; width: 100%; }
.screen.center .stack { text-align: left; }
.field { display: grid; gap: 8px; }
.field-label { font-size: 1rem; font-weight: 600; padding: 0; color: var(--ink); }

.text-input {
  width: 100%;
  font: inherit;
  font-size: 1.45rem;
  padding: 17px 20px;
  border: 2px solid var(--sand-300);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.text-input::placeholder { color: #b3ad9d; }
.text-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--green-600);
  box-shadow: 0 0 0 5px var(--sage-100);
}
.text-input.invalid { border-color: var(--alert); box-shadow: 0 0 0 5px var(--alert-tint); }

.dob { border: 0; padding: 0; margin: 0; min-width: 0; }
.dob-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 8px; }
.dob-row label { display: grid; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.dob-part { width: 5.4rem; text-align: center; font-variant-numeric: tabular-nums; padding-left: 8px; padding-right: 8px; }
.dob-year { width: 7.8rem; }
.dob-sep { font-size: 1.6rem; color: var(--sand-400); padding-bottom: 16px; }

.form-error { color: var(--alert); font-weight: 600; min-height: 1.4em; font-size: 1rem; }
.form-error:not(:empty) { animation: shake 0.4s ease; }
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.row { display: flex; flex-wrap: wrap; gap: 14px; }
.screen.center .row { justify-content: center; }
.btn.big { padding: 20px 34px; font-size: 1.2rem; min-height: 68px; }
.btn.wide { width: 100%; }

/* ----------------------------------------------------- loading states */
.splash-mark {
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
  animation: rise 0.6s var(--ease-out) both, breathe 2.4s ease-in-out 0.6s infinite;
}
.splash-mark img { width: 100%; height: auto; }
@keyframes breathe { 50% { transform: scale(1.06); } }

.shimmer-bar {
  width: 200px;
  height: 6px;
  border-radius: 999px;
  background: var(--sage-200);
  overflow: hidden;
  position: relative;
}
.shimmer-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: var(--green-600);
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(270%); } }

/* Logo mark inside a turning ring: used while an arrival is being sent. */
.orbit {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
}
.orbit img { width: 76px; height: auto; }
.orbit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid var(--sage-200);
  border-top-color: var(--green-700);
  animation: spin 0.95s linear infinite;
}

/* ------------------------------------------------------- result marks */
.tick { width: 104px; height: 104px; }
.tick-ring {
  fill: var(--sage-100);
  stroke: var(--green-700);
  stroke-width: 3.5;
  stroke-dasharray: 227;
  stroke-dashoffset: 227;
  transform: rotate(-90deg);
  transform-origin: center;
  animation: draw 0.6s var(--ease-out) 0.1s forwards;
}
.tick-mark {
  fill: none;
  stroke: var(--green-700);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: draw 0.35s var(--ease-out) 0.55s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.status-badge {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  background: var(--sand-200);
  color: var(--sand-700);
}
.status-badge.warn { background: var(--warm-tint); color: var(--warm); }

/* Thin bar that empties while the screen waits to return to the start. */
.return-bar {
  width: 180px;
  height: 5px;
  border-radius: 999px;
  background: var(--sand-200);
  overflow: hidden;
  margin-top: 6px;
}
.return-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--sage-500);
  transform-origin: left;
  animation: drain var(--return-ms, 8000ms) linear forwards;
}
@keyframes drain { to { transform: scaleX(0); } }

/* --------------------------------------------------------------- call */
.call-avatar {
  position: relative;
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  margin: 18px 0 6px;
}
.call-avatar-core {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  color: #fff;
  background: linear-gradient(150deg, var(--green-600), var(--green-800));
  box-shadow: var(--shadow-brand);
}
.call-avatar.ringing .call-avatar-core { animation: ring-bob 1.6s ease-in-out infinite; }
@keyframes ring-bob { 0%, 100% { transform: none; } 50% { transform: scale(1.05); } }

.ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--green-600);
  opacity: 0;
  animation: ripple 2.4s ease-out infinite;
}
.ripple:nth-child(2) { animation-delay: 0.8s; }
.ripple:nth-child(3) { animation-delay: 1.6s; }
@keyframes ripple {
  0% { transform: scale(0.66); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

.call-avatar-spin {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 5px solid var(--sage-200);
  border-top-color: var(--green-700);
  animation: spin 0.95s linear infinite;
}

.steps {
  list-style: none;
  display: flex;
  gap: 0;
  padding: 0;
  margin: 6px 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #a7a290;
}
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li + li::before {
  content: "";
  width: 44px;
  height: 2px;
  margin: 0 12px;
  background: var(--sand-300);
  border-radius: 2px;
}
.steps li span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sand-300);
  flex: none;
}
.steps li.done { color: var(--sage-500); }
.steps li.done span { background: var(--sage-500); }
.steps li.done + li::before { background: var(--sage-500); }
.steps li.active { color: var(--green-800); }
.steps li.active span {
  background: var(--green-700);
  box-shadow: 0 0 0 5px var(--sage-200);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 9px rgba(214, 228, 205, 0.4); } }

.sim-label {
  background: #2a2a2a;
  color: #ffd98a;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 8px 16px;
  border-radius: 999px;
}
.sim-video {
  position: relative;
  width: min(540px, 100%);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background: repeating-linear-gradient(135deg, #1d3318 0 18px, #182b14 18px 36px);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
}
.sim-avatar { width: 96px; height: 96px; border-radius: 50%; background: var(--sage-500); }
.sim-live {
  position: absolute;
  left: 16px;
  top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 12px;
  border-radius: 999px;
}
.sim-live i { width: 9px; height: 9px; border-radius: 50%; background: #6fdc5a; animation: pulse-text 1.6s ease-in-out infinite; }

/* ------------------------------------------------------- idle screen */
.attract {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 48px;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  color: #fff;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(110% 80% at 15% 5%, var(--green-600), transparent 55%),
    linear-gradient(160deg, var(--green-800), var(--green-900));
  animation: fade 0.7s ease both;
}
.attract::before {
  content: "";
  position: absolute;
  right: -14vmin;
  bottom: -18vmin;
  width: 92vmin;
  height: 92vmin;
  background: url("/static/brand/logo-mark-white.png") center / contain no-repeat;
  opacity: 0.07;
  animation: sway 26s ease-in-out infinite alternate;
}
@keyframes sway { from { transform: rotate(-16deg) scale(1); } to { transform: rotate(-9deg) scale(1.06); } }

/* The content drifts very slowly so nothing sits on the same pixels all day. */
.attract-inner {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 26px;
  animation: drift 50s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate(-14px, -10px); } to { transform: translate(14px, 12px); } }

.attract-logo { width: min(600px, 76vw); height: auto; animation: rise 0.9s var(--ease-out) 0.15s both; }
.attract-welcome {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sage-300);
  animation: rise 0.9s var(--ease-out) 0.3s both;
}
.attract-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 20px 38px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.35rem;
  font-weight: 600;
  animation: rise 0.9s var(--ease-out) 0.45s both, cta-glow 2.6s ease-in-out 1.4s infinite;
}
.attract-cta i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-text 1.6s ease-in-out infinite;
}
@keyframes cta-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.28); }
  50% { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0); }
}
.attract:focus-visible .attract-cta { outline: 3px solid #e8a33d; outline-offset: 4px; }
/* Fades away over the welcome screen when touched. */
.attract.leaving { animation: none; opacity: 0; transition: opacity 0.35s ease; pointer-events: none; }

/* ------------------------------------------------------ idle overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 54, 10, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 10;
  animation: fade 0.25s ease both;
}
@keyframes fade { from { opacity: 0; } }
.overlay-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px;
  max-width: 480px;
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
  animation: rise 0.4s var(--ease-out) both;
}
.overlay-card h2 { font-size: 1.7rem; color: var(--green-900); }
.overlay-card p { color: var(--ink-soft); font-size: 1.05rem; }
.idle-count {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--green-800);
  background: var(--sage-100);
  border: 3px solid var(--sage-300);
}

.demo-controls {
  padding: 10px 48px 14px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--line);
}
.demo-controls input { transform: scale(1.2); margin-right: 6px; accent-color: var(--green-700); }

@media (max-width: 700px) {
  .kiosk-header { padding: 20px 24px 0; }
  .brand-logo { height: 48px; }
  #kiosk-main { padding: 16px 24px 40px; }
  .panel { padding: 26px 22px 28px; }
  .steps li + li::before { width: 20px; margin: 0 8px; }
}
