/* ── Tokens ─────────────────────────────────────────── */
:root {
  --bg:       #656565;
  --surface:  #D0C9BD;
  --inlay:    #BBB8B4;
  --shadow-d: #A8A39B;
  --shadow-l: #E8E2D8;
  --text:     #181818;
  --text-mid: #4B4B4B;
  --text-faint:#7a7570;
  --green:    #4A7C59;
  --amber:    #C4901A;
  --amber-dk: #8B6B1A;
  --red:      #C06030;
  --blue:     #3A7AB8;
  --dot-yes:  #4A9E6A;
  --dot-no:   #C06030;
  --dot-null: #9a9490;
  --sel-0:    #3A7AB8;
  --sel-1:    #B84A7A;
  --sel-2:    #7AB84A;
  --white:    #F0EBE3;

  --neo-raised:    4px 4px 10px var(--shadow-d), -4px -4px 10px var(--shadow-l);
  --neo-raised-sm: 2px 2px 6px var(--shadow-d), -2px -2px 6px var(--shadow-l);
  --neo-pressed:   inset 3px 3px 8px var(--shadow-d), inset -3px -3px 8px var(--shadow-l);
  --neo-pressed-deep: inset 5px 5px 14px #9E9A95, inset -3px -3px 10px #E0DCD6;

  --font-title: 'Audiowide', sans-serif;
  --font-data:  'Iosevka', 'Iosevka Web', 'JetBrains Mono', 'Courier New', monospace;
  --font-ui:    'Istok Web', sans-serif;
}

/* ── Reset & base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

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

.hidden { display: none !important; }
.mono   { font-family: var(--font-data); }

/* ── Header ─────────────────────────────────────────── */
#header {
  background: var(--surface);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 4px 12px var(--shadow-d), 0 1px 0 var(--shadow-l);
  position: relative;
  z-index: 10;
}

#app-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 2px;
  line-height: 1;
}

#app-sub {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-mid);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
}

#presets {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-mid);
  background: var(--surface);
  border: none;
  border-radius: 4px;
  padding: 5px 11px;
  cursor: pointer;
  box-shadow: var(--neo-raised-sm);
  letter-spacing: 0.5px;
  transition: all 0.15s;
}
.preset-btn.active {
  background: var(--green);
  color: var(--white);
  font-weight: 700;
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
}

/* ── Layout ─────────────────────────────────────────── */
#layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 64px);
}

/* ── Panels ─────────────────────────────────────────── */
aside {
  background: var(--surface);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}

#left-panel  {
  width: 186px;
  min-width: 186px;
  box-shadow: inset -3px 0 8px var(--shadow-d);
}

#right-panel {
  width: 252px;
  min-width: 252px;
  box-shadow: inset 3px 0 8px var(--shadow-d);
}

.panel-section { margin-bottom: 4px; }

.section-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.divider {
  border: none;
  border-top: 1px solid var(--inlay);
  margin: 2px 0 10px;
}

/* ── Axis selects ───────────────────────────────────── */
.axis-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.axis-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  min-width: 36px;
}

.axis-select {
  flex: 1;
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text);
  background: var(--inlay);
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  box-shadow: var(--neo-pressed);
  outline: none;
  appearance: none;
}

/* ── Sliders ─────────────────────────────────────────── */
.slider-group { margin-bottom: 10px; }

.slider-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.slider-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 1.5px;
}

.slider-val {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--amber);
  font-weight: 600;
}

.slider-inlay {
  background: var(--inlay);
  border-radius: 6px;
  padding: 5px 8px;
  box-shadow: var(--neo-pressed);
}

.slider-inlay input[type="range"] {
  width: 100%;
  accent-color: var(--green);
  cursor: pointer;
}

/* ── Tristate boolean filter ─────────────────────────── */
.tristate-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tristate-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tristate-hint {
  font-family: var(--font-ui);
  font-size: 7px;
  color: var(--text-faint);
  letter-spacing: 0.3px;
  font-style: italic;
}

.tristate-btn {
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  background: var(--inlay);
  color: var(--text-faint);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  box-shadow: var(--neo-raised-sm);
  letter-spacing: 0.5px;
  transition: all 0.15s;
  min-width: 48px;
  text-align: center;
}

.tristate-btn.state-yes {
  background: var(--dot-yes);
  color: var(--white);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.25), inset -1px -1px 3px rgba(255,255,255,0.15);
}

.tristate-btn.state-no {
  background: var(--red);
  color: var(--white);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.25), inset -1px -1px 3px rgba(255,255,255,0.15);
}

/* ── Centre / Scatter ───────────────────────────────── */
#centre {
  flex: 1;
  background: var(--bg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

#plot-container {
  flex: 1;
  background: var(--inlay);
  border-radius: 8px;
  box-shadow: var(--neo-pressed-deep);
  position: relative;
  overflow: hidden;
  min-height: 0;
}

#scatter {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Tooltip ─────────────────────────────────────────── */
#tooltip {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--amber);
  border-radius: 6px;
  padding: 10px 12px;
  pointer-events: none;
  box-shadow: 2px 3px 8px var(--shadow-d);
  min-width: 180px;
  max-width: 220px;
  z-index: 100;
}

#tooltip .tt-brand {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

#tooltip .tt-model {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-mid);
  margin-bottom: 4px;
}

#tooltip .tt-price {
  font-family: var(--font-data);
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 4px;
}

#tooltip .tt-row {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-mid);
  line-height: 1.6;
}

#tooltip .tt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
  margin-bottom: 4px;
}

#tooltip .tt-tag {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 4px;
}
#tooltip .tt-tag.yes  { color: var(--green);      background: rgba(74,124,89,0.12); }
#tooltip .tt-tag.no   { color: var(--red);        background: rgba(192,96,48,0.12); }
#tooltip .tt-tag.null { color: var(--text-faint); background: rgba(154,148,144,0.15); }

#tooltip .tt-action {
  font-family: var(--font-ui);
  font-size: 10px;
  margin-top: 4px;
}

#tooltip .tt-link {
  font-family: var(--font-data);
  font-size: 9px;
  color: var(--blue);
  text-decoration: none;
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Colour legend ───────────────────────────────────── */
#color-legend {
  position: absolute;
  bottom: 10px;
  right: 12px;
  background: rgba(208,201,189,0.92);
  border-radius: 4px;
  padding: 4px 10px;
  box-shadow: var(--neo-raised-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-mid);
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.legend-dot.yes  { background: var(--dot-yes); }
.legend-dot.no   { background: var(--dot-no); }
.legend-dot.null { background: var(--dot-null); }
.legend-text     { margin-right: 2px; }
.legend-field    { font-weight: 700; letter-spacing: 0.5px; }

/* ── Status bar ─────────────────────────────────────── */
#status-bar {
  background: var(--surface);
  border-radius: 6px;
  padding: 8px 14px;
  box-shadow: var(--neo-raised-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  flex-shrink: 0;
}

#status-count    { color: var(--text-mid); font-family: var(--font-data); }
#status-selection { color: var(--text); flex: 1; }

#clear-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--dot-no);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 11px;
}

/* ── Right panel: cards ─────────────────────────────── */
 #comparison-cards { margin-bottom: 0px; } 

.product-card {
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: var(--neo-raised-sm);
  border-left: 3px solid #888;
  position: relative;
}

.card-remove {
  position: absolute;
  top: 6px; right: 8px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.card-brand {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  padding-right: 20px;
}

.card-model {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-mid);
  line-height: 1.3;
  margin-bottom: 4px;
}

.card-price {
  font-family: var(--font-data);
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 3px;
}

.card-stats {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-mid);
  line-height: 1.6;
}

.card-link {
  font-family: var(--font-data);
  font-size: 9px;
  color: var(--blue);
  text-decoration: none;
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.card-tag {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 3px;
  padding: 2px 5px;
}

.card-tag.yes {
  color: var(--green);
  background: var(--inlay);
  box-shadow: inset 1px 1px 3px var(--shadow-d), inset -1px -1px 3px var(--shadow-l);
}

.card-tag.no {
  color: var(--text-faint);
  background: var(--inlay);
  box-shadow: var(--neo-raised-sm);
}

.card-tag.null {
  color: var(--dot-null);
  background: var(--inlay);
  box-shadow: var(--neo-raised-sm);
  opacity: 0.7;
}

/* ── Dist charts ─────────────────────────────────────── */
.inlay {
  background: var(--inlay);
  border-radius: 6px;
  box-shadow: var(--neo-pressed);
}

.dist-block {
  padding: 8px 10px;
  margin-bottom: 8px;
}

.dist-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.dist-field-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 1.5px;
}

.dist-range {
  font-size: 10px;
  color: var(--text);
}

.dist-chart {
  display: block;
  width: 100%;
  height: 28px;
}

/* ── Boolean comparison panel ────────────────────────── */
#bool-panel {
  padding: 10px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.bool-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.bool-key {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 1px;
}

.bool-dots { display: flex; gap: 5px; }

.bool-dot {
  font-family: var(--font-data);
  font-size: 13px;
  line-height: 1;
}
.bool-dot.yes  { color: var(--dot-yes); }
.bool-dot.no   { color: var(--dot-no); }
.bool-dot.null { color: var(--dot-null); }

/* ── Open source section ─────────────────────────────── */
#open-source {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--shadow-d);
}

.oss-heading {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.oss-group { margin-bottom: 8px; }

.oss-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.oss-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.oss-links a {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--green);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oss-links a:hover { color: var(--amber); text-decoration: underline; }

/* ── Notes ───────────────────────────────────────────── */
.note {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-faint);
  line-height: 1.7;
  padding-top: 10px;
}

.note a { color: var(--blue); text-decoration: none; }
.note a:hover { text-decoration: underline; }

.madeby { color: #3d002b; font-family: var(--font-data); font-size: 12px; }

/* ── Scrollbar ───────────────────────────────────────── */
aside::-webkit-scrollbar { width: 4px; }
aside::-webkit-scrollbar-track { background: var(--inlay); }
aside::-webkit-scrollbar-thumb { background: var(--shadow-d); border-radius: 2px; }
