/* ── Reset & base ────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  background: #1a1a1a;
  color: #e0e0e0;
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  padding: 1rem 1.5rem 0.75rem;
  border-bottom: 1px solid #333;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

header p {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.2rem;
}

main {
  display: flex;
  flex: 1;
  gap: 0;
  min-height: 0; /* allow flex children to shrink below content height */
}

/* ── Controls panel ──────────────────────────────────────────────── */

#controls {
  width: 240px;
  min-width: 240px;
  background: #222;
  border-right: 1px solid #333;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

section h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: 0.2rem;
}

label {
  font-size: 0.75rem;
  color: #aaa;
  margin-top: 0.3rem;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  background: #2c2c2c;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: #666;
}

/* ── HSLA color row ──────────────────────────────────────────────── */

.color-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.color-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.color-field span {
  font-size: 0.65rem;
  color: #666;
  text-align: center;
}

.color-field input {
  padding: 0.3rem 0.25rem;
  text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────────────── */

.button-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.btn {
  width: 100%;
  padding: 0.5rem 0;
  border: 1px solid #444;
  border-radius: 4px;
  background: #2c2c2c;
  color: #e0e0e0;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #383838;
  border-color: #555;
}

.btn.primary {
  background: #3a5a3a;
  border-color: #4a7a4a;
  color: #cce8cc;
}

.btn.primary:hover {
  background: #456845;
}

/* ── Canvas area ─────────────────────────────────────────────────── */

#canvas-wrap {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: #111;
  padding: 1rem;
  min-height: 0;
}

#artCanvas {
  display: block;
  flex: 1;
  width: 100%;
  height: 100%;
  background: #000;
  border: 1px solid #333;
}
