/* Zenwall — UI styles. Dark, quiet, OLED-friendly. */

:root {
  --bg: #08080b;
  --panel: #101015;
  --panel-2: #16161d;
  --line: #24242e;
  --line-2: #2f2f3b;
  --ink: #e7e7ee;
  --ink-dim: #9a9aab;
  --ink-faint: #62626f;
  --accent: #7fd6c2;     /* muted sage-cyan */
  --accent-ink: #04130f;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Masthead ── */
.masthead { margin-bottom: 22px; }
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.wordmark .dot {
  width: 11px; height: 11px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 14px -2px var(--accent);
}
.tagline { margin: 6px 0 0; color: var(--ink-dim); font-size: 13.5px; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
  flex: 1;
  align-items: start;
}

/* ── Control panel ── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px 16px;
  position: sticky;
  top: 20px;
}
.group { padding: 16px 0; border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
.group-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

/* ── Tabs ── */
.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg);
  padding: 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.tab {
  appearance: none; border: 0; cursor: pointer;
  background: transparent; color: var(--ink-dim);
  padding: 7px 0; border-radius: 6px;
  font: inherit; font-size: 13px; font-weight: 550;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--panel-2); color: var(--ink); }

.tabpanel.is-hidden { display: none; }

/* ── Dropzone ── */
.dropzone {
  display: block; cursor: pointer;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 22px 14px; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: #0c1411; }
.dz-inner { display: flex; flex-direction: column; gap: 3px; }
.dz-inner strong { font-size: 13.5px; font-weight: 600; }
.dz-inner span { font-size: 12px; color: var(--ink-faint); }

/* ── Inputs ── */
.text-input, .select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit; font-size: 13px;
}
.text-input:focus, .select:focus { outline: none; border-color: var(--accent); }
.select { appearance: none; cursor: pointer; }
.num { width: 100%; }
.text-input::placeholder { color: var(--ink-faint); }

.examples { margin-top: 10px; font-size: 12px; color: var(--ink-faint); }
.chip {
  appearance: none; border: 1px solid var(--line-2); cursor: pointer;
  background: var(--bg); color: var(--ink-dim);
  padding: 3px 8px; border-radius: 999px; margin: 0 2px;
  font: inherit; font-size: 12px;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }

.source-status {
  margin-top: 12px; font-size: 12.5px; color: var(--ink-dim);
  min-height: 1.2em;
}
.source-status.is-error { color: #e88; }
.source-status.is-ok { color: var(--accent); }

/* ── Range controls ── */
.control { display: block; margin-bottom: 14px; }
.control:last-child { margin-bottom: 0; }
.control-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--ink-dim); margin-bottom: 7px;
}
.control-label em { font-style: normal; color: var(--ink); font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 999px;
  background: var(--line-2); cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 0;
  box-shadow: 0 0 0 4px rgba(127,214,194,.15);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 0;
}

.custom-res { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.custom-res.is-hidden { display: none; }
.custom-res .x { color: var(--ink-faint); }

/* ── OLED ── */
.info {
  width: 16px; height: 16px; border-radius: 50%; margin-left: auto;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-dim);
  cursor: pointer; font-size: 10px; font-style: italic; font-weight: 700;
  line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.info:hover { border-color: var(--accent); color: var(--ink); }
.oled-note { margin: 12px 0 0; font-size: 12px; color: var(--ink-faint); line-height: 1.5; }

/* ── Actions ── */
.actions { display: flex; flex-direction: column; gap: 9px; }
.btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 550;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  border-radius: var(--radius-sm); padding: 10px 14px;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { border-color: var(--ink-faint); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); border-color: var(--accent); }
.btn-secondary { background: var(--bg); }
.pack-status { font-size: 12px; color: var(--ink-dim); min-height: 1em; text-align: center; }

/* ── Stage ── */
.stage { min-width: 0; }
.stage-frame {
  position: relative;
  background:
    repeating-conic-gradient(#0d0d11 0% 25%, #0a0a0e 0% 50%) 50% / 22px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 320px;
}
#canvas { display: block; max-width: 100%; height: auto; }
.stage-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--ink-faint); text-align: center; padding: 20px;
}
.stage-empty p { margin: 0; color: var(--ink-dim); font-size: 14px; }
.stage-empty small { font-size: 12px; }
.stage-empty.is-hidden { display: none; }

.stage-busy {
  position: absolute; inset: 0;
  background: rgba(8,8,11,.7); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--ink); font-size: 13px;
}
.stage-busy.is-hidden { display: none; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stage-meta {
  margin-top: 10px; font-size: 12px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; min-height: 1em;
}

/* ── Footer ── */
.footer {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--ink-faint);
}
.footer a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.footer a:hover { color: var(--accent); border-color: var(--accent); }

/* ── Dialog ── */
.dialog {
  max-width: 460px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); padding: 24px;
}
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog h2 { margin: 0 0 12px; font-size: 17px; }
.dialog p { margin: 0 0 12px; color: var(--ink-dim); font-size: 13.5px; }
.dialog ul { margin: 0 0 18px; padding-left: 18px; color: var(--ink-dim); font-size: 13.5px; }
.dialog li { margin-bottom: 6px; }
.dialog strong { color: var(--ink); }

/* ── Responsive ── */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
}
