* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0c0c0c;
  color: #e6e6e6;
  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px;
  gap: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #141414;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #aaa;
  flex: 0 0 auto;
}

.toolbar .title {
  color: #e6e6e6;
  font-weight: 600;
}

.toolbar-spacer {
  flex: 1 1 auto;
}

.toolbar .status {
  font-variant-numeric: tabular-nums;
  color: #888;
}

.toolbar .back {
  color: #aaa;
  text-decoration: none;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.toolbar .back:hover {
  color: #e6e6e6;
  border-color: #444;
  background: #1a1a1a;
}

.toolbar .controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar .control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #888;
}

.toolbar select,
.toolbar button {
  font: inherit;
  font-size: 12px;
  text-transform: lowercase;
  letter-spacing: normal;
  color: #e6e6e6;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}

.toolbar select:hover,
.toolbar button:hover {
  border-color: #444;
}

.toolbar button:active {
  background: #222;
}

.library {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 8px 4px;
}

.library-intro {
  margin: 0;
  color: #888;
  font-size: 13px;
}

.scene-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.scene-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #111;
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.scene-card:hover {
  border-color: #555;
  background: #181818;
  transform: translateY(-1px);
}

.scene-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e6e6e6;
}

.scene-desc {
  font-size: 13px;
  color: #888;
}

.stage {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.root {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  min-width: 0;
}

.side-by-side {
  flex: 1 1 auto;
  display: flex;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}

.renderer {
  flex: 1 1 0;
  display: flex;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #0a0a0a;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.renderer-raw {
  padding: 8px;
}

.renderer-raw canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.renderer-raw-fit-contain canvas { object-fit: contain; }
.renderer-raw-fit-fill canvas { object-fit: fill; }
.renderer-raw-fit-cover canvas { object-fit: cover; }

.ascii {
  margin: 0;
  padding: 8px;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  overflow: hidden;
  color: #e6e6e6;
  user-select: none;
}
