* {
    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;
    }
    .chip-card { animation: none !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),
input: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;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--fill-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
    background: var(--fill-quaternary);
}

body:not(.light) .icon-sun { display: inline; }
body:not(.light) .icon-moon { display: none; }
body.light .icon-sun { display: none; }
body.light .icon-moon { display: inline; }

.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;
}

/* Filters */
.filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.011em;
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--fill-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    min-width: 120px;
    transition: border-color 0.15s ease;
    letter-spacing: -0.016em;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--blue);
}

.filter-group.search {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.filter-group.search input {
    width: 100%;
}

.search-clear {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: var(--fill-quaternary);
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    transition: background 0.15s ease;
}

.search-clear:hover {
    background: var(--border);
}

.search-clear.visible {
    display: flex;
}

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

.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: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--fill-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.15s ease;
}

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

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Vendor Filter Buttons */
.vendor-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.vendor-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--fill-secondary);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

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

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

.vendor-btn.active {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(41, 151, 255, 0.08);
}

body.light .vendor-btn.active {
    background: rgba(0, 113, 227, 0.08);
    color: var(--blue-fill);
}

/* 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;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 980px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    background: var(--fill-quaternary);
    color: var(--text-primary);
    transition: background 0.15s ease, transform 0.1s ease;
    font-weight: 500;
    letter-spacing: -0.016em;
}

.btn:hover {
    background: var(--fill-secondary);
}

.btn:active {
    transform: scale(0.97);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 8px;
    min-width: 44px;
    min-height: 32px;
}

/* Compare Section */
.compare-section {
    background: var(--fill-tertiary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 48px;
}

.compare-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: -0.016em;
}

.compare-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.compare-card {
    background: var(--fill-secondary);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    position: relative;
}

.compare-card h3 {
    font-size: 16px;
    margin-bottom: 14px;
    color: var(--blue);
    font-weight: 600;
    letter-spacing: -0.016em;
}

.compare-card .specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 13px;
    letter-spacing: -0.016em;
}

.compare-card .spec {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}

.compare-card .spec:last-child,
.compare-card .spec:nth-last-child(2):nth-child(odd) {
    border-bottom: none;
}

.compare-card .spec-label {
    color: var(--text-secondary);
}

.compare-card .spec-value {
    font-weight: 500;
}

/* Chips Grid */
.chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.chip-card {
    background: var(--fill-tertiary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    position: relative;
}

.chip-card:hover {
    background: var(--fill-secondary);
}

.chip-card.selected {
    border-color: var(--blue);
    background: rgba(0, 113, 227, 0.04);
}

body.light .chip-card.selected {
    background: rgba(0, 113, 227, 0.03);
}

.chip-card .vendor-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.vendor-badge.apple {
    background: rgba(41, 151, 255, 0.12);
    color: var(--blue);
}

body.light .vendor-badge.apple {
    background: rgba(0, 113, 227, 0.1);
    color: #0066cc;
}

.vendor-badge.nvidia {
    background: rgba(3, 161, 14, 0.12);
    color: var(--green);
}

body.light .vendor-badge.nvidia {
    background: rgba(3, 130, 10, 0.1);
    color: #0a7a12;
}

.vendor-badge.amd {
    background: rgba(255, 48, 55, 0.12);
    color: var(--red);
}

body.light .vendor-badge.amd {
    background: rgba(200, 30, 30, 0.1);
    color: #c81e1e;
}

.chip-card h3 {
    font-size: 16px;
    margin-bottom: 14px;
    padding-right: 60px;
    font-weight: 600;
    letter-spacing: -0.016em;
    line-height: 1.3;
}

.chip-card .specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.chip-card .spec {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chip-card .spec-label {
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.chip-card .spec-value {
    font-weight: 500;
    font-size: 13px;
    letter-spacing: -0.016em;
}

.chip-card .spec-value.best-in-class {
    color: var(--badge-text);
    font-weight: 600;
}

.best-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--badge-bg);
    color: var(--badge-text);
    vertical-align: middle;
}

.chip-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.chip-card .tag {
    padding: 3px 8px;
    background: var(--fill-quaternary);
    border-radius: 5px;
    font-size: 11px;
    color: var(--text-secondary);
}

.chip-card .select-checkbox {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.chip-card .select-checkbox:hover {
    border-color: var(--blue);
}

.chip-card.selected .select-checkbox {
    background: var(--blue);
    border-color: var(--blue);
}

.chip-card.selected .select-checkbox::after {
    content: '\2713';
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.chip-card .radar-btn {
    position: absolute;
    bottom: 16px;
    left: 16px;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--fill-quaternary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
    opacity: 0;
}

.chip-card:hover .radar-btn {
    opacity: 1;
}

.chip-card .radar-btn:hover {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.chip-card .radar-btn:active {
    transform: scale(0.9);
}

/* Radar Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content {
    background: var(--fill-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    max-width: 420px;
    width: 90%;
    position: relative;
    animation: scaleIn 0.2s ease;
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 17px;
    font-weight: 600;
}

.modal-content .btn {
    margin-top: 20px;
    width: 100%;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.shortcut kbd {
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
}

/* 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); }
}

@keyframes dotEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 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;
}

/* No Results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px;
    color: var(--text-secondary);
}

.no-results h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.no-results p {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
    }

    .filter-group select,
    .filter-group input {
        min-width: 100%;
    }

    .chips-grid {
        grid-template-columns: 1fr;
    }

    .compare-container {
        grid-template-columns: 1fr;
    }

    .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: 300px;
    }
}

@media (max-width: 480px) {
    .chip-card .specs {
        grid-template-columns: 1fr;
    }

    .compare-card .specs {
        grid-template-columns: 1fr;
    }

    .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;
    }
}
