:root {
  --ink: #e9f5ef;
  --muted: #9fb7b3;
  --teal-950: #061315;
  --teal-900: #091d20;
  --teal-850: #0d2729;
  --teal-800: #123235;
  --teal-700: #1a4547;
  --cyan: #4ce5dc;
  --cyan-soft: #a5fff7;
  --gold: #f2c96d;
  --coral: #ec785c;
  --line: rgba(140, 215, 207, .17);
  --panel: rgba(7, 24, 26, .94);
  --scale: 1;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--teal-700) rgba(6, 19, 21, .72);
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: rgba(6, 19, 21, .72); }
*::-webkit-scrollbar-thumb { border: 2px solid rgba(6, 19, 21, .72); border-radius: 99px; background: var(--teal-700); }
*::-webkit-scrollbar-thumb:hover { background: #286164; }
*::-webkit-scrollbar-corner { background: rgba(6, 19, 21, .72); }
html { background: var(--teal-950); color: var(--ink); font-family: "Trebuchet MS", "Gill Sans", sans-serif; font-size: calc(16px * var(--scale)); }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow: hidden; background:
  radial-gradient(circle at 50% 35%, rgba(46, 140, 137, .22), transparent 38%),
  linear-gradient(135deg, #061315 0%, #0b2526 48%, #061719 100%); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { height: 100vh; min-height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; position: relative; }
.app-shell::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .18; background-image:
  linear-gradient(30deg, transparent 47%, rgba(115, 232, 222, .14) 48%, transparent 49%),
  linear-gradient(150deg, transparent 47%, rgba(115, 232, 222, .10) 48%, transparent 49%); background-size: 46px 80px; }

.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(4, 17, 19, .9); backdrop-filter: blur(18px); position: relative; z-index: 3; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 43px; height: 43px; border: 1px solid rgba(76,229,220,.5); border-radius: 50%; position: relative; box-shadow: inset 0 0 20px rgba(76,229,220,.13), 0 0 24px rgba(76,229,220,.1); }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); }
.brand-mark::before { width: 100%; height: 1px; background: var(--cyan); }
.brand-mark::after { width: 12px; height: 12px; border: 3px solid var(--teal-950); border-radius: 50%; background: var(--cyan); }
.brand-mark span { width: 29px; height: 29px; border: 1px solid rgba(76,229,220,.5); border-radius: 50%; }
.eyebrow, .section-kicker { margin: 0 0 2px; color: var(--cyan); font-size: .64rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin: 0; font-size: 1.65rem; line-height: 1; letter-spacing: .04em; text-transform: uppercase; }
h1 em { color: var(--gold); font-style: italic; font-weight: 400; text-transform: none; }
h2 { margin: 0; font-size: 1.25rem; font-weight: 500; }
/* Keep the header stationary while the scale slider changes the workspace. */
.topbar .eyebrow { font-size: 10.24px; }
.topbar h1 { font-size: 26.4px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions .button { font-size: 13.12px; }
.scale-control { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; color: var(--muted); font-size: 12.48px; line-height: 18px; white-space: nowrap; }
.scale-control input { flex: 0 0 110px; width: 110px; height: 20px; margin: 0; accent-color: var(--cyan); }
.scale-control output { flex: 0 0 38px; width: 38px; color: var(--ink); font-variant-numeric: tabular-nums; }

.button, .icon-button, .text-button, .quick-views button, .category, .item-card { border: 0; cursor: pointer; }
.button { min-height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 5px; background: var(--teal-800); font-weight: 700; font-size: .82rem; transition: .18s ease; }
.button:hover { transform: translateY(-1px); border-color: rgba(76,229,220,.55); }
.button.primary { color: #062022; background: var(--cyan); border-color: transparent; }
.button.ghost { background: rgba(16,54,57,.55); }
.button.danger { color: #ffd8cf; border-color: rgba(236,120,92,.42); background: rgba(91,35,27,.72); }
.text-button { padding: 0; background: none; color: var(--cyan); font-size: .72rem; }
.text-button:disabled { opacity: .4; cursor: default; }
.outfit-actions { display: grid; flex-shrink: 0; justify-items: end; gap: 8px; }

.workspace { min-height: 0; display: grid; grid-template-columns: minmax(230px, 280px) minmax(420px, 1fr) minmax(330px, 410px); gap: 12px; padding: 12px 12px 0; position: relative; z-index: 1; }
.site-credit { display: grid; place-items: center; gap: 3px; padding: 0 12px 5px; color: rgb(161 125 229 / 82%); font-size: .768rem; letter-spacing: .04em; text-align: center; position: relative; z-index: 1; }
.site-credit-line span { color: #cf6b9f; }
.coffee-support { min-height: 19.04px; display: inline-flex; align-items: center; gap: 4.76px; padding: 0 8.16px; border: 1px solid rgb(255 232 119 / 72%); border-radius: 999px; color: #251d08; background: linear-gradient(135deg, #ffe66c, #f2c96d); box-shadow: 0 3.4px 9.35px rgb(0 0 0 / 18%), inset 0 1px 0 rgb(255 255 255 / 55%); font-size: calc(.4624rem + 1px); font-weight: 800; letter-spacing: .025em; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease, filter .16s ease; }
.coffee-support svg { width: 9.52px; height: 9.52px; fill: currentColor; }
.coffee-support:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 7px 18px rgb(0 0 0 / 24%), inset 0 1px 0 rgb(255 255 255 / 62%); }
.coffee-support:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.panel { min-height: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.control-rail { overflow-y: auto; }
.control-rail section { padding: 18px; border-bottom: 1px solid var(--line); }
.section-heading, .inventory-heading, .modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.switch-row { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .8rem; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row i { width: 38px; height: 20px; border-radius: 99px; background: #173538; position: relative; transition: .2s; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #829a97; transition: .2s; }
.switch-row input:checked + i { background: rgba(76,229,220,.35); }
.switch-row input:checked + i::after { transform: translateX(18px); background: var(--cyan); }
.godot-mode-toggle { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.godot-mode-toggle span { color: var(--ink); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.godot-mode-toggle input:checked + i { background: rgba(242,201,109,.38); box-shadow: 0 0 10px rgba(242,201,109,.16); }
.godot-mode-toggle input:checked + i::after { background: var(--gold); }
.mode-status { margin: 6px 0 0; color: var(--muted); font-size: .62rem; line-height: 1.4; }
.mode-status.is-godot { color: var(--gold); }

.equipped-list { margin-top: 12px; display: grid; gap: 4px; }
.equipped-item { height: 38px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, 22px); align-items: center; gap: 3px; padding: 3px 5px; border: 1px solid transparent; border-radius: 5px; background: rgba(19,51,53,.6); }
.equipped-slot-info { min-width: 0; display: grid; gap: 1px; line-height: 1.05; }
.equipped-slot-label, .equipped-slot-item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equipped-slot-label { color: var(--cyan-soft); font-size: .54rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.equipped-slot-item { color: var(--ink); font-size: .65rem; }
.equipped-item button { width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; color: var(--muted); background: rgba(255,255,255,.06); cursor: pointer; }
.equipped-item .piece-lock, .equipped-item .visibility-toggle { display: grid; place-items: center; }
.piece-lock svg, .visibility-toggle svg { width: 14px; height: 14px; }
.equipped-item.is-hidden { border-color: var(--line); border-style: dashed; }
.equipped-item.is-hidden .equipped-slot-item { color: var(--muted); }
.equipped-item.locks-nothing { border-color: rgba(242,201,109,.48); box-shadow: inset 3px 0 0 var(--gold); }
.visibility-toggle[aria-pressed="true"] { color: var(--cyan-soft); }
.visibility-toggle[aria-pressed="false"] { color: var(--coral); background: rgba(236,120,92,.12); }
.equipped-item button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.equipped-item .piece-lock[aria-pressed="true"] { color: #3b2905; background: linear-gradient(135deg, #ffe399, var(--gold) 70%, #dfaa37); box-shadow: inset 0 0 0 1px #ffecae, 0 0 8px rgba(242,201,109,.35); }
.equipped-item button:disabled { opacity: .3; cursor: default; }
.dye-dot { width: 13px; height: 13px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; }
.muted { color: var(--muted); font-size: .76rem; }
.appearance-controls { display: grid; gap: 12px; margin-top: 12px; }
.appearance-controls button { min-width: 0; min-height: 32px; padding: 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--teal-800); font-size: .72rem; cursor: pointer; overflow-wrap: anywhere; }
.appearance-controls button:hover { border-color: var(--cyan); }
.appearance-controls button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.appearance-controls button[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); background: #3d3523; }
.appearance-controls button:disabled { opacity: .4; cursor: default; }
.appearance-body { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: 7px; }
.appearance-body > span { margin-right: 3px; color: var(--muted); font-size: .7rem; }
.appearance-categories { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.appearance-categories button { flex: 1 1 2.4rem; padding: 6px 3px; }
.appearance-editor { display: grid; gap: 8px; min-width: 0; }
.appearance-heading { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .7rem; }
.appearance-heading span:last-child { text-align: right; overflow-wrap: anywhere; }
.appearance-cycle { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; gap: 4px; }
.appearance-cycle > button:not(.appearance-style-name) { padding: 2px; font-size: 1.25rem; }
.appearance-style-name { line-height: 1.4; }
.appearance-style-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 8px; border-radius: 4px; background: var(--teal-950); }
.appearance-style-choices[hidden] { display: none; }
.appearance-palette { display: grid; gap: 9px; margin-top: 4px; }
.appearance-swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; padding: 3px; }
.appearance-swatches button, .appearance-swatches button[aria-pressed="true"] { min-height: 28px; color: #fff; border-color: rgba(255,255,255,.25); background: var(--appearance-color); text-shadow: 0 1px 3px #000, 0 -1px 3px #000, 1px 0 3px #000, -1px 0 3px #000; }
.appearance-swatches button[aria-pressed="true"] { outline: 2px solid var(--gold); outline-offset: 1px; }
.appearance-swatches button:focus-visible { outline-color: var(--cyan); outline-offset: 3px; }
.outfit-tools { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.randomize-outfit { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 8px; }
.randomize-outfit svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--gold); }
.randomize-outfit:disabled { opacity: .45; cursor: default; }
.outfit-tools p { margin: 8px 0 0; font-size: .65rem; line-height: 1.5; }
@media (pointer: coarse) {
  .appearance-controls button { min-height: 44px; }
  .appearance-cycle { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .appearance-swatches { grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); }
}

.stage-panel { display: grid; grid-template-rows: auto minmax(260px,1fr) auto auto; overflow: hidden; position: relative; }
.stage-copy { padding: 18px 20px 4px; z-index: 2; }
.stage-copy h2 { font-size: 1.5rem; }
.stage-copy p:last-child { margin: 5px 0 0; color: var(--muted); font-size: .75rem; }
.stage { min-height: 0; display: grid; place-items: center; position: relative; overflow: hidden; }
.stage.grid { background-image: linear-gradient(rgba(108,196,189,.065) 1px, transparent 1px), linear-gradient(90deg, rgba(108,196,189,.065) 1px, transparent 1px); background-size: 32px 32px; background-position: center; }
.stage::after { content: ""; position: absolute; width: min(68%, 520px); aspect-ratio: 1; border: 1px solid rgba(76,229,220,.12); border-radius: 50%; }
.stage-glow { position: absolute; width: 50%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(76,229,220,.16), transparent 68%); filter: blur(10px); }
#outfitPreview { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 2; }
.stage.has-background { background: #102520; }
.stage.has-background::after, .stage.has-background .stage-glow { display: none; }
.background-picker { padding: 11px 14px 9px; border-top: 1px solid var(--line); background: var(--teal-900); }
.background-picker-row { display: flex; align-items: center; gap: 6px; }
.background-picker-row label { margin-right: 5px; color: var(--muted); font-size: .68rem; font-weight: 700; }
.background-picker select { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 5px; padding: 0 7px; color: var(--ink); background: var(--teal-800); font-size: .76rem; cursor: pointer; }
.background-arrow { flex: 0 0 32px; height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--teal-800); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.background-arrow:hover { color: var(--cyan); border-color: var(--cyan); }
.background-picker .button { min-height: 34px; padding: 0 10px; font-size: .7rem; }
.background-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 5px; color: var(--muted); font-size: .61rem; line-height: 1.4; }
#backgroundCount { flex: 0 0 auto; color: var(--cyan-soft); font-variant-numeric: tabular-nums; }
dialog.background-modal { width: min(900px, 94vw); max-height: 88vh; padding: 22px; }
.background-modal .modal-heading { padding: 0; }
.background-gallery { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; max-height: 60vh; overflow: auto; padding: 2px 6px 4px 2px; }
.background-card { min-width: 0; text-align: left; padding: 0 0 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--teal-900); overflow: hidden; cursor: pointer; }
.background-card:hover, .background-card[aria-pressed="true"] { border-color: var(--cyan); }
.background-card[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--cyan); }
.background-card canvas { display: block; width: 100%; aspect-ratio: 8/5; image-rendering: pixelated; background: radial-gradient(circle, #16494a, #091d20); }
.background-card.original-background canvas { background-color: #0a2022; background-image: radial-gradient(circle at 50% 52%, rgba(76,229,220,.18), transparent 38%), linear-gradient(rgba(108,196,189,.11) 1px, transparent 1px), linear-gradient(90deg, rgba(108,196,189,.11) 1px, transparent 1px); background-size: auto, 24px 24px, 24px 24px; background-position: center; }
.background-card strong, .background-card span { display: block; margin: 8px 10px 0; }
.background-card strong { font-size: .8rem; }
.background-card span { margin-top: 3px; color: var(--muted); font-size: .63rem; line-height: 1.4; }
.background-card:focus-visible, .background-arrow:focus-visible, .background-picker select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.quick-views { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.quick-views button { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 5px; padding: 6px 10px; color: var(--muted); background: var(--teal-900); text-align: left; }
.quick-views button.active { color: var(--cyan-soft); background: var(--teal-850); }
.quick-views canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.quick-views span { font-size: .72rem; font-weight: 700; }

.inventory-panel { display: grid; grid-template-rows: auto auto auto 1fr; overflow: hidden; }
.inventory-heading { padding: 18px 18px 10px; }
.create-cosmetic-link { text-decoration: none; }
.catalog-source-tabs { display: grid; grid-template-columns: 1fr 1fr auto; gap: 5px; padding: 0 16px 10px; }
.catalog-source-tabs button, .catalog-source-tabs select { min-width: 0; padding: 8px; color: var(--muted); border: 1px solid var(--line); background: rgba(5,17,19,.75); font-size: .7rem; }
.catalog-source-tabs button { cursor: pointer; }
.catalog-source-tabs button.active { color: #071718; border-color: var(--cyan); background: var(--cyan); font-weight: 800; }
.catalog-source-tabs select { color: var(--ink); }
.community-meta { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: 4px; color: #7fa39e; font-size: .6rem; }
.community-vote { position: relative; z-index: 2; padding: 3px 6px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,.2); cursor: pointer; }
.community-vote.voted { color: var(--gold); border-color: rgba(239,189,88,.55); background: rgba(239,189,88,.08); }
.count-pill { min-width: 38px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 99px; color: var(--cyan-soft); font-size: .7rem; text-align: center; }
.search-wrap { margin: 0 16px 12px; display: grid; grid-template-columns: 30px 1fr; align-items: center; border: 1px solid var(--line); border-radius: 5px; background: rgba(5,17,19,.8); }
.search-wrap span { color: var(--cyan); font-size: 1.2rem; text-align: center; }
.search-wrap input { min-width: 0; padding: 10px 10px 10px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: .78rem; }
.search-wrap input::placeholder { color: #66817e; }
.categories { display: flex; gap: 5px; padding: 0 16px 12px; overflow-x: auto; }
.category { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: transparent; font-size: .67rem; text-transform: capitalize; }
.category.active { color: var(--teal-950); background: var(--gold); border-color: var(--gold); }
.inventory-grid { min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-content: start; gap: 7px; padding: 0 14px 16px; overflow-y: auto; }
.inventory-spacer { grid-column: 1 / -1; min-height: 0; pointer-events: none; }
.item-card { min-width: 0; height: 9.5rem; contain: layout paint style; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 5px; padding: 8px; border: 1px solid rgba(140,215,207,.1); border-radius: 6px; color: var(--ink); background: rgba(17,44,46,.62); position: relative; text-align: left; transition: border-color .16s, transform .16s, background .16s; }
.item-card:hover { transform: translateY(-2px); border-color: rgba(76,229,220,.52); background: rgba(20,58,60,.8); }
.item-card.equipped { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(242,201,109,.24); }
.item-card canvas { width: 100%; height: 100%; min-height: 0; object-fit: contain; image-rendering: pixelated; }
.item-copy { min-width: 0; display: grid; grid-template-rows: 1.7rem 1.5rem; gap: .25rem; }
.item-card strong { overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .67rem; line-height: 1.25; }
.item-card small { display: block; color: var(--muted); font-size: .58rem; line-height: 1.25; text-transform: uppercase; letter-spacing: .04em; }
.availability-badge { position: absolute; z-index: 2; top: 6px; left: 6px; max-width: calc(100% - 12px); overflow: hidden; padding: 3px 5px; border: 1px solid rgba(242,201,109,.5); border-radius: 3px; color: #ffefbd; background: rgba(63,45,13,.92); font-size: .48rem; font-weight: 800; letter-spacing: .04em; line-height: 1; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.availability-badge.unreleased { border-color: rgba(236,120,92,.7); color: #ffd4c8; background: rgba(75,27,20,.94); }
.availability-badge.exclusive { border-color: rgba(115,190,255,.72); color: #d8efff; background: rgba(16,45,72,.95); }

.modal { width: min(760px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 1px solid rgba(76,229,220,.35); border-radius: 9px; color: var(--ink); background: #081719; box-shadow: 0 30px 100px rgba(0,0,0,.65); }
.modal::backdrop { background: rgba(0,9,10,.72); backdrop-filter: blur(5px); }
.modal form { padding: 22px; }
.modal-heading { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--teal-850); font-size: 1.25rem; }
.dye-modal { width: min(480px, calc(100vw - 28px)); }
.dye-dialog-mode-toggle { margin: 13px 0 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 6px; background: rgba(13,35,38,.72); }
.dye-dialog-mode-toggle span { display: grid; gap: 3px; text-transform: none; }
.dye-dialog-mode-toggle strong { color: var(--ink); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.dye-dialog-mode-toggle small { color: var(--muted); font-size: .6rem; font-weight: 500; letter-spacing: 0; }
.dye-preview { margin: 18px 0; display: grid; place-items: center; height: 260px; border-radius: 7px; background: radial-gradient(circle, rgba(76,229,220,.12), transparent 65%), #061214; }
.dye-preview canvas { width: 240px; height: 240px; image-rendering: pixelated; }
.dye-mode-note { margin: -8px 0 14px; color: var(--muted); font-size: .7rem; text-align: center; }
.color-row { display: grid; grid-template-columns: 1fr 70px minmax(110px,auto); align-items: center; gap: 12px; color: var(--muted); }
.color-row input { width: 70px; height: 36px; border: 0; background: transparent; }
.color-row output { color: var(--ink); font-family: Consolas, monospace; font-size: .8rem; text-align: right; }
.dye-channel-controls { display: grid; gap: 8px; margin-top: 13px; padding: 12px; border: 1px solid rgba(242,201,109,.28); border-radius: 6px; background: rgba(19,51,53,.46); }
.dye-channel-controls label { display: grid; grid-template-columns: 18px minmax(0,1fr) 54px; align-items: center; gap: 10px; color: var(--muted); font: 700 .68rem Consolas, monospace; }
.dye-channel-controls label[hidden] { display: none; }
.dye-channel-controls input[type="range"] { width: 100%; accent-color: var(--gold); }
.dye-channel-controls output { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.dye-channel-controls p { display: flex; justify-content: space-between; gap: 12px; margin: 3px 0 0; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: .68rem; }
.dye-channel-controls p output { color: var(--gold); font: .72rem Consolas, monospace; }
.dye-preset-label { margin: 14px 0 7px; color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 7px; }
.swatches button { aspect-ratio: 1; border: 2px solid rgba(255,255,255,.16); border-radius: 50%; cursor: pointer; }
@media (max-width: 520px) {
  .color-row { grid-template-columns: minmax(0, 1fr) 56px; }
  .color-row input { width: 56px; }
  .color-row output { grid-column: 1 / -1; text-align: left; white-space: normal; }
}
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }
.modal-intro { color: var(--muted); font-size: .78rem; }
.preset-modal form { max-height: calc(100vh - 28px); overflow-y: auto; }
.preset-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: rgba(6,18,20,.62); }
.preset-toolbar span { color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; }
.preset-toolbar .button { min-height: 32px; padding: 0 11px; font-size: .7rem; }
.preset-slots { max-height: min(52vh, 560px); display: grid; gap: 6px; margin-top: 8px; padding-right: 3px; overflow-y: auto; }
.preset-row { display: grid; grid-template-columns: 32px minmax(100px,1fr) repeat(4,auto); gap: 6px; align-items: center; padding: 7px; background: rgba(19,51,53,.55); }
.preset-row input { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #071416; }
.preset-row button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--teal-800); cursor: pointer; font-size: .7rem; }
.preset-row button:disabled { opacity: .35; cursor: default; }
.import-box { display: grid; gap: 7px; margin-top: 18px; color: var(--muted); font-size: .75rem; }
.import-box textarea { min-height: 90px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #061214; }
.modal-status { margin-right: auto; color: var(--cyan-soft); font-size: .72rem; }
.preset-actions .vault-launch { min-width: 92px; border-color: rgba(242,201,109,.42); color: var(--gold); }
.vault-connected-indicator { color: #65e68a; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-shadow: 0 0 12px rgba(101,230,138,.35); white-space: nowrap; }
.vault-connected-indicator[hidden] { display: none; }

.vault-modal { width: min(660px, calc(100vw - 28px)); }
.vault-section { display: grid; gap: 14px; margin-top: 18px; }
.vault-section[hidden] { display: none; }
.vault-choice { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: rgba(19,51,53,.48); }
.vault-choice strong, .vault-connected-card strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; font-weight: 500; }
.vault-choice p, .vault-connected-card p { margin: 4px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.vault-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; }
.vault-divider::before, .vault-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.vault-code-field { display: grid; gap: 7px; color: var(--muted); font-size: .72rem; }
.vault-code-field input { width: 100%; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #061214; font: .73rem Consolas, monospace; }
.vault-code-field input:focus { outline: 2px solid rgba(76,229,220,.35); outline-offset: 1px; }
.vault-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vault-copy-row { margin-top: -5px; }
.vault-warning { margin: -3px 0 0; color: #c7aaa2; font-size: .68rem; line-height: 1.45; }
.vault-warning.important { padding: 10px 12px; border-left: 3px solid var(--gold); color: #e8d9b6; background: rgba(242,201,109,.07); }
.vault-connected-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid rgba(76,229,220,.28); border-radius: 7px; background: rgba(23,74,73,.34); }
.vault-state-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 13px rgba(76,229,220,.75); }
.vault-management { display: flex; justify-content: flex-end; }
.vault-management .button { min-width: 120px; padding: 0 12px; font-size: .72rem; }
.vault-status { min-height: 1.2em; margin: 16px 0 0; color: var(--cyan-soft); font-size: .72rem; line-height: 1.45; }
.vault-status.error { color: #ffab98; }
.vault-status.busy { color: var(--gold); }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%,20px); padding: 11px 16px; border: 1px solid rgba(76,229,220,.4); border-radius: 5px; color: var(--ink); background: #0b2b2d; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
.loading-screen { position: fixed; z-index: 99; inset: 0; display: grid; place-content: center; justify-items: center; background: #061315; transition: opacity .35s, visibility .35s; }
.loading-screen.hidden { opacity: 0; visibility: hidden; }
.loading-screen p { margin: 18px 0 3px; font-family: Georgia, serif; font-size: 1.2rem; }
.loading-screen small { color: var(--muted); }
.loader-orbit { width: 54px; height: 54px; border: 1px solid rgba(76,229,220,.2); border-radius: 50%; position: relative; animation: spin 1.2s linear infinite; }
.loader-orbit::before { content: ""; position: absolute; left: -3px; top: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 18px var(--cyan); }
.loader-orbit span { position: absolute; inset: 12px; border: 1px solid rgba(242,201,109,.4); border-radius: 50%; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  body { overflow: auto; }
  .app-shell { height: auto; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .top-actions { max-width: 100%; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .workspace { grid-template-columns: 220px minmax(420px,1fr); grid-template-rows: minmax(620px, calc(100vh - 100px)) 620px; }
  .inventory-panel { grid-column: 1 / -1; }
  .inventory-grid { grid-template-columns: repeat(6,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 12px 14px; }
  .scale-control:not(.character-zoom-control) { display: none; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .workspace { display: flex; flex-direction: column; padding: 8px 8px 0; }
  .stage-panel { order: 1; min-height: 560px; }
  .control-rail { order: 2; max-height: none; overflow: visible; }
  .inventory-panel { order: 3; height: 620px; min-height: 620px; flex: 0 0 620px; }
  .inventory-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .quick-views span { display: none; }
  .quick-views button { grid-template-columns: 1fr; justify-items: center; }
  .preset-row { grid-template-columns: 24px 1fr 1fr; }
  .preset-row button { min-width: 0; }
  .preset-actions { flex-wrap: wrap; }
  .preset-actions .modal-status { flex: 1 0 100%; }
  .vault-choice { align-items: stretch; flex-direction: column; }
  .background-gallery { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .background-picker-row label { display: none; }
}
