.gm-phone-demo {
  /* Aligned with the real chat (chat.gomammy.local — LegacyPalette). */
  --gm-bg: #fafbfe;
  --gm-white: #ffffff;
  --gm-surface: #f3f4f8;
  --gm-surface2: #edeef3;
  --gm-line: #e2e4ec;
  --gm-text: #1a1a2e;
  --gm-text2: #555770;
  --gm-text3: #8b8da3;
  --gm-accent: #4f46e5;
  --gm-accent2: #ec4899;
  --gm-accent-soft: #eef2ff;
  --gm-green: #10b981;
  --gm-font: "Inter", system-ui, -apple-system, sans-serif;
  --gm-font-d: "Outfit", "Inter", sans-serif;
  position: relative;
  width: min(360px, 88vw);
  color: var(--gm-text);
  font-family: var(--gm-font);
  text-align: left;
}

.gm-phone-demo *,
.gm-phone-demo *::before,
.gm-phone-demo *::after {
  box-sizing: border-box;
}

.gm-phone-demo__device {
  position: relative;
}

.gm-phone-demo__img {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 30px 70px rgba(20, 24, 40, 0.18));
}

.gm-phone-demo__screen {
  position: absolute;
  top: 0.9%;
  left: 4.6%;
  width: 91.4%;
  height: 98.2%;
  z-index: 1;
  overflow: hidden;
  border-radius: 46px;
  background: #fff;
}

.gm-phone-demo__screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% -5%, rgba(91, 92, 233, 0.1) 0%, transparent 24%),
    radial-gradient(circle at 88% 100%, rgba(217, 90, 166, 0.08) 0%, transparent 28%);
  pointer-events: none;
}

.gm-phone-demo__screen-in {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gm-phone-demo__top {
  padding: 24px 30px 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.gm-phone-demo__header {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 8px;
}

.gm-phone-demo__logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--gm-font-d);
  font-size: 16px;
  font-weight: 300;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.gm-phone-demo__menu {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  border: 0;
  background: transparent;
}

.gm-phone-demo__menu span {
  display: block;
  width: 18px;
  height: 1.2px;
  border-radius: 999px;
  background: var(--gm-text);
  opacity: 0.8;
}

.gm-phone-demo__body {
  flex: 1;
  overflow: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--gm-bg);
}

.gm-phone-demo__body::-webkit-scrollbar {
  display: none;
}

.gm-phone-demo__stamp {
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--gm-text3);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(8px);
  margin-bottom: 8px;
}

.gm-phone-demo__join {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  margin: 0 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.03);
  animation: gmRise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.gm-phone-demo__join-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gm-phone-demo__join-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--gm-accent-soft);
  color: var(--gm-accent);
  flex-shrink: 0;
}

.gm-phone-demo__join b {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
  color: var(--gm-text);
  font-weight: 700;
}

.gm-phone-demo__join span {
  display: block;
  font-size: 11px;
  color: var(--gm-text2);
  line-height: 1.4;
}

.gm-phone-demo__join-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: var(--gm-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.25s;
  box-shadow: 0 4px 12px rgba(91, 92, 233, 0.2);
}

.gm-phone-demo__join-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(91, 92, 233, 0.3);
}

/* Message layout — mirrors the real chat: a name/spec/time header on top,
   then (for agents) a rounded-square avatar beside the bubble. */
.gm-phone-demo__msg {
  max-width: 92%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 14px;
  animation: gmRise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.gm-phone-demo__msg--you {
  align-self: flex-end;
  align-items: flex-end;
  max-width: 82%;
}

.gm-phone-demo__msg--ai {
  align-self: flex-start;
  align-items: flex-start;
}

.gm-phone-demo__msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.gm-phone-demo__msg-head--you {
  justify-content: flex-end;
}

.gm-phone-demo__msg-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gm-text);
}

.gm-phone-demo__msg-name--you {
  font-size: 12px;
  color: var(--gm-accent);
}

.gm-phone-demo__msg-spec {
  font-size: 11px;
  font-weight: 600;
  color: var(--gm-text2);
}

.gm-phone-demo__msg-time {
  font-size: 9px;
  font-weight: 500;
  color: rgba(85, 87, 112, 0.6);
}

.gm-phone-demo__msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.gm-phone-demo__avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gm-accent), var(--gm-accent2));
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  font-family: var(--gm-font-d);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

.gm-phone-demo__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gm-phone-demo__bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--gm-text);
  background: var(--gm-bg);
  border: 1px solid var(--gm-line);
  box-shadow: none;
}

.gm-phone-demo__msg--ai .gm-phone-demo__bubble {
  flex: 1;
  min-width: 0;
}

.gm-phone-demo__msg--you .gm-phone-demo__bubble {
  color: #fff;
  background: linear-gradient(135deg, var(--gm-accent), var(--gm-accent2));
  border: 1px solid var(--gm-line);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.gm-phone-demo__typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--gm-bg);
  border: 1px solid var(--gm-line);
  animation: gmRise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.gm-phone-demo__typing span {
  width: 5px;
  height: 5px;
  background: var(--gm-text3);
  border-radius: 50%;
  display: inline-block;
  animation: gmTyping 1.4s infinite ease-in-out;
}

.gm-phone-demo__typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.gm-phone-demo__typing span:nth-child(3) {
  animation-delay: 0.4s;
}

.gm-phone-demo__input-wrap {
  padding: 12px 12px 32px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.gm-phone-demo__input-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
  align-items: end;
}

.gm-phone-demo__input {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--gm-text);
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 8px 18px rgba(18, 22, 36, 0.04);
  word-break: break-word;
  display: block;
  position: relative;
}

.gm-phone-demo__input::after {
  content: attr(data-placeholder);
  position: absolute;
  left: 14px;
  top: 10px;
  color: var(--gm-text3);
  pointer-events: none;
  opacity: 0.6;
}

.gm-phone-demo__input--has-text::after {
  display: none;
}

.gm-phone-demo__cursor {
  display: inline-block;
  width: 1.5px;
  height: 12px;
  background: var(--gm-accent);
  margin-left: 1px;
  vertical-align: middle;
  animation: gmCursor 1s step-end infinite;
}

.gm-phone-demo__send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  /* Demo, not a real composer — non-interactive while the scenario plays. */
  cursor: default;
  pointer-events: none;
  background: linear-gradient(135deg, var(--gm-accent), var(--gm-accent2));
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.24);
  transition: transform 0.2s, box-shadow 0.2s;
}

/* Finished — the send button becomes a clickable "play again" control. */
.gm-phone-demo__send--play {
  pointer-events: auto;
  cursor: pointer;
}

.gm-phone-demo__send--play:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(79, 70, 229, 0.3);
}

.gm-phone-demo__send--play svg {
  transform: translateX(1px);
}

/* The hamburger is decorative in the demo. */
.gm-phone-demo__menu {
  pointer-events: none;
}

@keyframes gmTyping {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes gmCursor {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes gmRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  html.gm-mobile-snap-root,
  html.gm-mobile-snap-root body {
    scroll-snap-type: none;
  }

  html.gm-mobile-snap-root main > section {
    min-height: auto;
    scroll-snap-align: none;
    scroll-snap-stop: normal;
  }
}

/* ── Play gate ─────────────────────────────────────────────────────────
   Before Play: only the phone outline + the Play button. The screen
   contents fade in once the scenario starts. */
.gm-phone-demo__screen-in {
  transition: opacity 0.45s ease;
}

.gm-phone-demo--idle .gm-phone-demo__screen-in {
  opacity: 0;
  pointer-events: none;
}

/* Soft focus glow behind the Play button so the blank "poster" isn't empty. */
.gm-phone-demo--idle .gm-phone-demo__screen::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  height: 40%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    ellipse at center,
    rgba(79, 70, 229, 0.1) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.gm-phone-demo--running .gm-phone-demo__play {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Play control — page-level CTA, so it matches the site buttons
   (accent→pink gradient, Outfit, site shadows), not the in-phone UI. */
.gm-phone-demo__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 7px;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0 0 0 rgba(26, 26, 46, 0);
  transition: gap 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.32s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease,
    box-shadow 0.3s ease, opacity 0.35s ease, visibility 0.35s ease;
}

.gm-phone-demo__play-circle {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--accent, #4f46e5),
    var(--pink, #ec4899)
  );
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.32);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s ease;
}

/* Pulsing ring to invite the click (paused on hover / reduced motion). */
.gm-phone-demo__play-circle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45);
  animation: gmPlayPulse 2.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

/* The triangle path is centroid-centered; nudge 1px right for optical balance. */
.gm-phone-demo__play-circle svg {
  position: relative;
  transform: translateX(1px);
}

.gm-phone-demo__play-label {
  max-width: 0;
  opacity: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-d, "Outfit", "Inter", sans-serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 0.95rem;
  color: var(--text, #1a1a2e);
  transition: max-width 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease,
    margin 0.3s ease;
}

/* Hover/focus: circle stays, the button expands into a pill with the label. */
.gm-phone-demo__play:hover,
.gm-phone-demo__play:focus-visible {
  gap: 13px;
  padding: 7px 22px 7px 7px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.gm-phone-demo__play:hover .gm-phone-demo__play-circle,
.gm-phone-demo__play:focus-visible .gm-phone-demo__play-circle {
  transform: scale(1.05);
  box-shadow: 0 14px 32px rgba(79, 70, 229, 0.4);
}

.gm-phone-demo__play:hover .gm-phone-demo__play-circle::before,
.gm-phone-demo__play:focus-visible .gm-phone-demo__play-circle::before {
  animation: none;
}

.gm-phone-demo__play:hover .gm-phone-demo__play-label,
.gm-phone-demo__play:focus-visible .gm-phone-demo__play-label {
  max-width: 200px;
  opacity: 1;
  margin-right: 5px;
}

/* Touch devices have no hover — keep the label visible so it's never a
   bare, unlabelled circle. */
@media (hover: none) {
  .gm-phone-demo__play {
    gap: 13px;
    padding: 7px 22px 7px 7px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .gm-phone-demo__play .gm-phone-demo__play-label {
    max-width: 200px;
    opacity: 1;
    margin-right: 5px;
  }
}

@keyframes gmPlayPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(79, 70, 229, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gm-phone-demo__screen-in,
  .gm-phone-demo__play,
  .gm-phone-demo__play-label,
  .gm-phone-demo__play-circle {
    transition: none;
  }
  .gm-phone-demo__play-circle::before {
    animation: none;
  }
}
