/* ASCII Studio — Gruvbox Dark theme (matches segotari.com) */

:root {
  /* Gruvbox dark palette */
  --bg-hard: #1d2021;
  --bg0:     #282828;
  --bg1:     #3c3836;
  --bg2:     #504945;
  --bg3:     #665c54;
  --fg0:     #fbf1c7;
  --fg1:     #ebdbb2;
  --fg2:     #d5c4a1;
  --fg4:     #a89984;
  --gray:    #928374;
  --red:     #fb4934;
  --green:   #b8bb26;
  --yellow:  #fabd2f;
  --blue:    #83a598;
  --purple:  #d3869b;
  --aqua:    #8ec07c;
  --orange:  #fe8019;

  --accent:  var(--orange);
  --accent-2: var(--aqua);

  --radius: 6px;
  --gap: 14px;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-ui: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg-hard);
  color: var(--fg1);
  font-family: var(--font-ui);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 12px 20px;
  background: var(--bg0);
  border-bottom: 1px solid var(--bg2);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--accent);
  letter-spacing: -2px;
}
.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg0);
}
.hint { color: var(--gray); font-size: 12px; }

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: 0;
}

/* ---------- Preview pane ---------- */
.preview-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
  gap: 14px;
}
.stage {
  flex: 1;
  min-height: 300px;
  background:
    linear-gradient(45deg, var(--bg0) 25%, transparent 25%) 0 0/24px 24px,
    linear-gradient(-45deg, var(--bg0) 25%, transparent 25%) 0 12px/24px 24px,
    linear-gradient(45deg, transparent 75%, var(--bg0) 75%) 12px -12px/24px 24px,
    linear-gradient(-45deg, transparent 75%, var(--bg0) 75%) -12px 0/24px 24px,
    var(--bg-hard);
  border: 1px solid var(--bg2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 12px;
}
.preview-canvas {
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
  display: block;
}

.empty-state { text-align: center; color: var(--fg2); }
.empty-state p { margin: 6px 0; }
.empty-icon { font-size: 32px; margin-bottom: 10px; font-family: var(--font-mono); }
.muted { color: var(--gray); }
.small { font-size: 12px; }

/* ---------- Export bar ---------- */
.export-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.status { color: var(--green); font-size: 12px; margin-left: auto; }

/* ---------- Controls pane ---------- */
.controls-pane {
  background: var(--bg0);
  border-left: 1px solid var(--bg2);
  padding: 18px;
  overflow-y: auto;
  max-height: calc(100vh - 58px);
}
.control-group { margin-bottom: 22px; }
.control-group h2 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--yellow);
  border-bottom: 1px solid var(--bg2);
  padding-bottom: 6px;
}

.ctl { display: block; margin-bottom: 12px; }
.ctl-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg2);
  margin-bottom: 4px;
}
.ctl-label b { color: var(--accent); font-variant-numeric: tabular-nums; }
.ctl-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg1);
}

/* ---------- Inputs ---------- */
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: var(--bg2);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg0);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg0);
}
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.select, .text-input, .url-row input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-hard);
  color: var(--fg1);
  border: 1px solid var(--bg2);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  margin-bottom: 8px;
}
.select:focus, .text-input:focus, input:focus { border-color: var(--accent); }

.url-row { display: flex; gap: 8px; }
.url-row input { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  padding: 8px 14px;
  background: var(--bg1);
  color: var(--fg1);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg2); border-color: var(--gray); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: var(--bg-hard);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: var(--yellow); border-color: var(--yellow); }
.btn-block { width: 100%; }

/* ---------- Drop overlay ---------- */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(29, 32, 33, .85);
  backdrop-filter: blur(2px);
}
.drop-overlay.active { display: flex; }
.drop-overlay-inner {
  border: 3px dashed var(--accent);
  border-radius: 16px;
  padding: 60px 80px;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .controls-pane {
    border-left: none;
    border-top: 1px solid var(--bg2);
    max-height: none;
  }
  .preview-pane { min-height: 50vh; }
}
