@media (max-width: 1220px) {
  :root { --sidebar-w: 250px; }
  .app-shell { width:calc(100% - 24px); margin:12px auto; min-height:calc(100vh - 24px); border-radius:30px; }
  .sidebar { top:12px; height:calc(100vh - 24px); border-radius:30px 0 0 30px; }
  .wrap { width:min(calc(100% - 42px),var(--content-w)); }
  .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .hero-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .hero-stat:nth-child(2) { border-right:0; }
  .hero-stat:nth-child(-n+2) { border-bottom:1px solid var(--separator-soft); }
}

@media (max-width: 940px) {
  .app-shell { display:block; width:100%; margin:0; min-height:100vh; border:0; border-radius:0; overflow:visible; background:transparent; box-shadow:none; }
  .workspace { width:100%; background:transparent; }
  .sidebar { position:fixed; z-index:170; top:12px; left:12px; width:min(330px,calc(100vw - 36px)); height:calc(100vh - 24px); margin:0; border:1px solid var(--glass-border); border-radius:29px; transform:translateX(calc(-100% - 30px)); will-change:transform; }
  body.sidebar-open .sidebar { transform:translateX(0); }
  .sidebar-backdrop { display:block; position:fixed; inset:0; z-index:160; background:rgba(0,0,0,.27); opacity:0; pointer-events:none; -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); transition:opacity 180ms ease-out; }
  body.sidebar-open .sidebar-backdrop { opacity:1; pointer-events:auto; }
  .topbar { top:8px; width:calc(100% - 20px); min-height:54px; margin-top:8px; border-radius:18px; padding-left:7px; }
  .mobile-only { display:grid; }
  .wrap { width:min(calc(100% - 28px),var(--content-w)); padding-top:17px; padding-bottom:120px; }
  .hero { padding:34px 2px 34px; }
  .section-head { grid-template-columns:1fr; gap:8px; }
  .section-head p { max-width:720px; }
  .grid2,.grid3,.compare { grid-template-columns:1fr; }
  .evidence-grid,.revision-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .phase { grid-template-columns:118px 1fr; }
  .verbatim-flow { grid-template-columns:1fr; }
  .text-chapter.wide { grid-column:auto; }
  .archive ol { columns:1; }
  .tabbar { position:fixed; z-index:130; left:50%; bottom:max(10px,env(safe-area-inset-bottom)); width:min(530px,calc(100% - 22px)); min-height:64px; display:flex; padding:5px 7px; border-radius:23px; transform:translateX(-50%); will-change:transform,opacity; }
  .tabbar a { position:relative; z-index:1; flex:1; min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; border-radius:16px; text-decoration:none; color:var(--text-tertiary); font-size:9px; font-weight:590; }
  .tabbar a.active { color:var(--accent); }
  .tab-icon { font-size:18px; line-height:1; }
  .tabbar a.active::before { content:""; position:absolute; inset:2px; z-index:-1; border-radius:14px; background:var(--accent-soft); }
}

@media (max-width: 650px) {
  body { font-size:14px; line-height:1.68; }
  .wrap { width:calc(100% - 20px); }
  .topbar { width:calc(100% - 14px); }
  .hero { padding-top:28px; }
  h1 { font-size:clamp(1.85rem,9vw,2.3rem); line-height:1.15; margin-top:8px; }
  .hero>p { font-size:14px; }
  .hero-stats { grid-template-columns:1fr; margin-top:22px; }
  .hero-stat { min-height:65px; border-right:0!important; border-bottom:1px solid var(--separator-soft)!important; }
  .hero-stat:last-child { border-bottom:0!important; }
  section { margin-bottom:66px; }
  .section-head h2 { font-size:1.65rem; }
  .section-head p { font-size:11.5px; }
  .metric-grid,.revision-grid,.evidence-grid { grid-template-columns:1fr 1fr; gap:9px; }
  .metric { min-height:92px; padding:15px; }
  .metric b { font-size:22px; }
  .callout { padding:21px 19px; font-size:18px; }
  .card,.chart,.person { padding:18px; }
  .traits { grid-template-columns:1fr; }
  .person h3 { font-size:21px; }
  .phase { grid-template-columns:1fr; gap:7px; padding:18px; }
  .phase .when { color:var(--accent); }
  .matrix { grid-template-columns:88px 1fr 1fr; }
  .matrix>div { padding:9px 7px; font-size:10.5px; }
  .score-row { grid-template-columns:102px 1fr 42px; gap:8px; }
  .verbatim-table { grid-template-columns:120px 70px 70px 250px; overflow-x:auto; }
  .text-chapter { padding:19px; }
  .text-chapter h3 { font-size:16.5px; }
  .verbatim-intro { padding:19px; }
  .search-sheet { top:auto; bottom:8px; width:calc(100% - 16px); max-height:84vh; border-radius:26px; padding-bottom:max(16px,env(safe-area-inset-bottom)); transform:translate(-50%,48px) scale(.99); }
  .search-results { max-height:55vh; }
}

@media (max-width: 430px) {
  .metric-grid,.revision-grid,.evidence-grid { grid-template-columns:1fr; }
  .hero-segmented { width:100%; }
  .sidebar { left:10px; width:calc(100vw - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration:.001ms!important; animation-iteration-count:1!important; transition-duration:.001ms!important; scroll-behavior:auto!important; }
  .reveal { opacity:1; transform:none; }
}

@media print {
  .ambient,.sidebar,.topbar,.tabbar,.sheet-backdrop,.search-sheet,#pageProgress { display:none!important; }
  .app-shell { display:block; width:100%; margin:0; border:0; box-shadow:none; }
  .wrap { width:100%; padding:0; }
  .glass,details,.evidence { box-shadow:none; break-inside:avoid; }
  .reveal { opacity:1; transform:none; }
}

/* ===== Cupertino responsive pass ===== */
@media (max-width: 1220px) {
  .app-shell { grid-template-columns: 248px minmax(0,1fr); }
}
@media (max-width: 940px) {
  .hero { padding-top: 28px; }
  .topbar { min-height: 52px; }
}
@media (max-width: 650px) {
  h1 { font-size: clamp(1.72rem, 7.5vw, 2.02rem); line-height: 1.18; }
  .hero { padding: 23px 2px 26px; }
  .hero > p { font-size: 13.5px; }
  .section-head h2 { font-size: 1.48rem; }
  .callout { font-size: 16px; }
  .tabbar { min-height: 61px; border-radius: 22px; }
}
