/* OJO revision 2. Existing source structure and interaction retained.
   Apply after current production CSS. Values below are logical CSS pixels. */
:root{
 --primary:#0061ff;--primary-hover:#004dd1;
 --accent:#0061ff;--accent-hover:#004dd1;--accent-soft:#edf5ff;
 --brand-red:#fa2257;--brand-ink:#c51c4c;--brand-soft:#fff0f4;
 --error:#c51c4c;--success:#168579;--warning:#805124;
 --muted:#50617a;--border:#dfe7f1;--stage:#edf1f6;
 --field:#fff;--control-border:#8192a5;
 color:#102342;background:#f6f9fd;font-size:14px;
}
body,.workbench{background:#f6f9fd}
button{font-weight:500;letter-spacing:0}
.primary,.secondary{min-height:44px;border-radius:8px;font-size:14px;font-weight:600;box-shadow:none}
.primary:hover:not(:disabled),.primary:active:not(:disabled){background:var(--primary-hover);border-color:var(--primary-hover)}
.secondary{color:#34517d;border-color:var(--control-border)}
.secondary:hover:not(:disabled){background:var(--accent-soft);border-color:var(--primary)}
.primary:disabled,.secondary:disabled{background:#e8eef5;border-color:#c9d5e4;color:#66788e;opacity:1}
.settings-panel,.preview-panel{border-radius:12px}
.settings-panel{padding:6px 12px 0}
.panel-heading{margin-bottom:4px}
.panel-heading h2,.settings-panel h3{font-size:14px;font-weight:650;line-height:20px}
.settings-panel h3{margin-bottom:8px}
.settings-panel .control-label{font-size:13px;font-weight:500;line-height:20px;margin-bottom:4px;color:var(--muted)}
.settings-panel .font-color{margin-top:8px;gap:12px}
.settings-panel textarea,.settings-panel .font-color select,
.settings-panel .color-field,.settings-panel .template-fields input{
 min-height:40px;border-radius:8px;background:var(--field);border-color:var(--control-border);font-size:16px
}
.settings-panel textarea{resize:vertical}
.settings-panel .section-divider{margin:8px 0 10px;background:var(--border)}
.settings-panel .scope{margin-top:6px;padding:2px 0 8px;border-color:var(--border)}
.segments{background:#f1f5fa;border-radius:8px}
.segments button{font-size:14px;border-radius:6px;font-weight:500;min-height:36px}
.segments button.selected{background:var(--primary);color:#fff;font-weight:600}
.segments button:hover:not(.selected){background:#e3edfc}
.layout-segments{background:var(--accent-soft)}
.layout-segments button{color:#34517d}
.layout-segments button.selected{background:var(--primary);color:#fff}
.layout-segments button:hover:not(.selected){background:#dce9ff}
.settings-panel .slider-row{min-height:44px;gap:8px}
.slider-row>span{min-width:56px;font-size:13px;line-height:20px}
.slider-row>output{min-width:40px;font-size:13px;font-variant-numeric:tabular-nums;line-height:20px}
.tile-settings .slider-row>span{min-width:36px}
.tile-settings .slider-row>output{min-width:30px}
.settings-panel .tile-settings>p{font-size:12px;line-height:18px;margin:4px 0}
.settings-panel .toggle,.settings-panel .check-label{font-size:13px;min-height:36px}
.toggle input:checked+.toggle-track{background:var(--primary)}
.check-label input{accent-color:var(--primary)}
.position-grid button{border-color:var(--control-border);border-radius:6px}
.position-grid button.selected{background:var(--accent-soft);border-color:var(--primary)}
.position-grid button.selected>span{background:var(--primary)}
.settings-panel .placement p{font-size:12px;line-height:20px;color:var(--muted)}
.settings-panel .template-select{min-height:40px;font-size:13px;background:#fff;border-color:var(--control-border);border-radius:8px}
.template-select:hover{background:var(--accent-soft);border-color:var(--primary)}
.template-select>span:last-child,.template-color .text-button{color:var(--primary);font-weight:500}
.template-color .text-button{font-size:13px}
.template-fields{gap:8px;margin-top:8px}
.template-fields .field-required,.field-error{color:var(--error)}
.template-fields input[aria-invalid=true]{border-color:var(--error)}
.template-fields input[aria-invalid=true]:focus-visible{outline-color:var(--error)}
.field-error,.field-count{font-size:12px;line-height:18px;margin-top:4px}
.logo-drop{background:#fff;border-color:var(--control-border);border-radius:8px;min-height:76px;padding:8px 10px;gap:10px}
.logo-drop strong{font-size:14px;font-weight:500;line-height:20px}
.logo-drop>div>button{color:var(--primary);font-size:13px;line-height:20px;min-height:28px;padding:2px 0}
.logo-add{color:var(--primary);font-size:14px;min-height:64px}
.topbar .workspace-label{background:var(--accent-soft);color:#34517d;font-size:12px}
.active-nav{color:var(--brand-ink);border-bottom-color:var(--brand-red)}
.privacy-label,.local-status{color:var(--muted)}
.status-dot{background:var(--success);box-shadow:0 0 0 3px #e9f5f1}
.demo-label{background:var(--brand-ink);color:#fff;font-size:12px;font-weight:600}
.example-demo{background:var(--brand-soft);color:var(--brand-ink);font-size:12px}
.thumbnail.active{border-color:var(--primary)}
.add-thumbnail:hover:not(:disabled){border-color:var(--primary);background:var(--accent-soft)}
.download-current{color:var(--primary);border-color:var(--primary);font-weight:600}
.download-current:hover:not(:disabled){background:var(--accent-soft);border-color:var(--primary-hover)}
.download-all{border-radius:8px 0 0 8px}
.split-caret{border-radius:0 8px 8px 0}
.split-button:has(.download-all:disabled) .split-caret:not(:disabled){background:#fff;color:var(--primary);border-color:var(--control-border)}
.clear-button{color:var(--brand-ink)}
.control-label .count,.photo-count>span,.image-dimensions{font-size:12px;color:var(--muted)}
.export-menu{border-radius:12px;border-color:var(--border);box-shadow:0 8px 28px #1023421f;padding:16px}
.export-menu h3{font-size:16px;line-height:24px;font-weight:650;margin-bottom:12px}
.export-menu>label{font-size:13px;color:var(--muted)}
.export-menu>p,.export-menu small{font-size:12px;line-height:18px;color:var(--muted)}
.export-menu>button{min-height:56px;font-size:14px;padding-block:10px}
.export-menu>button:disabled{opacity:1;color:#66788e}
.export-menu>button:disabled small{color:#66788e}
.modal{width:min(500px,100%);border-radius:16px;padding:24px;border-color:var(--border);box-shadow:0 16px 56px #10234229}
.modal-backdrop{background:#1023424d;backdrop-filter:blur(2px)}
.modal>header h2{font-size:20px;line-height:28px;font-weight:650}
.modal>header .icon-button{width:36px;height:36px;flex-shrink:0}
.modal-actions{gap:12px;margin-top:20px}
.modal:has(.confirm-copy) .modal-actions .primary{background:var(--error);border-color:var(--error)}
.modal:has(.confirm-copy) .modal-actions .primary:hover{background:#a81740;border-color:#a81740}
.confirm-copy{font-size:14px;line-height:24px;padding:16px 0 0}
.help-content{padding-top:16px}
.help-content ol{margin:16px 0;padding-left:22px}
.help-content li{margin-top:12px;padding-left:4px;color:var(--primary)}
.help-content li strong{color:#102342;font-weight:600;font-size:14px}
.help-content li p,.help-note p,.metrics-note{font-size:14px;line-height:24px;color:var(--muted)}
.help-note{background:var(--accent-soft);color:var(--primary);border-radius:8px;padding:12px;gap:10px}
.help-caption{font-size:12px;line-height:20px;color:var(--muted)}
.help-content a,.help-lead{color:var(--primary)}
.modal-primary{margin-top:16px}
.template-modal{width:min(1100px,100%);max-width:1100px;padding:0}
.template-modal>header{padding:16px 24px 8px}
.template-note{font-size:14px;line-height:22px}
.template-categories{gap:8px}
.template-categories button{font-size:13px;min-height:44px;padding:8px 12px;border-radius:8px}
.template-categories .selected{background:var(--accent-soft);border-color:var(--primary);color:var(--primary);font-weight:600}
.template-category-count{font-size:12px}
.template-grid{gap:14px}
.template-grid>div>button{border-color:var(--border);border-radius:10px}
.template-grid>div>button.selected{outline:2px solid var(--primary);outline-offset:-2px;border-color:var(--primary)}
.template-grid>div>button:hover{border-color:var(--primary);box-shadow:none}
.template-card-label{font-size:14px;line-height:20px;font-weight:400}
.template-card-label strong{font-size:12px;color:var(--muted);font-weight:500}
.template-card-label>span{font-size:14px;color:#102342}
.template-grid>div>button.selected .template-card-label strong{color:var(--primary)}
.template-grid>div>button.selected .template-card-label>span{font-weight:600}
.export-result-icon{background:var(--accent-soft);color:var(--primary)}
.export-modal h3{font-size:22px;line-height:30px;font-weight:650}
.export-description{overflow-wrap:anywhere;font-size:14px;line-height:24px;margin:12px 0 20px;color:var(--muted)}
.progress-track{height:6px;border-radius:3px;background:#dfe7f1}
.progress-track>div{background:var(--primary)}
.export-errors{padding:12px;border-radius:8px;background:#fff6e7;color:var(--warning);font-size:13px;line-height:20px;margin-top:12px;max-height:200px;overflow:auto}
.export-errors p{margin:6px 0 0;overflow-wrap:anywhere}
.export-modal[data-export-state=processing] .export-result-icon{background:var(--accent-soft);color:var(--primary)}
.export-modal[data-export-state=success] .export-result-icon{background:#e9f5f1;color:var(--success)}
.export-modal[data-export-state=success] .progress-track>div{background:var(--success)}
.export-modal[data-export-state=partial] .export-result-icon{background:#fff6e7;color:var(--warning)}
.export-modal[data-export-state=stopped] .export-result-icon{background:#edf2f8;color:var(--muted)}
.export-modal[data-export-state=failed] .export-result-icon{background:var(--brand-soft);color:var(--error)}
.export-modal[data-export-state=failed] .export-errors{background:var(--brand-soft);color:var(--error)}
.export-modal[data-export-state=partial] .progress-track>div{background:var(--warning)}
.export-modal[data-export-state=stopped] .progress-track>div{background:var(--muted)}
.export-modal[data-export-state=failed] .progress-track>div{background:var(--error)}
.empty-icon{color:var(--primary)}
.empty-state h2{font-size:20px;line-height:28px}
.empty-state p{font-size:14px;line-height:24px;margin:8px 0 16px}
.toast{border-radius:10px;font-size:14px;line-height:22px;max-width:calc(100vw - 32px);border-color:var(--border);padding:12px 16px}
.toast.error{color:var(--error);border-color:#e8b8c6;background:#fff8fa}
.toast.error>svg{color:var(--error)}
.toast>button{width:44px;height:44px;flex-shrink:0}
.toast>button>svg{width:20px;height:20px}
.seo-content{font-size:14px;line-height:1.8}
.seo-content h2{font-size:22px;color:#102342}
.seo-content h3{font-size:18px;color:#102342}
.seo-content a{color:var(--primary);text-underline-offset:3px}
.seo-content details[open]>summary{color:var(--primary)}
.seo-content summary{min-height:44px}
.example-card{padding:18px;border-radius:12px}
.example-card>p{font-size:14px;line-height:24px}
.example-pair figcaption,.example-card .example-settings{font-size:12px;line-height:20px}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
@media(max-width:650px){
 :root{--brand-row:44px}
 .topbar .brand strong{font-size:14px;line-height:20px}
 .topbar .help-button{width:44px;height:44px}
 .workbench{padding:8px 8px 16px;gap:8px}
 /* Keep the fitted image stable while mobile browser toolbars expand/collapse.
    vh is the fallback for engines without the stable small-viewport unit. */
 .preview-panel{height:clamp(420px,68vh,740px);height:clamp(420px,68svh,740px)}
 .settings-panel{padding:4px 12px 0}
 .panel-heading{height:32px;min-height:32px;margin-bottom:2px}
 .panel-heading .reset{width:32px;height:32px;min-width:32px;min-height:32px}
 .panel-heading h2,.settings-panel h3{font-size:15px;line-height:22px}
 .settings-panel .control-label{font-size:14px;line-height:18px;margin-bottom:3px}
 .settings-panel .segments button{font-size:14px!important;min-height:36px;padding-block:4px}
 .settings-panel textarea,.settings-panel .font-color select,.settings-panel .template-fields input{font-size:16px;min-height:38px;padding-block:6px}
 .settings-panel textarea,.settings-panel .template-fields input{line-height:22px}
 .settings-panel .font-color select{height:38px;line-height:22px}
 .settings-panel .font-color{margin-top:6px}
 .settings-panel .color-field{height:38px;min-height:38px;padding:0}
 .settings-panel .color-field input{display:block;box-sizing:border-box;padding:4px;border-radius:7px}
 .settings-panel .toggle,.settings-panel .check-label{min-height:36px;font-size:14px}
 .settings-panel .slider-row{min-height:36px;gap:8px}
 .settings-panel .slider-row input{height:36px}
 .settings-panel .section-divider{margin:6px 0}
 .settings-panel h3{margin-bottom:6px}
 .slider-row>span,html:not([lang=zh-CN]) .slider-row>span,.tile-settings .slider-row>span{min-width:64px;font-size:14px}
 .slider-row>output,.tile-settings .slider-row>output{min-width:40px;font-size:14px}
 .settings-panel .position-grid{grid-template-columns:repeat(3,36px);gap:4px}
 .settings-panel .position-grid button{height:36px}
 .settings-panel .placement{padding-block:4px 2px}
 .settings-panel .placement>.control-label,html:not([lang=zh-CN]) .settings-panel .placement>.control-label{max-width:90px;overflow-wrap:anywhere}
 .settings-panel .placement p,html:not([lang=zh-CN]) .settings-panel .placement p{min-width:0;overflow-wrap:anywhere;font-size:12px;line-height:20px}
 .settings-panel .scope{margin-top:4px;padding-block:0 6px}
 .settings-panel .logo-drop{min-height:64px;padding:6px 10px}
 .settings-panel .logo-add{min-height:56px}
 .logo-drop>div>button{position:relative;min-height:32px}
 .logo-drop>div>button:before{content:"";position:absolute;inset:-6px -4px}
 .logo-drop>.icon-button{width:36px;height:36px;min-width:36px;min-height:36px}
 .settings-panel .template-select{min-height:36px;padding-block:6px;font-size:14px}
 .settings-panel .template-color{gap:8px;font-size:14px;line-height:20px}
 .template-color>span{min-width:0;overflow-wrap:anywhere}
 .settings-panel .template-color input{box-sizing:border-box;flex:0 0 70px;width:70px;height:38px;min-height:38px;padding:4px;border:1px solid var(--control-border);border-radius:8px;background:var(--field);cursor:pointer}
 .template-color .text-button{align-self:stretch;min-height:38px;min-width:0;max-width:45%;margin:0;margin-inline-start:auto;font-size:14px;line-height:20px;white-space:normal;overflow-wrap:anywhere}
 .settings-panel :is(.color-field,.template-color) input[type=color]::-webkit-color-swatch-wrapper{padding:0}
 .settings-panel :is(.color-field,.template-color) input[type=color]::-webkit-color-swatch{border:0;border-radius:3px}
 .settings-panel :is(.color-field,.template-color) input[type=color]::-moz-color-swatch{border:0;border-radius:3px}
 .preview-toolbar .original-button{min-width:44px;min-height:44px}
 .file-title>strong{font-size:12px;max-width:140px}
 .preview-tools .zoom-select select{font-size:12px}
 .photo-count>span{font-size:12px!important}
 .export-bar{padding:4px 10px max(4px,env(safe-area-inset-bottom));gap:4px}
 .export-bar .local-status{font-size:12px!important;line-height:16px}
 .export-controls{grid-template-columns:60px minmax(0,.85fr) minmax(0,1.4fr);align-items:stretch;min-height:40px;gap:6px}
 .export-controls .split-button{height:100%}
 /* Keep the native picker, but contain its platform-specific intrinsic width. */
 .export-bar .footer-select{position:relative;min-width:0;border-radius:8px;background:#fff}
 .export-bar .footer-select select{display:block;box-sizing:border-box;width:100%;min-width:0;max-width:100%;height:100%;min-height:38px;appearance:none;-webkit-appearance:none;background:transparent;padding:4px 20px 4px 8px;font-size:12px;border-radius:7px}
 .export-bar .footer-select:after{content:"";position:absolute;pointer-events:none;inset-inline-end:9px;top:calc(50% - 4px);width:6px;height:6px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg)}
 [dir=rtl] .export-bar .footer-select select{padding:4px 8px 4px 20px}
 .download-current,.download-all{font-size:14px!important;min-height:40px;padding-block:6px;line-height:20px}
 .download-all{padding-inline:8px;gap:4px}
 .split-caret{width:44px;min-width:44px;min-height:40px;padding:6px 8px}
 .export-actions{position:static}
 .export-actions .export-menu{bottom:calc(100% + 8px);right:12px}
 [dir=rtl] .export-actions .export-menu{right:auto;left:12px}
 .export-menu{padding:16px;max-width:calc(100vw - 24px)}
 .modal{padding:20px;max-height:calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
 .modal>header h2{font-size:20px;line-height:28px}
 .modal>header .icon-button{width:44px;height:44px}
 .template-modal{padding:0}
 .template-modal>header{padding:8px 12px 4px}
 .template-modal>header h2{font-size:18px;line-height:26px}
 .template-note{font-size:13px;line-height:20px;padding-inline:14px}
 .template-categories{padding:6px 12px 10px;gap:6px}
 .template-categories button{font-size:13px;min-height:44px;padding:6px 8px;gap:5px}
 .template-grid{gap:10px}
 .template-card-label{padding:8px;gap:2px;min-height:48px}
 .template-list{padding:0 12px 12px}
 .export-modal h3{font-size:22px;line-height:30px}
 .export-result-icon{width:56px;height:56px;margin-block:16px}
 .export-description{margin:12px 0 16px}
 .modal-actions{gap:12px;margin-top:16px}
 .toast{bottom:calc(92px + env(safe-area-inset-bottom));inset-inline:12px;max-width:none;padding:8px 12px}
 .seo-content{padding:24px 20px max(132px,calc(112px + env(safe-area-inset-bottom)));gap:24px}
 .seo-content h2{font-size:20px}
 .example-card{padding:14px}
}
@media(max-width:380px){
 html[lang^=zh] .export-controls{grid-template-columns:60px minmax(0,.75fr) minmax(0,1.5fr)}
 .download-current{padding-inline:7px}
 .download-all{padding-inline:6px}
 .download-all>svg{display:none}
 html:not([lang^=zh]) .download-current,html:not([lang^=zh]) .download-all{font-size:13px!important}
}
@media(max-width:900px) and (max-height:480px){
 /* Keep category rows from consuming the template names on short screens. */
 .template-categories{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;overscroll-behavior-x:contain;scrollbar-width:thin;touch-action:pan-x}
 .template-categories button{flex:0 0 auto}
}
@media(prefers-reduced-motion:reduce){.app-shell *,.app-shell *:before,.app-shell *:after{transition-duration:.01ms!important;animation-duration:.01ms!important}}

/* Usability pass: contextual feedback, mobile navigation and stable overlays. */
.export-status-row{display:flex;align-items:center;gap:8px;min-width:0;flex:1}
.export-status-row .local-status{min-width:0;overflow-wrap:anywhere}
.local-status[data-kind=error]{color:var(--error,#C51C4C)}
.local-status[data-kind=error] .status-dot{background:var(--error,#C51C4C);box-shadow:none}
.local-status[data-kind=busy] .status-dot{background:var(--primary,#0061FF)}
.mobile-workflow-nav{display:none}
.toast>svg{flex-shrink:0}
.toast>span{flex:1;min-width:0;overflow-wrap:anywhere}
.toast>button{margin-inline-start:auto}
.app-shell:has(.export-menu,.modal-backdrop)>.toast{visibility:hidden;pointer-events:none}
.modal-backdrop,.modal,.template-list{overscroll-behavior:contain}
.help-modal{display:flex;flex-direction:column;overflow:hidden}
.help-modal>header,.help-modal>.modal-primary{flex-shrink:0}
.help-modal>.help-content{min-height:0;overflow-y:auto;overscroll-behavior:contain}
@media(min-width:651px) and (max-height:599px){
 .app-shell{min-height:100dvh;grid-template-rows:var(--brand-row) minmax(0,1fr) auto}
}
@media(max-width:650px){
 html{scroll-padding-bottom:calc(var(--qy-export-height,81px) + 16px)}
 .export-status-row{width:100%;flex:none;justify-content:space-between;gap:8px}
 .export-status-row .local-status{flex:1;line-height:18px}
 .mobile-workflow-nav{display:block;flex-shrink:0;min-height:28px;min-width:72px;max-width:40%;padding:4px 10px;border:1px solid var(--primary,#0061FF);border-radius:8px;background:var(--primary-soft,#EDF5FF);color:var(--primary,#0061FF);font-size:13px;font-weight:600;line-height:18px;overflow-wrap:anywhere}
 .mobile-workflow-nav:hover:not(:disabled){background:#DFECFF}
 .mobile-workflow-nav:focus-visible{outline:3px solid #0061FF;outline-offset:2px}
 .export-actions .export-menu{max-height:calc(100dvh - var(--qy-export-height,81px) - 24px);overflow-y:auto;overscroll-behavior:contain}
 /* The measured footer height already includes the safe-area padding. */
 .toast{bottom:calc(var(--qy-export-height,81px) + 12px)}
 .settings-panel :is(input,textarea,select,button){scroll-margin-block:12px calc(var(--qy-export-height,81px) + 12px)}
}
