/* Shared mobile layout; loaded after page-specific styles. */
.mobile-menu-toggle{display:none}
.mobile-chat-toggle{display:none}
/* Give embedded chats more room for messages without changing the chat page. */
#overview-chat #chat-messages{height:clamp(240px,38dvh,440px)}
#map-screen #overview-chat #chat-messages{height:clamp(280px,45dvh,520px)}
@media(min-width:761px) and (max-width:1100px){
  .main-grid{grid-template-columns:minmax(0,1fr)}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .title-row{align-items:stretch;flex-direction:column}
  .parliament-grid,.chat-layout{grid-template-columns:minmax(0,1fr)}
}
@media(max-width:760px){
  html{scroll-padding-top:80px}
  body{font-size:14px}
  .sidebar{position:sticky;top:0;z-index:1200;padding:10px 16px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:0;overflow:visible;box-shadow:0 2px 12px #15263b15}
  .sidebar .brand{font-size:21px;min-height:44px}
  .sidebar .brand .logo{width:34px;height:34px;flex-basis:34px}
  .mobile-menu-toggle{display:block;min-height:44px;padding:10px 13px;background:#27384d;border-color:#526176;color:#fff;font-size:14px}
  .sidebar nav{width:100%;display:grid;grid-template-columns:1fr;gap:4px;max-height:calc(100dvh - 168px);overflow-y:auto;margin:10px 0 0;padding:0 0 8px;overscroll-behavior:contain}
  .sidebar.mobile-nav-ready:not(.menu-open) nav{display:none}
  .sidebar nav a{font-size:14px;min-height:44px;padding:11px 12px}
  .sidebar nav a.active::before{display:none}
  .sidebar .nav-group{margin:10px 12px 2px}
  .sidebar .nav-group:first-child{margin-top:4px}
  .sidebar .brand-note{display:none}
  .sidebar .side-bottom>:not(.side-coffee){display:none}
  .sidebar .side-bottom{display:block;width:100%;flex:0 0 auto;margin:8px 0 0;padding:0 0 max(10px,env(safe-area-inset-bottom,0px))}
  .sidebar.mobile-nav-ready:not(.menu-open) .side-bottom{display:none}
  .sidebar .side-coffee{width:100%;margin:0;min-height:44px;padding:10px 12px;font-size:13px;box-sizing:border-box}
  main{margin:0;padding:0 12px;min-width:0}
  main>header{height:auto;min-height:58px;gap:10px;letter-spacing:0}
  main>header>span{font-size:10px;line-height:1.5;min-width:0}
  #refresh{font-size:11px;flex-shrink:0;min-height:44px;padding:8px}
  #election-ticker{position:relative;top:auto;margin-bottom:16px;padding-top:0;z-index:1}
  .ticker-label{font-size:9px;max-width:76px}
  .ticker-pause{min-width:44px;min-height:44px}
  .title-row{margin:20px 0;gap:16px}
  h1{font-size:27px;line-height:1.2;letter-spacing:-.8px}
  h2{font-size:19px;line-height:1.4}
  .subtitle{font-size:13px;line-height:1.65}
  .cycle-label{min-width:0;width:100%;font-size:10px}
  select,input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea{font-size:16px!important;min-height:44px;max-width:100%}
  select{padding-right:28px;text-overflow:ellipsis}
  input[type=checkbox]{width:20px;height:20px;flex-shrink:0}
  button,summary{touch-action:manipulation}
  .card,.metric,.card-heading>div,.main-grid>*{min-width:0}
  .card-heading{flex-wrap:wrap;gap:10px}
  .card-heading .small{overflow-wrap:anywhere}
  .panel-fold-bar{gap:8px;margin-bottom:10px}
  .panel-fold-bar>button{min-height:36px;min-width:64px;font-size:11px}
  .panel-fold-bar>span{font-size:11px;min-width:0}
  .metrics{gap:8px;grid-template-columns:repeat(2,minmax(0,1fr))}
  .metric{padding:13px 11px}.metric strong{font-size:24px}.metric p{font-size:12px}.metric small{font-size:10px;line-height:1.5}
  .metrics .panel-fold-bar>span{display:none}.metrics .panel-fold-bar{justify-content:flex-end;margin-bottom:4px}
  .election-countdown{padding:16px;gap:16px}
  .election-countdown h2{font-size:20px}
  .countdown-clock{gap:6px}.countdown-clock strong{font-size:26px}.countdown-clock span{font-size:9px;letter-spacing:0}
  .parallel-control,.overview-chat-control{padding:12px;gap:8px}.parallel-control label,.overview-chat-control label{font-size:13px;line-height:1.5;min-height:44px}
  .parallel-control>.small{display:none}
  #parallel-panel>article,.detail-card,.results-card,.registry-card,.parliament-card,.method,#ai-predictions,#polymarket,#chat{padding:16px}
  .registry-card,.parliament-card,.method,#ai-predictions,#polymarket,#chat{margin-top:18px}
  #overview .map-card{padding:14px}
  #overview .map-wrap{height:430px;height:clamp(340px,58dvh,480px)}
  .map-region-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;max-width:100%;padding-bottom:6px;scrollbar-width:thin}
  .map-region-tabs button{flex:0 0 auto;min-height:44px;font-size:12px}
  .map-heading-actions{margin-left:auto}
  .map-screen-button{width:44px;height:44px}
  #overview #map-hover{font-size:11px;line-height:1.5}
  #overview #map-legend{grid-template-columns:minmax(0,1fr)}
  #overview #map-legend>button{min-height:44px;font-size:11px}
  #map-legend span{white-space:normal;overflow-wrap:anywhere}
  .result-row{grid-template-columns:minmax(0,1fr) auto;gap:5px 12px;font-size:12px;align-items:baseline}
  .result-row>div:first-child{grid-column:1/-1;line-height:1.6;overflow-wrap:anywhere}
  .result-row>span{text-align:left;font-size:12px}.result-row>b{font-size:14px}
  .bar,.screen-result-bar{height:6px}
  .notice,.small{line-height:1.75;overflow-wrap:anywhere}
  .small{font-size:11px}
  .registry-filter{max-width:none}
  .registry-row{gap:12px;padding:16px 0;overflow-wrap:anywhere}
  .registry-row strong{font-size:14px}
  .registry-row[data-candidate-id]{padding:16px 8px}
  .registry-meta{width:100%;flex-direction:row;justify-content:space-between;align-items:center;gap:10px}
  .registry-signatures{width:155px;flex-shrink:0}
  .candidate-dialog{width:calc(100vw - 12px);max-width:calc(100vw - 12px);max-height:calc(100dvh - 16px);margin:auto}
  .candidate-header{padding:14px 12px;gap:8px}.candidate-header>div{max-height:24dvh;overflow-y:auto}.candidate-header h2{font-size:16px;line-height:1.4}
  .candidate-close,.reader-close{width:44px;height:44px;flex-basis:44px}
  .candidate-tools{padding:10px 12px;gap:8px}.candidate-share{min-height:44px;font-size:12px}
  .candidate-content{padding:14px 12px;min-height:80px}.candidate-table td,.candidate-table th{padding:10px 7px;overflow-wrap:anywhere}
  .candidate-table td:first-child,.candidate-table th:first-child{width:64px;overflow-wrap:normal}
  .candidate-search{margin-top:12px}
  .news-item{padding:16px}.news-item h3{font-size:15px;line-height:1.6}.news-item .meta,.news-item .open{font-size:11px}
  .news-tools{margin-top:16px}.news-tools label{min-height:44px;font-size:13px}
  #source-tabs,.ai-tabs,.pm-periods{flex-wrap:nowrap;overflow-x:auto;max-width:100%;padding-bottom:8px;scrollbar-width:thin}
  #source-tabs button,.ai-tabs button,.pm-periods button{flex-shrink:0;min-height:44px;font-size:13px}
  .sources{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.source-card{min-width:0;padding:12px}.source-card .status{float:none;display:block;margin-top:5px}.source-card p{font-size:11px}
  .reader-toolbar h2{font-size:14px}.reader-nav button,.reader-original{min-height:44px;display:inline-flex;align-items:center;font-size:12px}.reader-content{font-size:16px;padding:14px}.reader-content img{max-width:100%;height:auto}
  .ai-chart{padding:14px}.ai-chart-row>div:first-child{font-size:13px}.ai-chart-grid{grid-template-columns:minmax(0,1fr)}
  .ai-meta{gap:8px}.ai-meta strong{overflow-wrap:anywhere}.ai-table-wrap{max-width:100%;overscroll-behavior-x:contain}
  .pm-heading h3{font-size:20px}.pm-status-row{flex-wrap:wrap}.pm-periods button,.pm-legend button{min-height:44px}
  #polymarket .pm-history,#polymarket .pm-ranking{padding:12px}.pm-readout span{white-space:normal}.pm-readout{font-size:12px}
  .tv-channels{display:flex;overflow-x:auto;gap:8px;padding-bottom:8px}.tv-channel{flex:0 0 150px;min-height:70px;padding:12px}
  .tv-screen{padding:12px}.tv-toolbar{flex-wrap:wrap}.tv-toolbar button,.tv-sound,.tv-tile-stop{min-height:44px}
  #tv-stage:has(iframe){height:360px;max-height:65dvh}.tv-grid-stage:has(iframe){height:300px}
  .tv-placeholder{padding:16px}.tv-placeholder strong{font-size:22px}
  #chat-messages{height:45dvh;min-height:220px;padding:10px}.chat-layout{gap:16px}
  .chat-actions{flex-direction:row;flex-wrap:wrap;align-items:center}.chat-actions button,#chat-join>button{min-height:44px}
  #chat .chat-message p{font-size:14px}.chat-live-meta{gap:8px;font-size:11px}
  #overview-layout.with-chat{display:block;padding-bottom:0}
  .overview-chat-control{display:none}
  .mobile-chat-toggle{position:fixed;right:16px;bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:1260;display:grid;place-items:center;width:56px;height:56px;padding:0;border:1px solid #42637e;border-radius:50%;background:#173a55;color:white;box-shadow:0 4px 18px #15263b40;touch-action:manipulation}
  .mobile-chat-toggle:hover{background:#244e6c}.mobile-chat-toggle[aria-expanded=true]{background:#bd3f49;border-color:#bd3f49}
  .mobile-chat-toggle svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .chat-unread-dot{position:absolute;right:0;top:0;width:15px;height:15px;border:3px solid white;border-radius:50%;background:#e13d4d;box-shadow:0 1px 4px #15263b30}
  .map-screen-open .mobile-chat-toggle{display:none}
  body[data-page=overview] main>footer{padding-bottom:90px}
  #overview-layout>#overview-chat{position:fixed;inset:auto 8px calc(84px + env(safe-area-inset-bottom,0px));z-index:1250;max-height:min(82dvh,calc(100dvh - 108px - env(safe-area-inset-bottom,0px)));box-shadow:0 -6px 40px #15263b40;border-radius:14px;overflow-y:auto}
  .overview-chat-heading{position:sticky;top:0;background:white;z-index:1;padding:8px 12px}.overview-chat-heading button{min-height:44px;font-size:12px}
  #overview-chat #chat-messages{height:clamp(230px,38dvh,420px);min-height:230px}
  #overview-chat #chat{padding:12px}#overview-chat .chat-connection{font-size:11px}
  .map-screen-header{display:grid;height:auto;letter-spacing:0;padding:10px 12px;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;position:relative}
  .map-screen-header>div:first-child{grid-column:1/-1;grid-row:1;padding-right:52px}#map-screen-close{position:absolute;top:10px;right:12px}
  .map-screen-clock{grid-column:1/-1;grid-row:2;text-align:left;grid-template-columns:auto 1fr;align-items:center;gap:0 10px}
  .map-screen-clock small{grid-column:1/-1}#screen-tv-toggle{grid-column:1;grid-row:3;justify-self:stretch;order:0}#screen-chat-toggle{grid-column:2;grid-row:3;width:auto}
  .map-screen-header .map-screen-button{width:44px;height:44px}
  #screen-chat-toggle,#screen-tv-toggle{min-height:44px}
  #map-screen:has(.with-tv){overflow:auto}.map-screen-shell.with-tv{height:auto;min-height:100dvh}.map-screen-shell.with-tv .map-screen-body{overflow:visible;flex:none}
  .map-screen-tv{padding:0 8px 12px;max-height:none;overflow:visible}.screen-tv-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.screen-tv-stage{max-height:none}.screen-tv-sound{min-height:32px}
  .map-screen-body{display:flex;flex-direction:column;overflow-y:auto;padding:8px}
  .screen-cycle-label select{font-size:16px}
  #screen-map-slot{height:auto;min-height:0;display:block;flex-shrink:0}
  #overview #map-screen .map-wrap{height:clamp(360px,58dvh,480px);flex:none}
  .map-screen-sidebar{order:1;min-height:0;flex-shrink:0}
  #screen-chat-slot:has(>#overview-chat:not([hidden])){order:2;min-height:0}
  #map-screen #overview-chat{position:static;max-height:none;box-shadow:none}
  #screen-source-tabs button{min-height:44px;font-size:12px}
  .screen-result-row strong{font-size:13px}.screen-result-numbers b{font-size:15px}
  #overview-live-sources #screen-list-results,.map-screen-sidebar #screen-list-results{max-height:none;overflow:visible}
  .method-source-card>p,.method p:not(.eyebrow),.method a{font-size:13px}.method-source-card small{font-size:11px}
  footer{flex-wrap:wrap;padding:22px 0 max(22px,env(safe-area-inset-bottom))}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
