/* Shared editor shell, based on the garage's existing mint/cream palette. */
#custom-editor{box-sizing:border-box;width:100%;height:100%;max-width:none;max-height:none;margin:0;border:0;background:#fff8e8;color:#213e3b;padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));font-family:system-ui,sans-serif}
#custom-editor[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px}#custom-editor [hidden]{display:none!important}
.editor-head,.editor-footer{display:flex;gap:10px;align-items:center;justify-content:space-between}.editor-head h2{margin:0;font-size:1.25rem}.editor-body{min-height:0;display:grid;grid-template-columns:minmax(0,1.1fr) minmax(300px,1fr);gap:16px}.editor-preview{min-height:0;overflow:hidden;background:#d9f0e3;border-radius:22px;position:relative;display:grid;place-items:center}.editor-preview #stage{width:100%;height:100%;min-height:0;touch-action:none;cursor:grab}.editor-options{min-height:0;overflow:auto;overscroll-behavior:contain;padding:4px 8px 20px}.editor-options fieldset{border:1px solid #c4dfd1;border-radius:15px;margin:10px 0;padding:9px;min-inline-size:0}.editor-options legend{font-weight:bold}.editor-options input[type=text]{width:95%;font-size:1.1rem}.editor-options label{display:block;margin:8px 0}.editor-options select{max-width:100%;font-size:1rem}.editor-options input,.editor-options button,.editor-options select,.editor-head button,.editor-footer button,.vehicle-confirmation button{box-sizing:border-box;min-height:44px;border:1px solid #b9c9bd;border-radius:13px;background:#fffdf6;color:#213e3b;padding:8px 12px;font-weight:bold}.editor-footer button:last-child{background:#d9f0e3;min-width:110px}.editor-options button:disabled{opacity:.45}.editor-options button[aria-pressed=true]{outline:3px solid #17685a;outline-offset:-3px}.color-palette{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:5px}.editor-options .color-palette button{min-width:0;padding:0;min-height:44px;border:2px solid #ffffff;box-shadow:0 0 0 1px #9daea1;border-radius:12px;background:var(--swatch)}.color-palette button[aria-pressed=true]{outline:3px solid #132b36;outline-offset:-5px}.pattern-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.editor-choices{display:flex;flex-wrap:wrap;gap:6px}.editor-message{margin:0;min-height:1.2em}#custom-models{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}#custom-models button{min-height:90px;background:#d9f0e3;font-size:1.25rem}
#garage #garage-detail{height:calc(100dvh - 2 * clamp(12px,3vw,28px));max-width:1200px;display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,1fr);grid-template-rows:auto minmax(0,1fr);gap:12px}#garage-detail>.garage-detail-top{grid-column:1/-1}#garage-detail>.garage-display{min-height:0;align-self:stretch}#garage-preview{height:100%;margin:0}#garage-preview #stage{height:100%;width:100%}#garage-name-form{min-height:0;overflow:auto;display:flex;flex-direction:column;gap:8px}.garage-footer{position:sticky;bottom:0;background:#fff8e8;padding:10px 0;z-index:1}.garage-panels{flex:1}.garage-actions{grid-template-columns:repeat(3,minmax(0,1fr))}#garage .garage-actions button{min-height:60px}.vehicle-confirmation{border:1px solid #c4dfd1;border-radius:20px;background:#fff8e8;color:#213e3b;max-width:90vw}.vehicle-confirmation button{margin:5px;min-width:90px}
@media(max-aspect-ratio:1/1){.editor-body{grid-template-columns:1fr;grid-template-rows:minmax(160px,35%) minmax(0,1fr)}#garage #garage-detail{grid-template-columns:1fr;grid-template-rows:auto minmax(160px,32%) minmax(0,1fr)}.editor-options{padding-bottom:12px}}
@media(max-height:430px) and (min-aspect-ratio:1/1){#custom-editor{gap:5px;padding:6px}.editor-head h2{font-size:1rem}.editor-body{grid-template-columns:minmax(0,1fr) minmax(270px,1fr)}#garage #garage-detail{height:calc(100dvh - 24px)}.garage-top{margin-bottom:0!important;min-height:44px!important}}
#garage{padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}#garage #garage-detail{height:calc(100dvh - max(12px,env(safe-area-inset-top)) - max(12px,env(safe-area-inset-bottom)));align-items:stretch;align-content:stretch}#garage-name-form{height:100%;max-height:100%;min-width:0;box-sizing:border-box}

/* v2: fixed preview/tabs/footer, only panel contents scroll. */
#custom-editor{height:var(--editor-height,100dvh)}.editor-column{display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;min-height:0;overflow:hidden;gap:9px}#custom-options{min-height:0;overflow:auto;overscroll-behavior:contain;padding:4px 8px 18px}#custom-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}#custom-tabs:has(button:first-child[data-tab=tire]){grid-template-columns:repeat(4,minmax(0,1fr))}#custom-tabs button{min-width:0;min-height:48px;border:2px solid #bed3c7;border-radius:14px;background:#fffdf6;font-size:1.3rem;padding:5px;cursor:pointer}#custom-tabs [aria-selected=true]{background:#d9f0e3;border:3px solid #17685a}#custom-settings>[data-tab]{display:block}#custom-settings>[hidden]{display:none!important}.pattern-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.pattern-grid button{aspect-ratio:1;min-height:58px;padding:5px!important}.pattern-grid img,#custom-sizes img{width:100%;height:100%;object-fit:contain;border-radius:8px;display:block}.pattern-grid [aria-pressed=true],#custom-sizes [aria-pressed=true]{outline:4px solid #17685a!important;outline-offset:-4px!important}#custom-sizes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}#custom-sizes button{height:78px;padding:5px}#custom-view-reset{position:absolute;right:10px;top:10px;z-index:2;width:44px;height:44px;border-radius:14px;border:1px solid #a6c5b5;background:#fff8e8;color:#213e3b;font-size:1.6rem;cursor:pointer}#custom-done,#custom-movie{min-height:48px;border-radius:14px;border:1px solid #b4cabb;background:#d9f0e3;padding:8px 16px;color:#213e3b;font-weight:bold}#custom-movie{min-width:48px;font-size:1.35rem}.editor-message{flex:1;font-size:.85rem}.editor-footer{justify-content:flex-end}.editor-footer button:last-child{min-width:48px}#custom-done{min-width:110px}#custom-delete{min-width:44px}#custom-name{scroll-margin:12px}#custom-settings select{width:100%;min-height:48px}.editor-preview{align-self:stretch}#custom-settings input[type=checkbox]{width:24px;height:24px;vertical-align:middle}
@media(max-aspect-ratio:1/1){.editor-body{grid-template-rows:minmax(135px,35%) minmax(0,1fr)}}
@media(max-height:500px){.editor-head h2{font-size:1rem}#custom-options{padding-bottom:8px}.editor-body{min-height:0}.editor-preview{min-height:100px}#custom-tabs button{min-height:44px}.editor-head button{min-height:44px}}

/* Stable settings geometry and reusable image choices. */
.editor-options{overflow-anchor:none}.editor-driver-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(76px,1fr));gap:8px;margin-top:8px}.editor-driver-cards button{min-height:80px;padding:4px;border:3px solid transparent;border-radius:12px;background:#f7f4df}.editor-driver-cards button[aria-pressed=true]{border-color:#ef8b32;background:#fff4c9}.editor-driver-cards img{width:100%;height:76px;object-fit:contain;display:block}.pattern-grid img,#custom-sizes img{width:100%;height:100%;object-fit:contain}#custom-tabs button{display:flex;align-items:center;justify-content:center}#custom-tabs svg{display:block;flex:none}#custom-preview canvas{touch-action:none}

.vehicle-confirmation{box-sizing:border-box;max-width:calc(100vw - 32px)}
.vehicle-confirmation-actions{display:flex;justify-content:flex-end;gap:8px}
