:root {
  color-scheme: light;
  --page: #ffffff;
  --canvas: #f5f7fa;
  --surface: #ffffff;
  --strong: #1d2a3d;
  --text: #4d5e77;
  --muted: #6c7b90;
  --border: #d8e0e9;
  --border-strong: #9ba8b7;
  --accent: #0874e8;
  --accent-soft: #eaf3ff;
  --danger: #b42318;
  --shadow: 0 1px 2px rgb(23 37 55 / 5%);
  --panel-radius: 15px;
  --panel-inset: 14px;
  --nested-radius: calc(var(--panel-radius) - var(--panel-inset) / 2);
  font-family: 'Noto Sans', ui-sans-serif, system-ui, sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #10151c;
  --canvas: #0c1117;
  --surface: #151c24;
  --strong: #edf3fc;
  --text: #c5d0e0;
  --muted: #91a0b5;
  --border: #293341;
  --border-strong: #526176;
  --accent: #43d866;
  --accent-soft: #13291c;
  --danger: #ff8a80;
  --shadow: 0 1px 2px rgb(0 0 0 / 25%);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--text);
}

body {
  font-size: 14px;
}

#tools-demo {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

button,
input,
select {
  font: inherit;
}

.settings {
  border-bottom: 1px solid var(--border);
  background: var(--canvas);
}

.settings summary {
  padding: 13px var(--panel-inset);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  list-style-position: inside;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 4px var(--panel-inset) var(--panel-inset);
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.field.wide {
  grid-column: 1 / -1;
}

.field span,
.compose label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.field input,
.field select,
.compose input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--nested-radius);
  outline: 0;
  background: var(--surface);
  color: var(--strong);
}

.field input,
.field select {
  height: 38px;
  padding: 7px 10px;
  font-size: 12px;
}

.field input:focus,
.field select:focus,
.compose input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.errors {
  padding: 10px var(--panel-inset);
  border-bottom: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger) 9%, var(--page));
  color: var(--danger);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.errors:empty {
  display: none;
}

.panes {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(230px, 2fr);
  min-height: 0;
  flex: 1;
}

.scene-pane,
.model-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.scene-pane {
  border-right: 1px solid var(--border);
}

.scene-pane > header,
.model-pane > header {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px var(--panel-inset);
  border-bottom: 1px solid var(--border);
  background: var(--canvas);
  color: var(--strong);
  font-size: 11px;
  font-weight: 600;
}

.scene-pane > header small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.canvas-wrap {
  display: flex;
  min-height: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: var(--panel-inset);
  background: var(--page);
}

#tools-canvas {
  display: block;
  width: 100%;
  max-width: 620px;
  max-height: 100%;
  aspect-ratio: 620 / 300;
  touch-action: none;
  border: 1px solid var(--border);
  border-radius: var(--nested-radius);
  background: var(--canvas);
  box-shadow: var(--shadow);
}

.compose {
  padding: 13px var(--panel-inset) var(--panel-inset);
  border-top: 1px solid var(--border);
  background: var(--canvas);
}

.compose label {
  display: block;
  margin-bottom: 7px;
}

.compose > div {
  display: flex;
  gap: 8px;
}

.compose input {
  height: 42px;
  flex: 1;
  padding: 8px 11px;
}

.compose button {
  min-width: 76px;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

:root[data-theme='dark'] .compose button {
  color: #08110b;
}

.compose button:disabled,
.compose input:disabled {
  cursor: default;
  opacity: 0.58;
}

.messages,
.log {
  min-height: 0;
  flex: 1;
  padding: 12px var(--panel-inset);
  overflow: auto;
  background: var(--surface);
}

.messages {
  flex: 3;
}

.log {
  flex: 2;
}

.empty {
  margin: 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.messages:has(.a11-bubble) .empty,
.log:has(.a11-log-line) .empty {
  display: none;
}

.a11-bubble {
  width: fit-content;
  max-width: 92%;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--nested-radius);
  background: var(--canvas);
  color: var(--strong);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.a11-bubble.question {
  margin-left: auto;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

:root[data-theme='dark'] .a11-bubble.question {
  color: #08110b;
}

.a11-log-line {
  padding: 3px 0;
  color: var(--muted);
  font:
    11px/1.55 ui-monospace,
    'SFMono-Regular',
    Consolas,
    monospace;
  overflow-wrap: anywhere;
}

.a11-log-line.done {
  color: var(--accent);
}

.a11-connection-banner {
  color: inherit;
}

@media (max-width: 620px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .field.wide {
    grid-column: auto;
  }

  .panes {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(380px, auto) minmax(300px, 1fr);
    flex: none;
  }

  .scene-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .canvas-wrap {
    min-height: 190px;
  }
}
