:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  background: #0f1115;
  color: #edf2f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0f1115;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-right: 1px solid #20242d;
  background: #151922;
}

.panel h1 {
  margin: 0;
  font-size: 1.2rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.check-field input {
  margin: 0;
}

.inline-field input,
textarea,
select,
button,
pre {
  font: inherit;
}

textarea,
input,
select,
button,
pre {
  border-radius: 10px;
  border: 1px solid #2d3642;
  background: #0f1115;
  color: inherit;
}

textarea,
input,
select,
pre {
  padding: 10px 12px;
}

textarea {
  min-height: 124px;
  resize: vertical;
}

pre {
  margin: 0;
  max-height: calc(1.4em * 4 + 20px);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

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

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.stats div {
  padding: 10px 12px;
  border: 1px solid #2d3642;
  border-radius: 10px;
  background: #0f1115;
}

.stats dt {
  font-size: 0.8rem;
  color: #a7b1c2;
}

.stats dd {
  margin: 4px 0 0;
}

.viewer-shell {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    #0b0d12;
  background-size: 32px 32px;
}

#viewport {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#viewport.dragging {
  cursor: grabbing;
}

.hint {
  margin: 0;
  color: #a7b1c2;
  font-size: 0.9rem;
}

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

  .panel {
    border-right: 0;
    border-bottom: 1px solid #20242d;
  }
}
