:root {
  --bg:          #080604;
  --gold:        #C9A96A;
  --gold-light:  #E6D3A3;
  --gold-dim:    rgba(201,169,106,0.15);
  --gold-border: rgba(201,169,106,0.35);
  --text-muted:  #927E60;
  --surface:     rgba(15,12,8,0.85);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-cinzel:  'Cinzel', Georgia, serif;
  --font-body:    'Outfit', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 15px; }
body {
  height: 100vh;
  background: var(--bg);
  color: var(--gold-light);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  text-align: center;
  padding: 1.75rem 1rem 0.75rem;
  flex-shrink: 0;
}
.header__title {
  font-family: var(--font-cinzel);
  font-size: clamp(2.2rem, 4.5vw, 3.5rem);
  color: var(--gold);
  letter-spacing: 0.08em;
}
.header__sub {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  margin-top: 0.4rem;
}

.editor {
  flex: 1;
  min-height: 0;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  padding: 0.45rem 1.5rem 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: center;
  align-content: center;
}

.canvas-wrap {
  position: relative;
  background: #0a0a0a;
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  max-height: calc(100vh - 7rem);
  max-height: calc(100dvh - 7rem);
}
.canvas-wrap--empty .drop-hint { display: flex; }
.drop-hint {
  display: none;
  position: absolute;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  pointer-events: none;
}
.drop-hint__icon { width: 40px; height: 40px; opacity: 0.4; }
.drop-hint__text { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; }
#canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background: transparent;
}
#canvas.dragging { cursor: grabbing; }

.controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  min-height: 0;
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  background: var(--surface);
  padding: 0.9rem;
  overflow: hidden;
}
.control-group {
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  padding: 0.8rem;
  background: rgba(8, 6, 4, 0.55);
}
.control-group__title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}
.control-row {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin-bottom: 0.65rem;
}
.control-row:last-child { margin-bottom: 0; }
.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--gold-light);
}
.control-label span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--gold);
}
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: var(--gold-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  transition: background 0.2s;
}
input[type="range"]:hover::-webkit-slider-thumb { background: var(--gold-light); }

.btn {
  display: block;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 3px;
  font-family: var(--font-cinzel);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  border: none;
}
.btn--upload { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.btn--upload:hover { background: rgba(201,169,106,0.1); }
.btn--download { background: var(--gold); color: #080604; }
.btn--download:hover { background: var(--gold-light); }
.btn--download:disabled { opacity: 0.35; cursor: not-allowed; }
.btn--reset {
  background: transparent;
  border: 1px solid rgba(201,169,106,0.2);
  color: var(--text-muted);
  font-size: 0.7rem;
}
.btn--reset:hover { border-color: var(--gold-border); color: var(--gold-light); }

.hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(201,169,106,0.1);
}

/* AI section - hidden for now */
.ai-section { display: none !important; }

.btn-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.15rem;
}
.btn-group .btn { flex: 1; }

.results { display: none !important; }

body.dragging-over .canvas-wrap {
  border-color: var(--gold);
  background: rgba(201,169,106,0.08);
}
#file-input { display: none; }

/* ─── MOBILE ─────────────────────────────────────── */
@media (max-width: 700px) {
  body {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: auto;
  }
  .header {
    padding: 1.75rem 1rem 0.85rem;
  }
  .header__title { font-size: clamp(1.6rem, 8vw, 2.4rem); }
  .header__sub { font-size: clamp(0.95rem, 4vw, 1.15rem); }
  .editor {
    grid-template-columns: 1fr;
    padding: 0.5rem 0.75rem 1.5rem;
    gap: 0.85rem;
  }
  .canvas-wrap {
    aspect-ratio: 1 / 1;
    max-height: 50vh;
    max-height: 50dvh;
    width: 80%;
    margin: 0 auto;
  }
  .controls {
    padding: 1rem;
  }
  .control-group {
    padding: 1rem;
  }
  .control-label {
    font-size: 0.9rem;
  }
  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }
  .hint {
    font-size: 0.65rem;
  }
}
