/* Mobile layout (max-width: 760px). Desktop is unchanged. */
#cc-menu-btn { display: none; }
.cc-backdrop { display: none; }
.cc-drawer-close { display: none; }

@media (max-width: 760px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  #cc-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: 0 0 38px; border: 0; border-radius: 10px;
    background: #e5e7eb; color: #111; font-size: 20px; cursor: pointer;
  }
  .cc-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 900; }
  .cc-backdrop.open { display: block; }
  .cc-drawer {
    display: block !important; position: fixed !important; top: 0; bottom: 0; left: 0;
    width: min(84vw, 320px) !important; max-width: 320px; height: 100vh; height: 100dvh;
    transform: translateX(-105%); transition: transform .22s ease; z-index: 1000;
    background: #fff; color: #111; overflow-y: auto; -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 18px rgba(0,0,0,.2); padding: 12px !important; box-sizing: border-box;
  }
  .cc-drawer.open { transform: translateX(0); }
  .cc-drawer-close {
    display: block; margin: 0 0 10px auto; padding: 6px 12px; border: 0; border-radius: 8px;
    background: #eee; cursor: pointer; font-size: 14px;
  }
}

/* ---- UI fixes for phones (max-width: 760px) ---- */
@media (max-width: 760px) {
  /* keep the header on top; content scrolls underneath it */
  header {
    position: sticky !important;
    top: 0 !important;
    z-index: 200 !important;
    background: #fff !important;
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
  }
  /* cards and code blocks never wider than the screen */
  .msg, .card, .bubble, .reply, .answer, .box, [class*="msg"], [class*="card"] {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  pre {
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: pre !important;
  }
  /* stop iPhone from zooming when the prompt box is tapped */
  textarea, input { font-size: 16px !important; }
}

/* header row sizes to its content on phones; the chat fills the rest */
@media (max-width: 760px) {
  #app { grid-template-rows: auto 1fr !important; height: 100vh; height: 100dvh !important; }
}
