:root {
  --bg: #14151a;
  --panel: #1d1f26;
  --panel-2: #262933;
  --border: #343845;
  --text: #e8e9ed;
  --muted: #9aa0ad;
  --accent: #6ea8fe;
  --ok: #4ade80;
  --warn: #f59e0b;
  --bad: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */

#sidebar {
  width: 250px;
  min-width: 250px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#sidebar header {
  padding: 16px 16px 8px;
}

#sidebar h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.02em;
}

#sidebar .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.control {
  padding: 10px 16px;
}

.control > label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 13px !important;
  color: var(--text) !important;
  cursor: pointer;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tabs button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.tabs button:hover { border-color: var(--accent); }

.tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #10131a;
  font-weight: 600;
}

input[type="range"] { width: 100%; }

.pages { flex: 1; }

#page-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#page-list li button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 7px 8px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

#page-list li button:hover { background: var(--panel-2); }

#page-list li button.active {
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
}

.dot.ok { background: var(--ok); }
.dot.partial { background: var(--warn); }
.dot.missing { background: var(--bad); }

#page-list .page-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Per-page change badge (from the build-time pixel diff). */
.badge {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.sev-none { color: var(--muted); }
.badge.sev-low { color: var(--ok); border-color: var(--ok); }
.badge.sev-mid { color: var(--warn); border-color: var(--warn); }
.badge.sev-high { color: var(--bad); border-color: var(--bad); }

#sidebar footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.hint { color: var(--muted); font-size: 11px; }

/* ---------- Main ---------- */

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

#status-dims { color: var(--muted); font-size: 12px; }

#status-links { display: flex; gap: 12px; margin-left: auto; }

#status-links a {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}

#status-links a:hover { text-decoration: underline; }

#compare {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Side-by-side panes */

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.pane:last-child { border-right: none; }

.pane-label {
  padding: 6px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.pane-label .badge-live { color: var(--ok); }
.pane-label .badge-preview { color: var(--accent); }

.pane-scroll {
  flex: 1;
  overflow: auto;
  background: #0c0d10;
}

.pane-scroll img {
  display: block;
  margin: 0 auto;
}

.fit .pane-scroll img { width: 100%; height: auto; }

.missing-msg {
  padding: 40px 20px;
  text-align: center;
  color: var(--bad);
  font-size: 13px;
}

/* Overlay / diff stack */

.stack-wrap {
  flex: 1;
  overflow: auto;
  background: #0c0d10;
}

.stack {
  position: relative;
  margin: 0 auto;
}

.stack img {
  display: block;
  width: 100%;
  height: auto;
}

.stack img.top {
  position: absolute;
  inset: 0;
}

.stack.diff { background: #fff; }
.stack.diff img.top { mix-blend-mode: difference; }

/* Wipe mode: draggable divider revealing preview over live. */

.stack.wipe { cursor: crosshair; }

.wipe-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  cursor: ew-resize;
  touch-action: none;
}

.wipe-handle {
  position: sticky;
  top: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: -13px;
  border-radius: 50%;
  background: var(--accent);
  color: #10131a;
  font-size: 14px;
  user-select: none;
}
