:root {
  color-scheme: dark;
  background: #121416;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #121416;
}

#synth-root {
  width: 100%;
  overflow: hidden;
  color: #e5e7eb;
  font: 13px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#synth-root *,
#synth-root *::before,
#synth-root *::after {
  box-sizing: border-box;
}

/* Carried node colour and text style (sru-45) reach the DOM as per-node custom
   properties. Each rule below names the surface that value paints for its node
   kind, and every `var()` fallback is the flat default look a node that carries
   nothing still gets. The backend decides nothing here beyond which surface a
   kind's one carried colour belongs on. */

#synth-root [data-synth-node-kind="root"] {
  background: var(--synth-fill, #121416);
  border-radius: var(--synth-corner-radius, 0);
  box-shadow: inset 0 0 0 var(--synth-border-width, 0) var(--synth-border-color, transparent);
}

#synth-root [data-synth-node-kind="row"],
#synth-root [data-synth-node-kind="section"],
#synth-root [data-synth-node-kind="scroll-area"] {
  background: var(--synth-fill, transparent);
  border-radius: var(--synth-corner-radius, 0);
  box-shadow: inset 0 0 0 var(--synth-border-width, 0) var(--synth-border-color, transparent);
}

#synth-root [data-synth-node-kind="label"],
#synth-root [data-synth-node-kind="status-text"] {
  display: flex;
  align-items: center;
  justify-content: var(--synth-text-align, flex-start);
  overflow: hidden;
  /* The node colour backs the text; the glyphs come from the text style. */
  background: var(--synth-fill, transparent);
  color: var(--synth-glyph, #e5e7eb);
  font-size: var(--synth-text-size, inherit);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#synth-root button,
#synth-root select,
#synth-root input[type="text"] {
  border: 1px solid #52606b;
  border-radius: 4px;
  background: var(--synth-fill, #252a2f);
  color: var(--synth-glyph, #f8fafc);
  font: inherit;
}

#synth-root button {
  /* Under `box-sizing: border-box` the used width is floored at border plus
     padding, so a flat `0 12px` made every button at least 26px wide however
     narrow an extent the library resolved for it -- the 24px Controllers
     disclosure rendered 26px and ate 2px of the row's 4px gap. The floor is
     capped against the node's own resolved width, which `ui.ts` publishes as
     `--synth-node-width`, so the chrome shrinks to fit rather than the element
     growing. Both chrome constants stay here; the backend contributes only the
     extent it was already given. */
  padding: 0 max(0px, min(12px, calc((var(--synth-node-width, 9999px) - 2px) / 2)));
  cursor: pointer;
}

#synth-root button:hover {
  border-color: #78a9b0;
  background: var(--synth-fill-hover, #30383e);
}

#synth-root button:active {
  background: var(--synth-fill-active, #285f64);
}

#synth-root button:focus-visible,
#synth-root select:focus-visible,
#synth-root input:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 1px;
}

#synth-root [data-synth-node-kind="toggle"] {
  display: flex;
  align-items: center;
  gap: 5px;
  /* Fitting text inside the resolved extent is the backend's own local
     concern (sru-49): clip rather than push a neighbour aside. */
  overflow: hidden;
  color: var(--synth-glyph, inherit);
  white-space: nowrap;
}

/* A toggle's control is its box, so the carried control fill is its accent. */
#synth-root [data-synth-node-kind="toggle"] input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--synth-fill, #2ca7ac);
}

#synth-root [data-synth-node-kind="slider"] {
  display: flex;
  align-items: center;
}

/* The carried colour is the slider's filled-track accent. */
#synth-root [data-synth-node-kind="slider"] input {
  width: 100%;
  margin: 0;
  accent-color: var(--synth-fill, #2ca7ac);
}

#synth-root canvas {
  display: block;
}

/* The element-level dim every disabled node gets, carried colour or not. It is
   the counterpart of `component.setAlpha(0.58f)` in `PortableJuceBackend.hpp`,
   which is likewise unconditional, so the two backends dim a disabled node the
   same way and by the same amount. The carried colour's own disabled fold
   (`darker(0.35)`) is applied exactly once, before this. */
#synth-root [aria-disabled="true"] {
  opacity: 0.58;
}

.synth-launcher {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.synth-launcher__header,
.synth-launcher__status,
.synth-launcher__sources {
  margin-bottom: 24px;
}

.synth-launcher__title,
.synth-launcher__subtitle,
.synth-launcher__app-name,
.synth-launcher__sources-title {
  margin: 0;
}

.synth-launcher__subtitle,
.synth-launcher__status,
.synth-launcher__metadata,
.synth-launcher__diagnostic {
  color: #aeb8c2;
}

.synth-launcher__apps,
.synth-launcher__diagnostics {
  display: grid;
  gap: 12px;
  padding: 0;
  list-style: none;
}

.synth-launcher__app {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 20px;
  border: 1px solid #39434c;
  border-radius: 8px;
  background: #1b1f23;
}

.synth-launcher__metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 0;
}

.synth-launcher__metadata div {
  display: flex;
}

.synth-launcher__metadata dt {
  margin-right: 5px;
  font-weight: 700;
}

.synth-launcher__metadata dd {
  margin: 0;
}

.synth-launcher__app-error {
  grid-column: 1 / -1;
  margin: 0;
  color: #fca5a5;
}

.synth-launcher button {
  min-height: 38px;
}

.synth-launcher button:disabled {
  cursor: default;
  opacity: 0.58;
}

@media (max-width: 600px) {
  .synth-launcher {
    width: min(100% - 24px, 880px);
    padding: 24px 0;
  }

  .synth-launcher__app {
    grid-template-columns: 1fr;
  }
}
