.studio-worldmap-mobile{display:none}
/* Shared phone/tablet layout. Desktop presentation is intentionally retained. */
@media (max-width: 1100px) and (min-width: 701px) {
  .preview-header{padding:14px 24px;gap:14px}
  .studio-brand-navigation{gap:16px}
  .studio-header-actions{margin-left:auto;gap:8px}
  .preview-header .studio-worldmap-link{width:220px;flex-basis:220px}
}
@media (max-width: 700px) {
  html{scroll-padding-bottom:110px}
  body{min-width:0}
  .preview-header{display:grid;grid-template-columns:minmax(0,1fr) repeat(3,44px);gap:10px 8px;padding:10px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left));align-items:center}
  .studio-brand-navigation,.preview-header>.studio-header-actions{display:contents}
  .studio-brand-navigation .studio-brand-stack{grid-column:1;grid-row:1;justify-self:start;gap:0;max-width:100%;min-width:0}
  .studio-brand-logo{width:112px;max-width:100%;height:36px}
  .studio-brand-navigation .studio-brand-stack small{font-size:10px;line-height:15px;letter-spacing:.04em}
  #studio-chats{grid-column:2;grid-row:1}
  #studio-new{grid-column:3;grid-row:1}
  .studio-profile,#studio-account{grid-column:4;grid-row:1;justify-self:end}
  .studio-profile #studio-account,.preview-header>.studio-header-actions>#studio-account{width:44px;height:44px}
  .preview-header #studio-open-timeline{grid-column:1 / -1;grid-row:2;justify-self:start;width:calc(50% - 4px);height:44px;min-height:44px;padding:8px;gap:6px;font-size:12px}
  .preview-header .studio-worldmap-link{grid-column:1 / -1;grid-row:2;justify-self:end;width:calc(50% - 4px);height:44px;min-height:44px;padding:0;min-width:0}
  .preview-header .studio-worldmap-art{width:100%;height:44px;object-fit:contain}
  .studio-profile-menu{width:min(260px,calc(100vw - 24px));top:calc(100% + 8px)}
  .studio-profile-menu button{min-height:44px}
  #chat{width:100%;max-width:752px;margin:12px auto 140px;padding:1px 12px;border-radius:12px}
  #chat>.message:not(.user){margin:16px 0 16px 36px;padding:12px;border-radius:6px 16px 16px 16px}
  #chat>.message:not(.user)>.label{left:-36px;width:28px;height:28px}
  #chat>.message:not(.user)>.label .studio-reply-logo{width:24px;height:18px}
  #chat>.message.user{margin-left:36px;text-align:left;overflow-wrap:anywhere}
  #chat>.message:not(.user)>.text{font-size:14px;line-height:1.7}
  #chat>.agent-reference-preview:not(.user){margin-left:0;padding:12px}
  #chat :is(.studio-workflow-card,.episode-studio,.studio-history-card){min-width:0;max-width:100%;overflow-wrap:anywhere}
  #chat :is(img,video,iframe){max-width:100%}
  .demo-choices{gap:8px}
  .demo-choices>button{min-height:44px;white-space:normal;padding:9px 12px;font-size:13px}
  .composer{width:calc(100% - 24px);bottom:max(8px,env(safe-area-inset-bottom));gap:8px;padding:8px;border-radius:16px;z-index:10;align-items:flex-end}
  .composer textarea{font-size:16px;line-height:24px;padding:10px 2px;max-height:min(160px,30dvh)}
  .composer button,.composer #studio-mic{width:44px;height:44px;min-width:44px;flex:0 0 44px}
  .composer .studio-voice-status button{min-height:44px;width:auto;flex:0 0 auto}
  dialog{box-sizing:border-box;max-width:calc(100% - 16px);max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain}
  :is(.studio-modal,#studio-login,.studio-history,.timeline-shot-dialog,.timeline-location-dialog,.timeline-dialogue-confirm,.reference-card-dialog){width:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100dvh - 24px);padding:16px;margin:auto}
  dialog :is(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:16px!important;min-width:0;max-width:100%}
  dialog :is(button,.btn){min-height:44px;max-width:100%;white-space:normal;overflow-wrap:anywhere}
  dialog :is(header,.studio-modal-header){gap:8px;min-width:0}
  dialog :is(h1,h2){font-size:19px;overflow-wrap:anywhere}
  dialog :is(footer,.studio-history-actions,.shot-edit-actions){flex-wrap:wrap;gap:8px}
  .studio-modal-header>button{flex:0 0 44px;min-width:44px;height:44px;padding:0}
  .studio-chat-actions{flex-wrap:wrap;max-width:100%}
  .studio-history-tools{flex-wrap:wrap}.studio-history-tools input{flex:1 1 180px}
  .studio-history-table-wrap{max-width:100%;overscroll-behavior-x:contain}
  .studio-editor iframe{max-width:100%;height:calc(100% - 70px)}
  .studio-dialogue-times,.tdc-times{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
  .studio-entry{padding:16px}.studio-entry-card{padding:22px 18px}
  .timeline-app{width:calc(100% - 12px);margin:6px auto;padding:6px;min-width:0}
  .timeline-app main,#timeline,#workspace,.balveer-original-timeline{min-width:0;max-width:100%}
  .timeline-nav{padding:8px;gap:8px}.timeline-nav>div{gap:8px;min-width:0}
  .timeline-nav .btn{min-height:44px;padding:8px 10px}
  .timeline-logo{width:104px;height:40px}
  .balveer-original-timeline{padding:8px}
  .bv-timeline-header{gap:10px;position:static!important}
  .bv-timeline-header>div{min-width:0;max-width:100%;overflow-wrap:anywhere}
  .bv-watch{margin:6px 0 0;min-height:36px;padding:8px 10px}
  .bv-metrics{gap:6px}.bv-metrics button{min-height:44px}
  .bv-sequence-track{max-width:100%;overscroll-behavior-x:contain;padding-bottom:14px}
  .balveer-original-timeline .bv-sequence-track .timeline-sequence{width:230px}
  .balveer-original-timeline .bv-sequence-track .timeline-sequence>summary{width:230px;min-width:0}
  .balveer-original-timeline .bv-sequence-track .timeline-sequence[open]>summary{width:100%;min-width:250px}
  .sequence-heading-row{gap:8px}
  .sequence-heading-row .sequence-header-render,.sequence-queue-controls .sequence-pause{height:44px;min-height:44px;font-size:11px;padding:8px 10px;line-height:1.2}
  .timeline-sequence:not([open])>summary .sequence-queue-controls .sequence-header-render,.timeline-sequence:not([open])>summary .sequence-queue-controls .sequence-pause{font-size:10px;min-height:44px}
  .balveer-original-timeline .bv-sequence-track .seg{width:160px;flex-basis:160px;height:auto;min-height:124px;padding:8px;gap:6px}
  .balveer-original-timeline .seg-actions button{height:44px;min-height:44px;min-width:44px!important;padding:6px!important}
  .balveer-original-timeline .seg-actions svg{width:18px;height:18px}
  .bv-workspace{padding:12px}.bv-workspace>header{flex-wrap:wrap;gap:12px}
  .timeline-shot-tools{width:100%;display:flex;flex-wrap:wrap;gap:8px}
  .timeline-shot-tools button{flex:1 1 auto;min-height:44px}
  .bv-workspace footer{grid-template-columns:minmax(0,1fr)}
  .bv-compare,.result-reference-layout{grid-template-columns:minmax(0,1fr)}
  .result-reference-layout .reference-column{grid-column:1;grid-row:1}
  .result-reference-layout .animated-column{grid-column:1;grid-row:2}
  .bv-empty{gap:12px;text-align:center;padding:12px}
  #timeline-reference-bank,.render-version-bank{padding:12px}
  #timeline-reference-bank h2{font-size:20px}
  .timeline-reference-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .timeline-reference-grid article{min-width:0;padding:10px;overflow-wrap:anywhere}
  .timeline-reference-grid button{min-height:44px;padding:8px;font-size:12px;white-space:normal}
  .timeline-reference-grid img{height:120px}
  #timeline-reference-bank>button,.version-controls button{min-height:44px;max-width:100%;white-space:normal}
  .version-controls select{min-width:0;max-width:100%;font-size:16px}
  #timeline-submit-error{left:12px;right:12px;max-width:none}
  #timeline-error-chat{right:12px;bottom:max(12px,env(safe-area-inset-bottom))}
  #timeline-error-chat section{width:calc(100vw - 24px)}
  #timeline-render-chat .chat-window-controls button,#timeline-error-chat .chat-window-controls button{width:44px;height:44px}
  .sequence-video-dialog .sequence-video-close{width:44px;height:44px}
}
@media (max-width:360px){
  .preview-header{gap:8px 6px;padding-left:10px;padding-right:10px}
  .studio-brand-logo{width:104px}
  .preview-header #studio-open-timeline{font-size:11px;gap:4px}
  #studio-open-timeline .studio-timeline-chevron{display:none}
  .timeline-reference-grid{grid-template-columns:minmax(0,1fr)}
  .timeline-reference-grid img{height:180px}
  .studio-dialogue-times,.tdc-times{grid-template-columns:minmax(0,1fr)}
}
@media (prefers-reduced-motion:reduce){
  .studio-background-slide{transition:none!important;animation:none!important}
}

@media(max-width:700px){
  .preview-header .studio-worldmap-art{display:none}
  .preview-header .studio-worldmap-link{background:rgba(255,253,249,.8);border:1px solid #e85258;line-height:1.3;color:#e85258}
  .studio-worldmap-mobile{display:flex;align-items:center;justify-content:center;gap:8px;font-size:12px;font-weight:600}
  .studio-worldmap-mobile svg{flex:none}
  .bv-metrics{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));width:100%}
  .bv-metrics>span{grid-column:span 2;text-align:center;padding:6px!important;font-size:11px!important}
  .bv-metrics>button{grid-column:span 3}
  .shot-edit-actions>button{flex:1 1 100%;width:100%}
  .shot-dialogue-toggle{min-height:44px}
  .reference-close,.shot-dialog-close{width:44px;min-width:44px;height:44px}
  .reference-card-dialog .reference-suggestions{padding:12px}
  .reference-card-dialog .reference-suggestion-grid{grid-template-columns:minmax(0,1fr)}
  .reference-card-dialog .reference-suggestion-grid article{padding:10px}
  .reference-card-dialog .reference-suggestion-grid img{height:160px}
}
@media(min-width:701px) and (max-width:900px){
  .preview-header{display:grid;grid-template-columns:minmax(0,1fr) repeat(3,44px);gap:12px 10px;padding:12px 24px}
  .studio-brand-navigation,.preview-header>.studio-header-actions{display:contents}
  .studio-brand-navigation .studio-brand-stack{grid-column:1;grid-row:1;justify-self:start}
  #studio-chats{grid-column:2;grid-row:1}
  #studio-new{grid-column:3;grid-row:1}
  .studio-profile,#studio-account{grid-column:4;grid-row:1;justify-self:end}
  .studio-profile #studio-account{width:44px;height:44px}
  .preview-header #studio-open-timeline{grid-column:1 / -1;grid-row:2;justify-self:start;width:calc(50% - 5px)}
  .preview-header .studio-worldmap-link{grid-column:1 / -1;grid-row:2;justify-self:end;width:calc(50% - 5px)}
}
@media(max-width:480px){
  .studio-ref-grid{grid-template-columns:minmax(0,1fr)}
  .studio-ref-grid button{min-height:44px}
}
