:root {
  color-scheme: light dark;
  font-family: "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0b0c10;
  color: #f1f1f1;
}

main {
  display: grid;
  gap: 1.5rem;
  padding: 2rem;
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.panel h1,
.panel h2 {
  margin-top: 0;
  font-size: 1.4rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  color: inherit;
  resize: vertical;
}

.options {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

button {
  background: #00c853;
  color: #050505;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 200, 83, 0.35);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

#status {
  margin-left: 1rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.queue-indicator {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #9be7ff;
  min-height: 1.1rem;
  transition: color 0.2s ease;
}

.queue-indicator.busy {
  color: #ffd166;
}

.queue-indicator.error {
  color: #ff6b6b;
}

.status-tag {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: #9be7ff;
  opacity: 0.8;
}

.status-tag.error {
  color: #ff6b6b;
}

.log-panel {
  min-height: 40vh;
}

#model-select,
#refresh-models,
#render-model,
#download-model {
  font-size: 0.95rem;
}

.model-panel {
  grid-column: 1 / -1;
}

.model-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.model-controls select {
  min-width: 220px;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
}

.viewer-wrapper {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  height: 480px;
  margin-bottom: 1rem;
}

stl-viewer#model-viewer {
  width: 100%;
  height: 100%;
  display: block;
}

#viewer-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  pointer-events: none;
} 

.viewer-wrapper.ready #viewer-hint {
  opacity: 0;
}

.code-pane {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 1rem;
  max-height: 40vh;
  overflow: auto;
  font-size: 0.9rem;
}

#log-output {
  margin: 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
}

@media (min-width: 960px) {
  main {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 0.95rem;
  }

  main {
    padding: 1rem;
    gap: 1rem;
  }

  .panel {
    padding: 1.1rem;
  }

  .panel h1,
  .panel h2 {
    font-size: 1.15rem;
  }

  textarea {
    font-size: 1rem;
    min-height: 120px;
  }

  .options {
    flex-direction: column;
    gap: 0.5rem;
  }

  button,
  .model-controls select {
    width: 100%;
  }

  .model-controls select {
    min-width: auto;
  }

  .model-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .viewer-wrapper {
    height: 320px;
  }

  .log-panel,
  .progress-panel {
    min-height: 0;
  }
}
