:root {
  color-scheme: light;
  --page: #f4f6f8;
  --ink: #17202a;
  --muted: #667085;
  --line: #cfd6df;
  --accent: #1f6feb;
  --accent-strong: #1557bd;
  --panel: #ffffff;
  --field: #dfe5ed;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(800px, 1fr) 380px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sim-column {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  overflow: auto;
}

.sim-frame {
  position: relative;
  width: 800px;
  height: 750px;
  flex: 0 0 auto;
  background: var(--field);
  border: 1px solid #9aa7b5;
}

#sim {
  width: 800px;
  height: 750px;
  margin: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
}

.sim-lock {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgb(244 246 248 / 42%);
  color: #17202a;
  font-size: 14px;
  font-weight: 700;
  pointer-events: auto;
}

.sim-lock[hidden] {
  display: none;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-section {
  display: grid;
  gap: 8px;
}

.panel-section.compact {
  grid-template-columns: 88px 1fr;
  align-items: center;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 14px;
}

.status-line {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

label {
  font-size: 13px;
}

select,
button,
textarea,
pre {
  font: inherit;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

select {
  height: 34px;
  padding: 0 8px;
}

.controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  border-color: #aab4c0;
  background: #aab4c0;
  cursor: wait;
}

.checks {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
}

.checks label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.state-grid {
  grid-template-columns: 76px 86px 1fr;
  align-items: center;
}

.state-grid label {
  color: var(--muted);
}

.state-grid input[type="number"] {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.state-grid input[type="range"] {
  width: 100%;
}

#tries-input {
  grid-column: 2 / 4;
}

textarea {
  min-height: 210px;
  resize: vertical;
  padding: 10px;
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

pre {
  min-height: 260px;
  max-height: 340px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111820;
  color: #e7edf4;
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
}

@media (max-width: 1220px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    max-height: none;
  }
}
