html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #070b12;
  color-scheme: dark;
}

body {
  min-width: 320px;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #070b12;
}

.controls {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.72);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
  font: 13px/1.2 system-ui, sans-serif;
}

.control-row,
.side-row,
.toggle-row,
.slider-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  align-items: center;
  gap: 10px;
  color: rgba(226, 232, 240, 0.88);
}

.side-row {
  color: rgba(148, 163, 184, 0.9);
}

.side-indicator {
  justify-self: end;
  min-width: 52px;
  padding: 4px 8px;
  border: 1px solid rgba(103, 232, 249, 0.42);
  border-radius: 8px;
  background: rgba(8, 145, 178, 0.16);
  color: rgba(207, 250, 254, 0.96);
  text-align: center;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0;
}

.slider-row[data-active-side="false"] {
  opacity: 0.48;
}

.slider-row[data-active-side="true"] > span {
  color: rgba(207, 250, 254, 0.98);
}

.ring-settings {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.model-settings {
  display: grid;
  gap: 8px;
}

.model-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.model-buttons button {
  min-height: 32px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: rgba(226, 232, 240, 0.92);
  font: 12px/1 system-ui, sans-serif;
  text-overflow: ellipsis;
  cursor: pointer;
}

.model-buttons button[data-active="true"] {
  border-color: rgba(103, 232, 249, 0.82);
  background: rgba(8, 145, 178, 0.24);
  color: #cffafe;
}

.model-buttons button:hover,
.model-buttons button:focus-visible {
  border-color: rgba(103, 232, 249, 0.82);
  outline: none;
}

.model-summary {
  min-height: 16px;
  color: rgba(148, 163, 184, 0.92);
  font: 12px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ring-heading {
  color: rgba(226, 232, 240, 0.96);
  font-weight: 650;
}

.scene-source {
  width: 100%;
  min-height: 220px;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 10px;
  background: rgba(3, 7, 18, 0.76);
  color: rgba(226, 232, 240, 0.94);
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.scene-source:focus {
  border-color: rgba(103, 232, 249, 0.72);
  outline: none;
}

.apply-button {
  justify-self: end;
  min-height: 32px;
  border: 1px solid rgba(103, 232, 249, 0.36);
  border-radius: 8px;
  background: rgba(8, 145, 178, 0.18);
  color: rgba(207, 250, 254, 0.96);
  font: 12px/1 system-ui, sans-serif;
  cursor: pointer;
}

.apply-button:hover,
.apply-button:focus-visible {
  border-color: rgba(103, 232, 249, 0.82);
  outline: none;
}

.parse-error {
  padding: 8px;
  border: 1px solid rgba(248, 113, 113, 0.38);
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.24);
  color: rgba(254, 202, 202, 0.94);
}

.ring-list {
  display: grid;
  gap: 10px;
}

.toggle-row input {
  justify-self: end;
  width: 18px;
  height: 18px;
  accent-color: #67e8f9;
}

.turn-buttons {
  display: grid;
  grid-template-columns: repeat(2, 36px);
  gap: 8px;
  justify-content: end;
}

.turn-buttons button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: rgba(226, 232, 240, 0.92);
  font: 18px/1 system-ui, sans-serif;
  cursor: pointer;
}

.turn-buttons button:hover,
.turn-buttons button:focus-visible {
  border-color: rgba(103, 232, 249, 0.8);
  color: #cffafe;
  outline: none;
}

.slider-row input {
  width: 100%;
  accent-color: #67e8f9;
}

.slider-row input:disabled {
  opacity: 0.38;
  accent-color: #9ca3af;
  cursor: not-allowed;
}

.slider-row:has(input:disabled) {
  color: rgba(148, 163, 184, 0.5);
}

/* Portfolio wrapper: keep the geometry visible until controls are requested. */
.controls-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 2;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: #111b2c;
  color: #e2e8f0;
  font: 13px/1.2 system-ui, sans-serif;
  cursor: pointer;
}
.controls-toggle:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 3px;
}
.controls[hidden] { display: none; }
.controls {
  top: 64px;
  box-sizing: border-box;
  max-height: calc(100vh - 80px);
}
