/* Content and secondary workspaces inside the main site. */
@media (max-width: 600px), (max-width: 1024px) and (max-height: 500px) and (orientation: landscape) {
  body:has(#ai-banana-max.panel.active) .container,
  body:not(.image-center-active):has(#ai-handbook.panel.active) .container { padding: 18px 14px 48px; }
  body:has(#ai-case-tips.panel.active) .container { width: 100%; min-width: 0; max-width: 100%; }
  .case-tips-page { width: 100%; max-width: 100%; padding: 6px 0 40px; }
  :is(#ai-case, #ai-case-personal) .case-section-title,
  .challenge-header h2, .case-tips-title, .growth-workspace-header h2 { font-size: 26px; line-height: 1.25; }
  :is(#ai-case, #ai-case-personal) .case-header { margin: 4px 0 18px; }
  :is(#ai-case, #ai-case-personal) .case-categories-row { position: relative; display: block; margin-top: 0; }
  :is(#ai-case, #ai-case-personal) .case-categories { display: grid; grid-template-rows: repeat(2, 44px); grid-auto-flow: column; grid-auto-columns: max-content; gap: 8px; width: 100%; padding-bottom: 8px; overflow-x: auto; overscroll-behavior-x: contain; }
  :is(#ai-case, #ai-case-personal) .case-category-btn { padding: 8px 16px; margin: 0; white-space: nowrap; font-size: 13px; }
  :is(#ai-case, #ai-case-personal) .case-search-tag { position: absolute; left: 0; top: 110px; width: 100%; height: 44px; border-radius: 14px; font-size: 16px; }
  :is(#ai-case, #ai-case-personal) .case-sort-actions { margin-top: 66px; gap: 8px; }
  .case-top-row { flex-direction: column; gap: 18px; }
  .case-list, .case-list-personal { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #ai-case-challenges .challenge-page { width: 100%; max-width: 100%; padding: 4px 0 40px; }
  .challenge-header { margin-bottom: 20px; }
  .challenge-toolbar { padding: 14px; border-radius: 18px; }
  .case-tips-header { margin-bottom: 20px; }
  .case-tips-search-panel { border-radius: 18px; }
  body:has(#ai-news.panel.active) .container { padding: 18px 14px 48px; }
  #ai-news .ai-video-layout { width: 100%; padding-top: 0; }
  #ai-news .ai-video-main { padding-top: 0; }
  .banana-max-shell { width: 100%; padding-top: 0; }
  .banana-max-control-section { padding: 14px; }
  .banana-max-reference-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .banana-max-reference-grid > * { max-height: 74px; }
  #ai-banana-max [data-max-prompt] { min-height: 100px; height: 100px; }
  .banana-chat-composer-wrap { grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; width: calc(100vw - 28px); bottom: max(12px, env(safe-area-inset-bottom)); }
  .banana-chat-composer { grid-column: 1 / -1; padding: 12px; border-radius: 18px; }
  .banana-chat-history-btn { grid-row: 1; grid-column: 2; width: 44px; height: 40px; margin: 0; padding: 0; }
  .banana-chat-mode-switch { justify-self: start; }
  .banana-chat-composer-top { grid-template-columns: 52px minmax(0, 1fr) 44px; gap: 10px; }
  .banana-chat-reference-stack { width: 52px; min-height: 64px; }
  .banana-chat-add { width: 48px; height: 56px; }
  #ai-banana-chat .banana-chat-send { grid-column: 3; grid-row: 1; width: 44px; height: 44px; align-self: end; }
  .banana-chat-prompt-input { min-height: 80px; max-height: 24dvh; }
  .banana-chat-composer-bottom { margin-top: 10px; }
  .banana-chat-chips { gap: 6px; flex-wrap: wrap; }
  .banana-chat-banana-word { font-size: clamp(36px, 11vw, 50px); }
  .banana-chat-model-menu { max-width: calc(100vw - 44px); }
  #ai-banana-chat .banana-chat-stage { aspect-ratio: auto; min-height: 180px; }

  .case-top-main { width: 100%; }
  #ai-case .case-layout { display: flex; flex-direction: column; gap: 20px; }
  #ai-case .case-top-row { display: contents; }
  #ai-case .case-top-main { order: 0; }
  #ai-case .case-list-wrap { order: 1; }
  #ai-case .case-review-rank { order: 2; }
  .case-monthly-stats-range input, .case-monthly-stats-query-btn { min-height: 44px; }

  .case-review-rank { position: static; width: 100%; padding: 12px 0; }
  #ai-case .case-sort-actions, #ai-case-personal .case-sort-actions { flex-wrap: wrap; justify-content: flex-start; width: 100%; margin-right: 0; }
  .case-sort-btn, .case-categories button { min-height: 44px; }
  .case-tips-masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-tips-toolbar, .case-tips-stats-row { flex-wrap: wrap; }
  .case-tips-search { min-width: 0; }
  .case-tips-masonry.is-list-mode .case-tips-card { grid-template-columns: 100px minmax(0, 1fr); }
  .case-tips-masonry.is-list-mode .case-tips-cover, .case-tips-masonry.is-list-mode .case-tips-img { height: 100%; min-height: 100px; }
  .banana-max-workbench { height: auto; min-height: 0; grid-template-columns: minmax(0,1fr); gap: 22px; transition: none; }
  .banana-max-control-shell { height: auto; grid-column: 1; grid-row: auto; grid-template-columns: 48px minmax(0, 1fr); }
  .banana-max-control-panel { height: auto; max-height: none; }
  .banana-max-control-scroll { height: auto; max-height: none; overflow: visible; }
  .banana-max-workbench:not(.is-controls-open) .banana-max-control-panel { display: none; }
  .banana-max-workbench:not(.is-controls-open) .banana-max-control-shell { display: block; }
  .banana-max-workbench:not(.is-controls-open) .banana-max-dock { flex-direction: row; justify-content: flex-start; gap: 8px; height: auto; }
  .banana-max-output-column, .banana-max-workbench.is-controls-open .banana-max-output-column { grid-column: 1; grid-row: auto; min-height: 260px; overflow: visible; }
  #ai-banana-max .banana-max-output-stage { height: auto; min-height: 220px; overflow: visible; grid-template-columns: repeat(2, minmax(0,1fr)); padding: 8px 0 28px; }
  .banana-max-empty { min-height: 200px; }
  [data-max-prompt] { font-size: 16px; }
  .banana-chat-workspace { min-width: 0; grid-template-columns: minmax(0, 1fr); padding-inline: 12px; }
  #ai-banana-chat .banana-chat-stage, #ai-banana-chat .banana-chat-task-board { width: 100%; max-width: 100%; min-width: 0; }
  .banana-chat-composer-wrap { bottom: max(12px, env(safe-area-inset-bottom)); }
  .banana-chat-prompt-input { font-size: 16px; }
}
@media (max-width: 600px) {
  .case-tips-masonry { grid-template-columns: minmax(0,1fr); }
  .case-tips-search-panel { padding: 14px; }
  .case-tips-title { font-size: 26px; }
  #ai-banana-max .banana-max-output-stage { grid-template-columns: minmax(0,1fr); }
}
