/* Aureality Studio — app shell. Brand tokens from the kit (blue palette, Outfit + IBM Plex Mono). */
:root {
  --bg: #07090D; --alt: #0E1116; --panel: #151920; --panel2: #1B2029; --line: #262C36; --line2: #333B48;
  --text: #F5F7FB; --muted: #A4ADBA; --dim: #6F7987; --button: #2563EB; --link: #7FB0FF; --hi: #8DBBFF;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --top: 28px; --bar: 38px; --opt: 32px; --tools: 38px; --side: 272px; --foot: 24px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 12px/1.4 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--hi); outline-offset: 1px; }
.ic { display: block; flex: none; }

/* ---------- grid ---------- */
.st { position: fixed; inset: var(--top) 0 0 0; display: grid;
  grid-template-columns: var(--tools) 1fr var(--side);
  grid-template-rows: var(--bar) var(--opt) 1fr auto;
  grid-template-areas: "top top top" "opt opt opt" "tools stage panel" "foot foot foot"; }
.st.no-panel { grid-template-columns: var(--tools) 1fr 0; }
.st.no-panel .st-panel { display: none; }

/* ---------- top bar ---------- */
.st-top { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--alt); border-bottom: 1px solid var(--line); min-width: 0; }
.st-brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding-right: 6px; flex: none; }
.st-brand b { font-weight: 500; font-size: 13.5px; letter-spacing: .01em; }
.st-menubar { display: flex; gap: 1px; flex: none; }
.st-menubar > div { position: relative; }
.st-menubar > div > button { background: none; border: 0; padding: 4px 8px; border-radius: 5px; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.st-menubar > div > button:hover, .st-menubar > div.open > button { color: var(--text); background: rgba(255,255,255,.06); }
.st-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 230px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.55); z-index: 50; display: none; }
.st-menubar > div.open .st-menu { display: block; }
.st-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 5px 9px; background: none; border: 0; border-radius: 5px; cursor: pointer; text-align: left; font-size: 12.5px; }
.st-menu button:hover:not(:disabled) { background: var(--button); }
.st-menu button:disabled { color: var(--dim); cursor: default; }
.st-menu button kbd { margin-left: auto; font: 400 11px var(--mono); color: var(--muted); }
.st-menu button:hover kbd { color: #dfe8ff; }
.st-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.st-menu .st-menu-h { padding: 6px 9px 3px; font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

.st-tabs { display: flex; gap: 2px; margin: 0 auto; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; flex: none; }
.st-tab { display: flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.st-tab:hover { color: var(--text); }
.st-tab[aria-selected="true"] { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.st-tab[aria-selected="true"] .ic { color: var(--hi); }
.st-tab small { font-weight: 400; color: var(--dim); }
.st-right { display: flex; align-items: center; gap: 8px; flex: none; }
.st-right .ax-avatar { width: 26px; height: 26px; font-size: 11px; }
.st-right .ax-pillbtn { padding: 5px 11px; font-size: 12px; }
.st-place { display: flex; align-items: center; gap: 6px; max-width: 220px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--hi); cursor: pointer; font: 400 11.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-iconbtn { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.st-iconbtn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.st-iconbtn[aria-pressed="true"] { color: var(--hi); background: rgba(141,187,255,.12); }

/* ---------- options bar ---------- */
.st-options { grid-area: opt; display: flex; align-items: center; gap: 10px; padding: 0 10px; font-size: 12px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.st-options .opt-tool { display: flex; align-items: center; gap: 6px; color: var(--hi); font-weight: 500; padding-right: 10px; border-right: 1px solid var(--line); }
.st-options label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.st-options input[type=number], .st-options select, .st-field input, .st-field select { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; font: 400 11.5px var(--mono); color: var(--text); }
.st-options input[type=number] { width: 58px; }
.st-options select { max-width: 150px; }
.st-options input[type=range] { width: 90px; accent-color: var(--hi); }
.st-options input[type=color], .st-field input[type=color] { width: 26px; height: 22px; padding: 0; border: 1px solid var(--line2); border-radius: 5px; background: none; cursor: pointer; }
.st-options .sep { width: 1px; height: 20px; background: var(--line); }
.st-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; background: none; color: var(--muted); cursor: pointer; font: 500 11px var(--mono); letter-spacing: .04em; }
.st-toggle[aria-pressed="true"] { color: var(--bg); background: var(--hi); border-color: var(--hi); }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line2); border-radius: 5px; background: var(--panel2); color: var(--text); cursor: pointer; font-size: 12.5px; text-decoration: none; }
.st-btn:hover { border-color: var(--hi); }
.st-btn-primary { background: var(--button); border-color: var(--button); color: #fff; }
.st-btn-sm { padding: 2px 8px; font-size: 11.5px; }

/* ---------- tools ---------- */
.st-tools { grid-area: tools; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; background: var(--alt); border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none; }
.st.tools2 { --tools: 64px; }
.st-tools.two { display: grid; grid-template-columns: 28px 28px; gap: 2px; justify-content: center; align-content: start; }
.st-tools.two .tsep { grid-column: 1 / -1; width: auto; margin: 3px 4px; }
.st-tools.two .st-swatch { grid-column: 1 / -1; justify-self: center; }
.st-tools .tsep { width: 20px; height: 1px; background: var(--line); margin: 4px 0; flex: none; }
.st-tool { position: relative; display: grid; place-items: center; width: 28px; height: 26px; flex: none; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; }
.st-tool:hover { color: var(--text); background: rgba(255,255,255,.06); }
.st-tool[aria-pressed="true"] { color: #fff; background: var(--button); }
.st-tool[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); padding: 4px 7px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line2); color: var(--text); font: 400 11.5px var(--font); white-space: nowrap; z-index: 40; pointer-events: none; }
.st-swatch { position: relative; width: 30px; height: 30px; margin-top: 8px; flex: none; }
.st-swatch input { position: absolute; width: 19px; height: 19px; padding: 0; border: 2px solid var(--text); border-radius: 4px; cursor: pointer; background: none; }
.st-swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.st-swatch input::-webkit-color-swatch { border: 0; border-radius: 2px; }
.st-swatch .fg { left: 0; top: 0; z-index: 2; }
.st-swatch .bg { right: 0; bottom: 0; }

/* ---------- stage ---------- */
.st-stage { grid-area: stage; position: relative; overflow: hidden; background: #0A0D12; min-width: 0; }
.st-stage > section { position: absolute; inset: 0; }
.st-stage canvas { display: block; touch-action: none; }
.st-stage .overlay { position: absolute; inset: 0; pointer-events: none; }
.st-hint:empty { display: none; }
.st-hint { position: absolute; left: 12px; bottom: 10px; padding: 5px 9px; border-radius: 6px; background: rgba(7,9,13,.78); color: var(--muted); font-size: 12px; pointer-events: none; }
.st-viewlabel { position: absolute; left: 12px; top: 10px; padding: 4px 8px; border-radius: 6px; background: rgba(7,9,13,.7); color: var(--muted); font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; pointer-events: none; }
.st-textedit { position: absolute; min-width: 40px; padding: 0; margin: 0; background: rgba(7,9,13,.4); border: 1px dashed var(--hi); outline: 0; color: var(--text); white-space: pre; resize: none; overflow: hidden; }

/* ---------- side panel ---------- */
.st-panel { grid-area: panel; display: flex; flex-direction: column; background: var(--alt); border-left: 1px solid var(--line); min-height: 0; overflow: hidden; }
.st-panel > section { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.st-sec { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.st-sec.grow { flex: 1; }
.st-sec > h2 { display: flex; align-items: center; gap: 6px; margin: 0; padding: 7px 10px; font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.st-sec > h2 .acts { margin-left: auto; display: flex; gap: 2px; }
.st-sec > h2 .acts button { display: grid; place-items: center; width: 22px; height: 20px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.st-sec > h2 .acts button:hover { color: var(--text); background: rgba(255,255,255,.07); }
.st-sec .body { padding: 2px 10px 10px; overflow-y: auto; }
.st-sec.grow .body { flex: 1; }
.st-field { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 6px; margin: 4px 0; color: var(--muted); font-size: 11.5px; }
.st-field input:not([type=color]):not([type=checkbox]):not([type=range]), .st-field select { width: 100%; min-width: 0; }
.st-field input[type=range] { width: 100%; accent-color: var(--hi); }
.st-xyz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.st-xyz input { width: 100%; min-width: 0; }
.st-empty { color: var(--dim); padding: 6px 0; }
.st-list { list-style: none; margin: 0; padding: 0; }
.st-row { display: flex; align-items: center; gap: 6px; padding: 3px 5px; border-radius: 4px; font-size: 12px; cursor: pointer; border: 1px solid transparent; }
.st-row:hover { background: rgba(255,255,255,.04); }
.st-row.on { background: rgba(37,99,235,.22); border-color: rgba(141,187,255,.35); }
.st-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row .nm input { width: 100%; background: var(--bg); border: 1px solid var(--hi); border-radius: 4px; padding: 1px 4px; }
.st-row .mini { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; flex: none; }
.st-row .mini:hover { color: var(--text); background: rgba(255,255,255,.07); }
.st-row .chip { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(255,255,255,.25); }
.st-row .thumb { width: 30px; height: 22px; border-radius: 3px; flex: none; border: 1px solid var(--line2); background: repeating-conic-gradient(#2a2f38 0 25%, #1c2028 0 50%) 0 0/8px 8px; image-rendering: pixelated; }
.st-row .sub { color: var(--dim); font: 400 11px var(--mono); }
.st-row.dim .nm { color: var(--dim); }
.st-row[data-depth="1"] { padding-left: 22px; }

/* ---------- footer: command line + status ---------- */
.st-foot { grid-area: foot; background: var(--alt); border-top: 1px solid var(--line); }
.st-cmd { border-bottom: 1px solid var(--line); }
.st-cmd-log { max-height: 46px; overflow-y: auto; padding: 4px 12px 0; font: 400 11.5px/1.5 var(--mono); color: var(--muted); }
.st-cmd-log .me { color: var(--text); }
.st-cmd-log .err { color: #FF9C8A; }
.st-cmd-in { display: flex; align-items: center; gap: 8px; padding: 3px 10px 5px; }
.st-cmd-in span { font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--hi); }
.st-cmd-in input { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; font: 400 12px var(--mono); color: var(--text); }
.st-cmd-in input:focus { border-color: var(--hi); outline: 0; }
.st-status { display: flex; align-items: center; gap: 16px; height: var(--foot); padding: 0 10px; font: 400 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; }
.st-status b { color: var(--text); font-weight: 400; }
.st-status .grow { flex: 1; }
.st-status button { background: none; border: 0; padding: 2px 5px; border-radius: 4px; font: 500 11px var(--mono); color: var(--dim); cursor: pointer; letter-spacing: .04em; }
.st-status button[aria-pressed="true"] { color: var(--hi); background: rgba(141,187,255,.12); }

/* ---------- gate, dialog, toast ---------- */
.st-gate { position: fixed; inset: var(--top) 0 0 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: radial-gradient(1000px 600px at 50% 0%, rgba(37,99,235,.18), transparent 60%), rgba(7,9,13,.92); backdrop-filter: blur(6px); }
.st-gate-card { width: min(480px, 100%); padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.6); font-size: 15px; line-height: 1.55; }
.st-gate-card h1 { margin: 12px 0 6px; font-weight: 500; font-size: 26px; }
.st-gate-card p { margin: 0 0 14px; color: var(--muted); }
.st-gate-card ul { margin: 0 0 16px; padding: 0; list-style: none; }
.st-gate-card li { padding: 7px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.st-gate-card li b { display: block; color: var(--text); font-weight: 500; }
.st-gate-note { font-size: 13.5px; }
.st-gate-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.st-gate-actions .st-btn { padding: 9px 16px; font-size: 14px; }

.st-dialog { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.5); }
.st-dialog .card { width: min(420px, 100%); max-height: 86vh; overflow-y: auto; padding: 18px; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.st-dialog h3 { margin: 0 0 10px; font-weight: 500; font-size: 16px; }
.st-dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.st-dialog table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.st-dialog td { padding: 4px 6px; border-top: 1px solid var(--line); }
.st-dialog td:first-child { font: 400 11.5px var(--mono); color: var(--hi); white-space: nowrap; }
.st-dialog .card.wide { width: min(640px, 100%); }
.st-dialog h4 { margin: 14px 0 4px; font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.st-toast { position: fixed; left: 50%; bottom: 46px; transform: translate(-50%, 20px); z-index: 80; padding: 8px 14px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line2); color: var(--text); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.st-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens: tools along the bottom, panel as a drawer ---------- */
@media (max-width: 900px) {
  :root { --side: 0px; }
  .st-tab small, .st-brand b { display: none; }
  .st-tab { padding: 6px 9px; }
  .st-panel { position: fixed; right: 0; top: calc(var(--top) + var(--bar)); bottom: 0; width: min(300px, 86vw); z-index: 30; box-shadow: -20px 0 50px rgba(0,0,0,.5); }
  .st:not(.panel-open) .st-panel { display: none; }
  .st.no-panel .st-panel { display: none; }
}
@media (max-width: 640px) {
  .st { grid-template-columns: 1fr; grid-template-rows: var(--bar) var(--opt) 1fr auto auto; grid-template-areas: "top" "opt" "stage" "tools" "foot"; }
  .st.no-panel { grid-template-columns: 1fr; }
  .st-menubar { display: none; }
  .st-menubtn { display: grid !important; }
  .st-tabs { margin: 0; }
  .st-tab .lbl { display: none; }
  .st-tools { flex-direction: row; padding: 4px 8px; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .st-tools .tsep { width: 1px; height: 22px; margin: 0 4px; }
  .st-tools.two { display: flex; }
  .st-tools.two .tsep { width: 1px; margin: 0 4px; grid-column: auto; }
  .st.tools2 { --tools: 38px; }
  .st-tool[data-tip]:hover::after { display: none; }
  .st-swatch { margin: 0 0 0 6px; }
  .st-cmd-log { display: none; }
  .st-place { display: none !important; }
}
.st-menubtn { display: none; }
