:root {
  --bg:           #0c0a08;
  --bg-alt:       #14100c;
  --text:         #cbc3b8;
  --muted:        #6b6258;
  --heading:      #f2e9dc;
  --accent:       #e8a33d;
  --accent-dim:   rgba(232, 163, 61, 0.12);
  --accent-border:rgba(232, 163, 61, 0.28);
  --border:       rgba(255, 245, 230, 0.08);
  --shadow:       0 0 0 1px rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.6);
  --error:        #ff6b6b;
  --error-dim:    rgba(255, 107, 107, 0.14);

  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  font: 16px/1.6 var(--sans);
  color: var(--text);
  background: var(--bg);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

body { margin: 0; }

#app {
  width: 640px;
  max-width: 100%;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

h1, h2, h3 { font-family: var(--mono); color: var(--heading); line-height: 1.15; margin: 0 0 0.5em; }
p { margin: 0; }

/* ── Header ─────────────────────────────────────────────────────────── */

.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.header-row h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-align: center;
  margin: 0;
}

.header-row h1::before {
  content: '> ';
  color: var(--muted);
  font-weight: 400;
}

.hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 32px;
}

/* ── Card ───────────────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  background: var(--bg-alt);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* ── Drop zone ──────────────────────────────────────────────────────── */

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 48px 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.drop-zone-label {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
}

.drop-zone-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

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

.canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

#canvas {
  max-width: 100%;
  max-height: 60vh;
  display: block;
}

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

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

.control-value {
  color: var(--accent);
}

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

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-alt);
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-alt);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-btn:hover { border-color: var(--accent-border); }

.preset-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ── Actions / buttons ──────────────────────────────────────────────── */

.actions-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}

.btn:hover { border-color: var(--accent-border); color: var(--heading); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-small {
  font-size: 11px;
  padding: 6px 10px;
  align-self: flex-start;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

.btn-primary:hover { background: #f0b25a; border-color: #f0b25a; color: #000; }

.btn-develop {
  border-color: rgba(120, 140, 255, 0.3);
  color: #b7c2ff;
}

.btn-develop:hover { border-color: rgba(120, 140, 255, 0.6); color: #d6dcff; }

/* ── Result panel ───────────────────────────────────────────────────── */

.result-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  text-align: center;
}

.result-panel a {
  color: var(--accent);
  word-break: break-all;
}

.result-panel.error { color: var(--error); border-color: var(--error-dim); }

/* ── Developing page (server-rendered) ─────────────────────────────── */

.develop-wrap {
  text-align: center;
  padding: 64px 16px;
}

.fog {
  width: 220px;
  height: 220px;
  margin: 0 auto 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a1712, #0c0a08);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.fog::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(232,163,61,0.08), transparent 70%);
  animation: drift 6s ease-in-out infinite;
}

@keyframes drift {
  0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.6; }
  50% { transform: scale(1.15) translate(4%, -4%); opacity: 1; }
}
