

@media (max-width: 900px) {
  .g2, .g3 { grid-template-columns: 1fr; }

  .bento { grid-template-columns: repeat(4, 1fr); }

  .cw { overflow: hidden; }
  .cw canvas { min-width: 0 !important; }

  #heatmap { overflow-x: hidden; }
  .hm { min-width: 0; }
}

@media (max-width: 600px) {
  .dash-nav     { padding: 0 .75rem; height: 50px; }
  .nav-right    { gap: .35rem; }
  .btn-share    { font-size: 10px; padding: 4px 10px; }
  .btn-export   { font-size: 10px; padding: 4px 10px; }
  .btn-sm       { font-size: 10px; padding: 4px 10px; }
  .nav-panel    { right: .75rem; left: .75rem; min-width: 0; }
  #bg-toggle-mobile { transform: translateY(1px); }

  .nav-right .btn-export,
  .nav-right .btn-bg-toggle { display: none; }
  .nav-panel .nav-panel-export,
  .nav-panel .nav-panel-bg  { display: flex; }
  .nav-panel .palette-picker-mobile { display: flex; }
  .nav-right .palette-picker-desktop { display: none; }

  .chat-switcher-bar .chat-pill:not([data-idx="0"]):not(.chat-pill-more) {
    display: none;
  }

  .dash-tabs,
  .chat-switcher-bar {
    scrollbar-width: thin;
    padding-right: 1rem;
  }
  .dash-tabs::-webkit-scrollbar,
  .chat-switcher-bar::-webkit-scrollbar {
    height: 4px;
  }
  .dash-tabs::-webkit-scrollbar-thumb,
  .chat-switcher-bar::-webkit-scrollbar-thumb {
    background: rgba(var(--c1-rgb), 0.3);
    border-radius: 4px;
  }
  .dash-tabs::-webkit-scrollbar-track,
  .chat-switcher-bar::-webkit-scrollbar-track {
    background: transparent;
  }

  .dash-content { padding: .65rem; }

  .bento          { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .mc             { padding: .75rem; }
  .mc-value       { font-size: 18px; }
  .mc-icon        { font-size: 14px; margin-bottom: 5px; }
  .mc-label       { font-size: 8px; }

  .chat-hero  { flex-direction: column; align-items: flex-start; padding: .9rem; gap: .75rem; }
  .ch-av      { width: 40px; height: 40px; font-size: 15px; }
  .ch-name    { font-size: 16px; }

  .dash-tab   { padding: 11px 10px; font-size: 9.5px; letter-spacing: .03em; }

  .sc-grid    { grid-template-columns: 1fr; }
  .sc-stats-4 { grid-template-columns: 1fr; }

  .cw[style*="height:230px"] { height: 180px !important; }
  .cw[style*="height:250px"] { height: 200px !important; }
  .cw[style*="height:260px"] { height: 200px !important; }
  .cw[style*="height:280px"] { height: 220px !important; }
  .cw[style*="height:190px"] { height: 160px !important; }
  .cw[style*="height:210px"] { height: 170px !important; }

  .cw { overflow: hidden; }
  .cw canvas {
    width: 100% !important;
    min-width: 0 !important;
  }

  .cc { overflow: hidden; }

  #heatmap { overflow-x: hidden; }
  .hm {
    grid-template-columns: 26px repeat(24, minmax(0, 1fr));
    gap: 1px;
    font-size: 7px;
  }
  .hm-cell { height: 16px; }
  .hm-lbl,
  .hm-h { font-size: 7px; }

  .words-cloud .wp { font-size: 11px !important; padding: 3px 8px; }

  .ri       { padding: 9px 11px; gap: .6rem; }
  .ri-val   { font-size: 14px; }
  .ri-label { font-size: 11px; }
  .ri-icon  { font-size: 15px; }

  .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 5px; }
  .ei-e       { font-size: 22px; }

  #scroll-top-btn { bottom: 1rem; right: 1rem; width: 38px; height: 38px; }

  .modal        { padding: 1.1rem; max-width: calc(100vw - 1.5rem); }
  .export-modal { flex-direction: column !important; max-height: 90vh; overflow-y: auto; }

  .toast {
    max-width: calc(100vw - 2rem);
    width: max-content;
    white-space: normal;
    text-align: center;
  }

  .hint-steps { flex-direction: column; align-items: stretch; }
  .hint-step  { max-width: 100%; }
  .drop-zone  { padding: 1.75rem 1.25rem; }
}

@media (max-width: 440px) {
  .bento      { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 1.5rem; }
  .dash-tab   { font-size: 9px; padding: 10px 8px; }
}

canvas { display: block; max-width: 100%; }

@media only screen and (max-width: 480px) {
  .toastify {
    max-width: calc(100vw - 32px);
    white-space: normal;
    word-break: break-word;
  }
  .toastify-center {
    max-width: calc(100vw - 32px);
  }
}
