/* ============================================================
   S HTML Minifier — token system
   Color:
     --bg-void      #0a0d10  page background
     --bg-panel     #12161a  raised panels / bar
     --bg-inset     #0d1013  textareas / wells
     --border       #232a30  default hairline
     --border-hi    #3a444c  hover / focus hairline
     --accent       #ff8c00  brand amber (kept from original)
     --accent-dim   #a35d00
     --mint         #3ddc97  success / copy / saved bytes
     --text         #e7ecef  primary text
     --text-mid     #9aa4ac  secondary text
     --text-dim     #5b656c  tertiary / meta
   Type:
     Inter          UI chrome, labels, buttons, prose
     JetBrains Mono code, numbers, stats, meta
   ============================================================ */

:root {
  --bg-void: #0a0d10;
  --bg-panel: #12161a;
  --bg-inset: #0d1013;
  --border: #232a30;
  --border-hi: #3a444c;
  --accent: #ff8c00;
  --accent-dim: #7a4a00;
  --mint: #3ddc97;
  --text: #e7ecef;
  --text-mid: #9aa4ac;
  --text-dim: #5b656c;
  --radius: 6px;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-void);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(255,140,0,0.06), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(61,220,151,0.04), transparent 40%);
  color: var(--text);
  font-family: var(--font-ui);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: no-preference) {
  .scanline {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    background: linear-gradient(to bottom, transparent, rgba(255,140,0,0.35), transparent);
    height: 2px;
    opacity: 0.5;
    animation: scan 7s linear infinite;
  }
}
@keyframes scan {
  0% { transform: translateY(-10px); opacity: 0; }
  8% { opacity: .5; }
  92% { opacity: .5; }
  100% { transform: translateY(100vh); opacity: 0; }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(18, 22, 26, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: linear-gradient(155deg, var(--accent), #b35f00);
  color: #14100a;
  font-family: var(--font-code);
  font-weight: 700;
  border-radius: 8px;
  font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-code); font-weight: 600; font-size: 14.5px; }
.brand-tag { font-size: 11.5px; color: var(--text-dim); }

.topnav { display: flex; align-items: center; gap: 14px; }
.topnav-link {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-mid);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: border-color .15s, color .15s;
}
.topnav-link:hover { color: var(--text); border-color: var(--border-hi); }
.topnav-badge {
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--mint);
  border: 1px solid rgba(61,220,151,0.3);
  background: rgba(61,220,151,0.08);
  padding: 3px 8px;
  border-radius: 20px;
}

/* ---------- Intro ---------- */
.intro { padding: 44px 4px 26px; max-width: 720px; }
.intro h1 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.2;
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.intro-dim { color: var(--text-dim); }
.intro-sub { color: var(--text-mid); font-size: 15px; line-height: 1.6; max-width: 60ch; margin: 0; }

/* ---------- Options bar ---------- */
.options-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 20px 0 16px;
}
.options-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
}
.options-actions { flex-shrink: 0; padding-left: 10px; border-left: 1px solid var(--border); }

.opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 6px 10px 6px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.opt:hover { border-color: var(--border-hi); }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt-box {
  width: 14px; height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--text-dim);
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  transition: border-color .15s, background .15s;
}
.opt input:checked + .opt-box {
  background: var(--accent);
  border-color: var(--accent);
}
.opt input:checked + .opt-box::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid #14100a;
  border-width: 0 2px 2px 0;
  transform: rotate(40deg);
}
.opt input:checked ~ .opt-label { color: var(--text); }
.opt-label { font-size: 12.5px; color: var(--text-mid); white-space: nowrap; }
.opt-label em { font-style: normal; color: var(--text-dim); }
.opt-auto .opt-label { color: var(--text); font-weight: 500; }

/* ---------- Editor grid ---------- */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .pane-controls { flex-direction: row; justify-content: center; padding: 4px 0; }
}

.pane {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.pane-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255,140,0,0.7);
  flex-shrink: 0;
}
.pane-dot-out { background: var(--mint); box-shadow: 0 0 8px rgba(61,220,151,0.7); }
.pane-title { font-family: var(--font-code); font-size: 12.5px; font-weight: 600; }
.pane-meta {
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 2px;
}
.pane-tools { display: flex; gap: 6px; margin-left: auto; }

.tool-btn {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mid);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.tool-btn:hover { color: var(--text); border-color: var(--border-hi); background: rgba(255,255,255,0.03); }
.tool-btn-accent { color: #14100a; background: var(--mint); border-color: var(--mint); }
.tool-btn-accent:hover { color: #14100a; background: #4eecac; border-color: #4eecac; }
.tool-btn-danger:hover { color: #ff6b6b; border-color: #5a2a2a; }
.tool-btn.is-success { background: var(--mint); border-color: var(--mint); color: #14100a; }

.pane-body {
  position: relative;
  flex: 1;
  display: flex;
}
textarea {
  width: 100%;
  min-height: 340px;
  background: var(--bg-inset);
  color: var(--text);
  border: none;
  padding: 14px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
textarea::placeholder { color: var(--text-dim); }
#minifiedHtml { color: var(--mint); }

.drop-overlay {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(255, 140, 0, 0.08);
  border: 2px dashed var(--accent);
  border-radius: 0 0 8px 8px;
  font-family: var(--font-code);
  color: var(--accent);
  font-size: 14px;
  pointer-events: none;
}
#dropZone.is-dragover .drop-overlay { display: flex; }

.pane-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.run-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  width: 68px; height: 68px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(160deg, var(--accent), #b35f00);
  color: #14100a;
  cursor: pointer;
  box-shadow: 0 0 0 rgba(255,140,0,0.5);
  transition: transform .15s, box-shadow .2s;
}
.run-btn:hover { transform: scale(1.06); box-shadow: 0 0 22px rgba(255,140,0,0.45); }
.run-btn:active { transform: scale(0.97); }
.run-btn span { font-size: 10.5px; font-weight: 700; font-family: var(--font-code); }
.run-hint {
  font-family: var(--font-code);
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.run-hint span { color: var(--accent); margin: 0 1px; }

/* ---------- Stats strip ---------- */
.stats-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0 40px;
  flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat-label {
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--font-code);
}
.stat-value {
  font-family: var(--font-code);
  font-size: 16px;
  font-weight: 600;
}
.stat-delta .stat-value { color: var(--mint); }
.stat-arrow { color: var(--text-dim); font-size: 16px; }
.stat-bar-wrap {
  flex: 1;
  min-width: 100px;
  height: 6px;
  background: var(--bg-inset);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.stat-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--mint));
  transition: width .5s cubic-bezier(.2,.9,.3,1);
}
.stat-pct { align-items: flex-end; margin-left: auto; }
.stat-value-lg { font-size: 26px; color: var(--mint); }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 22px 12px 40px;
  color: var(--text-dim);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}
.site-footer b { color: var(--text-mid); }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}
.toast {
  font-family: var(--font-code);
  font-size: 12.5px;
  background: #14181c;
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .25s ease-out;
}
.toast.toast-success { border-color: rgba(61,220,151,0.4); }
.toast.toast-error { border-color: rgba(255,107,107,0.4); }
.toast-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); flex-shrink: 0; }
.toast.toast-error .toast-dot { background: #ff6b6b; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.is-leaving { animation: toastOut .2s ease-in forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px); }
}

@media (max-width: 480px) {
  .intro h1 { font-size: 24px; }
  .stats-strip { padding: 14px; }
  .stat-pct { margin-left: 0; }
  textarea { min-height: 220px; font-size: 12.5px; }
}
