@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;700&family=Space+Mono:wght@400;700&display=swap');

/* ─── DESIGN TOKENS ──────────────────────────────────────── */
:root {
  --bg:     #080808;
  --panel:  #111111;
  --border: rgba(255, 255, 255, 0.07);
  --accent: #e84142;
  --text:   #d8d8d8;
  --muted:  #505050;
  --track:  #1c1c1c;
}

/* ─── RESET ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  height: 100vh;
  display: grid;
  grid-template-rows: 46px 1fr 34px;
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 350px;
  overflow: hidden;
}

/* ─── HEADER ─────────────────────────────────────────────── */
header {
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
header .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
header h1 {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
}
header .tag {
  margin-left: auto;
  font-size: 9px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 7px;
}

/* ─── FOOTER ─────────────────────────────────────────────── */
footer {
  padding: 0 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
footer span {
  font-size: 8.5px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* ─── PREVIEW AREA ───────────────────────────────────────── */
.preview {
  display: grid;
  grid-template-rows: 1fr auto;
  position: relative;
  border-right: 1px solid var(--border);
  background: radial-gradient(ellipse at 50% 44%, #1c1c1c 0%, #080808 65%);
  overflow: hidden;
}

/* dot-grid overlay */
.preview::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* button lives here — slight upward nudge keeps it visually centred above code box */
.btn-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding-bottom: 16px;
}

/* ─── THE BUTTON ─────────────────────────────────────────── */
.btn-wrapper {
  position: relative;
  padding: 18px 46px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 13px;
  cursor: pointer;
  display: inline-block;
  user-select: none;
  font-family: 'Space Mono', monospace;
  isolation: isolate;
}

/* SVG shape sits behind text */
.btn-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  overflow: visible;
}

.btn-label {
  position: relative;
  z-index: 1;
}

/* TL / TR / BR / BL corner labels in preview */
.clabels {
  position: absolute;
  inset: -26px;
  pointer-events: none;
}
.ci {
  position: absolute;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--muted);
  transition: color 0.2s;
  font-family: 'IBM Plex Mono', monospace;
}
.ci.on  { color: var(--accent); }
.ci-tl  { top: 0;    left: 0;   }
.ci-tr  { top: 0;    right: 0;  }
.ci-br  { bottom: 0; right: 0;  }
.ci-bl  { bottom: 0; left: 0;   }

/* ─── CODE OUTPUT BOX ────────────────────────────────────── */
.code-area {
  padding: 0 28px 18px;
  position: relative;
  z-index: 1;
}
.code-box {
  background: #090909;
  border: 1px solid var(--border);
  position: relative;
}
.code-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.code-tab {
  padding: 6px 13px;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: color 0.2s, background 0.2s;
  user-select: none;
}
.code-tab.active             { color: var(--accent); background: rgba(232, 65, 66, 0.06); }
.code-tab:hover:not(.active) { color: var(--text); }
.code-content         { display: none; }
.code-content.active  { display: block; }
.code-content pre {
  font-size: 9.5px;
  color: #7ec8a8;
  padding: 11px 46px 11px 14px;
  white-space: pre;
  overflow: auto;
  max-height: 155px;
  line-height: 1.65;
  font-family: 'IBM Plex Mono', monospace;
}
.copy-btn {
  position: absolute;
  top: 29px; right: 7px;
  background: #111;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  padding: 3px 8px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: color 0.2s, border-color 0.2s;
  z-index: 2;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ─── CONTROL PANEL ──────────────────────────────────────── */
.panel {
  overflow-y: auto;
  background: var(--panel);
}
.panel::-webkit-scrollbar       { width: 3px; }
.panel::-webkit-scrollbar-thumb { background: var(--muted); }

.section {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}

/* section heading with auto-expanding rule */
.stitle {
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stitle::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── SLIDER ROWS ────────────────────────────────────────── */
.sr {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}
.sl {
  font-size: 9.5px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.4px;
}
.vb {
  font-size: 10px;
  color: #fff;
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: var(--track);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}

/* ─── CORNER TOGGLES ─────────────────────────────────────── */
.cgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 4px;
}
.ctog {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}
.ctog:hover         { border-color: var(--muted); }
.ctog.active        { border-color: var(--accent); background: rgba(232, 65, 66, 0.06); }
.tdot {
  width: 7px; height: 7px;
  border: 1px solid var(--muted);
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
.ctog.active .tdot  { background: var(--accent); border-color: var(--accent); }
.ctog span          { font-size: 8.5px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.ctog.active span   { color: var(--accent); }

/* ─── COLOR SWATCHES ─────────────────────────────────────── */
.swgrid {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.sw {
  width: 23px; height: 23px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.sw:hover  { transform: scale(1.15); }
.sw.active { border-color: #fff; }

/* ─── PRESET BUTTONS ─────────────────────────────────────── */
.pgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.pbtn {
  padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.pbtn:hover { border-color: var(--accent); color: var(--accent); background: rgba(232, 65, 66, 0.06); }

/* ─── TOGGLE SWITCHES ────────────────────────────────────── */
.tr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.tr span { font-size: 9.5px; color: var(--muted); letter-spacing: 0.4px; }

.switch {
  position: relative;
  width: 32px; height: 17px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.strack {
  position: absolute;
  inset: 0;
  background: var(--track);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.strack::before {
  content: '';
  position: absolute;
  width: 11px; height: 11px;
  left: 2px; top: 2px;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .strack {
  background: rgba(232, 65, 66, 0.2);
  border-color: var(--accent);
}
.switch input:checked + .strack::before {
  transform: translateX(15px);
  background: var(--accent);
}

/* ─── FX TOGGLE ROWS ─────────────────────────────────────── */
.fxr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  padding-left: 7px;
  border-left: 2px solid transparent;
  transition: border-color 0.2s;
}
.fxr.on   { border-left-color: var(--accent); }
.fxr span { font-size: 9.5px; color: var(--muted); letter-spacing: 0.4px; }

/* collapsible sub-panel for FX options */
.fx-sub {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  margin-bottom: 9px;
  display: none;
}
.fx-sub.visible  { display: block; }
.fx-sub-label {
  font-size: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
