:root {
  color-scheme: light;
  --cycle: 18s;
  --cream: #fbf7f0;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #1f2933;
  --muted: #66717e;
  --line: #e1d7ca;
  --teal: #1d6f67;
  --teal-dark: #114d48;
  --teal-soft: #dcefed;
  --gold: #ad7b2f;
  --gold-soft: #fff3d7;
  --shadow: 0 18px 44px rgba(31, 41, 51, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(29, 111, 103, 0.13), transparent 22rem),
    linear-gradient(135deg, #fffdf8 0%, var(--cream) 48%, #eef8f6 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.demo-paused *,
body.demo-paused *::before,
body.demo-paused *::after {
  animation-play-state: paused !important;
}

button {
  font: inherit;
}

.demo-stage {
  display: grid;
  width: min(100vw, 1280px);
  aspect-ratio: 16 / 9;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  padding: clamp(10px, 2.1vw, 28px);
}

.product-frame {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  border: 1px solid rgba(17, 77, 72, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 253, 248, 0.96)),
    var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(225, 215, 202, 0.9);
}

.window-dots {
  display: inline-flex;
  gap: 6px;
}

.window-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d9cfc2;
}

.app-title,
.mailbox-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-dark);
  font-size: clamp(0.72rem, 1.45vw, 0.88rem);
  font-weight: 800;
  white-space: nowrap;
}

.app-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--teal-dark);
  color: #ffffff;
  font-weight: 900;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #29a36a;
  box-shadow: 0 0 0 5px rgba(41, 163, 106, 0.13);
}

.flow-labels {
  position: relative;
  min-height: 50px;
  padding: 14px 20px 0;
}

.flow-label {
  position: absolute;
  left: 20px;
  top: 13px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(17, 77, 72, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-dark);
  font-size: clamp(0.74rem, 1.5vw, 0.9rem);
  font-weight: 850;
  opacity: 0;
  padding: 4px 12px;
  transform: translateY(8px);
  animation: label-cycle var(--cycle) linear infinite;
}

.label-one {
  animation-delay: 0s;
}

.label-two {
  animation-delay: calc(var(--cycle) * 0.1667);
}

.label-three {
  animation-delay: calc(var(--cycle) * 0.3333);
}

.label-four {
  animation-delay: calc(var(--cycle) * 0.5556);
}

.label-five {
  animation-delay: calc(var(--cycle) * 0.7222);
}

.workspace {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(170px, 0.44fr) minmax(0, 1fr);
  gap: clamp(12px, 2.2vw, 24px);
  padding: 4px clamp(14px, 2.5vw, 26px) clamp(14px, 2.5vw, 26px);
}

.suggestion-queue,
.detail-pane,
.summary-card,
.email-card,
.draft-card,
.suggestion-card {
  min-width: 0;
}

.suggestion-queue {
  display: grid;
  align-content: start;
  gap: 12px;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: clamp(0.68rem, 1.35vw, 0.78rem);
  font-weight: 800;
}

.queue-count {
  position: relative;
  min-width: 88px;
  height: 18px;
  text-align: right;
}

.count-before,
.count-after {
  position: absolute;
  inset: 0;
  animation: count-cycle var(--cycle) linear infinite;
}

.count-after {
  opacity: 0;
  animation-name: count-after-cycle;
}

.suggestion-card {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 94px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 22px rgba(31, 41, 51, 0.06);
  padding: 14px;
}

.suggestion-card strong,
.suggestion-card p {
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-card strong {
  color: var(--ink);
  font-size: clamp(0.78rem, 1.55vw, 0.95rem);
  line-height: 1.16;
}

.suggestion-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.68rem, 1.35vw, 0.8rem);
  white-space: nowrap;
}

.card-row {
  display: grid;
  gap: 7px;
}

.priority-chip,
.draft-chip,
.review-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  font-size: clamp(0.62rem, 1.25vw, 0.73rem);
  font-weight: 850;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.priority-chip {
  background: var(--gold-soft);
  color: #7d541f;
}

.draft-chip,
.review-chip {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.muted-chip {
  background: #f3eee6;
  color: var(--muted);
}

.suggestion-active {
  z-index: 2;
  background:
    linear-gradient(135deg, rgba(220, 239, 237, 0.72), rgba(255, 255, 255, 0.96)),
    #ffffff;
  border-color: rgba(29, 111, 103, 0.34);
  transform-origin: center;
  animation: active-card-cycle var(--cycle) ease-in-out infinite;
}

.suggestion-active::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(29, 111, 103, 0.18), transparent);
  content: "";
  opacity: 0;
  transform: translateX(-70%);
  animation: card-sheen var(--cycle) ease-in-out infinite;
}

.suggestion-next {
  animation: next-card-cycle var(--cycle) ease-in-out infinite;
}

.suggestion-muted {
  opacity: 0.72;
}

.detail-pane {
  display: grid;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(10px, 1.75vw, 16px);
  opacity: 0;
  transform: translateX(16px);
  animation: detail-cycle var(--cycle) ease-in-out infinite;
}

.summary-card,
.email-card,
.draft-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 26px rgba(31, 41, 51, 0.07);
  padding: clamp(12px, 2vw, 18px);
}

.summary-card {
  border-color: rgba(29, 111, 103, 0.18);
  background: linear-gradient(135deg, #ffffff, #eff8f6);
  animation: summary-cycle var(--cycle) ease-in-out infinite;
}

.small-label {
  display: block;
  margin-bottom: 7px;
  color: var(--teal-dark);
  font-size: clamp(0.62rem, 1.25vw, 0.74rem);
  font-weight: 900;
  text-transform: uppercase;
}

.summary-card p,
.email-card p,
.draft-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.72rem, 1.45vw, 0.9rem);
  line-height: 1.42;
}

.email-card h2 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: clamp(0.92rem, 1.95vw, 1.25rem);
  line-height: 1.15;
}

.draft-card {
  display: grid;
  align-content: space-between;
  gap: 12px;
  animation: draft-focus-cycle var(--cycle) ease-in-out infinite;
}

.draft-header,
.send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.draft-header .small-label {
  margin-bottom: 0;
}

.typed-edit {
  display: block;
  min-height: 1.42em;
  margin-top: 4px;
  color: var(--ink);
  font-weight: 750;
  background: rgba(255, 243, 215, 0.8);
}

.typed-edit::after {
  display: none;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--teal-dark);
  content: "";
  transform: translateY(2px);
  animation: caret-blink 0.65s step-end infinite;
}

.typed-edit.is-typing::after {
  display: inline-block;
}

.mailbox-note {
  color: var(--muted);
  font-size: clamp(0.64rem, 1.25vw, 0.78rem);
  font-weight: 750;
}

.send-button {
  position: relative;
  min-width: 112px;
  min-height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: var(--teal-dark);
  color: #ffffff;
  font-size: clamp(0.7rem, 1.35vw, 0.84rem);
  font-weight: 900;
  overflow: hidden;
  padding: 0 14px;
}

.send-button span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.send-ready {
  animation: send-ready-cycle var(--cycle) linear infinite;
}

.send-loading {
  opacity: 0;
  animation: send-loading-cycle var(--cycle) linear infinite;
}

.send-done {
  opacity: 0;
  animation: send-done-cycle var(--cycle) linear infinite;
}

.cursor {
  position: absolute;
  left: 18%;
  top: 42%;
  z-index: 8;
  width: 19px;
  height: 25px;
  filter: drop-shadow(0 3px 6px rgba(17, 77, 72, 0.28));
  opacity: 0;
  transform: rotate(-12deg);
  animation: cursor-cycle var(--cycle) ease-in-out infinite;
}

.cursor::before,
.cursor::after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  clip-path: polygon(0 0, 0 82%, 27% 62%, 50% 100%, 73% 87%, 50% 55%, 91% 55%);
  content: "";
}

.cursor::after {
  background: var(--teal-dark);
  transform: translate(2px, 2px) scale(0.74);
  transform-origin: top left;
}

.cursor-click {
  position: absolute;
  left: -8px;
  top: -8px;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(29, 111, 103, 0.48);
  border-radius: 50%;
  opacity: 0;
  animation: cursor-click-cycle var(--cycle) ease-out infinite;
}

.success-toast {
  position: absolute;
  right: clamp(16px, 3vw, 30px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(29, 111, 103, 0.18);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--teal-dark);
  font-size: clamp(0.74rem, 1.45vw, 0.9rem);
  font-weight: 900;
  opacity: 0;
  padding: 10px 12px;
  transform: translateY(12px);
  box-shadow: 0 14px 28px rgba(31, 41, 51, 0.12);
  animation: toast-cycle var(--cycle) ease-in-out infinite;
}

.checkmark {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-dark);
  color: #ffffff;
}

@keyframes label-cycle {
  0%, 12% {
    opacity: 1;
    transform: translateY(0);
  }

  17%, 100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes active-card-cycle {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    box-shadow: 0 10px 22px rgba(31, 41, 51, 0.04);
  }

  7%, 55% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 32px rgba(17, 77, 72, 0.14);
  }

  69%, 80% {
    opacity: 0.25;
    transform: translateY(-16px) scale(0.98);
    box-shadow: 0 8px 18px rgba(31, 41, 51, 0.03);
  }

  88%, 100% {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
}

@keyframes card-sheen {
  5%, 9% {
    opacity: 0.9;
    transform: translateX(70%);
  }

  10%, 100% {
    opacity: 0;
    transform: translateX(70%);
  }
}

@keyframes next-card-cycle {
  0%, 66% {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.82);
    transform: translateY(0);
    box-shadow: 0 10px 22px rgba(31, 41, 51, 0.06);
  }

  76%, 92% {
    border-color: rgba(29, 111, 103, 0.34);
    background: linear-gradient(135deg, rgba(220, 239, 237, 0.72), rgba(255, 255, 255, 0.96));
    transform: translateY(-8px);
    box-shadow: 0 18px 32px rgba(17, 77, 72, 0.14);
  }

  100% {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.82);
    transform: translateY(0);
  }
}

@keyframes detail-cycle {
  0%, 14% {
    opacity: 0;
    transform: translateX(18px);
  }

  22%, 72% {
    opacity: 1;
    transform: translateX(0);
  }

  84%, 100% {
    opacity: 0;
    transform: translateX(-18px);
  }
}

@keyframes summary-cycle {
  0%, 18% {
    opacity: 0;
    transform: translateY(10px);
  }

  25%, 100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes draft-focus-cycle {
  0%, 32%, 58%, 100% {
    border-color: var(--line);
    box-shadow: 0 12px 26px rgba(31, 41, 51, 0.07);
  }

  36%, 54% {
    border-color: rgba(29, 111, 103, 0.58);
    box-shadow: 0 0 0 3px rgba(29, 111, 103, 0.1), 0 16px 30px rgba(31, 41, 51, 0.09);
  }
}

@keyframes caret-blink {
  0%, 48% {
    opacity: 1;
  }

  49%, 100% {
    opacity: 0;
  }
}

@keyframes cursor-click-cycle {
  0%, 12%, 16%, 33%, 37%, 58%, 62%, 80%, 84%, 100% {
    opacity: 0;
    transform: scale(0.35);
  }

  13%, 34%, 59%, 81% {
    opacity: 0.7;
    transform: scale(0.55);
  }

  15%, 36%, 61%, 83% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes cursor-cycle {
  0%, 5% {
    left: 18%;
    top: 29%;
    opacity: 0;
    transform: rotate(-12deg) scale(0.96);
  }

  8%, 14% {
    left: 18%;
    top: 29%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  17%, 27% {
    left: 18%;
    top: 29%;
    opacity: 0;
  }

  31%, 35% {
    left: 62%;
    top: 65%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  38%, 50% {
    left: 62%;
    top: 65%;
    opacity: 0.72;
    transform: rotate(-12deg) scale(0.94);
  }

  56%, 60% {
    left: 91%;
    top: 87%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  64%, 71% {
    left: 91%;
    top: 87%;
    opacity: 0;
  }

  75%, 81% {
    left: 18%;
    top: 45%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  85%, 92% {
    left: 18%;
    top: 45%;
    opacity: 0.8;
  }

  96%, 100% {
    left: 18%;
    top: 29%;
    opacity: 0;
  }
}

@keyframes send-ready-cycle {
  0%, 55% {
    opacity: 1;
  }

  57%, 100% {
    opacity: 0;
  }
}

@keyframes send-loading-cycle {
  0%, 56%, 64%, 100% {
    opacity: 0;
  }

  58%, 63% {
    opacity: 1;
  }
}

@keyframes send-done-cycle {
  0%, 63%, 100% {
    opacity: 0;
  }

  66%, 82% {
    opacity: 1;
  }
}

@keyframes toast-cycle {
  0%, 62%, 83%, 100% {
    opacity: 0;
    transform: translateY(12px);
  }

  67%, 78% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes count-cycle {
  0%, 70% {
    opacity: 1;
  }

  73%, 100% {
    opacity: 0;
  }
}

@keyframes count-after-cycle {
  0%, 70%, 100% {
    opacity: 0;
  }

  73%, 94% {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .demo-stage {
    height: 100vh;
    aspect-ratio: auto;
    padding: 8px;
  }

  .product-frame {
    grid-template-rows: auto auto 1fr;
  }

  .topbar {
    min-height: 42px;
    padding: 9px 10px;
  }

  .window-dots,
  .mailbox-status {
    display: none;
  }

  .flow-labels {
    min-height: 36px;
    padding: 9px 10px 0;
  }

  .flow-label {
    left: 10px;
    top: 8px;
    max-width: calc(100% - 20px);
    min-height: 26px;
    padding: 3px 10px;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding: 0 10px 10px;
  }

  .suggestion-queue {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
    gap: 8px;
  }

  .suggestion-card {
    min-height: 58px;
    padding: 9px;
  }

  .suggestion-card strong {
    font-size: 0.72rem;
  }

  .suggestion-card p {
    font-size: 0.66rem;
  }

  .card-row {
    gap: 4px;
  }

  .queue-header,
  .priority-chip,
  .draft-chip,
  .suggestion-muted,
  .email-card,
  .mailbox-note,
  .review-chip {
    display: none;
  }

  .detail-pane {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  .summary-card,
  .draft-card {
    padding: 9px;
  }

  .small-label {
    margin-bottom: 4px;
    font-size: 0.62rem;
  }

  .summary-card p,
  .draft-card p {
    font-size: 0.68rem;
    line-height: 1.35;
  }

  .typed-edit {
    display: block;
    min-height: 2.7em;
    margin-top: 3px;
    background: rgba(255, 243, 215, 0.8);
    white-space: normal;
  }

  .cursor {
    display: block;
    width: 16px;
    height: 22px;
    animation-name: cursor-cycle-mobile;
  }

  .cursor-click {
    left: -6px;
    top: -6px;
    width: 24px;
    height: 24px;
  }

  .send-row {
    justify-content: flex-end;
  }

  .send-button {
    min-width: 86px;
    min-height: 30px;
    font-size: 0.68rem;
  }
}

@keyframes cursor-cycle-mobile {
  0%, 5% {
    left: 27%;
    top: 31%;
    opacity: 0;
    transform: rotate(-12deg) scale(0.96);
  }

  8%, 14% {
    left: 27%;
    top: 31%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  17%, 27% {
    left: 27%;
    top: 31%;
    opacity: 0;
  }

  31%, 35% {
    left: 38%;
    top: 69%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  38%, 50% {
    left: 38%;
    top: 69%;
    opacity: 0.72;
    transform: rotate(-12deg) scale(0.94);
  }

  56%, 60% {
    left: 87%;
    top: 90%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  64%, 71% {
    left: 87%;
    top: 90%;
    opacity: 0;
  }

  75%, 81% {
    left: 75%;
    top: 31%;
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }

  85%, 92% {
    left: 75%;
    top: 31%;
    opacity: 0.8;
  }

  96%, 100% {
    left: 27%;
    top: 31%;
    opacity: 0;
  }
}

@media (max-width: 460px) {
  .suggestion-queue {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 8px;
  }

  .suggestion-card {
    min-height: 54px;
  }

  .detail-pane {
    gap: 8px;
  }

  .typed-edit {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .flow-label,
  .detail-pane,
  .summary-card,
  .suggestion-active,
  .suggestion-next,
  .count-before,
  .typed-edit {
    opacity: 1;
    transform: none;
  }

  .label-one,
  .label-three,
  .label-four,
  .label-five,
  .cursor,
  .success-toast,
  .count-after,
  .send-loading,
  .send-done,
  .typed-edit::after {
    display: none;
  }

  .label-two,
  .send-ready {
    opacity: 1;
  }

  .typed-edit {
    max-width: none;
    background: rgba(255, 243, 215, 0.8);
    white-space: normal;
  }
}
