:root {
  --bg: #0d1117;
  --panel: #161b22;
  --ink: #e6edf3;
  --muted: #8b949e;
  --line: #30363d;
  --accent: #2ea043;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at 20% 10%, #1f2937 0%, var(--bg) 45%);
  color: var(--ink);
  font-family: Consolas, "Liberation Mono", Menlo, monospace;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.toolbar h1 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

button, .fileLabel {
  background: #21262d;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover, .fileLabel:hover { border-color: var(--accent); }

.toggleLabel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #21262d;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.toggleLabel:hover {
  border-color: var(--accent);
}

.toggleLabel input {
  margin: 0;
}

.fileLabel input { display: none; }

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.screenWrap {
  margin-top: 12px;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

#screen {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

.status {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.status.hidden {
  display: none;
}

.status div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.debugWrap {
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}

.debugWrap.hidden {
  display: none;
}

.debugHeader {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.debugControls {
  display: flex;
  gap: 8px;
}

.debugControls button {
  padding: 4px 8px;
  font-size: 0.8rem;
}

.debugLog {
  margin: 0;
  padding: 8px;
  background: #0b0f14;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 90px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}
