/* ==========================================
   TIGA Forms — Public Runner (Typeform-style)
   ========================================== */

:root {
  --tf-primary: #4F46E5;
  --tf-primary-text: #FFFFFF;
  --tf-bg: #FFFFFF;
  --tf-text: #0F172A;
  --tf-text-muted: rgba(15, 23, 42, .55);
  --tf-text-dim: rgba(15, 23, 42, .35);
  --tf-border: rgba(15, 23, 42, .14);
  --tf-border-strong: rgba(15, 23, 42, .35);
  --tf-surface: rgba(15, 23, 42, .04);
  --tf-surface-hover: rgba(15, 23, 42, .07);
  --tf-radius: 6px;
  --tf-font: 'Inter', 'Helvetica Neue', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --tf-q-size: clamp(28px, 4.6vw, 38px);
  --tf-d-size: clamp(15px, 1.6vw, 18px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body.tf-runner-body {
  font-family: var(--tf-font);
  background: var(--tf-bg);
  color: var(--tf-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

button { font-family: inherit; }

/* Background image / video */
.tf-bg-img {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  pointer-events: none;
}
.tf-bg-img::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,.25) 100%);
}

/* App shell */
#tf-root {
  position: relative; z-index: 1;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* Top brand bar */
.tf-top {
  flex-shrink: 0;
  padding: 18px 28px;
  display: flex; align-items: center; gap: 10px;
  min-height: 48px;
}
.tf-top-spacer { flex: 1; }
.tf-customer-logo {
  flex: 1;
  display: flex; align-items: center;
}
.tf-customer-logo img {
  height: 36px; max-width: 200px;
  width: auto; object-fit: contain;
  display: block;
}

/* Question stage */
.tf-stage-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  min-height: 0;
  overflow: hidden;
}
/* When a slot picker is active the stage may be taller than the viewport —
   align to top so early dates are not clipped by the centering. */
.tf-stage-wrap.has-slots {
  align-items: flex-start;
  overflow-y: auto;
}
.tf-stage {
  width: 100%;
  max-width: 880px;
  padding: 24px 56px;
  margin: 0 auto;
  position: relative;
}
.tf-stage.tf-anim-in {
  animation: tf-slide-up-in 320ms cubic-bezier(.2, .8, .2, 1) both;
}
.tf-stage.tf-anim-out {
  animation: tf-slide-up-out 240ms cubic-bezier(.4, 0, 1, 1) both;
}
.tf-stage.tf-anim-back-in {
  animation: tf-slide-down-in 320ms cubic-bezier(.2, .8, .2, 1) both;
}
.tf-stage.tf-anim-back-out {
  animation: tf-slide-down-out 240ms cubic-bezier(.4, 0, 1, 1) both;
}

@keyframes tf-slide-up-in {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tf-slide-up-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-36px); }
}
@keyframes tf-slide-down-in {
  from { opacity: 0; transform: translateY(-36px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tf-slide-down-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(36px); }
}

/* Question header */
.tf-qnum {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--tf-text-muted);
  font-size: 14px; font-weight: 500;
  margin-bottom: 14px;
  letter-spacing: .01em;
}
.tf-qnum svg { width: 13px; height: 13px; opacity: .7; }

.tf-title {
  font-size: var(--tf-q-size);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--tf-text);
  margin: 0 0 12px;
}
.tf-title-required { color: var(--tf-primary); margin-left: 4px; opacity: .8; }
.tf-desc {
  font-size: var(--tf-d-size);
  color: var(--tf-text-muted);
  line-height: 1.5;
  margin: 0 0 36px;
}
.tf-input-area { margin-top: 24px; }

/* Inputs */
.tf-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--tf-border);
  color: var(--tf-text);
  font-family: inherit;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 300;
  padding: 12px 0;
  outline: none;
  transition: border-color .15s, padding .15s;
  letter-spacing: -.01em;
}
.tf-input:focus { border-bottom-color: var(--tf-primary); }
.tf-input::placeholder { color: var(--tf-text-dim); font-weight: 300; }

.tf-textarea {
  width: 100%; background: transparent; border: 0;
  border-bottom: 2px solid var(--tf-border);
  color: var(--tf-text); font-family: inherit;
  font-size: clamp(18px, 2vw, 22px); font-weight: 300;
  padding: 12px 0; outline: none; resize: none;
  min-height: 84px; max-height: 320px;
  letter-spacing: -.01em;
}
.tf-textarea:focus { border-bottom-color: var(--tf-primary); }
.tf-textarea::placeholder { color: var(--tf-text-dim); }

select.tf-input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right .5rem center;
  padding-right: 28px; cursor: pointer;
}

/* Choices: Typeform-exact letter-key style */
.tf-choices {
  display: flex; flex-direction: column;
  gap: 10px;
  max-width: 540px;
}
.tf-choice {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--tf-bg);
  color: var(--tf-text);
  border: 1.5px solid var(--tf-border);
  border-radius: var(--tf-radius);
  cursor: pointer; user-select: none;
  font-size: 16px; line-height: 1.4;
  transition: background .12s, border-color .12s, transform .08s;
}
.tf-choice:hover {
  background: color-mix(in srgb, var(--tf-primary) 6%, var(--tf-bg));
  border-color: color-mix(in srgb, var(--tf-primary) 35%, var(--tf-border));
}
.tf-choice:active { transform: scale(.997); }
.tf-choice.tf-selected {
  background: color-mix(in srgb, var(--tf-primary) 12%, var(--tf-bg));
  border-color: var(--tf-primary);
}
.tf-choice-letter {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
  background: transparent;
  border: 1.5px solid var(--tf-border-strong);
  border-radius: 4px;
  color: var(--tf-text);
  transition: background .12s, color .12s, border-color .12s;
}
.tf-choice:hover .tf-choice-letter {
  border-color: var(--tf-primary);
  color: var(--tf-primary);
}
.tf-choice.tf-selected .tf-choice-letter {
  background: var(--tf-primary);
  border-color: var(--tf-primary);
  color: var(--tf-primary-text);
}
.tf-choice-label { flex: 1; }
.tf-choice-check {
  width: 16px; height: 16px;
  opacity: 0; transition: opacity .15s;
  color: var(--tf-primary);
}
.tf-choice.tf-selected .tf-choice-check { opacity: 1; }

.tf-choice-hint {
  font-size: 13px;
  color: var(--tf-text-dim);
  margin-bottom: 16px;
}

/* Picture choice */
.tf-pic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 600px;
}
@media (min-width: 720px) {
  .tf-pic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tf-pic {
  position: relative;
  border: 1.5px solid var(--tf-border);
  border-radius: var(--tf-radius);
  overflow: hidden; cursor: pointer;
  background: var(--tf-bg);
  transition: border-color .12s, transform .08s;
}
.tf-pic:hover { border-color: var(--tf-primary); }
.tf-pic.tf-selected { border-color: var(--tf-primary); }
.tf-pic-img {
  width: 100%; aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--tf-surface);
  display: block;
}
.tf-pic-img-empty {
  width: 100%; aspect-ratio: 4 / 3;
  background: var(--tf-surface);
  display: grid; place-items: center;
  color: var(--tf-text-dim); font-size: 28px;
}
.tf-pic-label {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.tf-pic .tf-choice-letter {
  width: 22px; height: 22px; font-size: 12px;
}

/* Yes / No */
.tf-yesno {
  display: flex; flex-direction: column;
  gap: 10px; max-width: 380px;
}

/* Rating (stars) */
.tf-rating {
  display: flex; gap: 6px;
  font-size: 36px; line-height: 1;
}
.tf-rating-btn {
  background: transparent; border: 0; cursor: pointer;
  color: var(--tf-text-dim);
  transition: color .12s, transform .08s;
  padding: 0; line-height: 1;
}
.tf-rating-btn:hover { transform: scale(1.1); }
.tf-rating-btn.tf-active { color: var(--tf-primary); }

/* Scale (1–10 / NPS) */
.tf-scale {
  display: flex; gap: 4px; flex-wrap: wrap;
  max-width: 600px;
}
.tf-scale-btn {
  flex: 1 0 44px;
  height: 56px;
  border: 1.5px solid var(--tf-border);
  border-radius: var(--tf-radius);
  background: var(--tf-bg);
  color: var(--tf-text);
  font-weight: 500; font-size: 16px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.tf-scale-btn:hover {
  background: color-mix(in srgb, var(--tf-primary) 6%, var(--tf-bg));
  border-color: var(--tf-primary);
}
.tf-scale-btn.tf-active {
  background: var(--tf-primary); color: var(--tf-primary-text);
  border-color: var(--tf-primary);
}
.tf-scale-labels {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--tf-text-muted);
  margin-top: 8px; max-width: 600px;
}

/* Slider */
.tf-slider-wrap {
  display: flex; align-items: center; gap: 18px;
  max-width: 540px; padding: 12px 0;
}
.tf-slider-wrap input[type=range] {
  flex: 1;
  accent-color: var(--tf-primary);
  height: 4px;
}
.tf-slider-value {
  font-size: 28px; font-weight: 500;
  min-width: 64px; text-align: right;
  color: var(--tf-primary);
  font-variant-numeric: tabular-nums;
}

/* File upload */
.tf-file-drop {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border: 2px dashed var(--tf-border-strong);
  border-radius: 12px;
  padding: 36px 24px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  max-width: 540px;
  text-align: center;
}
.tf-file-drop:hover, .tf-file-drop.tf-drag {
  border-color: var(--tf-primary);
  background: color-mix(in srgb, var(--tf-primary) 5%, var(--tf-bg));
}
.tf-file-drop-icon { font-size: 32px; margin-bottom: 8px; opacity: .5; }
.tf-file-drop-main { font-size: 16px; color: var(--tf-text); }
.tf-file-drop-meta { font-size: 13px; color: var(--tf-text-muted); margin-top: 4px; }
.tf-file-list { margin-top: 12px; max-width: 540px; }
.tf-file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--tf-surface);
  border-radius: 8px;
  font-size: 14px;
}
.tf-file-rm {
  margin-left: auto;
  background: transparent; border: 0; cursor: pointer;
  color: var(--tf-text-muted); font-size: 18px;
  padding: 4px 8px;
}

/* Date / time */
.tf-input[type=date], .tf-input[type=time], .tf-input[type=datetime-local] {
  font-family: var(--tf-font);
  color-scheme: light;
}

/* Signature */
.tf-sig {
  border: 1.5px solid var(--tf-border);
  border-radius: var(--tf-radius);
  background: var(--tf-bg);
  width: 100%; max-width: 540px; aspect-ratio: 3 / 1;
  touch-action: none; cursor: crosshair;
}
.tf-sig-actions { margin-top: 8px; display: flex; gap: 8px; }

/* Matrix */
.tf-matrix {
  width: 100%; max-width: 600px;
  border-collapse: collapse;
}
.tf-matrix th, .tf-matrix td {
  padding: 8px 6px;
  text-align: center;
  font-size: 14px;
}
.tf-matrix th { color: var(--tf-text-muted); font-weight: 500; }
.tf-matrix td:first-child, .tf-matrix th:first-child {
  text-align: left; padding-left: 4px;
  color: var(--tf-text);
}
.tf-matrix input[type=radio] { accent-color: var(--tf-primary); }

/* Ranking (drag) */
.tf-rank { display: flex; flex-direction: column; gap: 8px; max-width: 540px; }
.tf-rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--tf-bg);
  border: 1.5px solid var(--tf-border);
  border-radius: var(--tf-radius);
  cursor: grab; user-select: none;
}
.tf-rank-item:hover { border-color: var(--tf-primary); }
.tf-rank-item.tf-dragging { opacity: .4; }
.tf-rank-num {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: var(--tf-surface);
  border-radius: 4px;
  font-size: 12px; font-weight: 600;
}
.tf-rank-handle { color: var(--tf-text-dim); font-size: 18px; }

/* Consent / Legal */
.tf-consent {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--tf-surface);
  border-radius: var(--tf-radius);
  max-width: 540px;
}
.tf-consent input { margin-top: 3px; accent-color: var(--tf-primary); }
.tf-consent-text {
  font-size: 14px; line-height: 1.5;
  color: var(--tf-text);
}
.tf-consent-text a { color: var(--tf-primary); }

/* Address */
.tf-address-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 12px; max-width: 540px;
}
@media (min-width: 540px) {
  .tf-address-grid { grid-template-columns: 2fr 1fr; }
  .tf-address-grid .tf-addr-street { grid-column: span 2; }
}

/* Honeypot */
.tf-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important; height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* OK / Submit button (Typeform's signature) */
.tf-actions {
  display: flex; align-items: center; gap: 16px;
  margin-top: 28px; flex-wrap: wrap;
}
.tf-ok {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--tf-primary);
  color: var(--tf-primary-text);
  border: 0; cursor: pointer;
  padding: 12px 18px;
  border-radius: 4px;
  font-family: inherit; font-size: 16px; font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--tf-primary) 70%, #000);
  transition: filter .12s, transform .08s;
}
.tf-ok:hover { filter: brightness(1.08); }
.tf-ok:active { transform: translateY(1px); box-shadow: none; }
.tf-ok:disabled { opacity: .4; cursor: not-allowed; }
.tf-ok-arrow { width: 16px; height: 16px; }
.tf-enter-hint {
  font-size: 13px; color: var(--tf-text-muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.tf-enter-hint kbd {
  font-family: inherit; font-size: 12px;
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 500;
}

/* Welcome / Statement / Ending */
.tf-welcome, .tf-ending {
  text-align: center;
  padding: 48px 24px;
  max-width: 820px; margin: 0 auto;
}
.tf-welcome h1, .tf-ending h1 {
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 600;
  line-height: 1.1; letter-spacing: -.02em;
  margin: 0 0 16px;
}
.tf-welcome p, .tf-ending p {
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.55;
  color: var(--tf-text-muted);
  margin: 0 auto 32px; max-width: 540px;
}
.tf-welcome .tf-actions, .tf-ending .tf-actions { justify-content: center; }
.tf-ending-icon {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  background: color-mix(in srgb, var(--tf-primary) 14%, var(--tf-bg));
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--tf-primary);
}

/* Errors */
.tf-error {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, .1);
  border-left: 3px solid #EF4444;
  color: #B91C1C;
  font-size: 14px;
  border-radius: 4px;
  max-width: 540px;
}

/* Schema-changed notice — shown when the visitor returns to a form whose
   schema was republished since their last visit. Their in-progress answers
   are gone (field-id mismatch); this banner tells them why instead of
   silently starting over. */
.tf-schema-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto;
  padding: 10px 14px;
  background: rgba(245, 158, 11, .12);
  border-left: 3px solid #F59E0B;
  color: #92400E;
  font-size: 13px;
  line-height: 1.45;
  max-width: 640px;
  border-radius: 6px;
}
.tf-schema-notice-close {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  opacity: .65;
}
.tf-schema-notice-close:hover { opacity: 1; }
.tf-dark .tf-schema-notice { background: rgba(245, 158, 11, .18); color: #FCD34D; }

/* Bottom controls — Typeform's iconic up/down + progress bar at bottom */
.tf-bottom {
  flex-shrink: 0;
  position: relative;
  height: 64px;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--tf-border);
  background: var(--tf-bg);
}
.tf-bottom-meta {
  font-size: 12px; color: var(--tf-text-muted);
  display: flex; align-items: center; gap: 8px;
}
.tf-bottom-meta strong { color: var(--tf-text); font-weight: 600; }
.tf-bottom-nav {
  display: flex; gap: 0;
  border: 1px solid var(--tf-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--tf-bg);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.tf-nav-btn {
  width: 38px; height: 36px;
  background: var(--tf-bg);
  color: var(--tf-text);
  border: 0; cursor: pointer;
  display: grid; place-items: center;
  transition: background .12s, color .12s;
}
.tf-nav-btn:hover:not(:disabled) {
  background: var(--tf-primary);
  color: var(--tf-primary-text);
}
.tf-nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.tf-nav-btn + .tf-nav-btn { border-left: 1px solid var(--tf-border); }
.tf-nav-btn svg { width: 14px; height: 14px; }

/* Progress bar — fixed at bottom */
.tf-progress {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 3px; background: transparent;
  z-index: 50;
  pointer-events: none;
}
.tf-progress-bar {
  height: 100%;
  background: var(--tf-primary);
  width: 0%;
  transition: width .35s cubic-bezier(.2,.8,.2,1);
}

/* Loading */
.tf-loading {
  flex: 1; display: grid; place-items: center;
}
.tf-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--tf-surface);
  border-top-color: var(--tf-primary);
  border-radius: 50%;
  animation: tf-spin .9s linear infinite;
}
@keyframes tf-spin { to { transform: rotate(360deg); } }

/* Footer brand — sits in the top bar, doesn't overlap nav */
.tf-brand {
  font-size: 11px; color: var(--tf-text-muted);
  background: transparent;
  padding: 4px 10px;
  border: 1px solid var(--tf-border);
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .12s, background .12s;
}
.tf-brand:hover { color: var(--tf-text); background: var(--tf-surface); }
.tf-brand-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tf-primary);
}

/* Dark theme override (when bg is dark) */
.tf-dark {
  --tf-bg: #0F172A;
  --tf-text: #F8FAFC;
  --tf-text-muted: rgba(248, 250, 252, .65);
  --tf-text-dim: rgba(248, 250, 252, .35);
  --tf-border: rgba(248, 250, 252, .15);
  --tf-border-strong: rgba(248, 250, 252, .35);
  --tf-surface: rgba(248, 250, 252, .06);
  --tf-surface-hover: rgba(248, 250, 252, .1);
}
.tf-dark .tf-input[type=date], .tf-dark .tf-input[type=time], .tf-dark .tf-input[type=datetime-local] { color-scheme: dark; }
.tf-dark .tf-error { background: rgba(239, 68, 68, .15); color: #FCA5A5; }

/* Mobile (≤640px) */
@media (max-width: 640px) {
  :root {
    --tf-q-size: clamp(24px, 6.2vw, 32px);
    --tf-d-size: clamp(14px, 3.8vw, 16px);
  }
  body.tf-runner-body { -webkit-tap-highlight-color: transparent; }
  .tf-stage { padding: 14px 20px; }
  .tf-top { padding: 12px 16px; min-height: 44px; }
  .tf-customer-logo img { height: 30px; max-width: 160px; }
  .tf-bottom {
    padding: 0 12px;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(56px + env(safe-area-inset-bottom));
  }
  .tf-progress { bottom: env(safe-area-inset-bottom); }
  .tf-enter-hint { display: none; }
  .tf-pic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tf-rating { font-size: 30px; gap: 4px; }
  /* Larger touch targets for chrome nav */
  .tf-nav-btn { width: 44px; height: 44px; }
  .tf-nav-btn svg { width: 16px; height: 16px; }
  /* Inputs: keep ≥16px to prevent iOS auto-zoom */
  .tf-input { font-size: 19px; padding: 10px 0; }
  .tf-textarea { font-size: 17px; min-height: 96px; }
  /* Title spacing tightens, description gets a little air below */
  .tf-title { line-height: 1.18; margin-bottom: 10px; }
  .tf-desc { margin-bottom: 24px; }
  .tf-input-area { margin-top: 18px; }
  /* OK / submit button: thumb-friendly, full row on phones */
  .tf-actions { margin-top: 22px; gap: 10px; }
  .tf-ok { padding: 13px 22px; font-size: 16px; min-height: 46px; }
  /* Choices: more vertical padding for fat-finger taps */
  .tf-choices { gap: 8px; }
  .tf-choice { padding: 14px 16px; font-size: 15px; }
  .tf-yesno { max-width: none; }
  .tf-consent {
    max-width: none;
    padding: 14px;
  }
  .tf-consent-text { font-size: 13.5px; line-height: 1.55; }
  /* Welcome / ending: smaller H1 so long titles don't crush layout */
  .tf-welcome, .tf-ending { padding: 36px 20px; }
  .tf-welcome h1, .tf-ending h1 { font-size: clamp(28px, 8vw, 44px); margin-bottom: 14px; }
  .tf-welcome p, .tf-ending p { font-size: 15px; margin-bottom: 24px; }
  .tf-ending-icon { width: 52px; height: 52px; }
  /* Address: still single column, tighter gap */
  .tf-address-grid { gap: 10px; }
  /* Question number — slightly smaller */
  .tf-qnum { font-size: 12px; margin-bottom: 10px; }
  /* Reduce slide distance — smoother on small screens */
  @keyframes tf-slide-up-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes tf-slide-up-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }
  @keyframes tf-slide-down-in { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes tf-slide-down-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(20px); } }
  /* Slot picker — 2-column on phones, tighter buttons */
  .tf-slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tf-slot-btn { padding: 14px 6px; font-size: 14px; min-height: 46px; }
  .tf-slot-btn.is-taken { font-size: 12px; padding: 14px 4px; }
  .tf-slot-day-label { font-size: 11px; margin: 12px 0 6px; }
  /* Key-pulse: lift above bottom safe area */
  .tf-key-pulse { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* Very narrow phones (≤380px) */
@media (max-width: 380px) {
  .tf-stage { padding: 12px 16px; }
  .tf-top { padding: 10px 14px; gap: 8px; }
  .tf-customer-logo img { height: 26px; max-width: 130px; }
  /* Hide TIGA brand badge — every pixel counts on very narrow phones */
  .tf-brand { display: none; }
  .tf-bottom { padding: 0 10px; }
  .tf-bottom-meta { font-size: 11px; }
  .tf-title { font-size: clamp(22px, 6.4vw, 26px); }
  .tf-ok { padding: 12px 18px; font-size: 15px; }
}

/* Touch: hide enter-hint on no-hover devices */
@media (hover: none) {
  .tf-enter-hint { display: none; }
  /* Disable hover-state flips that look "stuck on" after tap */
  .tf-slot-btn:hover:not(.is-taken) {
    background: transparent;
    color: var(--tf-text, #0F1217);
    border-color: var(--tf-border, rgba(0,0,0,.15));
  }
  .tf-slot-btn.is-selected:hover { background: var(--tf-text, #0F1217); color: var(--tf-bg, #fff); }
  .tf-choice:hover { background: var(--tf-bg); border-color: var(--tf-border); }
  .tf-choice.tf-selected:hover {
    background: color-mix(in srgb, var(--tf-primary) 12%, var(--tf-bg));
    border-color: var(--tf-primary);
  }
}

/* Choice key indicator (small badge that appears on press) */
.tf-key-pulse {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: var(--tf-text);
  color: var(--tf-bg);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  pointer-events: none;
  animation: tf-key-fade .8s ease-out forwards;
  z-index: 100;
}
@keyframes tf-key-fade {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  20% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -4px); }
}

/* Appointment slot picker */
.tf-slot-holder { width: 100%; }
.tf-slot-loading,
.tf-slot-empty {
  color: var(--tf-text-muted, rgba(0,0,0,.5));
  font-size: 13px;
  font-style: italic;
  padding: 12px 0;
}
.tf-slot-selected {
  font-size: 13px;
  color: var(--tf-text-muted, rgba(0,0,0,.55));
  margin-bottom: 10px;
}
.tf-slot-day-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tf-text-muted, rgba(0,0,0,.5));
  margin: 14px 0 6px;
}
.tf-slot-day-label:first-child { margin-top: 0; }
.tf-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.tf-slot-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 8px;
  background: transparent;
  border: 1px solid var(--tf-border, rgba(0,0,0,.15));
  color: var(--tf-text, #0F1217);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.tf-slot-btn:hover {
  background: var(--tf-text, #0F1217);
  border-color: var(--tf-text, #0F1217);
  color: var(--tf-bg, #fff);
}
.tf-slot-btn.is-selected {
  background: var(--tf-text, #0F1217);
  border-color: var(--tf-text, #0F1217);
  color: var(--tf-bg, #fff);
}
.tf-slot-btn.is-taken {
  background: repeating-linear-gradient(
    -45deg,
    rgba(0,0,0,.04) 0 6px,
    rgba(0,0,0,.08) 6px 12px
  );
  border-color: rgba(0,0,0,.08);
  color: rgba(0,0,0,.38);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: not-allowed;
  font-size: 12px;
  letter-spacing: .01em;
}
.tf-slot-btn.is-taken:hover {
  background: repeating-linear-gradient(
    -45deg,
    rgba(0,0,0,.04) 0 6px,
    rgba(0,0,0,.08) 6px 12px
  );
  border-color: rgba(0,0,0,.08);
  color: rgba(0,0,0,.38);
}
