/* Mobile navigation and comfortable touch layouts. */
.header-start{display:flex;align-items:center;gap:12px;min-width:0}
.menu-toggle,.drawer-close,.sidebar-backdrop{display:none}
main,.studio-grid>*{min-width:0}
@media(max-width:900px){
  html{scroll-padding-top:80px}
  main{margin-left:0;padding:0 24px;max-width:100%}
  main>header{position:sticky;top:0;z-index:20;height:72px;background:rgba(248,249,252,.95);backdrop-filter:blur(12px);gap:10px}
  .menu-toggle{display:grid;place-items:center;flex-shrink:0;width:44px;height:44px;border:1px solid #e4deee;border-radius:12px;background:#fff;color:#7253c7}
  .sidebar{z-index:50;width:min(300px,86vw);height:100vh;height:100dvh;padding:calc(25px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain;transform:translateX(-104%);visibility:hidden;transition:transform .3s cubic-bezier(.22,.8,.25,1),visibility 0s .3s;box-shadow:12px 0 50px #29203922;will-change:transform}
  .sidebar .brand{justify-content:flex-start;padding:0 10px;font-size:21px;margin-right:28px}
  .sidebar .brand>span:nth-child(2){display:block}
  .sidebar .brand-icon{width:36px;height:38px;flex-shrink:0}
  .sidebar .workspace-label{display:block;margin:38px 15px 15px}
  .sidebar .nav{font-size:13px;justify-content:flex-start;padding:14px 15px;min-height:48px;gap:12px}
  .sidebar .nav.active{margin-top:3px}
  .sidebar .nav>span:first-child{font-size:21px}
  .sidebar .nav-pill{display:inline-block}
  .sidebar .nav.settings i{display:block}
  .sidebar .sidebar-tip{display:block;margin:30px 10px;flex-shrink:0}
  .sidebar .profile{display:flex;flex-shrink:0}
  .sidebar .settings{margin-top:auto}
  .sidebar .logout-form{padding:0 10px;flex-shrink:0}
  .sidebar .logout-form button{min-height:44px;font-size:12px}
  .drawer-close{position:absolute;right:13px;top:calc(22px + env(safe-area-inset-top));display:grid;place-items:center;width:40px;height:40px;background:#f5f1fc;color:#8a74ad;font-size:25px;border:0;border-radius:12px}
  .sidebar-backdrop{display:block;position:fixed;inset:0;z-index:45;border:0;background:#20172e66;backdrop-filter:blur(3px);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .28s ease,visibility 0s .28s}
  .menu-open,.menu-open body{overflow:hidden;overscroll-behavior:none}
  .menu-open .sidebar{visibility:visible;transform:translateX(0);transition:transform .3s cubic-bezier(.22,.8,.25,1),visibility 0s}
  .menu-open .sidebar-backdrop{opacity:1;visibility:visible;pointer-events:auto;transition:opacity .28s ease,visibility 0s}
  .studio-grid{grid-template-columns:minmax(0,1fr) 295px}
  .page-title h1{font-size:28px}
  .usage-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:700px){
  main{padding:0 16px}
  main>header{height:68px}
  .header-start .breadcrumb,.header-start .slash{display:none}
  .header-start>div{font-size:13px;font-weight:600}
  #topGuide{font-size:12px;min-height:44px;padding:8px}
  .page-title{padding-top:26px}
  .page-title h1{font-size:clamp(24px,6.5vw,30px);line-height:1.45;letter-spacing:-.8px}
  .page-title p{font-size:12px;line-height:1.8;max-width:36ch}
  .eyebrow{font-size:9px;letter-spacing:1.6px}
  .steps{gap:8px;margin:24px 0;font-size:10px;justify-content:space-between}
  .steps>span{gap:6px;white-space:normal;flex:1;min-width:0;line-height:1.6}.steps b{flex-shrink:0}
  .steps i{width:8px;flex:0 0 8px;min-width:0}
  .studio-grid{grid-template-columns:minmax(0,1fr);gap:18px}
  .photo-panel{grid-row:1;margin:0}
  .editor-panel{grid-row:auto}
  .panel-heading{padding:20px 18px;align-items:center}
  .panel-heading p{max-width:26ch;font-size:11px;line-height:1.7}
  h2{font-size:15px}
  .button.small{font-size:11px;min-height:42px;padding:10px}
  .dropzone{padding:26px 14px;margin:0 18px 20px}
  .dropzone h3{font-size:14px}
  .dropzone p{font-size:12px;line-height:1.7}
  .dropzone small{font-size:10px;line-height:1.8;display:block}
  .upload-icon{width:46px;height:46px}
  .queue-toolbar{padding:0 15px;gap:8px}
  .tabs{gap:15px;min-width:0}
  .tabs button{font-size:11px;min-height:46px;white-space:nowrap}
  #clearButton{font-size:11px;min-height:44px;padding:7px 0}
  .empty-state{padding:28px 12px 32px}
  .empty-state h3{font-size:14px;line-height:1.7}
  .empty-state p{font-size:12px;line-height:1.8}
  .empty-state br{display:none}
  .empty-tags{font-size:10px;flex-wrap:wrap;gap:10px 20px}
  .queue-footer{padding:15px 18px;font-size:11px;row-gap:12px}
  .queue-footer>div{margin-left:auto}
  .photo-grid{grid-template-columns:repeat(auto-fill,minmax(125px,1fr));gap:12px;padding:18px}
  .card-name{font-size:12px}.card-status,.card-error{font-size:11px}
  .card-check{width:22px;height:22px;top:9px;left:9px}
  .card-remove{width:32px;height:32px;right:8px;top:8px;font-size:20px}
  .selection-bar{font-size:12px;padding:16px 18px 0;gap:10px}
  #selectAll{width:19px;height:19px}
  .editor-heading{padding:20px}.editor-heading p{font-size:11px}
  #editForm{padding:20px}
  .field-title{font-size:12px}.tiny-label{font-size:8px}
  #editForm select,#editForm textarea{font-size:16px;padding:12px;line-height:1.7}
  .section-label{font-size:10px;margin:23px 0 14px}.section-label span{font-size:8px}
  .color-option{font-size:11px;padding:11px 0;gap:10px;min-height:74px}
  .color-option i{width:27px;height:27px}
  .toggle-row{min-height:48px;gap:14px;margin:14px 0}
  .toggle-row b{font-size:13px}.toggle-row small{font-size:11px;line-height:1.7}
  .toggle-row input{width:38px;height:22px}.toggle-row input:before{width:16px;height:16px}.toggle-row input:checked:before{left:19px}
  .size-options button{min-height:46px;font-size:13px}.size-options small{font-size:11px}
  #processButton{min-height:50px;font-size:14px}.process-note{font-size:11px;line-height:1.8}
  .identity-note{font-size:11px;line-height:1.8;padding:12px}
  #studioPromptPanel .preset-description,#studioPromptPanel summary{font-size:12px}
  #studioPromptPanel label,#studioPromptPanel small{font-size:11px}
  #studioPromptPanel textarea{font-size:14px}
  .usage-panel{padding:18px;margin-bottom:18px}
  .usage-heading{align-items:flex-start}.usage-heading p{font-size:10px;line-height:1.8;max-width:28ch}
  .usage-heading .text-button{font-size:11px;min-height:44px;padding:5px;white-space:nowrap}
  .usage-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 16px;margin:20px 0}
  .usage-stats>div{padding-right:8px;border:0}.usage-stats small{font-size:8px;line-height:1.7;letter-spacing:.5px}
  .usage-stats strong{font-size:18px;line-height:1.45;margin:7px 0}
  .usage-stats span,.usage-panel>p,.usage-history{font-size:10px;line-height:1.8}
  .usage-panel summary{font-size:12px;min-height:40px;align-content:center}
  .usage-history-row{overflow-wrap:anywhere}
  dialog,.settings-dialog,.preview-dialog{width:calc(100% - 24px);max-height:calc(100dvh - 32px);padding:20px;border-radius:16px;overflow-y:auto;overscroll-behavior:contain}
  .dialog-heading{position:sticky;top:-20px;background:#fff;padding:12px 0;z-index:1;gap:10px;margin-top:-6px}
  .dialog-heading h2{font-size:16px;line-height:1.5}.close-button{width:40px;height:40px;flex-shrink:0}
  dialog p{font-size:12px}dialog .button{min-height:44px;font-size:12px}
  .api-key-field{padding:14px}.api-key-field input,.model-fields input,.model-fields select,#testEndpoint{font-size:16px;min-height:46px;width:100%}
  .model-fields{grid-template-columns:minmax(0,1fr);gap:18px}.model-fields label{font-size:13px}
  .provider-address code{max-width:100%;overflow-wrap:anywhere}
  .settings-actions{flex-direction:column}.settings-actions .button{width:100%;min-height:46px;font-size:12px}
  .endpoint-heading{align-items:flex-start}.endpoint-heading h3{font-size:14px}
  .endpoint-row{flex-wrap:wrap}.endpoint-row code{font-size:11px;overflow-wrap:anywhere}
  .compare{grid-template-columns:1fr;gap:12px}.compare img{height:min(360px,55dvh)}
  .compare figcaption{font-size:11px}
  #toast{bottom:calc(16px + env(safe-area-inset-bottom));font-size:12px;width:calc(100% - 32px);text-align:center;line-height:1.7;padding:14px;z-index:100}
  footer{padding:24px 0 calc(24px + env(safe-area-inset-bottom));font-size:10px;line-height:1.8;gap:10px}
  footer>span:first-child{max-width:none}
  .login-page{padding:20px}.login-card{padding:24px}.login-card h1{font-size:23px}.login-card input{font-size:16px;min-height:48px}.login-card button{min-height:48px}
}
@media(max-height:650px) and (max-width:900px){.sidebar .sidebar-tip{display:none}.sidebar .workspace-label{margin-top:28px}.sidebar .profile{padding-top:12px}}
@media(prefers-reduced-motion:reduce){.sidebar,.sidebar-backdrop{transition:none!important;will-change:auto}}

.photo-actions{position:absolute;right:7px;top:7px;display:flex;gap:5px;z-index:1}.photo-actions .card-remove,.photo-actions .card-rotate{position:static;display:grid;place-items:center;width:30px;height:30px;border:1px solid #ffffffc7;border-radius:8px;background:#fffffff0;color:#7253c7;box-shadow:0 2px 8px #35224c12;line-height:1;padding:0}.photo-actions .card-remove{font-size:20px;color:#8a7e95}.photo-actions button:focus-visible{outline-offset:2px}@media(max-width:700px){.photo-actions{right:7px;top:7px;gap:5px}.photo-actions .card-remove,.photo-actions .card-rotate{width:36px;height:36px;border-radius:10px}.photo-actions .card-rotate svg{width:21px;height:21px}}

.usage-page>.page-title{padding-bottom:28px}.usage-page .usage-history{max-height:420px}.workspace-page{min-width:0}@media(max-width:700px){.usage-page>.page-title{padding-bottom:24px}.usage-page .usage-stats{gap:20px 16px}.usage-page .usage-history{max-height:360px}}

.sidebar{overflow-y:auto;overscroll-behavior:contain}.sidebar-tip{margin-top:30px;margin-bottom:24px}
