/* Tileset Creator — studio workspace: command bar, settings sidebar, large map / sheet canvas. */
.tc-studio{--tc-a:#b993f1}
.tc-hero{padding:6px 0 18px}.tc-hero p{max-width:900px}
.tc-workspace{border:1px solid var(--studio-border);border-radius:18px;background:var(--studio-bg);overflow:hidden;display:flex;flex-direction:column}
.tc-command{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between;padding:10px 12px;background:#1d1a2a;border-bottom:1px solid var(--studio-border)}
.tc-brand{display:flex;gap:10px;align-items:center}.tc-brand>span{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;background:linear-gradient(135deg,#7d4fd0,#c26bf0);font-size:20px;color:#fff}.tc-brand strong{display:block;font-size:15px;line-height:1.2}.tc-brand small{display:block;font-size:12px;color:var(--studio-muted);line-height:1.3}
.tc-actions{display:flex;flex-wrap:wrap;gap:6px}
.tc-studio button,.tc-studio .tc-file{min-height:38px;padding:6px 12px;border-radius:9px;border:1px solid #5c4b72;background:#2a2238;color:#efe6ff;font:600 13.5px/1.2 inherit;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:5px;white-space:nowrap}
.tc-studio button:hover:not(:disabled),.tc-studio .tc-file:hover{background:#3a2e50}
.tc-studio .tc-primary{background:linear-gradient(135deg,#8a56dd,#c06cf2);border-color:transparent;color:#fff}
.tc-studio button[aria-pressed=true]{background:#4a3870;border-color:var(--tc-a)}
.tc-file{position:relative}.tc-file input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%}
.tc-editor{display:grid;grid-template-columns:330px minmax(0,1fr);min-height:640px;height:min(80vh,860px)}
.tc-sidebar{border-right:1px solid var(--studio-border);background:#1b1828;display:flex;flex-direction:column;min-height:0}
.tc-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:3px;padding:8px 8px 0;border-bottom:1px solid var(--studio-border)}
.tc-studio .tc-tabs button{min-height:34px;border:0;border-radius:8px 8px 0 0;background:transparent;color:var(--studio-muted);font-size:13px}
.tc-studio .tc-tabs button[aria-selected=true]{background:#2a2238;color:#fff;box-shadow:inset 0 2px 0 var(--tc-a)}
.tc-pane{flex:1;overflow:auto;padding:12px 14px 20px}.tc-pane[hidden]{display:none}
.tc-pane label{display:flex;flex-direction:column;gap:5px;font-size:13px;color:#ddd2ee;margin:0 0 12px}
.tc-pane label output{color:var(--studio-muted);font-weight:400}
.tc-studio .tc-pane :is(select,input[type=number]){height:36px;min-height:0;padding:4px 9px;border-radius:8px;border:1px solid #5c4b72;background:var(--studio-input);color:#fff;font-size:13.5px;width:100%}
.tc-studio input[type=range]{accent-color:var(--tc-a);width:100%}
.tc-studio input[type=checkbox]{accent-color:var(--tc-a);width:16px;height:16px;margin:0}
.tc-pair{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.tc-checks{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}.tc-pane .tc-checks label,.tc-pane label.tc-checks{flex-direction:row;align-items:center;gap:8px;margin:0}
.tc-seed{display:flex;gap:6px}.tc-seed input{flex:1}
.tc-help{font-size:12.5px;line-height:1.55;color:var(--studio-muted);margin:4px 0 12px}
.tc-pane h3{font-size:15px;margin:6px 0 6px}.tc-sub{font-size:12px;font-weight:700;color:var(--tc-a);text-transform:uppercase;letter-spacing:.06em;margin:8px 0 6px}
.tc-grid-list{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.tc-item{display:flex;align-items:center;gap:8px;padding:5px 6px;border:1px solid #3e3352;border-radius:9px;background:#221d30;cursor:pointer;font-size:12.5px;color:#e6dcf5;margin:0!important;flex-direction:row!important}
.tc-item canvas{width:32px;height:32px;image-rendering:pixelated;border-radius:5px;background:#120f1b;flex:none}
.tc-item:has(input:checked){border-color:var(--tc-a);background:#2c2440}
.tc-item span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tc-group{grid-column:1/-1;font-size:11.5px;font-weight:700;color:var(--tc-a);text-transform:uppercase;letter-spacing:.06em;margin-top:6px}
.tc-chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px}.tc-chips label{flex-direction:row!important;align-items:center;gap:6px;padding:5px 10px;border:1px solid #4a3e62;border-radius:999px;margin:0!important;cursor:pointer}.tc-chips label:has(input:checked){border-color:var(--tc-a);background:#2c2440}
.tc-auto{border:1px solid #3e3352;border-radius:12px;padding:10px;margin-bottom:10px;background:#211c2f}
.tc-auto-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:13px;font-weight:700}
.tc-studio .tc-auto-head button{min-height:28px;padding:2px 9px;font-size:12px}
.tc-auto .tc-pair label{margin-bottom:8px}
.tc-row{display:flex;gap:6px;margin-bottom:8px}.tc-studio .tc-row button{min-height:30px;font-size:12.5px}
.tc-studio .tc-wide{width:100%}
.tc-stack{display:grid;gap:7px;margin:8px 0 12px}
.tc-soon{margin-top:14px;padding:10px 12px;border:1px dashed #5c4b72;border-radius:10px;font-size:12.5px;color:var(--studio-muted);line-height:1.5}
.tc-main{display:flex;flex-direction:column;min-width:0;min-height:0}
.tc-viewbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:8px 10px;border-bottom:1px solid var(--studio-border);background:#1d1a2a}
.tc-seg{display:inline-flex;border:1px solid #5c4b72;border-radius:10px;overflow:hidden}.tc-studio .tc-seg button{border:0;border-radius:0;min-height:34px;padding:4px 11px;font-size:13px}
.tc-maptools{display:flex;flex-wrap:wrap;gap:6px;align-items:center}.tc-maptools[hidden]{display:none}
.tc-studio .tc-viewbar select{height:34px;min-height:0;padding:2px 8px;border-radius:8px;border:1px solid #5c4b72;background:var(--studio-input);color:#fff;font-size:13px;max-width:170px}
.tc-inline{display:inline-flex;gap:6px;align-items:center;font-size:13px;color:#ddd2ee}.tc-zoom{margin-left:auto}
.tc-stage{position:relative;flex:1;overflow:auto;background:#0f0d16;min-height:0}
.tc-stage.sheet{background-color:#1a1724;background-image:linear-gradient(45deg,#24202f 25%,transparent 25%),linear-gradient(-45deg,#24202f 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#24202f 75%),linear-gradient(-45deg,transparent 75%,#24202f 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0}
#tcCanvas{display:block;image-rendering:pixelated;margin:0 auto;cursor:crosshair;touch-action:none}#tcCanvas:focus-visible{outline:3px solid var(--tc-a)}
.tc-busy{position:absolute;left:50%;top:16px;transform:translateX(-50%);background:#1d1a2af0;border:1px solid #5c4b72;border-radius:12px;padding:10px 14px;display:flex;flex-direction:column;gap:6px;min-width:240px;font-size:13px;color:#fff;box-shadow:0 8px 30px #000a}.tc-busy progress{width:100%;accent-color:var(--tc-a)}
.tc-tip{position:absolute;pointer-events:none;background:#000c;color:#fff;font:12px/1.4 system-ui;padding:3px 8px;border-radius:6px;display:none;white-space:nowrap}
.tc-status{margin:0;padding:7px 12px;font-size:13px;color:#ddd2ee;background:#1d1a2a;border-top:1px solid var(--studio-border);min-height:20px}.tc-status[data-error=true]{color:#ffb4c4}
.tc-workspace:fullscreen,.tc-workspace.tc-full{position:fixed;inset:0;z-index:1000;border-radius:0;border:0}.tc-workspace:fullscreen .tc-editor,.tc-workspace.tc-full .tc-editor{flex:1;height:auto}
@media(max-width:1000px){.tc-editor{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;height:auto}.tc-main{order:-1}.tc-stage{height:58vh;flex:none}.tc-sidebar{border-right:0;border-top:1px solid var(--studio-border)}.tc-pane{overflow:visible}
 .tc-workspace:fullscreen,.tc-workspace.tc-full{overflow-y:auto;display:block}.tc-workspace:fullscreen .tc-editor,.tc-workspace.tc-full .tc-editor{height:auto}.tc-zoom{margin-left:0}}
@media(max-width:600px){.tc-command{padding:8px}.tc-actions{display:grid;grid-template-columns:repeat(3,1fr);width:100%}.tc-studio .tc-actions :is(button,.tc-file){padding:6px 4px;font-size:12.5px}.tc-actions #tcZip{grid-column:span 2}.tc-tabs{grid-template-columns:repeat(3,1fr)}.tc-grid-list{grid-template-columns:1fr}.tc-studio .tc-viewbar select{max-width:120px}}
/* phones: brushes wrap instead of overflowing; the stage hugs the map instead of a fixed tall box */
@media(max-width:600px){.tc-seg#tcBrushes{display:grid;grid-template-columns:repeat(4,1fr);width:100%}.tc-studio #tcBrushes button{padding:4px 2px;font-size:12px;border-right:1px solid #3e3352}.tc-stage{height:auto;min-height:220px;max-height:70vh}}
/* v1.1: tile types, library, sliders with reset */
.tc-typelist{display:flex;flex-direction:column;gap:4px;margin-bottom:8px}
.tc-type{display:grid;grid-template-columns:36px minmax(0,1fr) auto;gap:8px;align-items:center;padding:5px 6px;border:1px solid #3e3352;border-radius:10px;background:#221d30;cursor:pointer}
.tc-type[aria-current=true]{border-color:var(--tc-a);background:#2c2440}
.tc-type canvas{width:36px;height:36px;image-rendering:pixelated;border-radius:6px}.tc-type b{display:block;font-size:13px;line-height:1.2}.tc-type small{display:block;font-size:11.5px;color:var(--studio-muted);line-height:1.3}
.tc-studio .tc-type .tc-mini{min-height:26px;width:26px;padding:0;font-size:12px}
.tc-type-tools{display:flex;gap:2px}
.tc-library{border:1px solid #4a3e62;border-radius:12px;padding:8px;margin:8px 0;background:#1d1829}
.tc-lib-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.tc-studio .tc-lib-grid button{flex-direction:column;min-height:0;padding:5px;font-size:11.5px;gap:3px;white-space:normal;line-height:1.2}.tc-lib-grid canvas{width:48px;height:48px;image-rendering:pixelated;border-radius:6px}
.tc-type-editor{border-top:1px solid var(--studio-border);margin-top:10px;padding-top:10px}
.tc-type-editor h3{font-size:15px;margin:0 0 8px}
.tc-preview{display:flex;gap:10px;align-items:center;margin-bottom:10px}.tc-preview canvas{width:144px;height:144px;image-rendering:pixelated;border-radius:8px;border:1px solid #3e3352;flex:none}
.tc-colors{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-bottom:10px}.tc-colors label{margin:0!important;font-size:12px!important}
.tc-studio .tc-colors input[type=color]{width:100%;height:34px;padding:2px;border:1px solid #5c4b72;border-radius:8px;background:var(--studio-input)}
.tc-slider{margin:0 0 10px}.tc-slider label{display:flex!important;flex-direction:row!important;align-items:center;gap:6px;margin:0 0 4px!important}.tc-slider label output{margin-left:auto}
.tc-studio .tc-reset{min-height:22px;width:22px;padding:0;border-radius:6px;font-size:12px;line-height:1;visibility:hidden}.tc-slider.changed .tc-reset{visibility:visible}
.tc-brushes{flex-wrap:wrap}
.tc-sw{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:2px;border:1px solid #0006}
.tc-studio .tc-pane input:not([type]),.tc-studio .tc-pane input[type=text]{height:36px;min-height:0;padding:4px 9px;border-radius:8px;border:1px solid #5c4b72;background:var(--studio-input);color:#fff;font-size:13.5px;width:100%}
.tc-hero .studio-benefits{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}.tc-hero .studio-benefits span{padding:5px 11px;border:1px solid #5c4b72;border-radius:999px;background:#2a2238;font-size:12.5px;color:#e7d9f8}

/* v1.2 map editor: stage + layers/tile palette side panel */
.tc-mapwrap{flex:1;display:grid;grid-template-columns:minmax(0,1fr) 300px;min-height:0}.tc-mapwrap .tc-stage{min-height:0}
.tc-mapwrap.sheet{grid-template-columns:minmax(0,1fr)}.tc-mapwrap.sheet .tc-side{display:none}
.tc-side{border-left:1px solid var(--studio-border);display:flex;flex-direction:column;gap:6px;padding:8px;min-height:0;overflow:hidden;background:#15121d}
.tc-side .tc-sub{margin:2px 0 0;display:flex;align-items:center;gap:6px}.tc-side .tc-sub small{font-weight:400;opacity:.7;font-size:11px}
.tc-side-row{display:flex;align-items:center;gap:6px;justify-content:space-between;flex-wrap:wrap}.tc-side-row select{flex:1;min-width:0}
.tc-layers{display:grid;gap:3px}.tc-layer{display:flex;gap:3px}
.tc-studio .tc-layer button[data-layer]{flex:1;display:flex;align-items:center;gap:6px;justify-content:flex-start;min-height:30px;padding:3px 8px;font-size:13px;text-align:left}
.tc-studio .tc-layer button[data-layer] b{display:inline-grid;place-items:center;width:18px;height:18px;border-radius:5px;background:#ffffff18;font-size:11px}
.tc-studio .tc-layer button[data-layer] small{margin-left:auto;opacity:.6;font-size:11px}
.tc-studio .tc-layer button[aria-pressed=true]{background:#7a5cff;color:#fff;border-color:#9b84ff}
.tc-studio .tc-layer [data-eye][aria-pressed=false]{opacity:.55}
.tc-palette{flex:1;min-height:140px;overflow:auto;border-radius:8px;background-color:#1a1724;background-image:linear-gradient(45deg,#24202f 25%,transparent 25%),linear-gradient(-45deg,#24202f 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#24202f 75%),linear-gradient(-45deg,transparent 75%,#24202f 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0}
#tcPalette{display:block;width:100%;image-rendering:pixelated;cursor:crosshair;touch-action:none}.tc-palette.big #tcPalette{width:auto}
.tc-keys{font-size:11px;opacity:.7}.tc-coord{font-size:12px;opacity:.7;font-variant-numeric:tabular-nums;min-width:90px}.tc-sep{width:1px;align-self:stretch;background:var(--studio-border)}
#tcCanvas{touch-action:none}
@media(max-width:1000px){.tc-mapwrap{grid-template-columns:minmax(0,1fr)}.tc-side{border-left:0;border-top:1px solid var(--studio-border)}.tc-palette{max-height:45vh}}
.tc-studio .tc-layer button[data-layer]{min-height:26px;padding:2px 8px}.tc-layers{gap:2px}
.tc-studio .tc-layer [data-eye]{background:transparent;border-color:#3e3352;color:inherit;width:30px;padding:0}.tc-studio .tc-layer [data-eye][aria-pressed=false]{opacity:.45}
.tc-side .tc-sub.tc-side-row{text-transform:none}
.tc-studio .tc-side .tc-layer button{min-height:0;height:28px;line-height:1}
.tc-studio .tc-side .tc-layer button[data-eye][aria-pressed]{background:transparent;border:1px solid #3e3352;color:#e8e2f4;width:30px;padding:0;box-shadow:none}
.tc-side .tc-keys{line-height:1.35}

/* v1.3 modes */
.tc-workspace[data-mode=map] .tc-sidebar{display:none}.tc-workspace[data-mode=map] .tc-editor{grid-template-columns:minmax(0,1fr)}
.tc-workspace[data-mode=tiles] :is(#tcUndo,#tcRedo){display:none}
.tc-studio .tc-modes button{font-weight:700;padding:6px 14px;min-height:38px}.tc-studio .tc-modes button[aria-pressed=true]{background:#7a5cff;color:#fff}
.tc-hint{flex-basis:100%;margin:0;font-size:12.5px;opacity:.8}
.tc-studio .tc-brushes button{min-height:36px;padding:4px 12px}
@media(max-width:600px){.tc-modes{width:100%;display:grid;grid-template-columns:1fr 1fr}}
.tc-toolopts{flex-basis:100%;display:flex;align-items:center;gap:8px;height:36px;overflow:hidden;white-space:nowrap}.tc-toolopts .tc-hint{flex-basis:auto;overflow:hidden;text-overflow:ellipsis;min-width:0}
@media(max-width:600px){.tc-toolopts{height:auto;white-space:normal;flex-wrap:wrap;min-height:56px}}
.tc-maptools{flex:1 1 100%;min-width:0;display:flex;flex-direction:column;gap:4px}.tc-maprow{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;overflow-x:auto;min-width:0;padding-bottom:2px}.tc-maprow>*{flex:none}
.tc-coord{min-width:120px}
@media(max-width:600px){.tc-maprow{flex-wrap:wrap}}
.tc-viewbar{flex-wrap:nowrap;align-items:flex-start}.tc-studio .tc-maptools{flex:1 1 0;margin:0}.tc-maprow{justify-content:flex-start}
@media(max-width:1000px){.tc-viewbar{flex-wrap:wrap}.tc-studio .tc-maptools{flex-basis:100%}}
.tc-studio .tc-maptools{align-items:stretch}

/* v1.4 UI pass: one-line command bar, workspace fits the screen, compact tabs, roomier tile list */
.tc-command{flex-wrap:nowrap;gap:12px;padding:8px 10px}.tc-brand{flex:none}.tc-brand>span{width:32px;height:32px;font-size:17px}
.tc-modes{flex:none}.tc-actions{flex-wrap:nowrap;margin-left:auto}
.tc-studio .tc-command button,.tc-studio .tc-command .tc-file{min-height:34px;padding:5px 11px;font-size:13px}
.tc-workspace{height:calc(100vh - 104px);min-height:560px;max-height:1100px}.tc-editor{flex:1;height:auto;min-height:0}
.tc-tabs{grid-template-columns:repeat(5,1fr);gap:2px;padding:6px 6px 0}.tc-studio .tc-tabs button{padding:4px 2px;font-size:12.5px}
.tc-mapwrap{grid-template-columns:minmax(0,1fr) 340px}
.tc-side{gap:8px;padding:10px}.tc-studio .tc-side .tc-layer button{height:26px}
.tc-studio .tc-side select{height:30px;min-height:0;padding:2px 8px;border-radius:8px;border:1px solid #5c4b72;background:var(--studio-input);color:#fff;font-size:13px}
.tc-studio .tc-side #tcClearLayer{min-height:28px;padding:2px 10px;font-size:12.5px}
.tc-palette{min-height:200px}
.tc-toolopts{gap:12px}.tc-toolopts .tc-inline{flex:none}.tc-hint{line-height:36px}
.tc-studio .tc-viewbar .tc-zoom{flex:none}
@media(max-width:1200px){.tc-command{flex-wrap:wrap}.tc-actions{flex-wrap:wrap;margin-left:0}}
@media(max-width:1000px){.tc-workspace{height:auto;max-height:none}.tc-editor{height:auto}}
@media(max-width:600px){.tc-tabs{grid-template-columns:repeat(5,1fr)}.tc-actions{display:grid;grid-template-columns:repeat(3,1fr)}.tc-actions #tcZip{grid-column:auto}.tc-hint{line-height:1.4}}
.tc-workspace{scroll-margin-top:96px}.tc-mapwrap{grid-template-columns:minmax(0,1fr) clamp(320px,28vw,420px)}
@media(max-width:1000px){.tc-mapwrap{grid-template-columns:minmax(0,1fr)}.tc-mapwrap .tc-stage{height:60vh}}.tc-side .tc-keys{display:none}

/* 1.0.0 page: hero steps + info under the tool */
.tc-hero{padding:4px 0 20px}.tc-hero h1{margin:6px 0 10px}.tc-hero p{font-size:17px;line-height:1.6;color:#d8cde8}
.tc-steps{list-style:none;counter-reset:s;display:flex;flex-wrap:wrap;gap:10px;padding:0;margin:16px 0 14px}
.tc-steps li{counter-increment:s;display:flex;align-items:center;gap:10px;padding:10px 14px 10px 10px;border:1px solid var(--studio-border);border-radius:12px;background:var(--studio-panel);min-width:220px;flex:1 1 220px;max-width:320px}
.tc-steps li::before{content:counter(s);flex:none;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(135deg,#8a56dd,#c06cf2);color:#fff;font-weight:800}
.tc-steps b{display:block;font-size:14.5px}.tc-steps span{display:block;font-size:12.5px;color:var(--studio-muted)}
.tc-info{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-top:28px}
.tc-info section{padding:22px 24px;border:1px solid var(--studio-border);border-radius:15px;background:var(--studio-panel)}
.tc-info h2{font-size:18px;margin:0 0 10px}.tc-info p,.tc-info li{font-size:14.5px;line-height:1.6;color:#d8cde8}.tc-info ol{padding-left:20px;margin:0}.tc-info li+li{margin-top:6px}.tc-info p+p{margin-top:10px}
@media(max-width:1000px){.tc-info{grid-template-columns:1fr}}@media(max-width:600px){.tc-steps li{max-width:none}.tc-hero p{font-size:15.5px}}
.tc-steps li{display:grid;grid-template-columns:30px 1fr;column-gap:12px;row-gap:1px;align-items:center}.tc-steps li::before{grid-row:span 2}.tc-steps b{align-self:end}.tc-steps span{align-self:start}

/* map-only UI never shows while designing (also before the script has run) */
.tc-workspace[data-mode=tiles] :is(#tcMapTools,.tc-side,#tcUndo,#tcRedo){display:none!important}
.tc-workspace[data-mode=tiles] .tc-mapwrap{grid-template-columns:minmax(0,1fr)}
.tc-themes{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;margin-bottom:6px}
.tc-studio .tc-themes button{min-height:30px;padding:3px 4px;font-size:12px;gap:3px}
.tc-studio .tc-themes button[aria-pressed=true]{background:#4a3870;border-color:#9b84ff}
