/* The account browser fills My Snakes. Only the editor uses the large left preview. */
#studio-form .studio-selects{grid-template-columns:repeat(4,minmax(0,1fr))}
#studio-form .studio-colors{grid-template-columns:repeat(5,minmax(0,1fr))}
@media(orientation:landscape) and (max-height:600px){
 .dashboard .studio-heading h2{font-size:22px}
 #dash-studio-host .studio-category{padding:5px;gap:3px}
 #dash-studio-host .studio-category strong{font-size:20px}
 #dash-studio-host .studio-category small{font-size:8px}
 #dash-studio-host .studio-category canvas,#dash-studio-host .studio-model canvas{max-height:calc(100% - 32px)}
 #dash-studio-host .studio-empty-icon{font-size:35px}
 #studio-purchase{padding:14px}.studio-purchase-art canvas{max-height:200px}
 .studio-purchase-info{gap:8px}.studio-purchase-info h2{font-size:24px}
}
@media(orientation:landscape) and (max-height:340px){
 .dashboard[data-tab=snakes] .dash-heading{display:none}
 .dashboard .studio-heading h2{font-size:18px}
 #dash-studio-host .studio-category{display:grid;grid-template-columns:minmax(40px,.8fr) 1fr;grid-template-rows:1fr 1fr;padding:4px 8px;gap:0 5px;text-align:left}
 #dash-studio-host .studio-category canvas,#dash-studio-host .studio-empty-icon{grid-row:1/3;max-height:100%;height:100%;width:100%;max-width:90px;justify-self:center}
 #dash-studio-host .studio-category strong{font-size:16px;align-self:end}
 #dash-studio-host .studio-category small{font-size:6px;align-self:start}
 #dash-studio-host .studio-favorite .studio-model{flex-direction:column}
 #dash-studio-host .studio-favorite .studio-model canvas{flex:1;max-height:calc(100% - 16px);width:100%;height:100%}
 #dash-studio-host .studio-model strong{font-size:9px}
 .studio-purchase-info p{font-size:10px}.studio-purchase-info{gap:6px}
 .studio-purchase-art canvas{max-height:175px}.studio-purchase-info .play-button{min-height:32px}
}
@media(orientation:portrait) and (max-width:760px){
 #dash-studio-host #snake-studio[data-stage=categories] .studio-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr))}
 #dash-studio-host .studio-category strong{font-size:23px}
 #dash-studio-host .studio-category small{font-size:8px}
}

/* Give artwork a real grid track, not a percentage-height canvas inside a
   shrinking flex button. Favorites used to collapse this space to zero. */
#dash-studio-host .studio-category,#dash-studio-host .studio-model{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto auto;justify-items:center;align-content:stretch;text-align:center}
#dash-studio-host .studio-category>*{grid-column:1;grid-row:auto}
#dash-studio-host .studio-favorite{display:grid;grid-template-rows:minmax(0,1fr) auto}
#dash-studio-host .studio-favorite>.studio-model{display:grid;grid-template-rows:minmax(0,1fr) auto;gap:6px;padding:10px}
.studio-card-art{display:block;position:relative;width:100%;height:100%;min-height:0;min-width:0;overflow:hidden}
#dash-studio-host .studio-card-art{display:block;grid-row:1;max-width:none;justify-self:stretch}
#dash-studio-host #studio-grid .studio-card-art canvas,.studio-purchase-art .studio-card-art canvas{position:absolute;inset:0;display:block;width:100%;height:100%;max-height:none;max-width:none;object-fit:contain;margin:0;flex:none}
#dash-studio-host .studio-empty-icon{grid-row:1;max-width:none;font-size:52px}
.studio-purchase-art .studio-card-art{height:230px}
.studio-browse-note{margin:0;color:#bdaa85;font:10px/1.3 var(--text);flex:none}
#studio-grid:focus-visible{outline:1px solid #d8ac58;outline-offset:-2px}
#studio-status:empty{display:none}

/* Editor: one live snake, three visual tabs, a separately scrolling panel and
   an always reachable Save/Back. No whole-page scroll or tiny squeezed cards. */
#studio-editor-host #studio-editor{align-items:stretch;overflow:hidden}
#studio-editor-host #studio-form{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;align-items:stretch;gap:12px;height:100%;min-height:0}
.studio-custom-tabs{display:flex;gap:6px;border-bottom:1px solid #d0a45333;padding-bottom:8px}
.studio-custom-tabs button{flex:1;min-width:0;min-height:42px;padding:8px;border:1px solid #c6a66033;border-radius:9px;background:#152022e8;color:#cabb9a;font:600 13px var(--text)}
.studio-custom-tabs button[aria-selected=true]{background:linear-gradient(130deg,#97703350,#4e382132);border-color:#e7b950;color:#ffe0a1;box-shadow:inset 0 -2px #e7b950}
.studio-custom-tabs button:focus-visible,.studio-choice:focus-visible{outline:2px solid #ffe1a2;outline-offset:2px}
.studio-custom-panels{height:100%;min-height:0;overflow:hidden;align-self:stretch}
.studio-custom-panel{height:100%;min-height:0;box-sizing:border-box;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;touch-action:pan-y pinch-zoom;scrollbar-width:thin;scrollbar-color:#bb995960 #121b1e;padding:3px 8px 10px 3px}
.studio-custom-panel h3{font:600 13px var(--text);color:#f1d69d;margin:16px 0 10px}
.studio-custom-note{font:11px/1.45 var(--text);color:#beaf91;margin:0 0 10px}
.studio-choice-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:14px}
.studio-choice{display:grid;grid-template-rows:minmax(0,1fr) auto auto;align-items:center;justify-items:center;min-width:0;height:180px;padding:8px;gap:4px;border:1px solid #b9914f50;border-radius:12px;background:radial-gradient(ellipse at 50% 32%,#8f682932,transparent 76%),#142022e8;color:#edddbd;position:relative;touch-action:pan-y}
.studio-choice canvas{width:100%;height:100%;min-height:0;object-fit:contain;pointer-events:none}
.studio-choice strong{font:600 11px/1.25 var(--text);text-align:center}
.studio-choice small{font:9px var(--text);color:#baa780}
.studio-choice[aria-pressed=true]{border-color:#f1c761;background:radial-gradient(ellipse at 50% 32%,#bb852950,transparent 85%),#1d2927;box-shadow:inset 0 0 0 1px #f1c76166}
.studio-choice[aria-pressed=true]::after{content:'✓';position:absolute;right:6px;top:5px;background:#f1c761;color:#16201f;border-radius:50%;width:19px;height:19px;text-align:center;line-height:19px;font:700 13px/19px var(--text)}
.studio-choice:disabled{opacity:.45;cursor:default}
#studio-form .studio-custom-panel .studio-colors{grid-template-columns:repeat(3,minmax(0,1fr));margin:12px 0}
#studio-form .studio-custom-panel .studio-selects{grid-template-columns:1fr}
.studio-savebar{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:end;gap:8px;border-top:1px solid #c3a3593a;padding-top:10px}
.studio-savebar:has(#studio-copy[hidden]){grid-template-columns:minmax(0,1fr) auto}
#studio-form .studio-savebar .studio-name-label{grid-column:auto;min-width:0}
#studio-form .studio-savebar .play-button{min-height:42px;padding:10px 16px;font-size:12px}
#studio-form .studio-savebar .studio-small{min-height:42px}
@media(max-width:1100px){.studio-choice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(orientation:landscape) and (max-height:600px){
 #studio-editor-host #studio-form{gap:6px}
 #studio-editor-host #snake-studio{gap:6px}
 .studio-custom-tabs{gap:4px;padding-bottom:4px}
 .studio-custom-tabs button{min-height:34px;padding:5px;font-size:11px}
 .studio-custom-note{font-size:9px;margin-bottom:7px}
 .studio-choice-grid{gap:7px;margin-bottom:10px}
 .studio-choice{height:148px;padding:6px}
 .studio-choice strong{font-size:11px}
 .studio-savebar{gap:5px;padding-top:5px}
 #studio-form .studio-savebar .studio-name-label>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 #studio-form .studio-savebar input,#studio-form .studio-savebar .studio-small,#studio-form .studio-savebar .play-button{height:36px;min-height:36px;font-size:10px;padding:5px 8px}
 #studio-editor-host #studio-status:not([data-error=true]){display:none}
 #studio-editor-host .studio-heading h2{font-size:20px}
}

/* A phone gets large cards and a bounded touch-scroll list. Header, tabs and
   Back remain outside it; the page and the arena never start scrolling. */
@media(max-width:760px),(orientation:landscape) and (max-height:600px),(pointer:coarse) and (max-width:1200px){
 .dashboard[data-tab=snakes] .dash-heading{display:none}
 .dashboard[data-tab=snakes]{padding:8px 0;gap:6px}
 .dashboard[data-tab=snakes] .dash-tabs{margin-bottom:7px;padding-bottom:5px}
 .dashboard[data-tab=snakes] .dash-tabs button{min-height:36px;font-size:12px;padding:6px}
 #dash-studio-host #snake-studio{gap:6px;overflow:hidden}
 #dash-studio-host .studio-heading{min-height:38px;gap:8px}
 #dash-studio-host .studio-heading h2{font-size:22px;line-height:1.1}
 #dash-studio-host .studio-heading .studio-small{min-height:38px;font-size:11px;padding:6px 10px}
 #dash-studio-host #studio-browser{overflow:hidden;gap:5px}
 #dash-studio-host #studio-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:clamp(208px,calc(100dvh - 184px),320px);align-content:start;gap:12px;padding:2px 5px 10px 2px;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;touch-action:pan-y pinch-zoom;scrollbar-width:thin;scrollbar-color:#cba95b70 #121b1e;-webkit-overflow-scrolling:touch}
 #dash-studio-host #snake-studio[data-stage=categories] #studio-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none}
 #dash-studio-host .studio-category,#dash-studio-host .studio-model{padding:10px;gap:6px;border-radius:12px;min-height:0}
 #dash-studio-host .studio-category:last-child{grid-column:auto}
 #dash-studio-host .studio-category strong{font-size:24px;line-height:1.05;align-self:center}
 #dash-studio-host .studio-category small,#dash-studio-host .studio-model small{font:10px/1.3 var(--text);letter-spacing:.15px;align-self:center}
 #dash-studio-host .studio-model strong,#dash-studio-host .studio-favorite .studio-model strong{font-size:14px;line-height:1.3;min-height:18px}
 #dash-studio-host .studio-favorite{border-radius:12px}
 #dash-studio-host .studio-favorite-actions{padding:6px;gap:6px;background:#10191be8;border-top:1px solid #c7a35420}
 #dash-studio-host .studio-favorite-actions button{min-height:44px;font-size:12px;padding:6px;touch-action:manipulation}
 #dash-studio-host .studio-favorite-actions button:last-child{flex:0 0 44px}
 #dash-studio-host .studio-favorite-actions button:first-child{background:#d9ad5030;border-color:#c49a4a80;color:#ffe3a3}
 #dash-studio-host .studio-empty{align-self:start}
}
/* Independent Cartoon faces; large touch targets and the existing panel scroll. */
#studio-head-grid .studio-choice{height:190px}
#studio-head-grid .studio-choice:has(canvas[data-ready="false"])::before{content:'Loading…';position:absolute;top:12px;color:#cbbb99;font-size:10px}
#studio-head-grid .studio-choice:has(canvas[data-ready="unavailable"])::before{content:'Tap to retry';position:absolute;top:45%;color:#ffd095;font-size:12px}
.studio-custom-tabs button[hidden]{display:none}
@media(orientation:landscape) and (max-height:600px){#studio-head-grid .studio-choice{height:164px}.studio-custom-tabs button{font-size:10px;padding-inline:3px}}
