/* ── Tool shell ───────────────────────────────────────────────────────
   One minimal interface for every tool. A tool opts in by putting
   class="as-shell" on <body> and loading this file (plus js/tools-shell.js)
   after its own styles. Nothing here touches a tool's logic: it only
   restyles the shared building blocks the tools already use
   (.head, .card, .bench, .drop, .row, label.f, .btn, .hchip, #status).

   Look: the site's typefaces, near-black surfaces separated by hairlines
   instead of boxes-in-boxes, one accent (sky blue) reserved for the main
   action and live state, lavender for focus. */

body.as-shell {
  --as-bg: #060607; --as-panel: #0b0c10; --as-raised: #111319;
  --as-line: rgba(242, 253, 255, .1); --as-line-2: rgba(242, 253, 255, .22);
  --as-dim: rgba(242, 253, 255, .64);
}
[data-theme="light"] body.as-shell {
  --as-bg: #f3f6fa; --as-panel: #ffffff; --as-raised: #e9eef5;
  --as-line: rgba(4, 18, 43, .1); --as-line-2: rgba(4, 18, 43, .24);
  --as-text: #04122b; --as-dim: rgba(4, 18, 43, .68); --as-accent: #1b6bd0; --as-accent-ink: #ffffff;
}
body.as-kit {
  --shell: #060607; --panel: #0b0c10; --sunk: #111319;
  --line: rgba(242, 253, 255, .09); --line-2: rgba(242, 253, 255, .2);
  --ink: #f2fdff; --ink-2: rgba(242, 253, 255, .64); --ink-3: rgba(242, 253, 255, .46);
  --cobalt: #7bbbff; --cobalt-soft: rgba(123, 187, 255, .07); --on-cobalt: #04122b;
  --mark: #b8a9ff;
  --glass: rgba(6, 6, 7, .72); --shadow: none; --r: 14px;
  background-image: radial-gradient(70% 40% at 50% -10%, rgba(123, 187, 255, .09), transparent 70%);
  background-size: auto; background-repeat: no-repeat;
}
[data-theme="light"] body.as-kit {
  --shell: #f3f6fa; --panel: #ffffff; --sunk: #e9eef5;
  --line: rgba(4, 18, 43, .1); --line-2: rgba(4, 18, 43, .24);
  --ink: #04122b; --ink-2: rgba(4, 18, 43, .68); --ink-3: rgba(4, 18, 43, .52);
  --cobalt: #1b6bd0; --cobalt-soft: rgba(27, 107, 208, .06); --on-cobalt: #ffffff;
  --mark: #6a4fe0;
  --glass: rgba(243, 246, 250, .8);
  background-image: radial-gradient(70% 40% at 50% -10%, rgba(27, 107, 208, .08), transparent 70%);
}

/* ── Header: brand, tool switcher, quiet actions ── */
.as-kit .head { box-shadow: none; }
.as-kit .head-in { padding: 12px clamp(16px, 3vw, 32px); gap: 14px; flex-wrap: nowrap; }
.as-kit .head-tools { flex-wrap: wrap; justify-content: flex-end; }

/* ── Home button, tool switcher, dock: identical in every tool ── */
.as-home { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--as-line); color: var(--as-text); background: transparent; transition: border-color .2s, background .2s; }
.as-home svg { height: 20px; width: auto; }
.as-home:hover { border-color: var(--as-accent); background: rgba(123, 187, 255, .1); }
.as-switch { position: relative; flex: none; }
.as-switch > summary {
  list-style: none; cursor: pointer; white-space: nowrap; box-sizing: border-box;
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; line-height: 1;
  height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--as-line); border-radius: 99px; background: transparent; color: var(--as-dim);
  transition: border-color .2s, color .2s, background .2s;
}
.as-switch > summary::-webkit-details-marker { display: none; }
.as-switch > summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.as-switch > summary:hover, .as-switch[open] > summary { border-color: var(--as-accent); color: var(--as-text); background: rgba(123, 187, 255, .1); }
.as-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 200; width: min(300px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--as-line-2); border-radius: 16px; background: var(--as-panel); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); display: grid; gap: 2px; max-height: min(70vh, 520px); overflow: auto; text-align: left; }
.as-menu a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--as-text); font-family: 'Clash Display', system-ui, sans-serif; font-weight: 500; font-size: 15px; letter-spacing: 0; text-transform: none; transition: background .15s; }
.as-menu a small { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--as-dim); }
.as-menu a:hover { background: rgba(123, 187, 255, .12); }
.as-menu a[aria-current="page"] { background: var(--as-accent); color: var(--as-accent-ink); }
.as-menu a[aria-current="page"] small { color: inherit; opacity: .7; }
/* Floating dock for the side-panel tools (3D Studio, QR Studio, Asset Forge). */
.as-dock { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 300; display: flex; gap: 6px; padding: 6px; border-radius: 99px; border: 1px solid var(--as-line); background: rgba(6, 6, 7, .72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.as-dock .as-home, .as-dock .as-switch > summary { border-color: transparent; }

/* Kit header pieces */
.as-kit .brand { min-width: 0; }
.as-kit .brand b { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.as-kit .brand span { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; }
.as-kit .head-tools { gap: 8px; }
.as-kit .hchip, .as-kit .back {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--ink-2);
  cursor: pointer; white-space: nowrap; transition: border-color .2s, color .2s, background .2s;
}
.as-kit .hchip:hover, .as-kit .back:hover { border-color: var(--cobalt); color: var(--ink); background: var(--cobalt-soft); }
.as-kit .hchip:disabled { opacity: .4; cursor: not-allowed; }

/* ── Page ── */
.as-kit .wrap { max-width: 1200px; padding: clamp(18px, 3vw, 36px) clamp(16px, 3vw, 32px) 40px; }
.as-kit .intro { margin-bottom: 22px; }
.as-kit .tag { font-size: 15px; color: var(--ink-2); max-width: 62ch; }
.as-kit .grid { gap: 16px; }

/* Panels: one quiet surface, a small caps label, no boxed header strip. */
.as-kit .card, .as-kit .bench { border-radius: 18px; overflow: visible; }
.as-kit .bench { margin-top: 16px; }
.as-kit .card h2, .as-kit .bench h2 {
  background: none; border-bottom: 0; min-height: 0; padding: 18px 20px 0;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .16em; color: var(--ink-3);
}
.as-kit .card h2 span { font-family: var(--body); font-size: 13px; color: var(--ink-2); }
.as-kit .bench h2 span { font: inherit; color: inherit; letter-spacing: inherit; }
.as-kit .pbody { padding: 14px 20px 20px; }

/* Drop zone: the one big invitation on an empty tool. */
.as-kit .drop { min-height: 190px; border: 1px dashed var(--line-2); border-radius: 14px; background: var(--cobalt-soft); gap: 4px; }
.as-kit .drop b { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -.01em; }
.as-kit .drop p { font-size: 10.5px; }
.as-kit .lutview, .as-kit .split, .as-kit .slice canvas { border-radius: 12px; }
.as-kit .meta { font-size: 12.5px; }

/* Controls */
.as-kit .row { gap: 10px; margin-top: 14px; }
.as-shell label.f { font-size: 10px; letter-spacing: .12em; gap: 6px; color: var(--ink-3); }
.as-shell select, .as-shell input[type=number], .as-shell input[type=text] {
  font-family: var(--mono); font-size: 13px; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--sunk);
}
.as-shell select:hover, .as-shell input[type=number]:hover, .as-shell input[type=text]:hover { border-color: var(--line-2); }
.as-shell select:focus, .as-shell input[type=number]:focus, .as-shell input[type=text]:focus { border-color: var(--cobalt); }
.as-shell :focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }
.as-shell input[type=number] { width: 92px; }

.as-kit .btn {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .1em;
  height: 40px; padding: 0 18px; border-radius: 99px; box-shadow: none; background: transparent; border: 1px solid var(--line-2);
}
.as-kit .btn:hover { border-color: var(--cobalt); color: var(--cobalt); }
.as-kit .btn.pri { background: var(--cobalt); border-color: var(--cobalt); color: var(--on-cobalt); }
.as-kit .btn.pri:hover { color: var(--on-cobalt); filter: brightness(1.08); }
.as-kit .btn.sm { height: 32px; padding: 0 14px; font-size: 10px; }
.as-kit .btn:disabled { opacity: .35; }

/* The save actions stay in reach: they stick to the bottom of the screen
   for as long as their panel is on it. */
.as-kit .savebar {
  position: sticky; bottom: 12px; z-index: 5; margin-top: 18px; padding: 10px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--glass);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); align-items: center;
}
.as-kit .savebar label.f { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; }

.as-shell details.adv { margin-top: 16px; padding-top: 12px; }
.as-shell details.adv summary { font-size: 10.5px; font-weight: 500; }
.as-kit .chk { font-size: 10.5px; }
.as-kit .note { font-family: var(--body); font-size: 13px; color: var(--ink-3); }
.as-kit .slice .cap, .as-kit .axis, .as-kit .splitlabels { font-size: 10.5px; }
.as-kit .split .handle::after { border-color: var(--cobalt); }

/* Status line */
.as-shell #status { background: transparent; font-size: 10.5px; padding: 0 clamp(8px, 2vw, 20px); }
.as-shell #status .cell { border-right: 0; padding: 12px; }
.as-shell #status .credit-cell { border-left: 0; }

/* Dense workspaces (Matte, Print, Sprite) keep their tighter controls. */
.as-kit.as-dense .btn { height: 34px; padding: 0 14px; }
.as-kit.as-dense .btn.sm { height: 28px; padding: 0 10px; }
.as-kit.as-dense select, .as-kit.as-dense input[type=number], .as-kit.as-dense input[type=text] { height: 34px; padding: 0 10px; font-size: 12px; }
.as-kit.as-dense input[type=number] { width: 78px; }
.as-kit.as-dense .hchip, .as-kit.as-dense .back { height: 36px; padding: 0 13px; }
.as-kit.as-dense .as-switch > summary, .as-kit.as-dense .as-home { height: 36px; }
.as-kit.as-dense .as-home { width: 36px; }
/* Tabs and segmented switches in the kit tools */
.as-kit .tab, .as-kit .seg button { font-family: var(--mono); letter-spacing: .08em; }
.as-kit .tab[aria-selected="true"] { color: var(--cobalt); }
body[data-tool="lut-studio"] { font-size: 14px; }

/* ── Tools with their own building blocks: same surfaces and accent ── */
body[data-tool="image-studio"] { --ink: #060607; --panel: #060607; --raised: #1a1d26; --sunk: #0f1116; --text: #f2fdff; --sig: #7bbbff; --rule: rgba(242, 253, 255, .08); --dim: rgba(242, 253, 255, .64); --faint: rgba(242, 253, 255, .46); --mono: 'General Sans', system-ui, sans-serif; }
body[data-tool="media-studio"] { --bg: #060607; --panel: #0b0c10; --surface-2: #111319; --surface-3: #181b23; }
body[data-tool="3d-studio"] { --bg: #060607; --panel: #060607; --panel2: #0f1116; --accent: #7bbbff; --ink: #f2fdff; --muted: rgba(242, 253, 255, .64); }
body[data-tool="qr-studio"] { --bg: #060607; --panel: #0b0c10; }


/* ── Phones and tablets ── */
@media (max-width: 860px) {
  .as-kit .head-in { gap: 8px; }
  .as-kit .brand span, .as-kit .back svg { display: none; }
  .as-kit .hchip, .as-kit .back, .as-switch > summary { padding: 0 12px; }
  .as-kit .back { font-size: 0; gap: 0; }           /* keep the pill, drop its label */
  .as-kit .back::before { content: 'Home'; font-size: 10.5px; }
  .as-kit .card h2, .as-kit .bench h2 { padding: 16px 16px 0; }
  .as-kit .pbody { padding: 12px 16px 16px; }
  .as-kit .savebar { bottom: max(10px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .as-kit .savebar .btn { flex: 1; }
  .as-kit .row label.f { flex: 1 1 calc(50% - 10px); }
  .as-kit .row label.f select, .as-kit .row label.f input { width: 100%; }
  /* Save bar on small screens: the two buttons share a row, the size field sits under them. */
  .as-kit .row.savebar label.f { margin-left: 0; flex: 1 1 100%; justify-content: space-between; }
  .as-kit .row.savebar label.f input { width: 96px; }
}
@media (max-width: 480px) {
  .as-kit .brand b { font-size: 16px; }
  .as-switch > summary span { display: none; }         /* just the chevron pill */
}
@media (max-width: 768px), (pointer: coarse) {
  .as-kit:not(.as-dense) .btn, .as-kit .hchip, .as-kit .back, .as-switch > summary, .as-home { min-height: 44px; }
  .as-home { min-width: 44px; }
  .as-shell select, .as-shell input[type=number], .as-shell input[type=text] { height: 44px; }
}

/* ── Per-tool finishing ── */
/* Print Studio names its main button "primary" rather than "pri". */
.as-kit .btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--on-cobalt); }
.as-kit .btn.primary:hover { color: var(--on-cobalt); filter: brightness(1.08); }
/* WebXR Sandbox: brand left, switcher and home link grouped on the right. */
body[data-tool="webxr"] .head-in .brand { margin-right: auto; }
/* QR Studio and Media Studio used white for "active" and "main action"; use the accent. */
body[data-tool="qr-studio"] .qr-btn-primary,
body[data-tool="media-studio"] .btn-pill.primary,
body[data-tool="media-studio"] .btn-export { background: var(--as-accent); border-color: var(--as-accent); color: var(--as-accent-ink); }
body[data-tool="qr-studio"] .qr-btn-primary:hover,
body[data-tool="media-studio"] .btn-pill.primary:hover,
body[data-tool="media-studio"] .btn-export:hover { background: var(--as-second); border-color: var(--as-second); color: var(--as-accent-ink); }
body[data-tool="qr-studio"] .qr-brand-dot { background: var(--as-accent); }
/* Phones: keep the floating dock clear of the side-panel tools' intro text. */
@media (max-width: 860px) {
  body[data-tool="qr-studio"] .qr-sub, body[data-tool="3d-studio"] #panel .sub { padding-right: 112px; }
}

/* Phones: kit headers wrap. Brand and switcher stay on the first row; Print
   Studio's tabs and Matte Studio's many buttons move to a row of their own
   (Matte's row scrolls sideways rather than stacking four rows deep). */
@media (max-width: 860px) {
  .as-kit .head-in { flex-wrap: wrap; row-gap: 10px; }
  .as-kit .head-in > .as-switch { margin-right: auto; }
  body[data-tool="matte-studio"] .head-tools {
    order: 3; flex: 1 1 100%; margin-left: 0; flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
  }
  body[data-tool="matte-studio"] .head-tools::-webkit-scrollbar { display: none; }
  body[data-tool="matte-studio"] .head-tools > * { flex: none; }
}
/* When the switcher sits next to the tool name, its menu opens to the right. */
.head-in > .as-switch .as-menu { left: 0; right: auto; }
@media (max-width: 860px) {
  /* Phones: the menu spans the screen under the header, never off an edge. */
  .as-menu, .head-in > .as-switch .as-menu { position: fixed; left: 12px; right: 12px; top: 68px; width: auto; }
}
@media (max-width: 860px) {
  /* The dock blurs its backdrop, which pins fixed children to the dock; anchor its menu to the dock's right edge instead. */
  .as-dock .as-menu { position: absolute; left: auto; right: 0; top: calc(100% + 8px); width: min(300px, calc(100vw - 24px)); }
}

/* ══ Minimal kit ══════════════════════════════════════════════════════
   The look every header-bar tool shares (LUT, Matte, Print, Sprite,
   WebXR): no boxes around things, big plain type, soft filled fields,
   pills for actions, and the main action in a floating bar. Colours come
   from the kit variables above, so the light theme follows along. */
body.as-kit {
  --panel: #0f1116; --sunk: #0f1116; --r: 20px;
  background-image: radial-gradient(55% 45% at 50% -5%, rgba(123, 187, 255, .16), transparent 70%), radial-gradient(35% 35% at 88% 8%, rgba(184, 169, 255, .1), transparent 70%);
  background-attachment: fixed;
}
[data-theme="light"] body.as-kit {
  --panel: #ffffff; --sunk: #ffffff;
  background-image: radial-gradient(55% 45% at 50% -5%, rgba(27, 107, 208, .12), transparent 70%);
}
.as-kit .head { border-bottom: 0; box-shadow: none; }
.as-kit .head-in { padding: 14px clamp(16px, 3vw, 32px); }
.as-kit .brand span, .as-kit .back { display: none; }
.as-kit .hchip {
  font-family: var(--body); font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none;
  border-color: transparent; background: transparent; color: var(--ink-2); padding: 0 14px;
}
.as-kit .hchip:hover { border-color: transparent; background: var(--panel); color: var(--ink); }

/* The tool's name as the page headline */
.as-title { font-family: var(--display); font-weight: 600; font-size: clamp(44px, 8vw, 96px); line-height: .94; letter-spacing: -.02em; margin: 0; color: var(--ink); }
.as-title em { font-style: normal; letter-spacing: 0; color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.as-kit .intro { flex-direction: column; align-items: center; text-align: center; gap: 18px; margin: clamp(20px, 5vh, 56px) 0 clamp(32px, 6vh, 64px); }
.as-kit .intro .swatches { order: 3; }
.as-kit .tag { font-size: clamp(16px, 1.6vw, 19px); max-width: 52ch; }

/* Sections: a title and its content, no frame */
.as-kit .wrap { max-width: 1080px; }
.as-kit .grid { gap: 40px 32px; }
.as-kit .card, .as-kit .bench { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
.as-kit .bench { margin-top: 56px; }
.as-kit .card h2, .as-kit .bench h2 {
  padding: 0 0 14px; font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: -.01em;
  text-transform: none; color: var(--ink); align-items: baseline;
}
.as-kit .card h2 span { font-family: var(--body); font-size: 14px; font-weight: 400; color: var(--ink-2); }
.as-kit .pbody { padding: 0; }

.as-kit .drop { min-height: 240px; border: 0; border-radius: var(--r); background: var(--panel); gap: 6px; transition: box-shadow .2s; }
.as-kit .drop:hover, .as-kit .drop.over { background: var(--panel); box-shadow: inset 0 0 0 2px var(--cobalt); }
.as-kit .drop b { font-size: 28px; margin: 0; }
.as-kit .drop p { font-family: var(--body); font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.as-kit .lutview, .as-kit .split { border: 0; border-radius: var(--r); background: var(--panel); }
.as-kit .slice canvas { border: 0; border-radius: 14px; }
.as-kit .meta { font-family: var(--body); font-size: 14px; margin-top: 14px; }

/* Fields */
.as-kit .row { gap: 16px 12px; margin-top: 20px; }
.as-kit label.f, .as-kit .chk { font-family: var(--body); font-size: 13.5px; letter-spacing: 0; text-transform: none; color: var(--ink-2); gap: 8px; }
.as-kit .chk { font-size: 14px; }
.as-kit .chk input { width: 18px; height: 18px; }
.as-kit select, .as-kit input[type=number], .as-kit input[type=text] {
  font-family: var(--body); font-size: 15px; height: 52px; padding: 0 16px; border-radius: 14px;
  border: 1.5px solid transparent; background: var(--panel); color: var(--ink);
}
.as-kit select:hover, .as-kit input[type=number]:hover, .as-kit input[type=text]:hover { border-color: var(--line); }
.as-kit select:focus, .as-kit input[type=number]:focus, .as-kit input[type=text]:focus { border-color: var(--cobalt); }
.as-kit input[type=number] { width: 112px; }
.as-kit details.adv { border-top: 0; margin-top: 20px; padding-top: 0; }
.as-kit details.adv summary { font-family: var(--body); font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.as-kit .note { font-size: 14px; line-height: 1.55; }
.as-kit .slice .cap, .as-kit .axis, .as-kit .splitlabels { font-family: var(--body); font-size: 13.5px; letter-spacing: 0; text-transform: none; }

/* Buttons: pills. The main one is the only thing in the accent. */
.as-kit .btn {
  font-family: var(--body); font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none;
  height: 44px; padding: 0 20px; border: 0; background: var(--panel); color: var(--ink);
}
.as-kit .btn:hover { color: var(--cobalt); }
.as-kit .btn.pri, .as-kit .btn.primary { height: 52px; padding: 0 30px; font-size: 16px; font-weight: 600; }
.as-kit .btn.sm { height: 36px; padding: 0 16px; font-size: 13.5px; }
.as-kit .savebar {
  bottom: max(20px, env(safe-area-inset-bottom)); margin-top: 28px; padding: 8px; border: 0; border-radius: 99px;
  box-shadow: 0 0 0 1px var(--line), 0 24px 70px -10px rgba(0, 0, 0, .6); gap: 8px;
}
.as-kit .savebar .btn:not(.pri) { background: transparent; }
.as-kit .savebar label.f { padding-right: 6px; }
.as-kit .savebar input[type=number] { height: 44px; background: transparent; border-color: var(--line); }

/* Footer line */
.as-shell #status { justify-content: center; font-family: var(--body); font-size: 13px; letter-spacing: 0; color: var(--ink-3); border-top: 0; }
.as-shell #status .grow { flex: none; }
.as-shell #status .credit-cell { margin-left: 0; }

@media (max-width: 860px) {
  .as-kit .card h2, .as-kit .bench h2 { padding: 0 0 12px; }
  .as-kit .pbody { padding: 0; }
  .as-kit .savebar { border-radius: 26px; }
  .as-kit .row.savebar label.f { padding: 0 8px 4px; }
}
body[data-tool="lut-studio"]:has(#srcBox.hide) .brand { display: none; }
/* Nothing to save yet: the save bar waits in place instead of floating over the fields. */
.as-kit .savebar:has(.pri:disabled) { position: static; box-shadow: 0 0 0 1px var(--line); background: transparent; }

/* ══ Workspaces (Matte, Print, Sprite) ════════════════════════════════
   Same language as the minimal kit, tuned for a canvas with a settings
   panel beside it: the canvas is one rounded surface, the panel has no
   frames or header strips, and every label is plain readable type. */
.as-dense .btn { height: 38px; padding: 0 16px; font-size: 13.5px; }
.as-kit.as-dense .btn { height: 38px; padding: 0 16px; }
.as-kit.as-dense .btn.pri, .as-kit.as-dense .btn.primary { height: 46px; padding: 0 24px; font-size: 15px; }
.as-kit.as-dense .btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.as-kit.as-dense select, .as-kit.as-dense input[type=number], .as-kit.as-dense input[type=text], .as-kit.as-dense input[type=search] {
  height: 42px; padding: 0 12px; font-family: var(--body); font-size: 14px; border-radius: 12px;
  border: 1.5px solid transparent; background: var(--panel); width: 100%;
}
.as-kit.as-dense select[size] { height: auto; padding: 6px; }
.as-kit.as-dense select:focus, .as-kit.as-dense input:focus { border-color: var(--cobalt); }
.as-kit.as-dense .hchip { height: 38px; padding: 0 13px; }

/* Panels and their sections */
.as-dense #rack, .as-dense .panel, .as-dense .rail { background: transparent; border: 0; }
.as-dense .mod, .as-dense .step, .as-dense .sec { border: 0; padding: 4px 20px 22px; }
.as-dense .mod > h2, .as-dense .step h3, .as-dense .sec > h2 {
  margin: 0 0 12px; padding: 10px 0 0; background: none; border: 0;
  font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: var(--ink);
}
.as-dense .mod > h2 .idx, .as-dense .num { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink-3); }
.as-dense .mod > h2 .hint { font-family: var(--body); font-size: 12.5px; letter-spacing: 0; }
.as-dense .modbody, .as-dense .sec .in { padding: 0; }
.as-dense .modbody { gap: 14px; }

/* Canvas */
.as-dense #stage, .as-dense .stage { background-color: var(--panel); background-image: none; border: 0; border-radius: 20px; }
body[data-tool="matte-studio"] #stage { margin: 0 0 12px 16px; }
body[data-tool="sprite-studio"] .stage { margin: 0 16px 0 0; }
.as-dense .stagebar, .as-dense .strip { background: transparent; border: 0; }
body[data-tool="sprite-studio"] .stagebar { padding: 4px 16px 12px 0; }
body[data-tool="sprite-studio"] .strip { padding: 12px 16px 10px 0; }
.as-dense #zoompill { border: 0; border-radius: 99px; background: var(--shell); padding: 3px; gap: 0; left: 14px; bottom: 14px; }
.as-dense #zoompill button { background: transparent; border-radius: 99px; font-size: 12px; letter-spacing: 0; padding: 6px 12px; }

/* Empty canvas: a headline, not a dashed box */
.as-dense #dropzone .glyph, .as-dense .drop .glyph, body[data-tool="print-studio"] .drop {
  border: 0; background: transparent; font-family: var(--body); font-size: 15px; letter-spacing: 0; text-transform: none; line-height: 1.6; color: var(--ink-2);
}
.as-dense #dropzone .glyph b, .as-dense .drop h2, .as-dense .drop h3 {
  font-family: var(--display); font-size: clamp(28px, 3.6vw, 44px); font-weight: 600; letter-spacing: -.01em; line-height: 1.05; text-transform: none; margin-bottom: 6px;
}
.as-dense .drop p { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.as-dense #dropzone:hover .glyph, .as-dense #dropzone.hot .glyph, .as-dense .drop .glyph:hover, .as-dense .stage.dragover .drop .glyph, body[data-tool="print-studio"] .drop:hover, body[data-tool="print-studio"] .drop.over { background: transparent; }
.as-dense #dropzone.hot, body[data-tool="print-studio"] .drop.over { box-shadow: inset 0 0 0 2px var(--cobalt); border-radius: 20px; }

/* Segmented switches and tabs: pills */
.as-kit .seg, .as-kit .tabs { background: var(--panel); border: 0; border-radius: 99px; padding: 4px; gap: 2px; }
.as-dense .stagebar .seg, .as-dense .stagebar .tabs, .as-dense .stageBar .seg, .as-dense .head .tabs { background: var(--panel); }
.as-kit .seg button, .as-kit .tab, .as-kit .tabs button {
  font-family: var(--body); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none;
  border: 0; border-radius: 99px; padding: 0 12px; min-height: 32px; color: var(--ink-2);
}
.as-kit .seg button[aria-pressed="true"], .as-kit .tab[aria-selected="true"], .as-kit .tabs button[aria-selected="true"] {
  background: var(--ink); color: var(--shell); box-shadow: none; font-weight: 500;
}

/* Sliders, checks, notes */
.as-dense .sl, .as-dense .sl label, .as-dense label.fld, .as-dense .chk, .as-dense .chk span, .as-dense .check, .as-dense label.f > span, .as-dense .stagebar .lbl {
  font-family: var(--body); font-size: 13.5px; letter-spacing: 0; text-transform: none; color: var(--ink-2);
}
.as-dense .sl .val, .as-dense .sl output { background: transparent; border: 0; padding: 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.as-dense .chk input, .as-dense input[type=checkbox] { width: 17px; height: 17px; }
.as-dense .note, .as-dense .hint, .as-dense .info, .as-dense #chipsEmpty, .as-dense .empty, .as-dense .striphead .c { font-family: var(--body); font-size: 13px; letter-spacing: 0; line-height: 1.55; }
.as-dense .striphead .t { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.as-dense #scopeWrap { border: 0; border-radius: 16px; }
.as-dense .busy { font-family: var(--body); font-size: 13px; letter-spacing: 0; text-transform: none; }
.as-dense .toast, .as-dense .info-card, .as-dense .ctx-menu { font-family: var(--body); border-radius: 16px; }
.as-dense .info-body li, .as-dense .ctx-menu button { font-family: var(--body); font-size: 13.5px; }
.as-dense .hstatus { font-family: var(--body); font-size: 13px; letter-spacing: 0; text-transform: none; }
.as-dense #status { justify-content: flex-start; padding: 0 8px; }
.as-dense #status .credit-cell { margin-left: auto; }

@media (max-width: 860px) {
  body[data-tool="matte-studio"] #stage, body[data-tool="sprite-studio"] .stage { margin: 0 12px; }
  body[data-tool="sprite-studio"] .stagebar, body[data-tool="sprite-studio"] .strip { padding-left: 12px; padding-right: 12px; }
  .as-dense #rack, .as-dense .panel, .as-dense .rail { border: 0; }
  .as-dense .mod, .as-dense .step, .as-dense .sec { padding: 4px 16px 20px; }
}

/* ══ One stage, one row of tools ══════════════════════════════════════
   js/tools-shell.js turns each tool's stack of settings sections into a
   row of pills. Only the chosen section is on screen, in one card. */
.as-tabs {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; gap: 2px; padding: 5px; border-radius: 99px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none;
  background: rgba(15, 17, 22, .86); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 0 1px rgba(242, 253, 255, .1), 0 24px 70px -10px rgba(0, 0, 0, .8);
}
.as-tabs::-webkit-scrollbar { display: none; }
.as-tabs-flow { position: static; transform: none; align-self: center; flex: none; margin: 12px auto 4px; }
.as-tabs button {
  flex: none; height: 40px; padding: 0 18px; border: 0; border-radius: 99px; background: transparent; cursor: pointer; white-space: nowrap;
  font-family: 'General Sans', system-ui, sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; color: rgba(242, 253, 255, .64);
  transition: color .15s, background .15s;
}
.as-tabs button:hover { color: #f2fdff; }
.as-tabs button[aria-pressed="true"] { background: #f2fdff; color: #060607; }
.as-tabs button[hidden] { display: none; }
.as-tabbed .as-sec:not(.as-on) { display: none !important; }

/* Empty tool: the name, one line, one button */
.as-hero-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 64px; padding: 0 44px; border-radius: 99px; cursor: pointer;
  background: var(--as-accent); color: var(--as-accent-ink); font-family: 'General Sans', system-ui, sans-serif; font-size: 18px; font-weight: 600; letter-spacing: 0; text-transform: none;
  box-shadow: 0 18px 60px -12px rgba(123, 187, 255, .55); transition: transform .15s;
}
.as-hero-btn:hover { transform: translateY(-2px); }
.as-hero-line { display: block; font-family: 'General Sans', system-ui, sans-serif; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.5; letter-spacing: 0; text-transform: none; max-width: 40ch; margin: 22px auto 34px; opacity: .72; }
.as-hero-hint { display: block; margin-top: 16px; font-family: 'General Sans', system-ui, sans-serif; font-size: 14px; letter-spacing: 0; text-transform: none; opacity: .5; }
@media (max-width: 700px) { .as-hero-btn { height: 58px; padding: 0 34px; font-size: 17px; } .as-tabs button { height: 44px; padding: 0 16px; } }
.as-dense .drop .as-title, .as-dense .glyph .as-title { font-size: clamp(44px, 8vw, 96px); line-height: .94; letter-spacing: -.02em; margin: 0; }

/* Top bar for the tools that used a floating dock (3D Studio, QR Studio) */
.as-bar { flex: none; position: relative; z-index: 50; }
.as-bar .head-in { display: flex; align-items: center; gap: 12px; padding: 14px clamp(16px, 3vw, 32px); }
.as-bar .brand b { font-family: 'Clash Display', system-ui, sans-serif; font-size: 18px; font-weight: 600; white-space: nowrap; color: var(--as-text); }

/* ══ Use the room ═════════════════════════════════════════════════════
   The controls card runs the full height of the stage beside it, and
   whatever inside it can usefully grow (a list, a text box) grows. */
@media (min-width: 861px) {
  .as-dense #rack, .as-dense .rail, .as-dense .panel { align-self: stretch; }
  body[data-tool="print-studio"] .panel { display: flex; flex-direction: column; }
  body[data-tool="print-studio"] .panel .step.as-on { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body[data-tool="print-studio"] .panel .step.as-on > .btn:not(.wide) { align-self: flex-start; }
  body[data-tool="print-studio"] #ppPreset { flex: 1; min-height: 150px; }
  body[data-tool="qr-studio"] .qr-panel { align-self: stretch; display: flex; flex-direction: column; }
  body[data-tool="qr-studio"] .qr-panel .qr-group.as-on { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body[data-tool="qr-studio"] textarea#qr-data { flex: 1; min-height: 120px; }
  body[data-tool="qr-studio"] #qr-preview canvas, body[data-tool="qr-studio"] #qr-preview svg { width: min(54vh, 520px); max-width: none; height: auto; }
  body[data-tool="3d-studio"] #panel { align-self: stretch; }
}
@media (min-width: 1101px) {
  body[data-tool="image-studio"] main > .col:nth-child(3) { align-self: stretch; }
}
/* The workspace cards are real cards: one surface, with the fields a shade darker inside. */
.as-dense #rack, .as-dense .rail, .as-dense .panel { background: var(--panel); border-radius: 20px; }
.as-dense :is(#rack, .rail, .panel) :is(select, input[type=number], input[type=text], input[type=search], .seg, .btn:not(.pri):not(.primary)) { background: var(--shell); }
.as-dense :is(#rack, .rail, .panel) .seg button[aria-pressed="true"] { background: var(--ink); }

/* ══ Light mode ═══════════════════════════════════════════════════════
   Every tool has a Light / Dark switch in its top bar (js/tools-shell.js
   adds it where a tool had none). The choice is saved once and followed
   by all of them. Below: the light values for the shared pieces, then
   for each tool that was built dark-only. */
.as-theme {
  flex: none; height: 40px; padding: 0 14px; border: 0; border-radius: 99px; background: transparent; cursor: pointer; white-space: nowrap;
  font-family: 'General Sans', system-ui, sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--as-dim);
  transition: color .15s, background .15s;
}
.as-theme:hover { color: var(--as-text); background: var(--as-panel); }
.head-in > .as-theme { margin-left: auto; }
[data-theme="light"] { color-scheme: light; scrollbar-color: #b9c4d4 transparent; }
[data-theme="light"] .as-tabs { background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(4, 18, 43, .1), 0 18px 50px -14px rgba(4, 18, 43, .3); }
[data-theme="light"] .as-tabs button { color: rgba(4, 18, 43, .68); }
[data-theme="light"] .as-tabs button:hover { color: #04122b; }
[data-theme="light"] .as-tabs button[aria-pressed="true"] { background: #04122b; color: #ffffff; }
[data-theme="light"] .as-hero-btn { box-shadow: 0 18px 50px -14px rgba(27, 107, 208, .55); }
[data-theme="light"] .as-home:hover { background: rgba(27, 107, 208, .08); }

/* Media Studio */
[data-theme="light"] body[data-tool="media-studio"] {
  --bg: #f3f6fa; --panel: #ffffff; --surface-2: #ffffff; --surface-3: #d9e1ec; --sunk: #ffffff;
  --line: rgba(4, 18, 43, .1); --line-2: rgba(4, 18, 43, .24);
  --text: #04122b; --text-dim: rgba(4, 18, 43, .68); --faint: rgba(4, 18, 43, .5);
  --accent: #1b6bd0; --accent-2: #6a4fe0; --accent-ink: #ffffff; --accent-soft: rgba(27, 107, 208, .1);
  --ok: #15803d; --bad: #dc2626;
}
[data-theme="light"] body[data-tool="media-studio"]:has(#studioWorkspace:not(.hidden)) .head { background: rgba(243, 246, 250, .8); }
/* The waveform is drawn white-on-dark; flip it and tint with the same gradient. */
[data-theme="light"] body[data-tool="media-studio"] #waveCanvas { filter: invert(1); }
[data-theme="light"] body[data-tool="media-studio"] .waveform-stage::after { mix-blend-mode: screen; }
[data-theme="light"] body[data-tool="media-studio"] :is(.trim-mask, .vtl-trim-mask) { background: rgba(243, 246, 250, .74); }
[data-theme="light"] body[data-tool="media-studio"] .playhead-tooltip { color: #f2fdff; }
[data-theme="light"] body[data-tool="media-studio"] .video-res-badge { color: rgba(242, 253, 255, .8); }
[data-theme="light"] body[data-tool="media-studio"] :is(.vtl-handle, .vtl-playhead, .vtl-scrubber) { --text: #ffffff; }
[data-theme="light"] body[data-tool="media-studio"] .open-file-btn { box-shadow: 0 18px 50px -14px rgba(27, 107, 208, .55); }
@media (max-width: 999px) { [data-theme="light"] body[data-tool="media-studio"] .export-bar { background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(4, 18, 43, .1), 0 18px 50px -14px rgba(4, 18, 43, .3); } }

/* Image Studio */
[data-theme="light"] body[data-tool="image-studio"] {
  --ink: #f3f6fa; --panel: #f3f6fa; --raised: #e1e8f1; --sunk: #ffffff;
  --text: #04122b; --dim: rgba(4, 18, 43, .68); --faint: rgba(4, 18, 43, .52);
  --sig: #1b6bd0; --sig-soft: rgba(27, 107, 208, .1);
  --rule: rgba(4, 18, 43, .1); --rule-hi: rgba(4, 18, 43, .24);
}
[data-theme="light"] body[data-tool="image-studio"] .stage {
  background-color: #ffffff;
  background-image: linear-gradient(45deg, #e9eef5 25%, transparent 25%), linear-gradient(-45deg, #e9eef5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e9eef5 75%), linear-gradient(-45deg, transparent 75%, #e9eef5 75%);
}
[data-theme="light"] body[data-tool="image-studio"] #frame { box-shadow: 0 0 0 1px rgba(4, 18, 43, .1), 0 20px 50px -10px rgba(4, 18, 43, .28); }
[data-theme="light"] body[data-tool="image-studio"] .stagetools { background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(4, 18, 43, .1); }
[data-theme="light"] body[data-tool="image-studio"] :is(.btn, .as-hero-btn) { color: #ffffff; }

/* 3D Studio */
[data-theme="light"] body[data-tool="3d-studio"] {
  --bg: #f3f6fa; --panel: #f3f6fa; --panel2: #ffffff; --line: rgba(4, 18, 43, .1);
  --ink: #04122b; --muted: rgba(4, 18, 43, .68); --accent: #1b6bd0; --accent2: rgba(4, 18, 43, .5);
}
[data-theme="light"] body[data-tool="3d-studio"] :is(#bgMode .chip.active, .btn.primary) { color: #ffffff; }
/* Text laid over the 3D view sits on the render background, which stays as the user set it. */
[data-theme="light"] body[data-tool="3d-studio"] :is(.hint, .credit-line) { color: rgba(242, 253, 255, .64); }
[data-theme="light"] body[data-tool="3d-studio"] .credit-line a { color: rgba(242, 253, 255, .8); }
[data-theme="light"] body[data-tool="3d-studio"] .badge { color: #f2fdff; }
[data-theme="light"] body[data-tool="3d-studio"] .ctx-menu { border-color: rgba(4, 18, 43, .2); }

/* QR Studio */
[data-theme="light"] body[data-tool="qr-studio"] {
  --bg: #f3f6fa; --panel: #ffffff; --white: #04122b; --text-dim: rgba(4, 18, 43, .6);
  --white-06: rgba(4, 18, 43, .06); --white-10: rgba(4, 18, 43, .1); --white-20: rgba(4, 18, 43, .2); --white-40: rgba(4, 18, 43, .45); --white-60: rgba(4, 18, 43, .68);
  background: var(--bg); color: var(--white);
}
html[data-theme="light"]:has(body[data-tool="qr-studio"]) { background: #f3f6fa; }
[data-theme="light"] body[data-tool="qr-studio"] :is(.qr-group h4, .qr-filebtn, .qr-btn, .qr-mini-btn, textarea#qr-data, select) { color: #04122b; }
[data-theme="light"] body[data-tool="qr-studio"] :is(.qr-label, .qr-inline, .qr-check, .qr-chips button) { color: rgba(4, 18, 43, .68); }
[data-theme="light"] body[data-tool="qr-studio"] :is(.qr-stage, .qr-panel) { background: #ffffff; }
[data-theme="light"] body[data-tool="qr-studio"] .qr-panel :is(textarea#qr-data, .qr-chips button, .qr-btn:not(.qr-btn-primary), .qr-mini-btn, .qr-filebtn, select) { background: #f3f6fa; }
[data-theme="light"] body[data-tool="qr-studio"] .qr-panel .qr-chips button.is-active { background: #04122b; color: #ffffff; }
[data-theme="light"] body[data-tool="qr-studio"] select option { background: #ffffff; }
[data-theme="light"] body[data-tool="qr-studio"] textarea#qr-data:focus { border-color: #1b6bd0; }
[data-theme="light"] body[data-tool="qr-studio"] .qr-preview-card { box-shadow: 0 0 0 1px rgba(4, 18, 43, .08), 0 30px 70px -24px rgba(4, 18, 43, .35); }
[data-theme="light"] body[data-tool="qr-studio"] :is(input[type=range], .qr-check input) { accent-color: #1b6bd0; }

/* WebXR */
[data-theme="light"] body[data-tool="webxr"] {
  --bg: #f3f6fa; --panel: #ffffff; --line: rgba(4, 18, 43, .1); --line-2: rgba(4, 18, 43, .24);
  --white: #04122b; --white-60: rgba(4, 18, 43, .68); --white-40: rgba(4, 18, 43, .5); --text-dim: rgba(4, 18, 43, .6); --white-10: rgba(4, 18, 43, .1);
}
[data-theme="light"] body[data-tool="webxr"] svg[stroke="#ffffff"] { stroke: #04122b; }
[data-theme="light"] body[data-tool="webxr"] #spatialCanvas { filter: invert(1) hue-rotate(180deg); }

/* Tool icons: the home button wears the current tool's icon. */
.as-home.as-home-tool { border-color: transparent; background: transparent; }
.as-home.as-home-tool img { width: 34px; height: 34px; display: block; transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.as-home.as-home-tool:hover { border-color: var(--as-line); background: transparent; }
.as-home.as-home-tool:hover img { transform: scale(1.08) rotate(-6deg); }
.as-menu a { align-items: center; }
.as-menu-name { display: inline-flex; align-items: center; gap: 10px; }
.as-menu-name img { width: 22px; height: 22px; flex: none; }
