:root {
  --bg-pitch: #050505;
  --bg-surface: #0c0c0c;
  --bg-panel: #141414;
  --bg-hover: #1f1f1f;
  --border-subtle: #242424;
  --border-active: #404040;
  --fg-muted: #737373;
  --fg-default: #d4d4d4;
  --fg-bright: #ffffff;
  --accent-mono: #ffffff;
  
  --font-mono: "Geist Mono", "JetBrains Mono", "SF Mono", monospace;
  --font-sans: "Geist", "Inter", -apple-system, sans-serif;
  --header-height: 52px;
  --footer-height: 48px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-pitch);
  color: var(--fg-default);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  height: 100vh;
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.app-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.panel-controls {
  width: 320px;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stage-viewport {
  flex: 1;
  position: relative;
  background: var(--bg-pitch);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.app-export-bar {
  height: var(--footer-height);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-family: var(--font-mono);
}

/* UI Elements */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  color: var(--fg-bright);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

.btn-primary {
  background: var(--fg-bright);
  color: var(--bg-pitch);
  font-weight: 600;
  border-color: var(--fg-bright);
}

.btn-primary:hover {
  background: #e5e5e5;
}

.tag-version {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  color: var(--fg-muted);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
}

.control-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-subtle);
  outline: none;
}

.control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--fg-bright);
  cursor: pointer;
  border-radius: 0;
}

.control-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--fg-bright);
  cursor: pointer;
  border: none;
  border-radius: 0;
}

.btn-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-textarea {
  width: 100%;
  height: 180px;
  background: var(--bg-pitch);
  border: 1px solid var(--border-subtle);
  color: var(--fg-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px;
  resize: vertical;
  outline: none;
}

.modal-textarea:focus {
  border-color: var(--border-active);
}

/* Viewport Canvas Styles */
.svg-render-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.viewport-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, #111111 1px, transparent 1px),
    linear-gradient(to bottom, #111111 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.svg-stage-element {
  max-width: 80%;
  max-height: 80%;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  transition: transform 0.1s ease-out;
}