* {
  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;
}

.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;
}

textarea {
  display: block;
  width: 100%;
  margin-top: 3px;
  font-family: monospace;
  font-size: 12px;
}

/* The module is laid out in a real 1280x720 application area, scaled to
   fit the screen box by harness.js. */
.app-area {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 720px;
  transform-origin: 0 0;
}

.remote {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(3, 44px);
  gap: 6px;
  justify-content: center;
  margin: 8px 0 12px;
}

.remote-up {
  grid-column: 2;
  grid-row: 1;
}

.remote-left {
  grid-column: 1;
  grid-row: 2;
}

.remote-ok {
  grid-column: 2;
  grid-row: 2;
  font-weight: bold;
}

.remote-right {
  grid-column: 3;
  grid-row: 2;
}

.remote-down {
  grid-column: 2;
  grid-row: 3;
}

.remote-colors {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.remote-key {
  cursor: pointer;
}

.remote-red {
  background-color: #e0524f;
  color: #ffffff;
}

.remote-green {
  background-color: #3fa860;
  color: #ffffff;
}

.remote-yellow {
  background-color: #e6c229;
  color: #1b1f24;
}

.remote-blue {
  background-color: #3d7fd9;
  color: #ffffff;
}

.log {
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  font-size: 12px;
  white-space: pre-wrap;
}

.log-error {
  color: #c62828;
}
