@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;700&family=Quicksand:wght@400;500;600&display=swap");

:root {
  --brand-primary: #1a3b5c;
  --brand-secondary: #c9a87c;
  --brand-bg: #f8f6f3;
  --brand-neutral: #e8e5e0;
  --brand-text: #2c2c2b;
  --brand-text-soft: #7d7a75;
  --brand-font-headline: "Playfair Display", Georgia, serif;
  --brand-font-body: "Inter", system-ui, sans-serif;
  --brand-radius: 8px;
  --brand-radius-lg: 14px;
  --brand-shadow: 0 2px 16px rgba(0, 0, 0, 0.09), 0 1px 4px rgba(0, 0, 0, 0.05);

  --form-bg: #fdf8f0;
  --form-accent: #c9a87c;
  --form-accent-soft: rgba(201, 168, 124, 0.14);
  --form-text: #2c2c2b;
  --form-font-headline: "Playfair Display", Georgia, serif;
  --form-font-body: "Inter", system-ui, sans-serif;
  --form-dialogue-bg: rgba(253, 248, 240, 0.93);
  --form-btn-radius: 100px;
  --form-btn-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  --form-transition: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#clarityflow-player {
  --cf-bg: #0d0d1a;
  --cf-accent: #4a7c6f;
  --cf-font: inherit;
  --cf-bg-image: none;
  background-color: var(--cf-bg);
  font-family: var(--cf-font);
}

#clarityflow-player.has-bg-image .cf-scene-layer {
  background-image: var(--cf-bg-image, none);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top center;

}


#clarityflow-player.has-bg-image[data-bg-scope="start"]:not(.cf-on-start) .cf-scene-layer,
#clarityflow-player.has-bg-image[data-bg-scope="start"]:not(.cf-on-start) .cf-scene-layer::before {
  background-image: none;
}
/* Keep the entire welcome artwork visible in split layout too. */
#clarityflow-player.cf-layout-split.has-bg-image[data-bg-scope="start"].cf-on-start .cf-scene-layer::before {
  background-size: contain;
  background-position: top center;
  -webkit-mask-image: none;
          mask-image: none;
}
#clarityflow-player.cf-layout-split.has-bg-image .cf-scene-layer {
  background-image: none;
}
#clarityflow-player.cf-layout-split.has-bg-image .cf-scene-layer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--cf-stage-h);
  z-index: 0;
  background: var(--cf-bg-image) center 40% / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent);
}

/* Manifest player.sceneImageFit: "contain" keeps the whole scene image
   inside its responsive stage. Remove the edge mask so it cannot clip art.
   Omitted / "cover" preserves existing behavior; videos are unaffected. */
.cf-player[data-scene-image-fit="contain"] .cf-scene-image {
  object-fit: contain;
  object-position: center;
  -webkit-mask-image: none;
          mask-image: none;
}

.cf-player[data-scene-image-fit="width"] .cf-scene-image {
  top: calc(var(--cf-stage-h) / 2);
  bottom: auto;
  height: auto;
  max-height: var(--cf-stage-h);
  transform: translateY(-50%);
  object-fit: contain;
  -webkit-mask-image: none;
          mask-image: none;
}

.cf-player.vibe-challenging {
  --form-bg: #2c3e50;
  --form-accent: #e74c3c;
  --form-accent-soft: rgba(231, 76, 60, 0.18);
  --form-text: #f0f0f0;
  --form-font-headline: "Space Grotesk", "Inter", sans-serif;
  --form-dialogue-bg: rgba(28, 38, 46, 0.93);
  --form-btn-radius: 4px;
}

.cf-player.vibe-triumphant {
  --form-bg: #f0f4f8;
  --form-accent: #27ae60;
  --form-accent-soft: rgba(39, 174, 96, 0.14);
  --form-text: #2c2c2b;
  --form-font-headline: "Playfair Display", Georgia, serif;
  --form-dialogue-bg: rgba(240, 244, 248, 0.93);
  --form-btn-radius: 10px;
}

.cf-player.vibe-grief {
  --form-bg: #fdf6ec;
  --form-accent: #c9a7a0;
  --form-accent-soft: rgba(201, 167, 160, 0.15);
  --form-text: #2c2c2b;
  --form-font-headline: "Playfair Display", Georgia, serif;
  --form-dialogue-bg: rgba(253, 246, 236, 0.93);
  --form-btn-radius: 100px;
}

.cf-player.vibe-anger {
  --form-bg: #1e1e1e;
  --form-accent: #d94a38;
  --form-accent-soft: rgba(217, 74, 56, 0.18);
  --form-text: #f0f0f0;
  --form-font-headline: "Space Grotesk", "Inter", sans-serif;
  --form-dialogue-bg: rgba(18, 18, 18, 0.94);
  --form-btn-radius: 2px;
}

.cf-player.vibe-joy {
  --form-bg: #fff0e0;
  --form-accent: #f4c542;
  --form-accent-soft: rgba(244, 197, 66, 0.18);
  --form-text: #2c2c2b;
  --form-font-headline: "Quicksand", "Inter", sans-serif;
  --form-font-body: "Quicksand", "Inter", sans-serif;
  --form-dialogue-bg: rgba(255, 242, 224, 0.93);
  --form-btn-radius: 100px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--brand-font-body);
  background: #111;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
}

.cf-player {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;

  height: 100dvh;

  margin: 0 auto;
  background: var(--form-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background var(--form-transition);
  font-family: var(--form-font-body);
  isolation: isolate;
}

@supports (height: 100dvh) {
  html,
  body {
    height: 100dvh;
  }
}

@media (min-width: 520px) {
  .cf-player {
    height: min(900px, 96dvh);
    border-radius: 28px;
    box-shadow:
      0 40px 90px rgba(0, 0, 0, 0.45),
      0 12px 30px rgba(0, 0, 0, 0.28);
  }
}

.cf-brand-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: flex-start; 
  /* justify-content: space-between; */
  padding: 18px 20px 36px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.38) 0%,
    transparent 100%
  );
  pointer-events: none;
}
.cf-on-start .cf-footer .cf-nav-btn { visibility: hidden; }

/* .cf-brand-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.88;
  pointer-events: auto;
  flex-shrink: 0;
} */
 .cf-brand-logo {

  max-width: 65%;
max-height: 15dvh;
  height: var(--cf-logo-h, 28px);
  width: auto;
  object-fit: contain;
  opacity: 1;
  filter: none;
  pointer-events: auto;
  flex-shrink: 0;
  transition: opacity .3s, filter .3s;
}
.cf-logo-white .cf-brand-logo { filter: brightness(0) invert(1) drop-shadow(0 1px 3px rgba(0,0,0,.35)); }
.cf-logo-dark  .cf-brand-logo { filter: brightness(0) drop-shadow(0 1px 2px rgba(255,255,255,.4)); opacity: .88; }
.cf-logo-original .cf-brand-logo { filter: drop-shadow(0 1px 2px rgba(0,0,0,.18)); }


.cf-pause-reflect-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px 7px 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 100px;
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--brand-font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(10px);
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.15s;
  white-space: nowrap;
}

#cf-btn-pause:disabled,
#cf-btn-pause.cf-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.cf-pause-reflect-btn .cf-icon {
  font-size: 14px;
  line-height: 1;
}

.cf-pause-reflect-btn:hover {
  background: var(--form-accent-soft);
  border-color: var(--form-accent);
  color: var(--form-accent);
  transform: scale(1.03);
}

.cf-brand-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 0 calc(16px + env(safe-area-inset-bottom, 0px));
  background: transparent;
}

.cf-clarityflow-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.cf-clarityflow-label {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cf-clarityflow-name {
  font-size: 15px;
  font-weight: 700;
  color: #2a2a28;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.cf-scene-youtube {
  position: absolute;
  top: 64px;                 /* clears the logo header */
  left: 12px;
  right: 12px;
  height: calc(var(--cf-stage-h, 56%) - 76px);
  z-index: 2;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}
.cf-scene-youtube[hidden] { display: none; }
.cf-scene-youtube iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.cf-youtube-on .cf-scene-layer,
.cf-youtube-on .cf-scene-layer::before {
  background-image: none !important;
}
.cf-youtube-on #cf-scene-ambient { opacity: 0; }

/* Keep YouTube above the dialogue, without the image edge fade. */
.cf-layout-split .cf-scene-youtube {
  inset: 0 0 auto 0;
  height: var(--cf-youtube-h, var(--cf-stage-h));
}
.cf-diary-btn {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.88);
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.15s;
  min-width: 38px;
  min-height: 38px;
}

.cf-diary-btn:hover {
  background: var(--form-accent-soft);
  border-color: var(--form-accent);
  color: var(--form-accent);
  transform: scale(1.08);
}

.cf-scene-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--form-bg);
  transition: background var(--form-transition);
}

.cf-scene-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.14) 0%,
    transparent 25%,
    transparent 42%,
    rgba(0, 0, 0, 0.52) 100%
  );
}

.cf-scene-image,
.cf-scene-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 400ms ease;
}

.cf-scene-image.cf-active,
.cf-scene-video.cf-active {
  opacity: 1;
}
/* ---------- Split layout: image on top, ambient dialogue below ---------- */
.cf-layout-split { --cf-stage-h: 56%; }

/* Keep the top shade for header legibility; drop the dark bottom wash */
.cf-layout-split .cf-scene-layer::after {
  background: linear-gradient(to bottom, rgba(0,0,0,.16) 0%, transparent 22%);
}

/* Blurred copy of the current scene behind the dialogue */
.cf-layout-split #cf-scene-ambient {
  position: absolute; inset: 0; z-index: 0;
  background: center bottom / cover no-repeat;
  filter: blur(28px) saturate(1.15);
  transform: scale(1.2);
  opacity: .55;
  pointer-events: none;
}
.cf-layout-bottom #cf-scene-ambient,
.cf-player:not(.cf-layout-split) #cf-scene-ambient { display: none; }

/* Scene image/video fill only the top stage and fade out at the edge */
.cf-layout-split .cf-scene-image,
.cf-layout-split .cf-scene-video {
  inset: 0 0 auto 0;
  height: var(--cf-stage-h);
  z-index: 1;
  object-position: var(--cf-scene-focus, center 40%);
-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent);
        mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent);}

/* Character stands on the image, not behind the dialogue */
.cf-layout-split .cf-character-sprite {
  bottom: calc(100% - var(--cf-stage-h) + 24px);
  max-height: calc(var(--cf-stage-h) - 48px);
}

/* Dialogue fills from the stage edge to the bottom — no grass strip */
.cf-layout-split .cf-content-layer {
  padding-top: 0;
  padding-bottom: 0;
  justify-content: flex-end;   /* dialogue hugs the bottom */
}
.cf-layout-split .cf-dialogue-shell {
  flex: 0 0 auto;              /* only as tall as its content */
  min-height: 0;
  max-height: 62%;             /* long beats scroll inside */
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--form-bg) 74%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 22px 22px 0 0;
}
.cf-layout-split .cf-dialogue-box { max-height: none; overflow-y: auto; }

/* Short screens: give the dialogue more room */

.cf-character-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.cf-character-sprite {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-height: 68%;
  width: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.cf-character-sprite.cf-active {
  opacity: 1;
}

.cf-lottie-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cf-content-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
}

.cf-dialogue-shell {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  min-height: 100;
  max-height: min(98%, 100% - 40px);
  background: var(--form-dialogue-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.14);
  transition: background var(--form-transition);
  margin-bottom: 0px;
  position: relative;
}

.cf-shell-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 4px 16px;
  flex: 0 0 auto;
  min-height: 44px;
}

.cf-portrait {
  position: relative;

  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--form-accent);
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.3s;
  display: none;
}

.cf-portrait.cf-active {
  opacity: 1;
  display: block;
}

.cf-speaker-label {
  position: static;
  font-family: var(--brand-font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--form-accent);
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-speaker-label.cf-visible {
  opacity: 1;
}

.cf-dialogue-box {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 20px 12px;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: none;
  margin-bottom: 0;

  min-height: 0;
  max-height: 39vh;
  overflow-y: hidden;

  padding-right: 10px;
}

.cf-dialogue-box::-webkit-scrollbar {
  width: 4px;
}

.cf-dialogue-box::-webkit-scrollbar-thumb {
  background: var(--form-accent);
  opacity: 0.4;
  border-radius: 2px;
}

.cf-text {
  font-family: var(--form-font-headline);
  font-size: 18px;
  line-height: 1.6;
  max-width: fit-content;
  color: var(--form-text);
  min-height: auto;
  overflow: hidden;
}

/* Replace / Reveal: allow accumulated passages to scroll. */
.cf-dialogue-box:has(.cf-text-block) {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cf-text-block + .cf-text-block {
  margin-top: 1.1em;
}

.cf-text-block--new {
  animation: cf-passage-reveal 280ms ease-out both;
}

@keyframes cf-passage-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .cf-text-block--new { animation: none; }
}

.cf-start-disclaimer {
  flex-basis: 100%;
  width: 100%;
  margin: 6px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.45;
  opacity: 0.6;
}

.cf-continue-indicator {
  position: absolute;
  bottom: 1px;
  right: 18px;
  font-size: 28px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.3s;
  animation: cf-bob 1.5s ease-in-out infinite;
  pointer-events: none;
}

.cf-continue-indicator.cf-visible {
  opacity: 1;
}

@keyframes cf-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(4px);
  }
}

.cf-choices {
  flex: 1 1 auto;

  min-height: 0;

  padding: 4px 16px 16px;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  background: none;
  backdrop-filter: none;
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: none;
}

.cf-choices.cf-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cf-choices::-webkit-scrollbar {
  width: 4px;
}

.cf-choices::-webkit-scrollbar-thumb {
  background: var(--form-accent);
  opacity: 0.4;
  border-radius: 2px;
}

.cf-choice-btn {
  display: block;
  width: 100%;
  flex: 0 0 auto;
  padding: 12px 18px;
  background: var(--form-accent-soft);
  border: 1.5px solid var(--form-accent);
  border-radius: var(--form-btn-radius);
  color: var(--form-text);
  font-family: var(--form-font-body);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  line-height: 1.35;
  min-height: 44px;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.15s,
    box-shadow 0.2s;
  animation: cf-choice-in 0.3s ease both;
}

.cf-choice-btn:hover:not(:disabled) {
  background: var(--form-accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--form-btn-shadow);
}

.cf-choice-btn.cf-choice-selected {
  background: var(--form-accent);
  color: #fff;
}

.cf-choice-btn.cf-choice-dimmed {
  opacity: 0.32;
  pointer-events: none;
}

.cf-choice-btn.cf-choice-blocked {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@keyframes cf-choice-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cf-narration-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

.cf-btn-narr {
  width: 34px;
  height: 34px;

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--form-accent-soft);
  border: 1px solid var(--form-accent);
  border-radius: 50%;
  color: var(--form-text);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.15s;
}

.cf-btn-narr::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
}

.cf-btn-narr:hover {
  background: var(--form-accent);
  color: #fff;
}

.cf-btn-narr.cf-off {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--brand-text-soft);
  opacity: 0.7;
}

.cf-narr-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  transition:
    background 0.25s,
    box-shadow 0.25s;
}

.cf-narr-status.cf-narr-active {
  background: var(--form-accent);
  box-shadow: 0 0 0 3px var(--form-accent-soft);
  animation: cf-narr-pulse 1.4s ease-in-out infinite;
}

@keyframes cf-narr-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.cf-loading {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  gap: 20px;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--brand-font-body);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.cf-loading-spinner {
  width: 34px;
  height: 34px;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--brand-secondary);
  border-radius: 50%;
  animation: cf-spin 0.8s linear infinite;
}

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

/* .cf-player.cf-transitioning::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 190;
  background: var(--brand-neutral);
  pointer-events: none;
  animation: cf-crossfade 0.95s ease-in-out forwards;
} */
.cf-player.cf-transitioning::before {
  content: none;
  animation: none;
}
@keyframes cf-crossfade {
  0% {
    opacity: 0;
  }

  40% {
    opacity: 1;
  }

  60% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.cf-player.cf-transitioning .cf-brand-logo {
 animation: none;
}

@keyframes cf-logo-pulse {
  0%,
  100% {
    opacity: 0.88;
  }

  50% {
    opacity: 0.18;
  }
}

.cf-diary-panel {
  position: absolute;
  inset: 0;
  z-index: 155;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.cf-diary-panel.cf-open {
  transform: translateY(0);
  pointer-events: auto;
}

.cf-diary-scrim {
  flex: 1;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.cf-diary-sheet {
  background: var(--brand-bg);
  border-radius: 20px 20px 0 0;
  padding: 10px 24px 44px;
  min-height: 56%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cf-diary-handle {
  width: 38px;
  height: 4px;
  background: #d8d5d0;
  border-radius: 2px;
  margin: 0 auto 4px;
}

.cf-diary-title {
  font-family: var(--brand-font-headline);
  font-size: 18px;
  color: var(--brand-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cf-diary-textarea {
  flex: 1;
  min-height: 120px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid #e0ddd8;
  border-radius: 10px;
  font-family: var(--brand-font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--brand-text);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.cf-diary-textarea::placeholder {
  color: var(--brand-text-soft);
}

.cf-diary-textarea:focus {
  border-color: var(--form-accent);
}

.cf-diary-save {
  padding: 14px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s;
}

.cf-diary-save:hover {
  background: var(--form-accent);
  transform: translateY(-1px);
}

.cf-mood-screen {
  position: absolute;
  inset: 0;
  z-index: 160;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  padding: 40px 32px;
  gap: 28px;
  text-align: center;
}

.cf-mood-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.82;
}

.cf-mood-title {
  font-family: var(--brand-font-headline);
  font-size: 22px;
  color: #fff;
  line-height: 1.45;
  max-width: 280px;
}

.cf-mood-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.52);
  margin-top: -16px;
}

.cf-mood-scale {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.cf-mood-btn {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s;
  min-width: 44px;
  min-height: 44px;
}

.cf-mood-btn:hover,
.cf-mood-btn.selected {
  background: var(--brand-secondary);
  border-color: var(--brand-secondary);
  transform: scale(1.12);
}

.cf-mood-continue {
  padding: 14px 36px;
  background: var(--brand-secondary);
  color: var(--brand-primary);
  border: none;
  border-radius: 100px;
  font-family: var(--brand-font-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition:
    filter 0.2s,
    transform 0.15s;
  min-height: 44px;
}

.cf-mood-continue:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.cf-form-preview-card {
  background: var(--brand-bg);
  border-radius: var(--brand-radius-lg);
  overflow: hidden;
  box-shadow: var(--brand-shadow);
  max-width: 340px;
  margin: 0 auto;
  font-family: var(--brand-font-body);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.cf-form-preview-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.13),
    0 3px 10px rgba(0, 0, 0, 0.07);
}

.cf-form-preview-thumb {
  width: 100%;
  height: 150px;
  object-fit: cover;
  filter: blur(2.5px) brightness(0.82);
  transition: filter 0.4s;
  display: block;
}

.cf-form-preview-card:hover .cf-form-preview-thumb {
  filter: blur(1px) brightness(0.92);
}

.cf-form-preview-body {
  padding: 20px 20px 24px;
}

.cf-form-preview-title {
  font-family: var(--form-font-headline);
  font-size: 20px;
  font-weight: 600;
  color: var(--brand-text);
  margin-bottom: 8px;
}

.cf-form-preview-desc {
  font-size: 13.5px;
  color: var(--brand-text-soft);
  line-height: 1.55;
  margin-bottom: 20px;
}

.cf-form-preview-begin {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--form-accent);
  color: #fff;
  border: none;
  border-radius: var(--form-btn-radius);
  font-family: var(--brand-font-body);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition:
    filter 0.2s,
    transform 0.15s;
  min-height: 44px;
}

.cf-form-preview-begin:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.cf-form-library {
  min-height: 100vh;
  background: var(--brand-bg);
  font-family: var(--brand-font-body);
  overflow-y: auto;
}

.cf-library-header {
  background: var(--brand-primary);
  padding: 52px 24px 36px;
}

.cf-library-logo {
  height: 26px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.88;
  display: block;
  margin-bottom: 16px;
}

.cf-library-title {
  font-family: var(--brand-font-headline);
  font-size: 28px;
  color: #fff;
  font-weight: 600;
  margin-bottom: 6px;
}

.cf-library-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.56);
  line-height: 1.5;
  max-width: 320px;
}

.cf-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 24px;
  max-width: 960px;
  margin: 0 auto;
}

.cf-library-card {
  background: #fff;
  border-radius: var(--brand-radius-lg);
  overflow: hidden;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.07),
    0 4px 12px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  position: relative;
}

.cf-library-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.12),
    0 3px 10px rgba(0, 0, 0, 0.06);
}

.cf-library-card-thumb {
  width: 100%;
  height: 116px;
  object-fit: cover;
  display: block;
  background: var(--brand-neutral);
}

.cf-library-card-body {
  padding: 14px 16px 18px;
}

.cf-library-card-title {
  font-family: var(--brand-font-headline);
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-text);
  margin-bottom: 5px;
}

.cf-library-card-desc {
  font-size: 12.5px;
  color: var(--brand-text-soft);
  line-height: 1.4;
  margin-bottom: 10px;
}

.cf-intensity {
  display: flex;
  gap: 4px;
  align-items: center;
}

.cf-intensity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0ddd8;
}

.cf-intensity-dot.filled {
  background: var(--form-accent, var(--brand-secondary));
}

.cf-completed-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--form-accent, var(--brand-secondary));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
}

.cf-footer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(80px, auto) 1fr minmax(80px, auto);
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
  width: 100%;
  padding: 10px 16px 18px;
}

.cf-footer > .cf-start-disclaimer {
  grid-column: 1 / -1;
}

.cf-footer > .cf-continue-indicator {
  display: none;
}

.cf-footer .cf-trail-map {
  position: relative;
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  width: auto;
  min-width: 0;
}

.cf-footer .cf-trail-map[data-label]::after {
  content: attr(data-label);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--form-text);
  opacity: 0.55;
}

.cf-footer .cf-trail-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--form-accent);
  opacity: 0.22;
  transition:
    width 0.25s ease,
    opacity 0.25s ease;
}

.cf-footer .cf-trail-dot.complete {
  opacity: 0.55;
}

.cf-footer .cf-trail-dot.active {
  width: 22px;
  opacity: 1;
}

.cf-footer .cf-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--form-accent);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--form-btn-radius);
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s,
    opacity 0.2s,
    transform 0.1s;
}

.cf-footer .cf-nav-btn--back {
  grid-column: 1;
  justify-self: start;
}

.cf-footer .cf-nav-btn--next {
  grid-column: 3;
  justify-self: end;
}

.cf-footer .cf-nav-btn:hover:not(:disabled) {
  background: var(--form-accent-soft);
}

.cf-footer .cf-nav-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.cf-footer .cf-nav-btn:focus-visible {
  outline: 2px solid var(--form-accent);
  outline-offset: 2px;
}

.cf-footer .cf-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cf-footer .cf-nav-btn__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cf-footer .cf-nav-btn--next.cf-ready {
  background: var(--form-accent);
  color: #fff;
}
.cf-beat-ctas { margin: 4px 0 12px; }

.cf-conversion-cta {
  padding: 6px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.cf-cta-text {
  font-family: var(--brand-font-headline);
  font-size: 16px;
  color: var(--form-text);
  opacity: 0.82;
}

.cf-cta-btn {
  display: block;
  width: 100%;
  padding: 15px 20px;
  background: var(--form-accent);
  color: #fff;
  border: none;
  border-radius: var(--form-btn-radius);
  font-family: var(--brand-font-body);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  transition:
    filter 0.2s,
    transform 0.15s;
  min-height: 44px;
}

.cf-cta-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.cf-cta-subtext {
  font-size: 12px;
  color: var(--form-text);
  opacity: 0.5;
}

.cf-end-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.cf-end-ctas .cf-cta-btn {
  width: 100%;
}

.cf-inline-image {
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  border-radius: var(--brand-radius);
  margin-bottom: 12px;
  display: block;
}

.cf-choice-btn:focus-visible,
.cf-btn-narr:focus-visible,
.cf-diary-btn:focus-visible,
.cf-pause-reflect-btn:focus-visible,
.cf-mood-btn:focus-visible,
.cf-mood-continue:focus-visible,
.cf-diary-save:focus-visible,
.cf-form-preview-begin:focus-visible {
  outline: 2px solid var(--form-accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .cf-continue-indicator {
    animation: none;
  }

  .cf-player.cf-transitioning::before {
    animation: none;
    opacity: 0;
  }

  .cf-scene-image,
  .cf-scene-video,
  .cf-character-sprite {
    transition: none;
  }

  .cf-choices,
  .cf-choice-btn {
    animation: none;
    transition: none;
  }
}

@media (max-width: 520px) {
  .cf-player {
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
  }

  .cf-text {
    font-size: 16px;
  }

  .cf-choice-btn {
    font-size: 14.5px;
    padding: 12px 16px;
  }

  .cf-brand-header {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 26px;
  }

  #cf-dialogue-shell {
    margin-top: 8px;
  }

  .cf-mood-scale {
    gap: 8px;
  }

  .cf-mood-btn {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }

  .cf-library-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
}

@media (max-height: 680px) {
  .cf-dialogue-shell {
    max-height: min(94%, 100% - 40px);
  }

  .cf-dialogue-box {
    padding: 8px 10px 4px;
  }
  .cf-text {
    font-size: 15.5px;
    line-height: 1.5;
    min-height: 2.4em;
  }

  .cf-choice-btn {
    padding: 11px 14px;
    min-height: 44px;
  }

  .cf-shell-top {
    padding-top: 6px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .cf-brand-header {
    padding-bottom: 14px;
  }

  .cf-dialogue-shell {
    max-height: 92%;
  }

  .cf-dialogue-box {
    max-height: 30vh;
  }

  .cf-text {
    font-size: 15px;
  }

  #cf-choices {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .cf-choices {
    padding-bottom: 10px;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .cf-choice-btn {
    width: calc(50% - 5px);
  }
}

.cf-brand-header {
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
}

.cf-diary-sheet {
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

.cf-diary-btn,
.cf-pause-reflect-btn {
  min-width: 44px;
  min-height: 44px;
}

@supports (height: 100dvh) {
  .cf-content-layer {
    padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-narr-status.cf-narr-active {
    animation: none;
  }

  .cf-dialogue-shell,
  .cf-choices {
    transition: none;
  }

  .cf-footer .cf-trail-dot,
  .cf-footer .cf-nav-btn {
    transition: none;
  }
}

.cf-inputs {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin: 12px 0;
  padding: 2px 6px 2px;
  max-height: 22vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cf-inputs.cf-visible {
  display: flex;
}

.cf-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  margin: 0;
}

.cf-field-check {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}

.cf-field-check .cf-field-input {
  width: 16px;
  height: 14px;
  min-width: 16px;
  margin-top: 2px !important;
  flex-shrink: 0;
  padding: 0;
  order: -1;
  accent-color: var(--form-accent, #4a7c6f);
}

.cf-field-check .cf-field-label {
  padding-top: 1px;
}

.cf-field-label {
  color: #3a3a38;
  line-height: 1.2;
  margin: 0 0 2px;
  display: block;
}

.cf-field-input {
  box-sizing: border-box;
  width: 100%;
  margin: 4px 0 0;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: #ffffff;
  color: #2a2a28;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.35;
}

.cf-choice-blocked {
  opacity: 0.4;
  cursor: not-allowed;
}

textarea.cf-field-input {
  resize: vertical;
  min-height: 76px;
}

select.cf-field-input {
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.cf-field-input:focus {
  border-color: var(--form-accent);
  box-shadow: 0 0 0 3px var(--form-accent-soft);
}

.cf-field-input.cf-invalid {
  border-color: #d94a38;
  box-shadow: 0 0 0 3px rgba(217, 74, 56, 0.14);
}

.cf-field-error {
  font-size: 11.5px;
  color: #d94a38;
  min-height: 1em;
  margin: 4px 0 0;
}

.cf-field-input::placeholder {
  color: var(--brand-text-soft);
  opacity: 0.8;
}

.cf-player.vibe-challenging .cf-field-input,
.cf-player.vibe-anger .cf-field-input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--form-text);
}
#clarityflow-player:has(.cf-scene-image.cf-active, .cf-scene-video.cf-active, .cf-scene-youtube:not([hidden])) .cf-scene-layer,
#clarityflow-player:has(.cf-scene-image.cf-active, .cf-scene-video.cf-active, .cf-scene-youtube:not([hidden])) .cf-scene-layer::before {
  background-image: none !important;
}
/* Clean Storybook — split layout only. */
.cf-layout-split #cf-scene-ambient {
  display: none;
}

/* Keep images, direct video and the branding background crisp. */
.cf-layout-split .cf-scene-image,
.cf-layout-split .cf-scene-video,
#clarityflow-player.cf-layout-split.has-bg-image .cf-scene-layer::before {
  -webkit-mask-image: none;
  mask-image: none;
}

/* Give the dialogue the space below the scene stage. */
.cf-layout-split .cf-content-layer {
  top: var(--cf-stage-h, 56%);
  bottom: 0;
  padding: 0;
  justify-content: flex-start;
}

.cf-layout-split .cf-dialogue-shell {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--form-bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-top: 2px solid var(--form-accent);
  border-radius: 22px 22px 0 0;
  box-shadow: none;
}
/* Extend the scene just behind the rounded dialogue corners. */
.cf-layout-split:not([data-scene-image-fit="width"]) .cf-scene-image,
.cf-layout-split .cf-scene-video,
#clarityflow-player.cf-layout-split.has-bg-image .cf-scene-layer::before {
  height: calc(var(--cf-stage-h, 56%) + 22px);
}
/* Optional branding background fit in split layout. */
#clarityflow-player.cf-layout-split.has-bg-image[data-bg-scope][data-bg-image-fit]
  .cf-scene-layer::before {
  background-size: var(--cf-brand-bg-fit);
  background-position: top center;
  -webkit-mask-image: none;
  mask-image: none;
}
/* Give the welcome panel more room in split mode. */
.cf-player.cf-layout-split.cf-on-start {
  --cf-stage-h: 44%;
}

/* One scrollable panel for the entire welcome screen. */
.cf-player.cf-on-start .cf-dialogue-shell {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Let the welcome text take its natural height. */
.cf-player.cf-on-start .cf-dialogue-box {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}

/* Keep the full Begin button in the main scroll flow. */
.cf-player.cf-on-start .cf-choices {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

/* Move disclaimer and brand mark down when space is available. */
.cf-player.cf-on-start .cf-footer {
  flex: 0 0 auto;
  margin-top: auto;
}

.cf-player.cf-on-start .cf-brand-footer {
  flex: 0 0 auto;
}

/* These navigation controls aren't used on the welcome screen. */
.cf-player.cf-on-start .cf-footer .cf-nav-btn,
.cf-player.cf-on-start .cf-footer .cf-trail-map {
  display: none;
}