:root {
  --bg: #0f111a;
  --panel: #1a1d2a;
  --border: #2e3244;
  --fg: #e0e0e0;
  --accent: #4cc2ff;
  --accent-hover: #72d4ff;
  --highlight: #252a3a;
  --code-bg: #11131f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  height: 100vh;
  display: flex;
}

main {
  display: flex;
  width: 100%;
  height: 100%;
}

#sidebar {
  width: 20%;
  padding: 1rem;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-height: 100%;
  box-shadow: 2px 0 8px rgba(0,0,0,0.4);
}

#codeArea {
  width: 80%;
  padding: 1.5rem;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 50%;
  min-height: 100%;
}

.preview-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: fit-content;
  min-height: fit-content;
}

#originalCanvas, #renderPreview {
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--highlight);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--highlight);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--fg);
  border: 1px solid var(--border);
}

.label-text {
  font-weight: 500;
}

.action-button {
  background: var(--accent);
  color: var(--bg);
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s ease;
}

.action-button:hover {
  background: var(--accent-hover);
}

#codeBox {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  background: var(--code-bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: none;
  white-space: pre;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
}

@media (max-width: 1000px) {
  main {
    display: flex;
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    flex-direction: row;
    height: fit-content;
  }
  .preview-block {
    width: 50%;
    height: 100%;
  }
  #codeArea {
    width: 100%;
    height: 100%;
    min-height: fit-content;
    min-width: 100%;
  }
  #originalCanvas, #renderPreview {
    width: 100%;
    aspect-ratio: 1/1;
    background: var(--highlight);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
  }
}

.dropdown {
  display: inline-block;
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  z-index: 1;
  min-width: 120px;
}

.dropdown-content button {
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  padding: 8px;
  cursor: pointer;
}