@media (max-width: 860px) {
  .row,
  .button-row,
  .session-grid,
  .account-usage-window-grid {
    grid-template-columns: 1fr;
  }

  .account-usage-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-usage-summary-windows {
    justify-content: flex-start;
  }

  .message {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    height: 100svh;
    padding: 0 0 env(safe-area-inset-bottom);
  }

  .chat-frame {
    height: 100%;
    border-radius: 26px 26px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    padding: 10px 12px 6px;
  }

  .title {
    font-size: 17px;
  }

  .header-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .header-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    font-size: 0;
    flex: 0 0 auto;
  }

  .header-btn::before {
    display: block;
    font-size: 20px;
    line-height: 1;
    font-weight: 600;
  }

  #newThreadBtn::before {
    content: "+";
    font-size: 28px;
    transform: translateY(-1px);
  }

  #activityLink::before {
    content: "A";
  }

  #forkThreadBtn::before {
    content: "F";
  }

  #connectBtn::before {
    content: "↻";
  }

  .status-line {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .thread-summary {
    display: none;
  }

  .header-strip {
    padding: 0 12px 6px;
    gap: 8px;
  }

  .header-strip-links {
    display: none;
  }

  .mobile-nav {
    display: flex;
    gap: 8px;
    padding: 0 12px 8px;
  }

  .mobile-nav-btn,
  .mobile-nav-link {
    flex: 1 1 0;
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
  }

  .status-pill {
    padding: 6px 10px;
    font-size: 12px;
  }

  .banner {
    padding: 8px 10px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.45;
  }

  .panel-rail {
    display: none;
  }

  .top-panel {
    min-width: 0;
    border-radius: 0;
  }

  .chat-frame[data-mobile-view="threads"] {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .chat-frame[data-mobile-view="experiments"] {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .chat-frame[data-mobile-view="settings"] {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .chat-frame[data-mobile-view="threads"] .mobile-nav,
  .chat-frame[data-mobile-view="threads"] .panel-rail,
  .chat-frame[data-mobile-view="threads"] .messages,
  .chat-frame[data-mobile-view="threads"] .composer-wrap {
    display: none;
  }

  .chat-frame[data-mobile-view="settings"] .mobile-nav,
  .chat-frame[data-mobile-view="settings"] .panel-rail,
  .chat-frame[data-mobile-view="settings"] .messages,
  .chat-frame[data-mobile-view="settings"] .composer-wrap {
    display: none;
  }

  .chat-frame[data-mobile-view="experiments"] .mobile-nav,
  .chat-frame[data-mobile-view="experiments"] .panel-rail,
  .chat-frame[data-mobile-view="experiments"] .messages,
  .chat-frame[data-mobile-view="experiments"] .composer-wrap {
    display: none;
  }

  .chat-frame[data-mobile-view="threads"] .mobile-threads-view {
    display: flex;
    grid-row: 4;
    min-height: 0;
    flex-direction: column;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 251, 0.98);
  }

  .chat-frame[data-mobile-view="threads"] .mobile-screen-body {
    flex: 1 1 auto;
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .chat-frame[data-mobile-view="settings"] .mobile-settings-view {
    display: flex;
    grid-row: 4;
    min-height: 0;
    flex-direction: column;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 251, 0.98);
  }

  .chat-frame[data-mobile-view="settings"] .mobile-screen-body {
    flex: 1 1 auto;
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .chat-frame[data-mobile-view="experiments"] .mobile-experiments-view {
    display: flex;
    grid-row: 4;
    min-height: 0;
    flex-direction: column;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 251, 0.98);
  }

  .chat-frame[data-mobile-view="experiments"] .mobile-screen-body {
    flex: 1 1 auto;
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .thread-list {
    min-height: 0;
  }

  .mobile-screen-bar {
    gap: 10px;
    padding: 12px 14px;
  }

  .mobile-screen-back,
  .mobile-screen-action {
    padding: 10px 12px;
    font-size: 12px;
  }

  .mobile-screen-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
  }

  #mobileStorageHint {
    display: none;
  }

  .mobile-settings-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .messages {
    padding: 8px 12px 10px;
    gap: 10px;
  }

  .message {
    max-width: 94%;
    padding: 12px 14px;
    border-radius: 20px;
  }

  .message.user .message-body,
  .message.assistant .message-body {
    font-size: 16px;
    line-height: 1.58;
  }

  .composer-wrap {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(243, 242, 238, 0) 0%, rgba(243, 242, 238, 0.96) 22%);
  }

  .composer {
    gap: 8px;
    padding: 10px 12px;
    border-radius: 28px;
    box-shadow: 0 12px 28px rgba(23, 23, 20, 0.08);
  }

  #prompt {
    min-height: 48px;
    max-height: 144px;
    padding: 4px 2px 0;
    font-size: 17px;
    line-height: 1.45;
  }

  .composer-footer {
    align-items: center;
    padding-top: 0;
    border-top: 0;
  }

  .composer-note {
    display: none;
  }

  .composer-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 44px 44px 44px 44px 1fr;
    align-items: center;
    gap: 8px;
  }

  .composer-actions button {
    min-height: 44px;
  }

  #attachImageBtn,
  #attachFileBtn,
  #voiceInputBtn,
  #autoContinueBtn,
  #sendBtn {
    padding: 0;
    border-radius: 999px;
    font-size: 0;
  }

  #attachImageBtn,
  #attachFileBtn,
  #voiceInputBtn,
  #autoContinueBtn {
    width: 44px;
    height: 44px;
  }

  #sendBtn {
    width: 44px;
    height: 44px;
    grid-column: 5;
    justify-self: end;
  }

  #sendBtn[data-primary-action="steer"] {
    position: relative;
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  #sendBtn[data-primary-action="interrupt"] {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  #attachImageBtn::before,
  #attachFileBtn::before,
  #voiceInputBtn::before,
  #autoContinueBtn::before,
  #sendBtn::before {
    display: block;
    line-height: 1;
    font-weight: 600;
  }

  #attachImageBtn::before {
    content: "+";
    font-size: 28px;
    transform: translateY(-1px);
  }

  #attachFileBtn::before {
    content: "F";
    font-size: 14px;
  }

  #voiceInputBtn::before {
    content: "V";
    font-size: 14px;
  }

  #voiceInputBtn[aria-pressed="true"]::before {
    content: "■";
  }

  #voiceInputBtn[data-voice-phase="transcribing"]::before {
    content: "...";
    font-size: 12px;
  }

  #autoContinueBtn::before {
    content: "C";
    font-size: 14px;
  }

  #sendBtn::before {
    content: "↑";
    font-size: 20px;
    font-weight: 750;
    transform: translateY(-1px);
  }

  #sendBtn[data-primary-action="interrupt"]::before {
    content: "■";
    font-size: 12px;
  }

  #sendBtn[data-primary-action="steer"]::before {
    content: "↑";
    font-size: 24px;
    font-weight: 750;
    line-height: 1;
    transform: translateY(1px);
  }

  #sendBtn[data-primary-action="steer"]::after {
    content: "";
    position: absolute;
    top: 58%;
    left: 50%;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.95);
    transform: translate(-50%, -50%);
  }

  .attachment-tray {
    gap: 8px;
    padding-bottom: 2px;
  }

  .attachment-card {
    width: 88px;
  }

  .attachment-thumb {
    width: 88px;
    height: 88px;
  }

  .attachment-file-icon {
    width: 88px;
    height: 88px;
    font-size: 15px;
  }
}
