@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0f1117;
  color: #e0e0e6;
  font-family: "DM Sans", sans-serif;
  font-size: 18px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: #f0f0f5;
}

h1 + .axis-controls {
  margin-top: 16px;
}

.axis-controls + .outer-wrapper {
  margin-top: 16px;
}

/* Axis selector controls */
.axis-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: center;
}

.axis-control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.axis-control-group label {
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  color: #7a7a8e;
  font-weight: 500;
}

.axis-control-group select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: #1e2038;
  border: 1px solid #3a3c5a;
  border-radius: 6px;
  color: #c0c0d0;
  font-size: 0.7rem !important;
  font-family: "JetBrains Mono", monospace;
  padding: 4px 24px 4px 8px !important;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a7a8e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.axis-control-group select:hover {
  border-color: #6a6c8a;
}

.axis-control-group select:focus {
  border-color: #8a8caa;
}

/* Layout */
.outer-wrapper {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: stretch;
  max-width: 100%;
}

.y-axis-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.8rem;
  font-weight: 500;
  color: #7a7a8e;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  width: 24px;
}

.y-labels-col {
  display: flex;
  flex-direction: column;
  width: 52px;
  flex-shrink: 0;
  position: relative;
}

.chart-and-x {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.chart-container {
  position: relative;
  width: 820px;
  max-width: 100%;
  height: 560px;
  background: #161822;
  border: 1px solid #2a2c3a;
  border-radius: 12px;
  overflow: visible;
}

.chart-area {
  position: absolute;
  top: 30px;
  left: 20px;
  right: 20px;
  bottom: 30px;
}

.x-axis-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: #7a7a8e;
  letter-spacing: 0.03em;
  margin-top: 12px;
  white-space: nowrap;
}

/* Grid */
.grid-line-h,
.grid-line-v {
  position: absolute;
  background: #1e2030;
}
.grid-line-h {
  left: 0;
  right: 0;
  height: 1px;
}
.grid-line-v {
  top: 0;
  bottom: 0;
  width: 1px;
}

/* Axis labels */
.axis-label-y {
  position: absolute;
  font-size: 0.7rem;
  font-family: "JetBrains Mono", monospace;
  color: #5a5a6e;
  text-align: right;
  right: 4px;
  transform: translateY(-50%);
  white-space: nowrap;
}

.axis-label-x {
  position: absolute;
  font-size: 0.7rem;
  font-family: "JetBrains Mono", monospace;
  color: #5a5a6e;
  transform: translateX(-50%);
  bottom: 8px;
}

/* Dots */
.dot {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s ease;
}
.dot:hover,
.dot.pinned {
  transform: translate(-50%, -50%) scale(1.8);
  z-index: 10;
}

.dot.fan-animate {
  transition:
    left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.15s ease;
}

.monitor-label.fan-animate {
  transition:
    left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.25s ease;
}

.dot.cat-joshua-monitor {
  background: #f472b6;
  box-shadow: 0 0 10px #f472b666;
}
.dot.cat-joshua-work-monitor {
  background: #22d3ee;
  box-shadow: 0 0 10px #22d3ee66;
}
.dot.cat-macbook {
  background: #f5a623;
  box-shadow: 0 0 10px #f5a62366;
}
.dot.cat-4k {
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf866;
}
.dot.cat-5k {
  background: #a78bfa;
  box-shadow: 0 0 10px #a78bfa66;
}
.dot.cat-6k {
  background: #c084fc;
  box-shadow: 0 0 10px #c084fc66;
}
.dot.cat-8k {
  background: #e879f9;
  box-shadow: 0 0 10px #e879f966;
}
.dot.cat-ultrawide-high {
  background: #34d399;
  box-shadow: 0 0 10px #34d39966;
}
.dot.cat-ultrawide-mid {
  background: #60a5fa;
  box-shadow: 0 0 10px #60a5fa66;
}
.dot.cat-ultrawide-low {
  background: #f87171;
  box-shadow: 0 0 10px #f8717166;
}
.dot.cat-super-ultra {
  background: #fb923c;
  box-shadow: 0 0 10px #fb923c66;
}
.dot.cat-ultrawide-6k {
  background: #2dd4bf;
  box-shadow: 0 0 10px #2dd4bf66;
}
.dot.cat-ultrawide-entry {
  background: #fbbf24;
  box-shadow: 0 0 10px #fbbf2466;
}

.dot.upcoming {
  background: transparent !important;
  border: 2px solid;
  width: 13px;
  height: 13px;
}
.dot.upcoming.cat-4k {
  border-color: #38bdf8;
  box-shadow: 0 0 10px #38bdf866;
}
.dot.upcoming.cat-5k {
  border-color: #a78bfa;
  box-shadow: 0 0 10px #a78bfa66;
}
.dot.upcoming.cat-8k {
  border-color: #e879f9;
  box-shadow: 0 0 10px #e879f966;
}
.dot.upcoming.cat-ultrawide-high {
  border-color: #34d399;
  box-shadow: 0 0 10px #34d39966;
}
.dot.upcoming.cat-ultrawide-mid {
  border-color: #60a5fa;
  box-shadow: 0 0 10px #60a5fa66;
}
.dot.upcoming.cat-ultrawide-low {
  border-color: #f87171;
  box-shadow: 0 0 10px #f8717166;
}
.dot.upcoming.cat-super-ultra {
  border-color: #fb923c;
  box-shadow: 0 0 10px #fb923c66;
}
.dot.upcoming.cat-ultrawide-6k {
  border-color: #2dd4bf;
  box-shadow: 0 0 10px #2dd4bf66;
}
.dot.upcoming.cat-ultrawide-entry {
  border-color: #fbbf24;
  box-shadow: 0 0 10px #fbbf2466;
}

/* Monitor labels */
.monitor-label {
  position: absolute;
  font-size: 0.58rem;
  font-family: "JetBrains Mono", monospace;
  color: #8a8a9e;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.25s ease;
}

/* Cluster badges */
.cluster-badge {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: #bbbbd0;
  background: #252740;
  border: 1px solid #3a3c52;
  border-radius: 10px;
  padding: 2px 7px;
  cursor: pointer;
  z-index: 4;
  transition:
    opacity 0.25s ease,
    pointer-events 0s;
  user-select: none;
}
.cluster-badge:hover {
  border-color: #6a6c8a;
  color: #e0e0f0;
}

.cluster-res-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.52rem;
  font-family: "JetBrains Mono", monospace;
  color: #55556a;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.25s ease;
}

/* Reference lines */
.ratio-label {
  position: absolute;
  font-size: 0.68rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 0;
}

.curve-label {
  position: absolute;
  font-size: 0.68rem;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
  pointer-events: none;
  z-index: 0;
}

/* Tooltip */
.tooltip {
  display: none;
  position: fixed;
  background: #1e2038;
  border: 1px solid #3a3c5a;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.78rem;
  z-index: 100;
  pointer-events: none;
  min-width: 240px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.tooltip .tt-name {
  font-weight: 700;
  color: #f0f0f5;
  margin-bottom: 6px;
  font-size: 0.82rem;
}
.tooltip .tt-detail {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  color: #9a9aae;
  line-height: 1.7;
}

/* Legend */
.legend {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  justify-content: center;
  max-width: 820px;
}
.legend-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legend-group-heading {
  font-size: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  color: #55556a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  color: #7a7a8e;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Panels side by side */
.panels-row {
  display: flex;
  gap: 16px;
  max-width: 820px;
  width: 100%;
  margin-top: 12px;
  align-items: flex-start;
  box-sizing: border-box;
}

.panels-row > div {
  flex: 1;
  min-width: 0;
}

/* Monitor panel */
#monitorPanel {
  max-width: 820px;
  width: 100%;
  margin-top: 20px;
}

.monitor-list {
  text-align: left;
  background: #161822;
  border: 1px solid #2a2c3a;
  border-radius: 10px;
  padding: 18px 24px;
  columns: 3 200px;
  column-gap: 28px;
}

.monitor-list-category {
  margin-bottom: 10px;
  break-inside: avoid;
}

.monitor-list-category-title {
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  color: #9a9aae;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.monitor-list-category-title input[type="checkbox"] {
  accent-color: #7a7a8e;
  cursor: pointer;
}

.monitor-list-category-title .cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.monitor-list-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 24px;
}

.monitor-checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-family: "JetBrains Mono", monospace;
  color: #7a7a8e;
  cursor: pointer;
  user-select: none;
}

.monitor-checkbox-label input[type="checkbox"] {
  accent-color: #7a7a8e;
  cursor: pointer;
}

.unreleased-tag {
  color: #555;
  font-size: 0.6rem;
  margin-left: 2px;
}

/* Filter panel & ref toggle panels */
.filter-panel {
  text-align: center;
}

.filter-panel-sidebar {
  text-align: left;
}

.filter-panel-sidebar .filter-list {
  margin: 0;
  background: #161822;
  border: 1px solid #2a2c3a;
  border-radius: 10px;
  padding: 16px 14px;
}

.filter-sidebar-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9a9aae;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

#filterPanel {
  margin-left: 14px;
  margin-right: 20px;
  min-width: 180px;
  max-width: 220px;
  align-self: flex-start;
  padding-top: 0;
}

.filter-section {
  background: #161822;
  border: 1px solid #2a2c3a;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.filter-section:last-child {
  margin-bottom: 0;
}

.filter-group-heading {
  font-size: 0.65rem;
  font-weight: 600;
  color: #6a6a7e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}

/* Unified reference lines panel */
.ref-lines-panel {
  display: flex;
  gap: 16px;
}

.ref-lines-section {
  flex: 1;
  min-width: 0;
  background: #161822;
  border: 1px solid #2a2c3a;
  border-radius: 10px;
  padding: 14px 14px;
}

.ref-lines-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #6a6a7e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.ref-lines-heading input[type="checkbox"] {
  accent-color: #7a7a8e;
  cursor: pointer;
  margin-left: auto;
}

.ref-lines-all-label {
  font-size: 0.6rem;
  color: #55556a;
  cursor: default;
}

.ref-lines-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ref-lines-items .monitor-checkbox-label {
  font-size: 0.72rem;
  gap: 7px;
  white-space: nowrap;
}

.filter-list {
  display: none;
  margin: 14px 0 0;
  text-align: left;
  background: #161822;
  border: 1px solid #2a2c3a;
  border-radius: 10px;
  padding: 16px 20px;
}

.filter-list.open {
  display: block;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-bottom: 10px;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-row-label {
  font-size: 0.68rem;
  font-family: "JetBrains Mono", monospace;
  color: #9a9aae;
  width: 100%;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.filter-sliders {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.dual-range {
  position: relative;
  height: 20px;
  flex: 1;
  min-width: 40px;
}

.dual-range-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: #2a2c3a;
}

.dual-range-fill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  border-radius: 2px;
  background: #4a4a6a;
}

.dual-range-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

.dual-range-input::-webkit-slider-runnable-track {
  height: 3px;
  background: transparent;
}

.dual-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7a7a8e;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s;
  margin-top: -5.5px;
}

.dual-range-input::-webkit-slider-thumb:hover {
  background: #aaaabe;
}

.dual-range-input::-moz-range-track {
  height: 0;
  background: transparent;
}

.dual-range-input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7a7a8e;
  cursor: pointer;
  border: none;
  pointer-events: auto;
}

.dual-range-input::-moz-range-thumb:hover {
  background: #aaaabe;
}

.filter-value-label {
  font-size: 0.58rem;
  font-family: "JetBrains Mono", monospace;
  color: #7a7a8e;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}

/* Glossary */
.glossary {
  max-width: 820px;
  width: 100%;
  margin-top: 40px;
  padding: 24px 28px;
  background: #161822;
  border: 1px solid #2a2c3a;
  border-radius: 12px;
}

.glossary h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #9a9aae;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

.glossary dl {
  display: grid;
  gap: 14px;
}

.glossary dt {
  font-size: 0.78rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  color: #c0c0d0;
}

.glossary dd {
  font-size: 0.74rem;
  color: #7a7a8e;
  line-height: 1.65;
  margin-top: 2px;
}

.glossary dd ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.glossary dd li {
  margin-bottom: 4px;
}

.glossary dd li:last-child {
  margin-bottom: 0;
}

/* ---- Responsive ---- */

/* When the outer-wrapper can't fit chart + sidebar side-by-side */
@media (max-width: 1100px) {
  .outer-wrapper {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  #filterPanel {
    grid-column: 1 / -1;
    margin-left: 0;
    margin-right: 0;
    padding-top: 16px;
    min-width: unset;
    max-width: unset;
    width: 100%;
  }

  #filterPanel .filter-panel-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  #filterPanel .filter-section {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
  }
}

@media (max-width: 900px) {
  .chart-container {
    width: 100%;
    max-width: 820px;
    height: clamp(320px, 55vw, 560px);
  }

  .legend {
    flex-wrap: wrap;
    gap: 16px;
  }

  .ref-lines-panel {
    flex-wrap: wrap;
  }

  .ref-lines-section {
    flex: 1 1 calc(50% - 16px);
    min-width: 140px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 24px 10px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .axis-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .chart-container {
    max-width: calc(100vw - 80px);
    height: clamp(260px, 65vw, 460px);
  }

  .y-labels-col {
    width: 36px;
  }

  .legend {
    flex-wrap: wrap;
    gap: 12px;
  }

  .panels-row > div {
    flex: 1 1 100%;
  }

  .monitor-list {
    padding: 12px 14px;
  }

  .monitor-list-items {
    gap: 4px 12px;
  }
}
