/* Tablet touch layout: works in Safari/iPadOS and Android browsers. */
@media (min-width: 1101px) {
  html, body { height: 100%; overflow: hidden; }
  .app-shell { height: 100vh; overflow: hidden; }
  .sidebar { flex: 0 0 232px; height: 100vh; overflow-y: auto; overscroll-behavior: contain; }
  .content { min-width: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 1100px) {
  :root { --tablet-gutter: clamp(16px, 3vw, 32px); }
  body { min-width: 0; overflow-x: hidden; }
  .app-shell { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 30; width: 100%; height: auto; display: flex; align-items: center; gap: 18px; padding: 12px var(--tablet-gutter); border-right: 0; border-bottom: 1px solid rgba(72,104,117,.16); }
  .brand { flex: 0 0 auto; white-space: nowrap; }
  .nav { display: flex; flex: 1; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { min-height: 44px; padding: 10px 13px; white-space: nowrap; }
  .sidebar-bottom { display: none; }
  .content { width: 100%; max-width: none; padding: var(--tablet-gutter); }
  .dashboard-grid, .assistant-layout, .reading-main-grid { grid-template-columns: 1fr; }
  .project-grid, .recommend-grid, .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journal-body { grid-template-columns: 1fr; }
  button, input, select, textarea { font-size: 16px; }
  button, .nav-item, .task { min-height: 44px; }
  .canvas-wrap { min-height: 360px; }
}
@media (max-width: 640px) {
  .sidebar { align-items: stretch; flex-direction: column; gap: 8px; }
  .nav { flex: none; }
  .topbar, .welcome, .projects-hero, .journal-intro, .assistant-intro { flex-wrap: wrap; gap: 16px; }
  .top-actions, .journal-actions, .learning-top-actions { width: 100%; }
  .project-grid, .recommend-grid, .book-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
@media (pointer: coarse) {
  .task input[type="checkbox"] { width: 24px; height: 24px; }
  .color-dot, .tool { min-width: 44px; min-height: 44px; }
}
