:root {
  --app-note-h: 44px;
  --purro-ink: #2c241c;
  --purro-muted: rgba(44, 36, 28, 0.68);
  --purro-line: rgba(68, 48, 28, 0.15);
  --purro-panel: rgba(255, 250, 240, 0.72);
  --purro-panel-strong: rgba(255, 252, 246, 0.88);
  --purro-accent: #6d4c2f;
  --purro-blue: #466774;
  --purro-warm: #efe7d6;
}

* {
  box-sizing: border-box;
}

body.purro-body {
  margin: 0;
  min-width: 320px;
  background: var(--purro-warm);
  color: var(--purro-ink);
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.purro-webapp {
  min-height: 100svh;
  background: var(--purro-warm);
}

.purro-stage {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.purro-bg {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(8px) saturate(1.06);
  transform: scale(1.04);
}

.purro-bg-still {
  position: absolute;
  inset: 0;
  z-index: -4;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.purro-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(255, 247, 231, 0.34), rgba(255, 247, 231, 0.08) 46%, rgba(255, 247, 231, 0.42)),
    rgba(245, 235, 215, 0.36);
}

.purro-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 40px) 10px;
}

.purro-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 850;
}

.purro-brand img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  box-shadow: 0 10px 24px rgba(45, 32, 18, 0.18);
}

.purro-brand span {
  font-size: 20px;
  line-height: 1;
}

.purro-store-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-store-badge-link {
  display: block;
  line-height: 0;
}

.app-store-badge-link img {
  display: block;
  width: auto;
  height: 40px;
}

.legal-mini-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(16px, 4vw, 40px);
  color: var(--purro-muted);
  font-size: 13px;
}

.legal-mini-nav a {
  color: inherit;
  text-underline-offset: 3px;
}

/* Visitors meet the typing demo first and read it as the product. The app is a
   spoken conversation, so the difference is stated above the fold. The strip is
   in the page flow, so --app-note-h is what the layout below gives up for it —
   measured at the widths in the media queries, not guessed. */
.app-note {
  margin: 0;
  padding: 8px clamp(16px, 4vw, 40px) 0;
  color: var(--purro-muted);
  font-size: 13px;
  line-height: 1.4;
  max-width: 108ch;
}

.app-note strong {
  color: var(--purro-ink);
  font-weight: 850;
}

.purro-layout {
  min-height: calc(100svh - 104px - var(--app-note-h));
  display: grid;
  grid-template-columns: minmax(340px, 1.24fr) minmax(340px, 0.76fr);
  gap: clamp(16px, 3vw, 36px);
  padding: 12px clamp(16px, 4vw, 40px) 24px;
}

.cat-scene {
  position: relative;
  min-height: min(560px, calc(100svh - 148px - var(--app-note-h)));
  display: grid;
  place-items: end center;
  overflow: hidden;
}

.cat-stage-inner {
  position: relative;
  width: auto;
  height: min(calc(100% - clamp(12px, 3vh, 34px)), 748px);
  max-width: 76vw;
  aspect-ratio: 1086 / 1448;
  margin-bottom: clamp(12px, 3vh, 34px);
  transform-origin: 50% 88%;
}

.cat-pose,
.cat-eyes,
.cat-mouth,
.cat-effect {
  position: absolute;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.cat-pose {
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translate(calc(var(--pose-dx, 0) * 100%), calc(var(--pose-dy, 0) * 100%)) scale(var(--pose-scale, 1));
  transition: opacity 160ms ease;
}

.cat-pose.previous {
  opacity: 0;
}

.cat-eyes,
.cat-mouth {
  opacity: 0;
  transition: opacity 90ms linear;
  left: calc(var(--patch-left, 0) * 100%);
  top: calc(var(--patch-top, 0) * 100%);
  width: calc((var(--patch-right, 1) - var(--patch-left, 0)) * 100%);
  height: calc((var(--patch-bottom, 1) - var(--patch-top, 0)) * 100%);
}

.cat-effect {
  left: 50%;
  top: 28%;
  width: 58%;
  height: 58%;
  opacity: 0;
  object-fit: contain;
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 180ms ease, transform 420ms ease;
  pointer-events: none;
}

.cat-effect.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.cat-shadow {
  position: absolute;
  left: 50%;
  bottom: clamp(20px, 5vh, 52px);
  width: min(34vw, 282px);
  height: 36px;
  border-radius: 999px;
  background: rgba(47, 34, 20, 0.18);
  filter: blur(14px);
  transform: translateX(-50%);
}

.sound-cta {
  grid-row: 2;
  margin: 10px 12px 0;
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--purro-accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(45, 32, 18, 0.2);
}

.sound-cta[hidden] {
  display: none;
}

.snack-rail {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 4vh, 44px);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  transform: translateX(-50%);
  opacity: 0.86;
  pointer-events: none;
}

.snack-rail img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(45, 32, 18, 0.18));
}

.pose-dock {
  position: absolute;
  left: 50%;
  top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: min(560px, calc(100% - 24px));
  transform: translateX(-50%);
}

.pose-dock button {
  min-height: 32px;
  border: 1px solid rgba(68, 48, 28, 0.14);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 252, 246, 0.62);
  color: var(--purro-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.pose-dock button[aria-pressed="true"] {
  background: var(--purro-accent);
  color: white;
}

.transcript-card {
  align-self: end;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  height: clamp(420px, calc(100svh - 148px - var(--app-note-h)), 820px);
  min-height: 0;
  background: var(--purro-panel);
  border: 1px solid var(--purro-line);
  backdrop-filter: blur(18px);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(45, 32, 18, 0.14);
}

.transcript-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(68, 48, 28, 0.1);
}

.transcript-header h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
}

.voice-status {
  min-width: 8ch;
  color: var(--purro-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.transcript-list {
  grid-row: 3;
  overflow: auto;
  min-height: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.line {
  max-width: 90%;
  display: grid;
  gap: 4px;
}

.line.user {
  align-self: end;
  text-align: right;
}

.line.purro {
  align-self: start;
}

.line[role="button"] {
  cursor: pointer;
}

.line[role="button"]:focus-visible {
  outline: 3px solid rgba(70, 103, 116, 0.34);
  outline-offset: 4px;
  border-radius: 10px;
}

.speaker {
  color: var(--purro-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.bubble {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(157, 119, 70, 0.18);
  color: var(--purro-ink);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.line.user .bubble {
  background: rgba(70, 103, 116, 0.17);
}

.line.is-speaking .bubble {
  box-shadow: 0 0 0 2px rgba(109, 76, 47, 0.18), 0 10px 24px rgba(45, 32, 18, 0.1);
}

.composer {
  grid-row: 4;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(68, 48, 28, 0.12);
  background: var(--purro-panel-strong);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.composer input {
  min-width: 0;
  border: 1px solid rgba(68, 48, 28, 0.22);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.8);
  color: inherit;
  font: inherit;
  font-size: 15px;
}

.composer button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--purro-accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.composer button[data-action="stop"] {
  background: rgba(58, 42, 29, 0.12);
  color: #3a2a1d;
}

.privacy-note {
  grid-row: 5;
  padding: 0 14px 12px;
  color: var(--purro-muted);
  font-size: 12px;
  line-height: 1.35;
}

.page-footer {
  padding: 16px clamp(16px, 4vw, 40px) 24px;
  background: #251d16;
  color: rgba(255, 250, 240, 0.76);
  font-size: 13px;
}

.page-footer a {
  color: inherit;
}

@media (max-width: 900px) {
  /* One screen, two stacked panes: the cat keeps a fixed share and the card
     takes the rest, so the composer stays near the fold instead of below it. */
  .purro-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: calc(100svh - 128px - var(--app-note-h));
  }

  .cat-scene {
    min-height: 0;
    height: clamp(150px, calc((100svh - 128px - var(--app-note-h)) * 0.44), 420px);
    padding-top: 44px;
  }

  .cat-stage-inner {
    width: auto;
    height: calc(100% - 8px);
    margin-bottom: 8px;
  }

  .transcript-card {
    align-self: stretch;
    height: clamp(280px, calc((100svh - 128px - var(--app-note-h)) * 0.56), 620px);
  }

  .cat-shadow {
    bottom: clamp(10px, 2.5vh, 24px);
    width: min(46vw, 220px);
    height: 24px;
  }

  .snack-rail {
    bottom: clamp(6px, 1.6vh, 16px);
  }

  .snack-rail img {
    width: 22px;
    height: 22px;
  }

  /* A single scrollable row of pose chips instead of three wrapped rows. */
  .pose-dock {
    top: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .pose-dock::-webkit-scrollbar {
    display: none;
  }

  .pose-dock button {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }
}

@media (max-width: 560px) {
  .app-note {
    font-size: 12px;
  }

  .purro-topbar {
    align-items: flex-start;
  }

  .legal-mini-nav {
    flex-wrap: wrap;
  }

  .composer {
    grid-template-columns: 1fr 1fr;
  }

  .composer input {
    grid-column: 1 / -1;
  }

  .composer button {
    width: 100%;
  }

  .privacy-note {
    padding: 0 12px 10px;
    font-size: 11px;
  }

  .transcript-header {
    align-items: flex-start;
  }

  .line {
    max-width: 96%;
  }
}

/* Measured: the strip wraps to a third line at 414pt and below, and a 667pt
   phone has no height to spare for it. */
@media (max-width: 420px) {
  :root {
    --app-note-h: 40px;
  }

  .app-note {
    padding-top: 6px;
    font-size: 11px;
    line-height: 1.35;
  }
}

@media (max-width: 384px) {
  :root {
    --app-note-h: 51px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cat-stage-inner,
  .cat-pose,
  .cat-eyes,
  .cat-mouth,
  .cat-effect,
  .transcript-list {
    transition: none;
    scroll-behavior: auto;
  }
}
