/* Mobile reserves room for the headline, actions and footer, then gives the
   remaining visible height to the demo. Keep page scrolling as an overflow fallback. */
.hero{grid-column:2;grid-row:1}
.demo-section{grid-column:1;grid-row:1}

@media(max-width:900px){
  html,body{height:auto;min-height:100%}
  body{overflow:auto}
  .page{height:100svh;height:100dvh;max-width:520px;padding:0 16px max(12px,env(safe-area-inset-bottom));display:flex;flex-direction:column}
  .header{height:56px;flex:none}
  .brand{font-size:20px;gap:8px}
  .brand img{width:30px;height:30px}
  .single-pane{display:flex;flex:1;flex-direction:column;align-items:stretch;gap:12px;padding-top:0}
  .hero,.intro{display:contents}
  h1{order:0;flex:none;align-self:center;max-width:440px;font-size:clamp(28px,8vw,38px);line-height:1.06;letter-spacing:-.045em;margin:0;text-align:center;text-wrap:balance}
  .headline-line{display:inline;white-space:normal}
  .hero-subtitle{order:2;flex:none;align-self:center;max-width:350px;margin:0;font-size:13px;line-height:1.4;text-align:center}

  .demo-section{order:1;flex:1;height:auto;max-height:none;min-height:0}
  .discord-demo{height:100%;container-type:inline-size;--avatar:28px;--message-size:13px;--message-gap:10px}
  .demo-stack{width:100%;height:100%;min-height:0;max-height:none;padding-top:0;gap:4px}
  .platform-switcher{position:static;flex:none;width:100%;display:block}
  .platform-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;transform:none}
  .platform-tabs button,.platform-tabs button[aria-selected=true]{width:100%;min-width:0;height:36px;padding:0 0 5px;justify-content:center;flex-direction:row;gap:0}
  .platform-tabs img{width:20px;height:20px;opacity:.65}
  .platform-tabs .tab-label{display:none}
  .platform-tabs .tab-timer{left:4px;right:4px;height:3px}
  .corner-mascot{display:none}

  /* Only the chat grows or shrinks; the onboarding actions keep their full height. */
  .chat-card{height:auto;flex:1;min-height:0;border-radius:14px;container:mobile-chat / size}
  .chat-card .chat-viewport{overscroll-behavior-y:auto}
  .chat-card .channel-header,.chat-card[data-bubbles=true] .channel-header{height:44px;padding:0 10px;gap:8px;font-size:14px}
  .chat-card .channel-title{min-width:0}
  .chat-card .channel-title strong{font-size:14px}
  .chat-card .channel-title small{font-size:10px}
  .chat-card .channel-group{flex-shrink:0;transform:none}
  .chat-card .telegram-header-tools{display:none}
  .chat-card .demo-actions{gap:0;margin-left:auto;flex:none}
  .chat-card .demo-actions button{width:44px;height:44px}
  .chat-card .demo-actions img{width:18px;height:18px}
  .chat-card .discord-messages{padding:12px 10px;gap:10px}
  .chat-card .d-message{column-gap:9px}
  .chat-card .d-author{gap:5px;margin-bottom:4px}
  .chat-card .d-author strong{font-size:13px}
  .chat-card .d-author time{display:none}
  .chat-card .message-text{font-size:13px;line-height:1.4}
  .chat-card .discord-app-badge{font-size:8px}
  .chat-card .discord-typing{height:22px;margin-left:53px;font-size:10px}
  .chat-card .video-controls{right:6px;bottom:6px;gap:4px}
  .chat-card .video-control{width:44px;height:44px;padding:11px}
  .chat-card .video-control img{width:20px;height:20px}
  .chat-card[data-surface=telegram] .message-copy,.chat-card[data-surface=whatsapp] .message-copy{padding-bottom:6px}
  .chat-card .message-composer,.chat-card .telegram-date{display:none}
  .chat-card[data-demo-stage="5"] .d-message[data-stage="0"],
  .chat-card[data-demo-stage="5"] .d-message[data-stage="2"],
  .chat-card[data-demo-stage="5"] .d-bot-intro,
  .chat-card[data-demo-stage="5"] .d-bot-avatar,
  .chat-card[data-demo-stage="5"] .chat-followup,
  .chat-card[data-demo-stage="5"] .discord-typing,
  .chat-card[data-demo-stage="5"] .video-reactions{display:none!important}
  /* Let the prompt take its natural height and give the remaining room to the video. */
  .chat-card[data-demo-stage="5"] .discord-messages{height:100%;box-sizing:border-box}
  .chat-card[data-demo-stage="5"] .d-message[data-stage="3"]{flex:none}
  .chat-card[data-demo-stage="5"] .d-bot-message{display:block;flex:1;min-height:0}
  .chat-card[data-demo-stage="5"] .d-bot-content{height:100%;box-sizing:border-box}
  .chat-card .video-tile{height:100%;aspect-ratio:auto;margin-top:0}
  .chat-card[data-surface=telegram][data-demo-stage="5"] .d-bot-content,
  .chat-card[data-surface=whatsapp][data-demo-stage="5"] .d-bot-content{padding:4px}

  .hero-actions{order:3;flex:none;margin-top:0;gap:8px}
  .no-script-links{order:4}
  .hero-action-primary{min-height:68px;gap:10px;padding:12px 14px;font-size:22px;line-height:1.2}
  .cta-mascot{width:48px;height:48px;margin:-8px}
  .cta-discord{width:32px;height:32px}
  .cta-subtitle{margin-top:4px;font-size:15px;line-height:1.35}
  .hero-action .flow-arrow{font-size:24px}
  .group-install .hero-action-secondary{min-height:36px;padding:8px 12px 4px;gap:8px;font-size:14px;line-height:1.3}
  .group-platforms{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;padding:0 6px 6px}
  .group-platforms :is(a,button){min-height:58px;gap:4px;padding:4px 0;font-size:10px}
  .group-platforms img{width:23px;height:23px}
  .group-platforms small{margin-top:-1px;font-size:8px;line-height:1.2}

  .site-footer{flex:none;justify-content:center;margin-top:12px;padding-top:0}
  .reactor-credit{min-height:36px}

  /* Use extra room for the conversation; short screens keep just prompt + result. */
  @container mobile-chat (min-height:400px){
    .chat-card[data-demo-stage="5"] .d-message[data-stage="0"],
    .chat-card[data-demo-stage="5"] .d-message[data-stage="2"]{display:grid!important}
  }
}

@media(max-width:360px){
  .chat-card .channel-group{display:none}
}

@media(max-width:380px){
  .hero-action-primary{font-size:20px;padding-inline:12px;gap:8px}
  .hero-action-primary>.flow-arrow{display:none}
  .cta-mascot{width:44px;height:44px;margin:-7px}
  .cta-subtitle{font-size:14px}
  .group-install .hero-action-secondary{font-size:13px}
}
@media(max-width:900px) and (max-height:740px){
  .header{height:48px}
  .single-pane{gap:10px}
  h1{font-size:clamp(26px,8vw,32px)}
  .hero-subtitle{font-size:12px}
}
@media(max-width:900px) and (max-height:620px){
  .header{height:40px}
  .single-pane{gap:6px}
  h1{font-size:clamp(24px,7.5vw,28px)}
  .hero-action-primary{min-height:60px;padding-block:8px}
  .site-footer{margin-top:8px}
  .reactor-credit{min-height:24px}
  .chat-card .discord-messages{padding:8px 10px;gap:6px}
  .chat-card[data-demo-stage="5"] .d-message[data-stage="3"]{display:block}
  .chat-card[data-demo-stage="5"] .d-message[data-stage="3"]>.anime-avatar,
  .chat-card[data-demo-stage="5"] .d-message[data-stage="3"] .d-author{display:none}
}
