/* Lumina Studio — warm dark theme */

:root {
  --bg: #0c0a08;
  --panel-solid: #14110e;
  --card: #1b1713;
  --border-strong: #2b231a;
  --text: #f0ebe2;
  --muted: #a3947f;
  --accent: #f3a73f;
  --accent-dim: rgba(243, 167, 63, 0.14);
  --amber: #fbbf24;
  --radius: 12px;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', var(--font-body);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------- header */
header {
  height: 60px;
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #151110cc, transparent);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.brand h1 span { color: var(--accent); font-weight: 500; }
.brand p { font-size: 11px; color: var(--muted); }

.header-actions { display: flex; gap: 10px; align-items: center; }

/* ---------------------------------------------------------- layout */
main { flex: 1; display: flex; min-height: 0; }

#viewport { position: relative; flex: 1; min-width: 0; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#panel {
  width: 348px;
  flex: 0 0 348px;
  background: var(--panel-solid);
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#controls { flex: 1; overflow-y: auto; padding: 6px 18px 18px; }
#controls::-webkit-scrollbar { width: 8px; }
#controls::-webkit-scrollbar-thumb { background: #2b231a; border-radius: 4px; }

.panel-footer {
  flex: 0 0 auto;
  padding: 10px 18px;
  font-size: 10.5px;
  color: var(--muted);
  border-top: 1px solid var(--border-strong);
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------- sections */
.panel-section { padding: 16px 0 6px; border-bottom: 1px solid #221b14; }
.panel-section:last-child { border-bottom: none; }

.panel-section h3 {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 12px;
}

/* ---------------------------------------------------------- controls */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
  transition: opacity 0.18s;
}
.control-row label { font-size: 12.5px; color: #d6c8b4; flex: 0 0 108px; }
.control-row.disabled { opacity: 0.35; pointer-events: none; }

.range-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

input[type="range"] {
  flex: 1;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #2b231a;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0c0a08;
  box-shadow: 0 0 0 1px var(--accent);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0c0a08;
  cursor: grab;
}

.num {
  width: 52px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font: 500 12px var(--font-body);
  padding: 5px 6px;
  text-align: right;
}
.num:focus { outline: none; border-color: var(--accent); }
.num::-webkit-inner-spin-button { display: none; }

.unit { font-size: 10.5px; color: var(--muted); width: 22px; }

select {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font: 500 12.5px var(--font-body);
  padding: 7px 8px;
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); }

/* switch */
.switch {
  width: 38px; height: 22px;
  border-radius: 11px;
  background: #2b231a;
  border: 1px solid var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.18s;
  flex: 0 0 38px;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #a3947f;
  transition: all 0.18s;
}
.switch[aria-checked="true"] { background: var(--accent-dim); border-color: var(--accent); }
.switch[aria-checked="true"]::after { left: 18px; background: var(--accent); }

/* swatches */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }

/* profile editor */
.profile-editor { margin-bottom: 12px; }
#profile-canvas {
  width: 100%;
  height: 205px;
  display: block;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: crosshair;
  touch-action: none;
}

/* presets */
.preset-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: #d6c8b4;
  font: 500 12px var(--font-body);
  padding: 6px 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip-accent { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* buttons */
.btn {
  font: 600 13px var(--font-body);
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: block;
  width: 100%;
  margin-bottom: 8px;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #160f04;
}
.btn-primary:hover:not(:disabled) { background: #ffbd5c; }
.header-actions .btn { width: auto; margin: 0; padding: 8px 14px; }
.btn-ghost { background: transparent; }

.hint { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 2px 0 10px; }

/* ---------------------------------------------------------- HUD */
#hud-stats {
  position: absolute;
  left: 16px; bottom: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
}
.stat-chip {
  background: rgba(18, 14, 10, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.stat-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.stat-chip span:last-child { font: 600 13.5px var(--font-display); color: var(--text); }

#view-tools {
  position: absolute;
  right: 16px; top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tool-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(18, 14, 10, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  color: #d6c8b4;
  font-size: 17px;
  cursor: pointer;
  transition: all 0.15s;
}
.tool-btn:hover, .tool-btn.active { border-color: var(--accent); color: var(--accent); }

#warnings {
  position: absolute;
  left: 16px; top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(440px, 70%);
  pointer-events: none;
}
.warning-chip {
  background: rgba(40, 32, 8, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid #5d4a12;
  border-radius: 9px;
  color: var(--amber);
  font-size: 11.5px;
  padding: 7px 12px;
  line-height: 1.45;
}

.panel-toggle { display: none; }

/* ---------------------------------------------------------- mobile */
@media (max-width: 880px) {
  main { flex-direction: column; }
  #viewport { flex: 1 1 52vh; }
  #panel {
    width: 100%;
    flex: 0 0 42vh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
  }
  body.panel-collapsed #panel { display: none; }
  .panel-toggle { display: block; }
  .header-actions .btn-ghost:not(.panel-toggle) { display: none; }
  .brand p { display: none; }
  #hud-stats { gap: 6px; }
  .stat-chip { padding: 6px 10px; }
  .stat-secondary { display: none; }
}
