/* Shared phone/tablet edition. Media queries also respond to rotation and zoom. */
.nav-toggle,.table-scroll-hint,.mobile-count-return{display:none}
@media (min-width:801px) and (max-width:1100px){
  .site-header{height:auto;flex-wrap:wrap;padding-block:16px;gap:12px}
  .top-nav{flex-basis:100%;margin:0;gap:4px 22px}
}
@media (max-width:800px){
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-padding-top:16px}
  .site-header{height:auto;min-height:76px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;padding:14px 16px;padding-inline:max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right))}
  .brand{min-width:0;max-width:100%;gap:8px}
  .brand-symbol{width:30px;height:30px;flex:none;font-size:15px}
  .brand-name{font-size:10px;letter-spacing:.075em;line-height:1.45;min-width:0}
  .brand-sub{font-size:8px;letter-spacing:.23em}
  .site-header.nav-enhanced .nav-toggle{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:44px;padding:10px 12px;border:1px solid #596071;border-radius:4px;background:transparent;color:var(--gold);font:600 13px var(--sans);cursor:pointer}
  .nav-toggle:after{content:"";width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg)}
  .nav-toggle[aria-expanded=true]:after{transform:translateY(2px) rotate(225deg)}
  .site-header .top-nav{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;height:auto;min-width:0;margin:0;padding-top:10px;border-top:1px solid #3b4050;gap:4px 12px;overflow:visible;white-space:normal}
  .site-header.nav-enhanced:not(.is-nav-open) .top-nav{display:none}
  .site-header .top-nav a{min-height:44px;align-items:center;white-space:normal;line-height:1.45;font-size:14px;padding:9px 8px;border-radius:3px}
  .site-header .top-nav a:hover,.site-header .top-nav .nav-active{background:#172038}
  main>section{padding-inline:max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right))}
  .intro-grid,.intro-grid>div,.control-group,.case-filters>div,.construction-toolbar>div,.construction-toolbar>label{min-width:0}
  .intro h1{font-size:clamp(34px,10vw,48px);line-height:1.07;letter-spacing:-.025em}
  .intro-text,.intro-resource{font-size:14px;line-height:1.7}
  .intro-subtitle{font-size:22px;line-height:1.35}
  .section-heading h2{font-size:clamp(28px,7.8vw,36px);line-height:1.15}
  .workspace,.classification-section,.rings-section,.papers-section,.sources-section{padding-block:30px 40px}
  .control-bar{padding:14px;gap:12px 16px}
  .control-bar .control-group:first-child{width:100%;align-items:flex-start;flex-direction:column;gap:8px}
  .rank-filters{width:100%;flex-wrap:wrap;gap:5px}
  .rank-btn{min-width:40px;min-height:44px;padding:9px 10px;font-size:12px}
  .control-label{font-size:11px}
  body input,body select,body textarea{font-size:16px;min-height:44px;max-width:100%}
  .search-wrap{margin-left:0;max-width:140px}
  .search-wrap input{width:112px;font-size:16px}
  .kind-switch{padding:8px 8px 0;overflow:visible}
  .kind-switch button{flex:1 1 0;min-width:0;flex-direction:column;align-items:center;gap:4px;padding:12px 6px;font-size:13px;line-height:1.45;white-space:normal;text-align:center}
  .kind-switch button small{font-size:9px}
  .table-scroll,.profile-table-scroll,.case-table-scroll,.theory-table-wrap{min-width:0;max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
  .table-scroll table{table-layout:auto;min-width:0;width:100%}
  .table-scroll th:not(:first-child),.table-scroll td:not(:first-child){min-width:80px}
  .table-scroll th:first-child{left:0;z-index:3;width:56px;min-width:56px}
  .table-scroll th{padding:12px 10px;font-size:11px}
  .table-scroll-hint:not([hidden]){display:block;margin:0;padding:10px 14px;color:#77502e;background:#f3eee4;font:12px/1.5 var(--sans)}
  .table-scroll tbody tr:not(.virtual-spacer),.table-scroll tbody tr:not(.virtual-spacer)>td{height:40px}
  .count-cell{height:38px;line-height:36px;margin-block:0;white-space:nowrap;min-width:max-content}
  .table-footer,.status-legend{padding-inline:14px;font-size:12px;line-height:1.6}
  .detail-panel{padding:20px;position:static;min-height:0}
  .mobile-count-return{display:inline-flex;align-items:center;justify-self:start;min-height:44px;padding:4px 0;color:#77502e;font-size:13px;border-bottom:1px solid #aa8a62}
  .detail-row,.detail-note,.detail-row strong,.detail-link{font-size:12px;line-height:1.65}
  .scope-description,.paper-card p,.source-item p{font-size:14px;line-height:1.65}
  .scope-note{font-size:13px;line-height:1.75}
  .paper-actions a,.intro-actions a,.atlas-reading-actions a,.atlas-reading-actions button,.reading-link,.case-section-nav a,.review-nav a{min-height:44px;display:inline-flex;align-items:center;line-height:1.5}
  .paper-actions a{font-size:12px}
  .case-filters>div{flex:1 1 120px}
  .case-filters input,.case-filters select{width:100%;height:44px}
  .case-button,.case-secondary-button,.matrix-btn,.profile-tabs button{min-height:44px}
  .case-source-path,main p,main li,main summary,.profile-fact strong,.theory-references{overflow-wrap:anywhere}
  main pre,.case-formula{max-width:100%;overflow-x:auto}
  .construction-toolbar>div:first-child,.construction-toolbar>label:first-child{min-width:0}
  .construction-toolbar select,.construction-toolbar input{font-size:16px}
  .ring-dialog,.reading-dialog{width:calc(100vw - 20px);max-width:calc(100vw - 20px);max-height:calc(100dvh - 24px)}
  .profile-bar{gap:10px;overflow-wrap:anywhere}
  .profile-bar button,.reading-close{flex:none;min-width:44px;min-height:44px}
  .profile-tabs,.ring-profile{min-width:0;max-width:100%}
  body:has(dialog[open]){overflow:hidden}
  .site-footer{padding:24px 16px;font-size:12px;line-height:1.7}
  .review-wrap{max-width:100%;overflow-wrap:anywhere}
}
@media (max-width:360px){
  .property-grid,.case-facts{grid-template-columns:minmax(0,1fr)}
  .catalogue-controls{padding:12px}
  .catalogue-search input{min-width:0}
}
