  /* ============================================================
     CHATGPT-MAINOS: tumma demo-osio, jossa keskustelu etenee
     vaihe kerrallaan, kun osio tulee näkyviin (.in)
     ============================================================ */
  .cg-section {
    position: relative;
    overflow: hidden;
    padding: 120px 0 110px;
    color: #fff;
    background: linear-gradient(160deg, var(--navy-deeper) 0%, #241a52 55%, #3b1f6b 120%);
  }
  .cg-section::before,
  .cg-section::after {
    content: '';
    position: absolute;
    width: 640px;
    height: 640px;
    border-radius: 50%;
    pointer-events: none;
  }
  .cg-section::before {
    top: -220px;
    right: -180px;
    background: radial-gradient(circle, rgba(216, 35, 205, 0.28) 0%, transparent 65%);
  }
  .cg-section::after {
    bottom: -260px;
    left: -200px;
    background: radial-gradient(circle, rgba(245, 128, 36, 0.20) 0%, transparent 65%);
  }
  .cg-section > .container { position: relative; z-index: 1; }

  .cg-headline {
    max-width: 720px;
    margin: 0 auto 64px;
    text-align: center;
  }
  .cg-headline .kicker { color: var(--pink-soft); }
  .cg-title {
    font-size: clamp(34px, 4.6vw, 60px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 6px 0 20px;
  }
  .cg-title .gr {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .cg-lead {
    font-size: 19px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.76);
    margin: 0;
  }

  /* Ikkuna on oma taustakerroksensa, jonka päällä keskustelun osat ja
     vaiheselitykset ovat samassa ruudukossa. Näin selitys osuu aina
     oman osansa kohdalle. */
  .cg-stage {
    display: grid;
    grid-template-columns: minmax(0, 600px) minmax(0, 1fr);
    grid-template-rows: repeat(5, auto);
    column-gap: 80px;
    row-gap: 20px;
    max-width: 1080px;
    margin: 0 auto;
  }
  .cg-window {
    grid-column: 1;
    grid-row: 1 / -1;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 40px 120px -30px rgba(216, 35, 205, 0.55), 0 30px 60px -20px rgba(0, 0, 0, 0.45);
  }
  .cg-head, .cg-ask, .cg-answer, .cg-ad, .cg-input {
    grid-column: 1;
    position: relative;
    z-index: 1;
  }
  .cg-head  { grid-row: 1; }
  .cg-ask   { grid-row: 2; }
  .cg-answer { grid-row: 3; }
  .cg-ad    { grid-row: 4; }
  .cg-input { grid-row: 5; }

  .cg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 28px 10px;
    border-bottom: 1px solid var(--border);
  }
  .cg-app {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 800;
    color: var(--navy-dark);
  }
  .cg-app svg { color: var(--text-muted); }
  .cg-tag {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: 999px;
    padding: 5px 10px;
  }

  .cg-ask {
    justify-self: end;
    max-width: 78%;
    margin: 12px 28px 0 0;
    background: #f1f2f6;
    border-radius: 20px 20px 6px 20px;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--navy-dark);
  }

  .cg-answer {
    margin: 0 28px;
    min-height: 72px;
  }
  .cg-answer p {
    font-size: 15px;
    line-height: 1.65;
    color: #222;
    margin: 0;
  }
  .cg-typing {
    position: absolute;
    top: 6px;
    left: 0;
    display: flex;
    gap: 5px;
    opacity: 0;
  }
  .cg-typing i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b9bccb;
    animation: cg-dot 0.9s ease-in-out infinite;
  }
  .cg-typing i:nth-child(2) { animation-delay: 0.15s; }
  .cg-typing i:nth-child(3) { animation-delay: 0.3s; }

  .cg-ad {
    display: grid;
    grid-template-columns: 132px 1fr;
    margin: 4px 28px 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #fff 0%, var(--pink-50) 100%);
  }
  .cg-ad img {
    width: 100%;
    height: 100%;
    min-height: 136px;
    object-fit: cover;
    object-position: 30% center;
    display: block;
  }
  .cg-ad-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 14px 16px;
  }
  .cg-ad-tag {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .cg-ad-body strong {
    font-size: 17px;
    line-height: 1.3;
    color: var(--navy-dark);
  }
  .cg-ad-copy {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-muted);
  }
  .cg-ad-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--navy-dark);
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
  }

  .cg-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 20px 20px;
    padding: 8px 8px 8px 20px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 14px;
    color: var(--text-muted);
  }
  /* Kirjoitettu teksti pysyy yhdellä rivillä ja vierii vasemmalle, kuten oikeassa kentässä */
  .cg-field {
    flex: 1;
    min-width: 0;
    display: flex;
    overflow: hidden;
    margin-right: 10px;
  }
  .cg-typed {
    flex-shrink: 0;
    margin-right: auto;
    white-space: nowrap;
    color: var(--navy-dark);
  }
  .cg-input.is-typing .cg-field { justify-content: flex-end; }
  .cg-input.is-typing .cg-placeholder { display: none; }
  .cg-input.is-typing .cg-typed::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1.1em;
    margin-left: 1px;
    vertical-align: text-bottom;
    background: var(--magenta);
    animation: cg-caret 0.8s steps(1) infinite;
  }
  .cg-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--navy-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Vaiheselitykset ikkunan oikealla puolella, viiva osoittaa ikkunaan */
  .cg-steps {
    display: contents;
    list-style: none;
  }
  .cg-step {
    grid-column: 2;
    align-self: center;
    position: relative;
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 16px;
    align-items: start;
  }
  .cg-step--1 { grid-row: 2; }
  .cg-step--2 { grid-row: 3; }
  .cg-step--3 { grid-row: 4; }
  .cg-step::before {
    content: '';
    position: absolute;
    top: 19px;
    left: -72px;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.35) 100%);
  }
  .cg-step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--grad-tilt);
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.06);
  }
  .cg-step h3 {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
    color: #fff;
    margin: 7px 0 6px;
  }
  .cg-step p {
    font-size: 15.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.70);
    margin: 0;
  }

  /* Keskustelun eteneminen: osat ovat piilossa, kunnes osio saa .in-luokan. */
  .cg-stage .cg-ask,
  .cg-stage .cg-answer p,
  .cg-stage .cg-ad { opacity: 0; }
  .cg-stage .cg-step { opacity: 0.3; transition: opacity 0.5s ease; }

  /* Sivun skripti kirjoittaa kysymyksen kenttään ja lisää lähetyksen jälkeen
     .is-sent-luokan, josta loput keskustelusta etenee. Näin kirjoitus ja
     animaatio pysyvät tahdissa, vaikka selain hidastaisi ajastimia. */
  .cg-stage.in .cg-step--1        { opacity: 1; transition-delay: 0.3s; }
  .cg-stage.is-sent .cg-send      { animation: cg-press 0.35s ease-out both; }
  .cg-stage.is-sent .cg-ask       { animation: cg-pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
  .cg-stage.is-sent .cg-typing    { animation: cg-typing 1s linear 0.65s both; }
  .cg-stage.is-sent .cg-answer p  { animation: cg-stream 1.2s ease-out 1.65s both; }
  .cg-stage.is-sent .cg-ad        { animation: cg-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 2.85s both, cg-glow 1.6s ease-out 3.45s both; }
  .cg-stage.is-sent .cg-step--2   { opacity: 1; transition-delay: 1.65s; }
  .cg-stage.is-sent .cg-step--3   { opacity: 1; transition-delay: 2.85s; }

  @keyframes cg-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes cg-press {
    0%, 100% { transform: none; }
    50%      { transform: scale(0.82); background: var(--magenta); }
  }
  @keyframes cg-caret {
    0%   { opacity: 1; }
    50%  { opacity: 0; }
  }
  @keyframes cg-typing {
    0%   { opacity: 0; }
    8%   { opacity: 1; }
    88%  { opacity: 1; }
    100% { opacity: 0; }
  }
  @keyframes cg-dot {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50%      { transform: translateY(-4px); opacity: 1; }
  }
  @keyframes cg-stream {
    from { opacity: 1; clip-path: inset(0 0 100% 0); }
    to   { opacity: 1; clip-path: inset(0 0 0 0); }
  }
  @keyframes cg-rise {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes cg-glow {
    0%   { box-shadow: 0 0 0 0 rgba(216, 35, 205, 0.45); }
    100% { box-shadow: 0 0 0 14px rgba(216, 35, 205, 0); }
  }

  @media (prefers-reduced-motion: reduce) {
    .cg-stage .cg-ask,
    .cg-stage .cg-answer p,
    .cg-stage .cg-ad,
    .cg-stage .cg-step { opacity: 1; animation: none !important; transition: none; }
    .cg-typing { display: none; }
  }

  /* Kapeammalla näytöllä selitys tulee heti oman osansa alle ikkunan sisään */
  @media (max-width: 1100px) {
    .cg-stage {
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: repeat(8, auto);
      max-width: 620px;
      row-gap: 16px;
    }
    .cg-head      { grid-row: 1; }
    .cg-ask       { grid-row: 2; }
    .cg-step--1   { grid-row: 3; }
    .cg-answer    { grid-row: 4; }
    .cg-step--2   { grid-row: 5; }
    .cg-ad        { grid-row: 6; }
    .cg-step--3   { grid-row: 7; }
    .cg-input     { grid-row: 8; }
    .cg-step {
      grid-column: 1;
      z-index: 1;
      margin: 0 22px;
      padding: 14px 16px;
      grid-template-columns: 32px 1fr;
      gap: 12px;
      border-radius: 16px;
      background: var(--navy-50);
    }
    .cg-step::before { display: none; }
    .cg-step-num { width: 32px; height: 32px; font-size: 14px; box-shadow: none; }
    .cg-step h3 { font-size: 16px; color: var(--navy-dark); margin: 4px 0 4px; }
    .cg-step p { font-size: 14px; color: var(--text-muted); }
  }

  @media (max-width: 600px) {
    .cg-section { padding: 84px 0 80px; }
    .cg-headline { margin-bottom: 40px; }
    .cg-lead { font-size: 17px; }
    .cg-head { padding: 16px 18px 10px; }
    .cg-tag { font-size: 9.5px; letter-spacing: 0.06em; white-space: nowrap; }
    .cg-ask { margin-right: 18px; max-width: 86%; font-size: 14.5px; }
    .cg-answer { margin: 0 18px; }
    .cg-answer p { font-size: 14.5px; }
    .cg-ad { margin: 4px 18px 0; grid-template-columns: 96px 1fr; }
    .cg-ad img { min-height: 128px; }
    .cg-input { margin: 6px 14px 16px; }
    .cg-step { margin: 0 14px; }
  }
