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

:root {
    --bg: rgb(0, 0, 0);
    --fill-secondary: rgb(22, 22, 23);
    --fill-tertiary: rgb(29, 29, 31);
    --fill-quaternary: rgb(51, 51, 54);
    --text-primary: rgb(245, 245, 247);
    --text-secondary: rgb(134, 134, 139);
    --text-tertiary: rgb(110, 110, 115);
    --text-glyph: rgb(255, 255, 255);
    --blue: rgb(41, 151, 255);
    --blue-fill: rgb(0, 113, 227);
    --green: rgb(3, 161, 14);
    --orange: rgb(255, 121, 27);
    --red: rgb(255, 48, 55);
    --pink: rgb(255, 55, 95);
    --purple: rgb(191, 90, 242);
    --yellow: rgb(255, 214, 10);
    --teal: rgb(100, 210, 255);
    --indigo: rgb(94, 92, 230);
    --border: rgb(66, 66, 69);
    --badge-bg: rgba(255, 214, 10, 0.12);
    --badge-text: rgb(255, 214, 10);
    --focus-ring: rgba(41, 151, 255, 0.5);
    --header-bg: rgba(0, 0, 0, 0.85);
    --overlay: rgba(0, 0, 0, 0.6);
}

body.light {
    --bg: rgb(255, 255, 255);
    --fill-secondary: rgb(245, 245, 247);
    --fill-tertiary: rgb(237, 237, 240);
    --fill-quaternary: rgb(221, 221, 226);
    --text-primary: rgb(29, 29, 31);
    --text-secondary: rgb(110, 110, 115);
    --text-tertiary: rgb(134, 134, 139);
    --text-glyph: rgb(0, 0, 0);
    --border: rgb(209, 209, 214);
    --badge-bg: rgba(180, 130, 0, 0.1);
    --badge-text: rgb(160, 100, 0);
    --focus-ring: rgba(0, 113, 227, 0.4);
    --header-bg: rgba(255, 255, 255, 0.85);
    --overlay: rgba(0, 0, 0, 0.4);
}

body {
    font-family: "SF Pro Text", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.47059;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

h1, h2, h3, h4, h5, h6 {
    font-family: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
    letter-spacing: -0.016em;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Focus */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}

/* Header */
header {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.022em;
    color: var(--text-primary);
}

header .tagline {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
    letter-spacing: -0.016em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-shortcuts {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--fill-tertiary);
    font-size: 11px;
    font-family: inherit;
    color: var(--text-secondary);
    line-height: 1.4;
}

main {
    padding: 48px 0;
}

/* Scatter Plot */
.scatter-section {
    background: var(--fill-tertiary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border);
    margin-top: 32px;
}

.scatter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.scatter-header h2 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.016em;
}

.scatter-controls {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.axis-select {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.axis-select label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.011em;
}

.axis-select select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--fill-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.axis-select select:focus {
    border-color: var(--blue);
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    touch-action: pan-y pinch-zoom;
}

.scatter-tooltip {
    position: absolute;
    z-index: 100;
    pointer-events: none;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.scatter-tooltip[hidden] { display: none; }

/* Vendor Filter Buttons */
.vendor-filter {
    display: flex;
    gap: 0;
    background: var(--fill-secondary);
    border-radius: 20px;
    padding: 3px;
    border: 1px solid var(--border);
}

.vendor-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 18px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

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

.vendor-btn:active {
    transform: scale(0.96);
}

.vendor-btn.active {
    background: var(--fill-quaternary);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.light .vendor-btn.active {
    background: var(--fill-quaternary);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Scatter Legend */
.scatter-legend {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: -0.016em;
    user-select: none;
}

.legend-item:hover {
    background: var(--fill-quaternary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-count {
    color: var(--text-tertiary);
    font-size: 11px;
}

/* Detail Panel */
.detail-panel {
    margin-top: 16px;
    background: var(--fill-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
}

.detail-panel[hidden] {
    display: none;
}

.detail-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.016em;
}

.detail-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.detail-close:hover {
    background: var(--fill-quaternary);
    color: var(--text-primary);
}

.detail-rows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2px 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    letter-spacing: -0.016em;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 500;
    text-align: right;
}

/* Loading */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px;
    gap: 16px;
}

.loading.active {
    display: flex;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
footer {
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 48px;
    letter-spacing: -0.016em;
}

/* Responsive */
@media (max-width: 768px) {
    .vendor-filter {
        width: 100%;
        justify-content: center;
    }

    .scatter-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .scatter-controls {
        width: 100%;
    }

    .scatter-controls .axis-select {
        flex: 1;
        min-width: 0;
    }

    .scatter-controls .axis-select select {
        width: 100%;
    }

    .header-shortcuts {
        display: none;
    }

    .scatter-section {
        padding: 16px;
    }

    .chart-container {
        height: 350px;
    }
}

@media (max-width: 480px) {
    .scatter-controls {
        flex-direction: column;
        gap: 8px;
    }

    .scatter-controls .axis-select {
        width: 100%;
    }

    .vendor-filter {
        gap: 6px;
    }

    .vendor-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .detail-rows {
        grid-template-columns: 1fr;
    }
}