:root {
  --radius: 4px;
  --bg-dark: #1a1a1a;
  --bg-mid: #222;
  --border: 1px solid #333;
  --border-mid: 1px solid #444;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}
#start {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 2rem;
}
#app {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: #000;
}
#app canvas {
  display: block;
  width: 100%;
  height: 100%;
}
#controls {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 1;
  width: 14rem;
  box-sizing: border-box;
}
#controls .controls-row {
  width: 100%;
  box-sizing: border-box;
}
#controls .sortable-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}
#controls .sortable-item {
  display: flex;
}
#controls .sortable-item.dragging {
  opacity: 0.6;
}
#controls button {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  background: var(--bg-mid);
  color: #fff;
  border: var(--border-mid);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
#controls .drag-handle {
  cursor: grab;
  color: #666;
  padding-right: 0.25rem;
  user-select: none;
}
#controls .drag-handle:active {
  cursor: grabbing;
}
#controls button .key-hint {
  margin-left: auto;
}
#controls button.active {
  background: #3a3a3a;
  border-color: #555;
}
#controls select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-mid);
  color: #fff;
  border: var(--border-mid);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}
#options-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
.options-panel-buttons {
  display: flex;
  gap: 0.5rem;
}
#fullscreen-toggle {
  padding: 0.5rem 0.75rem;
  background: var(--bg-dark);
  color: #e0e0e0;
  border: var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
}
#fullscreen-toggle:hover {
  background: #252525;
  border-color: #444;
}
#options-toggle {
  padding: 0.5rem 1rem;
  background: var(--bg-dark);
  color: #e0e0e0;
  border: var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}
#options-toggle:hover {
  background: #252525;
  border-color: #444;
}
#options-box {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  color: #e0e0e0;
  max-height: 80vh;
  overflow-y: auto;
  margin-top: 0.5rem;
  min-width: 220px;
}
#options-box.visible {
  display: flex;
}
.options-section {
  flex-shrink: 0;
  border: var(--border);
  border-radius: var(--radius);
  background: #1e1e1e;
  overflow: hidden;
}
.options-section-header {
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  user-select: none;
  font-size: 0.85rem;
  color: #c0c0c0;
  background: var(--bg-dark);
  border-bottom: 1px solid transparent;
}
.options-section:not(.no-options) .options-section-header {
  cursor: pointer;
}
.options-section:not(.no-options) .options-section-header:hover {
  color: #fff;
}
.options-section-header::after {
  content: " ▾";
  font-size: 0.75em;
  opacity: 0.7;
  margin-left: 0.25rem;
}
.options-section.no-options .options-section-header::after {
  content: none;
}
.options-section.collapsed .options-section-header::after {
  content: " ▸";
}
.options-section-content {
  padding: 0.75rem;
  background: var(--bg-dark);
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.options-section-content::-webkit-scrollbar {
  display: none;
}
.options-section.collapsed .options-section-content {
  display: none;
}
.options-section iframe {
  background: transparent;
}
.options-file-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.options-file-row button {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  background: #333;
  color: #e0e0e0;
  border: var(--border-mid);
  border-radius: var(--radius);
  cursor: pointer;
}
.options-file-row button:hover {
  background: #444;
}

.key-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25em;
  padding: 0.15em 0.3em;
  margin-left: 0.25em;
  font-size: 0.75em;
  font-weight: 600;
  color: #1a1a1a;
  background: #e8e8e8;
  border: 1px solid #bbb;
  border-radius: 3px;
  box-shadow: 0 1px 0 #ccc, inset 0 1px 0 #fff;
  font-family: inherit;
}
#controls .blend-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-mid);
  border: var(--border-mid);
  border-radius: var(--radius);
}
#controls .blend-row .key-hint {
  margin-left: 0;
  flex-shrink: 0;
}
#controls .blend-row select {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0.5rem;
  background: transparent;
  color: #fff;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
}
