* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0f1419;
  color: #eef3f7;
  font: 13px/1.4 system-ui, sans-serif;
}

.toolbar {
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  flex-wrap: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid #2a343d;
  background: #151b21;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.demo-home-link {
  flex: none;
  color: #80e1d5;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.demo-home-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.demo-home-link:focus-visible { outline: 2px solid #80e1d5; outline-offset: 3px; }

.toolbar strong {
  font-size: 14px;
  white-space: nowrap;
}

input,
button,
select {
  height: 30px;
  border: 1px solid #35424d;
  border-radius: 4px;
  background: #202a33;
  color: #eef3f7;
  font: inherit;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  color: #c9d3dc;
  white-space: nowrap;
}

.toggle input {
  width: 14px;
  min-width: 14px;
  height: 14px;
}

input {
  min-width: 180px;
  width: min(320px, 28vw);
  padding: 0 9px;
}

button {
  padding: 0 10px;
  cursor: pointer;
}

select {
  padding: 0 8px;
}

button:hover {
  background: #27333e;
}

#stats,
#sort-note {
  color: #9ba8b3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#message {
  color: #facc15;
  white-space: nowrap;
}

#benchmark-panel {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 3;
  width: 280px;
  border: 1px solid #2a343d;
  background: rgb(11 16 32 / 88%);
  color: #c9d3dc;
  padding: 8px 10px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  pointer-events: none;
}

#benchmark-panel .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

#benchmark-panel .rule {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #2a343d;
  color: #94a3b8;
}

#json-dialog {
  width: min(780px, calc(100vw - 32px));
  border: 1px solid #35424d;
  background: #111827;
  color: #eef3f7;
  padding: 0;
}

#json-dialog::backdrop {
  background: rgb(0 0 0 / 55%);
}

#json-dialog form {
  display: grid;
  gap: 0;
  margin: 0;
}

#json-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-bottom: 1px solid #35424d;
}

#json-output {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: #0b1020;
  color: #dbeafe;
  padding: 10px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tree-shell {
  position: fixed;
  inset: 44px 0 0 0;
  background: #0f1419;
}

/* The benchmark has more controls than the compact inspector toolbar. */
.benchmark-demo {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.benchmark-demo .toolbar {
  position: relative;
  inset: auto;
  height: auto;
  min-height: 44px;
  flex: none;
  flex-wrap: wrap;
  align-content: center;
  gap: 6px 14px;
  overflow: visible;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.toolbar-brand { flex: 0 0 auto; gap: 10px; }
#toggle-metrics { display: none; }
.toolbar-search { flex: 1 1 440px; flex-wrap: wrap; }
.toolbar-search input {
  width: auto;
  min-width: 100px;
  flex: 1 1 140px;
}
.toolbar-settings { flex: 1 1 380px; flex-wrap: wrap; }
.toolbar-actions { flex: 1 1 350px; flex-wrap: wrap; }
.toolbar-feedback { flex: 1 1 150px; overflow: hidden; }
.toolbar-feedback #stats { flex: 1 1 auto; min-width: 0; }
.toolbar-benchmark button,
.toolbar-benchmark select { flex: none; white-space: nowrap; }

.benchmark-demo .tree-shell {
  position: relative;
  inset: auto;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

#tree {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #2a343d;
  background: #101419;
  outline: none;
}

#tree:focus {
  border-color: #46a7ff;
}

@media (max-width: 900px) {
  .toolbar-brand { gap: 6px; }
  #toggle-metrics { display: inline-block; margin-left: 2px; }
  #benchmark-panel { display: none; }
  #benchmark-panel.is-open {
    display: block;
    width: min(280px, calc(100% - 20px));
    max-height: min(70%, 580px);
    overflow: auto;
    pointer-events: auto;
  }
}
