:root {
  color-scheme: dark;
  --bg: #151715;
  --panel: #1b1e1b;
  --border: #343a32;
  --text: #e5e9df;
  --muted: #9ba596;
  --accent: #d4ed9a;
  --paper: #f4f4e9;
  font:
    13px/1.6 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
@font-face {
  font-family: BoardHand;
  src: url("/fonts/Kalam-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: BoardHand;
  src: url("/fonts/Kalam-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: block;
}
@font-face {
  font-family: BoardSans;
  src: url("/fonts/NotoSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: block;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select,
.file-button {
  color: var(--text);
  border: 1px solid var(--border);
  background: #222720;
  border-radius: 6px;
  padding: 7px 10px;
}
button,
.file-button,
summary {
  cursor: pointer;
}
button:hover,
.file-button:hover {
  border-color: #869774;
  background: #2c3527;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}

.voice-controls {
  margin: 20px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.voice-controls > button {
  width: 100%;
  margin: 5px 0;
}

#talk {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#talk[aria-pressed="true"] {
  background: #a53b2c;
  color: white;
}
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button.primary {
  color: #17200f;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
button.quiet {
  background: none;
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
textarea {
  resize: vertical;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #151915;
  color: var(--text);
  line-height: 1.55;
}
label {
  display: block;
  font-size: 12px;
  margin: 14px 0 7px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.8px;
  margin: 20px 0 15px;
}
h2 {
  font-weight: 500;
  font-size: 17px;
  margin: 4px 0 0;
}
h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}
p {
  margin-bottom: 12px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 11px;
}
.topbar {
  height: 67px;
  padding: 0 27px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  gap: 28px;
}
.brand {
  font-size: 23px;
  font-weight: 650;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -1px;
}
.brand span {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 14px;
}
.mode {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 10px monospace;
  color: var(--muted);
  margin-left: auto;
}
.mode i {
  width: 6px;
  height: 6px;
  border-radius: 100%;
  background: var(--accent);
}
.mode span {
  margin: 0 4px;
}
.workspace {
  display: grid;
  grid-template-columns: 250px minmax(320px, 1fr) 280px;
  min-height: calc(100vh - 67px);
}
aside {
  padding: 26px 22px;
}
.profiles-panel {
  border-right: 1px solid var(--border);
}
.inspector {
  border-left: 1px solid var(--border);
  background: #191d18;
}
.eyebrow {
  font: 10px monospace;
  letter-spacing: 1.8px;
  color: var(--muted);
}
#profile-select {
  width: 100%;
  font-size: 11px;
}
dl {
  margin: 18px 0;
}
dl div {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid #2b3029;
  font-size: 11px;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  text-align: right;
  max-width: 65%;
}
.button-row {
  display: flex;
  gap: 6px;
  margin: 12px 0;
}
.button-row button {
  flex: 1;
  font-size: 11px;
  padding: 7px 6px;
}
details {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 15px;
}
summary {
  font-size: 12px;
}
details p {
  margin: 12px 0;
}
.file-button {
  font-size: 11px;
  text-align: center;
}
#import-profile {
  display: none;
}
#profile-json {
  font: 10px/1.6 monospace;
}
#apply-profile {
  width: 100%;
  margin-top: 10px;
}
.error {
  color: #f5bdb0;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.scope-note {
  margin-top: 28px;
  font-size: 11px;
  color: var(--muted);
}
.scope-note strong {
  color: #bdc9b5;
  font-weight: 500;
}
.scope-note p {
  margin-top: 7px;
}
main {
  padding: 26px 30px;
  min-width: 0;
}
.stage-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pill {
  font: 10px monospace;
  white-space: nowrap;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 9px;
}
.screen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 12px;
  font-size: 11px;
  color: var(--muted);
}
.screen-toolbar select {
  font-size: 10px;
  padding: 4px 8px;
}
.stage {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  height: calc(100vh - 333px);
  max-height: 730px;
  padding: 12px;
  background: radial-gradient(
    ellipse at center,
    #30352b 0,
    #242922 55%,
    #20251e 100%
  );
  border: 1px solid #363d30;
  border-radius: 12px;
  overflow: hidden;
}
.device {
  position: relative;
  line-height: 0;
  padding: 13px;
  border: 1px solid #595b50;
  border-radius: 9px;
  background: #41443b;
  box-shadow: 0 16px 35px #080d0870;
  max-height: 100%;
  max-width: 100%;
  aspect-ratio: var(--ratio, 0.75);
  height: 100%;
}
.device canvas {
  display: block;
  background: #fff;
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: 0 0 0 1px #191d16;
  image-rendering: auto;
}
.touch-controls {
  position: absolute;
  inset: 13px;
  touch-action: none;
  user-select: none;
}
.touch-controls button {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-controls button:hover {
  background: transparent;
}
.touch-controls button:active {
  background: #0002;
}
.touch-controls button:focus-visible {
  outline: 2px solid black;
  outline-offset: -2px;
}
#board-dialog {
  color-scheme: light;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 24px;
  max-width: calc(100vw - 32px);
  overflow: auto;
  background: white;
  color: black;
  border: 2px solid black;
  border-radius: 0;
  line-height: 1.5;
  box-shadow: 6px 7px 0 #777;
  font:
    16px/1.5 BoardSans,
    sans-serif;
  overflow-wrap: anywhere;
}
#board-dialog::backdrop {
  background: #0004;
}
#board-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
#board-dialog h2 {
  font-size: 24px;
  color: black;
  margin: 0;
}
#board-dialog label {
  color: #222;
  font-size: 14px;
}
#board-dialog input,
#board-dialog textarea {
  width: 100%;
  display: block;
  margin-top: 5px;
  padding: 9px;
  border: 1px solid #888;
  border-radius: 0;
  color: black;
  background: white;
  font:
    16px/1.4 BoardSans,
    sans-serif;
}
#board-dialog button,
#board-dialog a {
  display: inline-block;
  margin: 6px 8px 6px 0;
  padding: 8px 16px;
  border: 2px solid black;
  border-radius: 28px;
  background: white;
  color: black;
  font:
    600 15px/1.4 BoardSans,
    sans-serif;
}
#board-dialog .board-primary {
  color: white;
  background: black;
}
#board-dialog button:hover {
  background: #ddd;
}
#board-dialog .board-primary:hover {
  background: #333;
}
#board-dialog .form-error {
  color: #7a2020;
  font-size: 14px;
}
.device.refreshing canvas {
  filter: invert(1);
}
.sleep-tag {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font: 8px monospace;
  white-space: nowrap;
  background: #252b23;
  color: var(--accent);
  padding: 8px 9px;
  border-radius: 4px;
}
.pages {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.pages button {
  font-size: 10px;
  background: none;
  padding: 5px 9px;
}
.pages button[aria-current="page"] {
  background: #d4ed9a18;
  color: var(--accent);
  border-color: #6b8050;
}
.device-controls {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
}
.device-controls button {
  font-size: 10px;
  background: none;
  border-color: #3f4838;
}
.stage-caption {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  max-width: 400px;
  margin: 14px auto 0;
}
.fixture-note {
  margin: 18px 0 22px;
  background: #d4ed9a0b;
  border-left: 2px solid #8b9e68;
  padding: 10px 12px;
}
.fixture-note strong {
  font-size: 12px;
  font-weight: 500;
}
.fixture-note p {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}
form button {
  width: 100%;
  margin-top: 8px;
}
.faults {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.faults label {
  font-size: 11px;
  margin: 9px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.metrics {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 13px;
  font: 10px monospace;
  color: var(--muted);
}
.metrics strong {
  font-size: 16px;
  font-weight: 500;
  display: block;
  color: var(--text);
}
.trace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
}
.trace-header span {
  font: 8px monospace;
  color: var(--muted);
}
#trace {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  max-height: 185px;
  overflow: auto;
  font: 10px/1.6 monospace;
}
#trace li {
  padding: 6px 0;
  border-bottom: 1px solid #2c3228;
}
#trace time {
  color: #84907b;
  margin-right: 8px;
}
#trace span {
  color: #c5d2b7;
}
#notification {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 12px 22px;
  background: #392a22;
  border: 1px solid #8b6351;
  border-radius: 8px;
  color: #ffe3d2;
  max-width: 90vw;
  box-shadow: 0 4px 20px #0006;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
[hidden] {
  display: none !important;
}
@media (min-width: 1600px) {
  .workspace {
    grid-template-columns: 290px minmax(320px, 1fr) 320px;
  }
  aside {
    padding: 30px;
  }
  .stage {
    max-height: 850px;
  }
  main {
    padding: 30px 45px;
  }
}
@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 220px minmax(280px, 1fr);
  }
  .inspector {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 25px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
  .inspector > .eyebrow,
  .trace-header,
  #trace {
    grid-column: 1/-1;
  }
  .fixture-note {
    margin: 0;
  }
  .stage {
    height: 570px;
  }
  .mode {
    display: none;
  }
  .topbar > button {
    margin-left: auto;
  }
  main {
    padding: 24px 18px;
  }
  .stage-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .scope-note {
    margin-top: 20px;
  }
}
@media (max-width: 620px) {
  .workspace {
    display: block;
  }
  .profiles-panel {
    border: 0;
    border-bottom: 1px solid var(--border);
  }
  h1 br {
    display: none;
  }
  h1 {
    font-size: 23px;
    margin: 10px 0;
  }
  .profiles-panel > p.muted,
  .scope-note {
    display: none;
  }
  dl {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 18px;
    margin: 10px 0;
  }
  dl div {
    gap: 10px;
  }
  .profiles-panel {
    padding: 18px 22px;
  }
  .stage {
    height: 470px;
  }
  .topbar {
    padding: 0 20px;
    gap: 12px;
  }
  .brand span {
    font-size: 11px;
    margin-left: 6px;
  }
  .topbar button {
    font-size: 10px;
  }
  .stage-heading {
    flex-direction: row;
  }
  .inspector {
    display: block;
  }
  .fixture-note {
    margin: 15px 0;
  }
  .stage-caption {
    padding: 0 20px;
  }
}
.connection-box {
  margin: 20px 0;
  padding: 14px;
  border: 1px solid #75865c;
  border-radius: 7px;
  background: #d4ed9a0a;
}
.connection-box strong {
  font-size: 12px;
  font-weight: 500;
}
.connection-box p {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.connection-box button,
.connection-box a {
  display: block;
  width: 100%;
  font-size: 11px;
  text-align: center;
  margin-top: 9px;
}
.connection-box a {
  color: var(--accent);
  padding: 8px 3px;
  border: 1px solid #75865c;
  border-radius: 5px;
  text-decoration: none;
}
.connection-box .error {
  color: #f5bdb0;
}

body:not(.lab-open) .workspace {
  display: block;
}
body:not(.lab-open) .profiles-panel,
body:not(.lab-open) .inspector,
body:not(.lab-open) .pages {
  display: none;
}
body:not(.lab-open) main {
  width: min(100%, 1600px);
  margin: auto;
  padding: 14px 24px 8px;
}
body:not(.lab-open) .stage {
  height: calc(100vh - 255px);
  min-height: 300px;
  max-height: 1100px;
}
body:not(.lab-open) .stage-heading {
  margin-bottom: 8px;
}
body:not(.lab-open) .device-controls {
  margin-top: 10px;
}
body:not(.lab-open) .stage-caption {
  margin: 8px 0 0;
}
@media (max-width: 650px) {
  body:not(.lab-open) main {
    padding: 8px;
  }
  body:not(.lab-open) .stage {
    height: calc(100vh - 260px);
    min-height: 280px;
  }
  .topbar {
    gap: 10px;
    padding: 0 12px;
  }
  #export-trace {
    display: none;
  }
  #toggle-lab {
    white-space: nowrap;
  }
  #board-dialog {
    padding: 16px;
  }
}

body:not(.lab-open) .topbar {
  height: 45px;
}
body:not(.lab-open) .workspace {
  min-height: calc(100vh - 45px);
}
body:not(.lab-open) .stage-heading,
body:not(.lab-open) .screen-toolbar,
body:not(.lab-open) .stage-caption {
  display: none;
}
body:not(.lab-open) main {
  padding: 8px 18px;
}
body:not(.lab-open) .stage {
  height: calc(100vh - 115px);
  min-height: 280px;
}
body:not(.lab-open) .device-controls {
  margin-top: 8px;
}
