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

    :root {
      --bg-primary: #000000;
      --bg-secondary: #0a0a0a;
      --bg-card: #111111;
      --bg-card-hover: #1a1a1a;
      --border-color: #222222;
      --border-hover: #444444;
      --text-primary: #f0f0f0;
      --text-secondary: #999999;
      --text-muted: #666666;
      --accent: #00c2de;
      --accent-dim: rgba(0, 194, 222, 0.1);
      --accent-glow: rgba(0, 194, 222, 0.15);
      --npu-color: #e8706a;
      --npu-dim: rgba(232, 112, 106, 0.15);
      --radius-sm: 4px;
      --radius-md: 6px;
      --radius-lg: 8px;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: var(--bg-primary);
      color: var(--text-primary);
      min-height: 100vh;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow: hidden;
      position: relative;
    }

    body::before {
      content: '';
      position: fixed;
      inset: 0;
      background-image: radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
      background-size: 24px 24px;
      pointer-events: none;
      z-index: 0;
    }

    body::after {
      content: '';
      position: fixed;
      inset: 0;
      background:
        radial-gradient(ellipse 60% 50% at 10% 10%, rgba(0, 194, 222, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 90% 85%, rgba(0, 194, 222, 0.03) 0%, transparent 70%);
      pointer-events: none;
      z-index: 0;
    }

    .navbar, .page-layout {
      position: relative;
      z-index: 1;
    }

    /* ── Navbar ── */
    .navbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 48px;
      height: 64px;
      border-bottom: 1px solid var(--border-color);
      background: rgba(0, 0, 0, 0.8);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .navbar-logo {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 20px;
      font-weight: 700;
      letter-spacing: -0.5px;
      color: var(--text-primary);
      text-decoration: none;
    }

    .navbar-actions {
      display: flex;
      align-items: center;
      gap: 24px;
    }

    .nav-link {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--text-secondary);
      text-decoration: none;
      font-size: 14px;
      font-weight: 500;
      transition: color 0.2s ease;
    }

    .nav-link:hover {
      color: var(--text-primary);
    }

    .nav-link svg {
      width: 18px;
      height: 18px;
    }

    .avatar-btn {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border: 1.5px solid var(--border-color);
      background: var(--bg-card);
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: border-color 0.2s ease, color 0.2s ease;
    }

    .avatar-btn:hover {
      border-color: var(--border-hover);
      color: var(--text-primary);
    }

    .avatar-btn svg {
      width: 20px;
      height: 20px;
    }

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

    /* ── Sidebar ── */
    .sidebar {
      width: 280px;
      min-width: 280px;
      background: var(--bg-secondary);
      border-right: 1px solid var(--border-color);
      padding: 0;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
    }

    .sidebar-header {
      padding: 24px 20px 16px;
    }

    .sidebar-title {
      font-size: 16px;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 4px;
    }

    .sidebar-subtitle {
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.5;
    }

    .sidebar-search {
      padding: 0 20px 16px;
    }

    .sidebar-search .search-wrapper {
      width: 100%;
      margin-right: 0;
    }

    .sidebar-search .search-input {
      width: 100%;
    }

    .sidebar-search .search-input:focus {
      width: 100%;
    }

    .filter-divider {
      height: 1px;
      background: var(--border-color);
      margin: 0 20px;
    }

    .filter-section {
      padding: 16px 20px;
    }

    .filter-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 10px;
    }

    /* ── Filter Tags (HW Selection) ── */
    .filter-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .filter-tag {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--radius-md);
      color: var(--text-secondary);
      font-size: 12px;
      font-weight: 500;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .filter-tag:hover {
      background: rgba(255, 255, 255, 0.04);
      border-color: rgba(255, 255, 255, 0.1);
      color: var(--text-primary);
    }

    .filter-tag.active {
      background: rgba(0, 194, 222, 0.08);
      border-color: rgba(0, 194, 222, 0.2);
      color: var(--accent);
    }

    .filter-tag .tag-check {
      display: none;
      font-size: 10px;
    }

    .filter-tag.active .tag-check {
      display: inline;
    }

    /* ── HW Engine Blocks ── */
    .engine-filter-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }

    .engine-filter-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 14px 8px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--radius-md);
      color: var(--text-secondary);
      font-size: 11px;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.15s ease;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }

    .engine-filter-item:hover {
      background: rgba(255, 255, 255, 0.04);
      border-color: rgba(255, 255, 255, 0.1);
      color: var(--text-primary);
    }

    .engine-filter-item.active {
      background: rgba(0, 194, 222, 0.08);
      border-color: rgba(0, 194, 222, 0.25);
      color: var(--accent);
    }

    .engine-filter-item svg {
      width: 20px;
      height: 20px;
      opacity: 0.7;
    }

    .engine-filter-item.active svg {
      opacity: 1;
    }

    /* ── Device Filter Items ── */
    .device-filter-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .device-filter-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--radius-md);
      color: var(--text-secondary);
      font-size: 13px;
      font-weight: 500;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.15s ease;
      text-align: left;
      width: 100%;
    }

    .device-filter-item:hover {
      background: rgba(255, 255, 255, 0.04);
      border-color: rgba(255, 255, 255, 0.1);
    }

    .device-filter-item.active {
      background: rgba(0, 194, 222, 0.06);
      border-color: rgba(0, 194, 222, 0.15);
    }

    .device-filter-icon {
      width: 24px;
      height: 24px;
      flex-shrink: 0;
      color: var(--text-muted);
    }

    .device-filter-icon svg {
      width: 100%;
      height: 100%;
    }

    .device-filter-item.active .device-filter-icon {
      color: var(--accent);
    }

    .device-filter-name {
      flex: 1;
    }

    .device-filter-item.active .device-filter-name {
      color: var(--text-primary);
    }

    .device-filter-check {
      width: 18px;
      height: 18px;
      border-radius: 4px;
      border: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: all 0.15s ease;
    }

    .device-filter-item.active .device-filter-check {
      opacity: 1;
      background: rgba(0, 194, 222, 0.15);
      border-color: var(--accent);
      color: var(--accent);
    }

    .device-filter-check svg {
      width: 12px;
      height: 12px;
    }

    /* ── Filter Input ── */
    .filter-input {
      width: 100%;
      padding: 10px 14px;
      font-size: 13px;
      font-family: inherit;
      color: var(--text-primary);
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .filter-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px var(--accent-glow);
    }

    .filter-input::placeholder {
      color: var(--text-muted);
    }

    /* ── Slider ── */
    .slider-group {
      margin-top: 4px;
    }

    .slider-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }

    .slider-value {
      font-size: 13px;
      font-weight: 600;
      color: var(--accent);
    }

    .filter-range {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 4px;
      border-radius: 2px;
      background: var(--border-color);
      outline: none;
    }

    .filter-range::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: var(--accent);
      cursor: pointer;
      border: 2px solid var(--bg-card);
      box-shadow: 0 0 6px var(--accent-glow);
    }

    .filter-range::-moz-range-thumb {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: var(--accent);
      cursor: pointer;
      border: 2px solid var(--bg-card);
      box-shadow: 0 0 6px var(--accent-glow);
    }

    .range-labels {
      display: flex;
      justify-content: space-between;
      font-size: 10px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    /* Models found card */
    .models-found {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 14px 16px;
    }

    .models-found-label {
      font-size: 11px;
      color: var(--text-muted);
      font-weight: 500;
    }

    .models-found-count {
      font-size: 30px;
      font-weight: 700;
      color: var(--text-primary);
      line-height: 1.2;
      margin-top: 4px;
    }

    /* Guide Button */
    .btn-modern-guide {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      background: linear-gradient(135deg, rgba(0, 194, 222, 0.1) 0%, rgba(0, 194, 222, 0.02) 100%);
      border: 1px solid var(--accent);
      color: var(--accent);
      padding: 12px 16px;
      border-radius: var(--radius-md);
      font-family: inherit;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      text-decoration: none;
    }

    .btn-modern-guide:hover {
      background: linear-gradient(135deg, rgba(0, 194, 222, 0.15) 0%, rgba(0, 194, 222, 0.05) 100%);
      box-shadow: 0 4px 12px var(--accent-glow);
      transform: translateY(-1px);
    }

    .btn-modern-guide svg {
      width: 16px;
      height: 16px;
      transition: transform 0.2s ease;
    }

    .btn-modern-guide:hover svg {
      transform: translateX(4px);
    }

    /* ── Main Content ── */
    .main-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      padding: 24px 28px;
      gap: 16px;
    }

    .chart-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
    }

    .chart-title {
      font-size: 20px;
      font-weight: 700;
      color: var(--text-primary);
    }

    .chart-subtitle {
      font-size: 13px;
      color: var(--text-secondary);
      margin-top: 2px;
    }

    .chart-actions {
      display: flex;
      gap: 8px;
      align-items: center;
    }

    .btn {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 7px 14px;
      font-size: 12px;
      font-weight: 600;
      font-family: inherit;
      border-radius: var(--radius-md);
      cursor: pointer;
      transition: all 0.15s;
      border: none;
    }

    .btn-accent {
      background: var(--accent);
      color: #000;
    }

    .btn-accent:hover {
      background: #00d4f0;
    }

    .btn-ghost {
      background: transparent;
      color: var(--text-secondary);
      border: 1px solid var(--border-color);
    }

    .btn-ghost:hover {
      background: var(--bg-card);
      color: var(--text-primary);
      border-color: var(--border-hover);
    }

    .btn svg {
      width: 14px;
      height: 14px;
    }

    .search-wrapper {
      position: relative;
      display: flex;
      align-items: center;
      margin-right: 8px;
    }

    .search-input {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      color: var(--text-primary);
      padding: 6px 12px 6px 32px;
      border-radius: var(--radius-md);
      font-size: 13px;
      font-family: inherit;
      width: 200px;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s, width 0.2s;
    }

    .search-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px var(--accent-glow);
      width: 240px;
    }

    .search-input::placeholder {
      color: var(--text-muted);
    }

    .search-icon {
      position: absolute;
      left: 10px;
      width: 14px;
      height: 14px;
      color: var(--text-muted);
      pointer-events: none;
    }

    /* Search Results Dropdown */
    .search-results {
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      background: var(--bg-card);
      border: 1px solid var(--border-hover);
      border-radius: var(--radius-md);
      padding: 4px;
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-6px);
      transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
      max-height: 200px;
      overflow-y: auto;
    }

    .search-results.open {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }

    .search-result-item {
      padding: 8px 10px;
      font-size: 13px;
      font-weight: 500;
      color: var(--text-secondary);
      border-radius: var(--radius-sm);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .search-result-item:hover {
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-primary);
    }

    .search-result-item .add-icon {
      opacity: 0;
      width: 14px;
      height: 14px;
      color: var(--accent);
    }

    .search-result-item:hover .add-icon {
      opacity: 1;
    }

    .search-result-item.added {
      color: var(--accent);
    }

    .search-result-item.added .add-icon {
      opacity: 1;
      color: var(--accent);
    }

    /* Chart container */
    .chart-container {
      flex: 1;
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      padding: 16px;
      position: relative;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .canvas-wrapper {
      flex: 1;
      position: relative;
      min-height: 0;
    }

    .canvas-wrapper canvas {
      width: 100% !important;
      height: 100% !important;
      cursor: default;
    }

    .canvas-wrapper canvas:active {
      cursor: default;
    }

    /* Footer: engine legend (left) + parameter scale (right), below chart card */
    .chart-footer {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 16px;
      flex-shrink: 0;
      min-height: 0;
    }

    .chart-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 20px;
      padding-top: 2px;
    }

    .param-scale-legend {
      display: flex;
      flex-direction: row;
      flex-wrap: nowrap;
      align-items: center;
      justify-content: flex-end;
      gap: 10px;
      margin-left: auto;
      flex-shrink: 0;
    }

    .param-scale-legend .legend-item {
      gap: 4px;
      font-size: 10px;
      font-weight: 500;
      color: var(--text-muted);
      white-space: nowrap;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: var(--text-secondary);
      font-weight: 500;
    }

    .legend-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
    }

    .legend-dot.igpu { background: var(--accent); }
    .legend-dot.npu  { background: var(--npu-color); }

    .param-scale-legend .legend-shape {
      width: 8px;
      height: 8px;
    }

    .legend-shape {
      width: 12px;
      height: 12px;
      flex-shrink: 0;
      background: var(--text-muted);
    }

    .legend-shape--triangle {
      clip-path: polygon(50% 0%, 93% 75%, 7% 75%);
    }

    .legend-shape--diamond {
      clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    }

    .legend-shape--pentagon {
      clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    }

    .legend-shape--hexagon {
      clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    }

    /* Chart hover tooltip */
    .chart-tooltip {
      opacity: 0;
      position: absolute;
      background: var(--bg-card-hover);
      border: 1px solid var(--border-color);
      border-radius: 12px;
      padding: 14px;
      pointer-events: none;
      transition: opacity 0.15s ease;
      transform: none;
      z-index: 10;
      width: 320px;
      max-width: min(320px, 92vw);
      box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04);
    }

    .tooltip-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 12px;
      line-height: 1.3;
    }

    .tooltip-metric-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px 10px;
      margin-bottom: 14px;
    }

    .tooltip-metric-cell {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 10px 11px;
      min-width: 0;
    }

    .tooltip-metric-kicker {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 4px;
    }

    .tooltip-metric-value {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-primary);
      line-height: 1.25;
      word-break: break-word;
    }

    .tooltip-actions {
      display: flex;
      gap: 8px;
    }

    .tooltip-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1;
      gap: 6px;
      padding: 8px 12px;
      font-size: 12px;
      font-weight: 600;
      font-family: inherit;
      border-radius: var(--radius-md);
      cursor: pointer;
      text-decoration: none;
      transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }

    .tooltip-btn svg {
      width: 14px;
      height: 14px;
      flex-shrink: 0;
    }

    .tooltip-btn-primary {
      background: var(--accent);
      color: #000;
      border: 1px solid transparent;
    }

    .tooltip-btn-primary:hover {
      background: #00d4f0;
    }

    .tooltip-btn-secondary {
      background: transparent;
      color: var(--text-secondary);
      border: 1px solid var(--border-color);
    }

    .tooltip-btn-secondary:hover {
      background: var(--bg-card);
      color: var(--text-primary);
      border-color: var(--border-hover);
    }

    /* Invisible hover bridge toward the point (tooltip anchors bottom-right of dot) */
    #chartjs-tooltip::after {
      content: '';
      position: absolute;
      left: -52px;
      top: -52px;
      width: 52px;
      height: 52px;
    }

    /* Scrollbar */
    * { scrollbar-width: thin; scrollbar-color: #333333 transparent; }
    ::-webkit-scrollbar { width: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #333333; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: #555555; }
