* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px 28px 48px;
  background-color: #f4f5f7;
  color: #1b1f24;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
}

h1 {
  margin: 8px 0 4px;
  font-size: 22px;
}

h2 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #6b7280;
  text-transform: uppercase;
}

code {
  background-color: #eef0f2;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.back-link {
  color: #1f6feb;
  font-size: 13px;
  text-decoration: none;
}

.subtitle {
  margin: 0 0 20px;
  color: #6b7280;
  font-size: 14px;
}

.layout {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.screen-column {
  flex: 1 1 640px;
  min-width: 0;
}

.controls-column {
  flex: 0 1 380px;
}

.tv-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #202226;
  border-radius: 8px;
}

.state-panel {
  margin-top: 14px;
  padding: 12px 14px;
  background-color: #ffffff;
  border: 1px solid #dde1e6;
  border-radius: 8px;
}

.state-panel pre {
  margin: 0;
  font-size: 12px;
  white-space: pre-wrap;
}

fieldset {
  margin: 0 0 14px;
  padding: 10px 14px 12px;
  background-color: #ffffff;
  border: 1px solid #dde1e6;
  border-radius: 8px;
}

legend {
  padding: 0 4px;
  font-size: 13px;
  font-weight: 700;
}

label {
  display: block;
  margin: 6px 0;
  font-size: 13px;
}

label.inline {
  display: inline-block;
  margin-right: 12px;
}

input[type="text"],
input[type="number"],
input[type="range"],
select {
  display: block;
  width: 100%;
  margin-top: 3px;
}

.bounds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

button {
  padding: 5px 10px;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
}

.event-log {
  max-height: 180px;
  margin: 0;
  padding-left: 22px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
}

.event-error {
  color: #cf222e;
}
