---
---

/* CSS Variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --success-bg: #f0fdf4;
    --success-border: #4ade80;
    --success-text: #15803d;
    --danger-bg: #fef2f2;
    --danger-border: #f87171;
    --danger-text: #b91c1c;
}

/* Prevent horizontal overflow on all screen sizes */
html, body {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

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

/* Base modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.modal__dialog {
    position: relative;
    max-width: 420px;
    margin: 6rem auto;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 8px;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    background-color: transparent;
    border: none;
    font-size: 1.2em;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal__close:hover,
.modal__close:focus {
    background: none;
    background-color: transparent;
    color: var(--text-primary);
    outline: none;
}
.modal__form {
    display: flex;
    gap: 0.5rem;
}
.modal__form input[type="url"] {
    flex: 1;
    margin: 0;
}
.modal__form button {
    margin: 0;
}
.modal__dialog input[type="url"] {
    width: 100%;
    padding: 0.5rem;
    margin: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
}
.modal__dialog input::placeholder {
    color: var(--text-muted);
}
.modal__dialog input:disabled {
    background: var(--bg-secondary);
    opacity: 0.6;
    cursor: not-allowed;
}
.modal__dialog button {
    padding: 0.375rem 0.75rem;
    background: var(--accent);
    border: none;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}
.modal__dialog button:hover {
    background: var(--accent-hover);
}
.modal__dialog button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}
.modal__dialog button:disabled:hover {
    background: var(--text-muted);
}
.modal__feedback {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}
.modal__feedback.valid {
    color: #6FCF97;
}
.modal__feedback.invalid {
    color: #EB5757;
}

.modal__private {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

/* Utility to show modal */
.modal--open {
    display: block;
}

[data-theme="dark"] {
    --bg-primary: #1c2026;
    --bg-secondary: #1e293b;
    --bg-card: #292f38;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #475569;
    --accent: #6366f1;
    --accent-hover: #7c3aed;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --success-bg: rgba(74, 222, 128, 0.1);
    --success-border: #4ade80;
    --success-text: #4ade80;
    --danger-bg: rgba(248, 113, 113, 0.1);
    --danger-border: #f87171;
    --danger-text: #f87171;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 400;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
}

.container {
    max-width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
    width: 100%;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0.25rem 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    margin: 0 auto;
    grid-column: 2;
}

.logo-icon {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-light, .logo-dark {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    grid-column: 3;
    justify-self: end;
}

.menu-toggle svg {
    width: 20px;
    height: 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.cta-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    grid-column: 3;
    justify-self: end;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-link {
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.header-link.primary {
    background: var(--accent);
    color: white;
}

.header-link.primary:hover {
    background: var(--accent-hover);
}

.header-link.secondary {
    background: none;
    border: 1px solid transparent;
    color: var(--text-primary);
}

.header-link.secondary:hover {
    background: var(--bg-secondary);
}

.header-link.discovery {
    background: none;
    border: 1px solid transparent;
    color: var(--text-primary);
}

.header-link.discovery:hover {
    background: var(--bg-secondary);
}

.header-social {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.header-social a {
    color: var(--text-secondary);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.header-social a:hover {
    color: var(--text-primary);
}

.header-social svg {
    fill: currentColor;
}


.theme-switch-container {
    display: flex;
    margin-left: auto;
    justify-content: flex-end;

}

.footer-links .theme-switch-container {
    margin-left: auto;
}

.theme-switch {
    display: flex;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 6px;
    overflow: hidden;
}

.theme-option {
    background: transparent;
    border: none;
    padding: 0.5rem 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 100px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-option:hover {
    background: var(--border);
}

.theme-option.active {
    background: #DEE5EF;
    border: 1px solid transparent;
    color: var(--text-primary);
}

[data-theme="dark"] .theme-option.active {
    background: #DEE5EF;
    border-color: transparent;
    color: var(--text-primary);
}

.theme-icon {
    fill: currentColor;
}

[data-theme="dark"] .theme-option.dark {
    background: #DEE5EF;
    border: 1px solid transparent;
    color: #000000;
}

:root:not([data-theme="dark"]) .theme-option.light {
    background: #DEE5EF;
    border: 1px solid transparent;
    color: var(--text-primary);
}

.deploy-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.deploy-btn:hover {
    background: var(--accent-hover);
}

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 0;
    background: var(--bg-primary);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent), #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .hero h1 {
    background: none;
    color: white;
    -webkit-text-fill-color: white;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Leaderboard hero overrides */
.leaderboard-hero .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.leaderboard-hero .back-link {
    align-self: flex-start;
}

/* Filters */
.filters {
    background: var(--bg-primary);
    padding: 1rem 0;
    position: sticky;
    top: 73px;
    z-index: 90;
    backdrop-filter: blur(10px);
}

.filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    min-width: 120px;
}

.multi-select-container {
    position: relative;
    min-width: 200px;
}

.multi-select-trigger {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
}

.multi-select-trigger:hover {
    background: var(--border);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-search {
    background: var(--bg-secondary);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem;
    font-size: 0.875rem;
    width: 100%;
    outline: none;
}

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

.multi-select-option {
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.multi-select-option:hover {
    background: var(--bg-secondary);
}

.multi-select-option input[type="checkbox"] {
    margin: 0;
}

.multi-select-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-width: calc(100% - 20px);
}

.multi-select-tag {
    background: var(--accent);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.multi-select-tag .remove {
    cursor: pointer;
    font-weight: bold;
}

.multi-select-arrow {
    transition: transform 0.2s ease;
}

.multi-select-container.open .multi-select-arrow {
    transform: rotate(180deg);
}

.search-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    min-width: 200px;
    min-height: 36px;
    box-sizing: border-box;
}

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

.clear-filters {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.clear-filters:hover {
    background: var(--bg-secondary);
}

/* Main content and cards */
.main-content {
    padding: 1rem 0;
}

.reviewer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.extra-reviewer {
    display: none;
}

.load-more-wrapper {
    margin-top: 2rem;
    text-align: center;
}

#load-more {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
}

.reviewer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    padding-bottom: 3rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.reviewer-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}


.reviewer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.reviewer-header > div:first-child {
    flex: 1;
    min-width: 0;
}

.reviewer-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    padding-right: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reviewer-repo {
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.reviewer-repo:hover {
    color: var(--accent);
    text-decoration: underline;
}

.reviewer-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}


.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: -2px;
    min-width: 0;
}

.stat-item .stat-value {
    margin-bottom: 0;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reviewer-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.reviewer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

.reviewer-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    position: absolute;
    bottom: 1rem;
    left: 1rem;
}

.tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag.language {
    background: #DEE5EF;
    color: var(--text-primary);
}

[data-theme="dark"] .tag.language {
    color: #000000;
}

.share-button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.share-button:hover {
    background: var(--bg-secondary);
}


.reviewer-card .share-button {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
}

.reviewer-card .card-actions {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.reviewer-card .card-actions .share-button {
    position: static;
}

.fullpage-button {
    border: 1px solid var(--border);
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.fullpage-button:hover {
    background: var(--bg-secondary);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: left;
    color: var(--text-muted);
}

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

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease;
}

.footer a:hover {
    text-decoration: underline;
}

.footer a svg {
    fill: var(--text-primary);
}

[data-theme="dark"] .header,
[data-theme="dark"] .footer {
    background: var(--bg-primary);
}

/* Theme switch icons */
.theme-option .theme-icon {
    width: 16px;
    height: 16px;
}

/* Drawer styles */
.drawer {
    position: fixed;
    inset: 0;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease-out, visibility 0s linear 0.3s;
}

.drawer.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.3s ease-out, visibility 0s linear 0s;
}

.drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.drawer.open .drawer-overlay {
    opacity: 1;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 50%;
    min-width: 400px;
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
}

.drawer-panel #org-drawer-content {
    padding: 1rem;
}

.drawer-panel #org-drawer-content h2 {
    margin-top: 0;
}

.drawer-section {
    margin-top: 1rem;
}

.drawer-section h3 {
    margin: 0 0 0.5rem;
}

.drawer-section table {
    margin-top: 0.5rem;
}
.drawer.open .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.drawer-close:hover {
    background: var(--bg-secondary);
}

.drawer-deploy-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.drawer-deploy-btn:hover {
    background: var(--accent-hover);
}

/* Reviewer detail styles */
.reviewer-detail {
    margin: 0;
    padding: 0 200px;
    min-height: 100vh;
}

.reviewer-detail-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--accent-hover);
}

.reviewer-detail-title {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.reviewer-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reviewer-detail-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.reviewer-detail-tags {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.detail-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: default;
}

.detail-tag.language {
    background: #DEE5EF;
    color: var(--text-primary);
    border-color: transparent;
}

[data-theme="dark"] .detail-tag.language {
    color: #000000;
}

.reviewer-content {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 2rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.content-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.button-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.copy-button, .deploy-button {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
}

.copy-button {
    background: var(--accent);
    color: white;
}

.copy-button:hover {
    background: var(--accent-hover);
}

.deploy-button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.deploy-button:hover {
    background: var(--border);
}

.reviewer-prompt {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
    color: var(--text-primary);
    overflow-x: auto;
    position: relative;
}

/* Markdown content styling within the prompt box */
.reviewer-prompt h1,
.reviewer-prompt h2,
.reviewer-prompt h3,
.reviewer-prompt h4,
.reviewer-prompt h5,
.reviewer-prompt h6 {
    margin: 1.25rem 0 0.75rem 0;
    font-weight: 600;
    color: var(--text-primary);
}

.reviewer-prompt h1:first-child,
.reviewer-prompt h2:first-child,
.reviewer-prompt h3:first-child {
    margin-top: 0;
}

.reviewer-prompt p {
    margin: 0 0 1rem 0;
}

.reviewer-prompt ul,
.reviewer-prompt ol {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.reviewer-prompt li {
    margin: 0.25rem 0;
}

.reviewer-prompt code {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.125rem 0.25rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.reviewer-prompt pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.reviewer-prompt pre code {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: inherit;
}

.reviewer-prompt blockquote {
    border-left: 4px solid var(--accent);
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border-radius: 0 4px 4px 0;
}

.reviewer-prompt strong {
    font-weight: 600;
}

.reviewer-prompt em {
    font-style: italic;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-primary);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.reviewer-card .stat-value {
    font-size: 0.75rem;
}

h2 .stat-value {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    margin-bottom: 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        grid-template-columns: auto 1fr auto;
        gap: 0.5rem;
    }

    .menu-toggle {
        display: block;
    }

    .cta-group {
        display: none;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
    }

    .header.open .cta-group {
        display: flex;
    }

    .header-links {
        gap: 0.5rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .header-link {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .header-social {
        justify-content: center;
        margin-left: 0;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .reviewer-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }

    .reviewer-card {
        padding: 1rem;
        padding-bottom: 2.5rem;
    }

    .main-content {
        padding: 0.5rem 0;
    }

    .container {
        padding: 0 1rem;
    }

    /* Mobile card layout fixes */
    .reviewer-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .reviewer-header > div:first-child {
        max-width: 100%;
        width: 100%;
    }

    .reviewer-stats {
        align-self: flex-start;
        width: auto;
    }

    .reviewer-title {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .reviewer-detail {
        padding: 0 5px;
    }

    .reviewer-detail-header {
        padding: 1.5rem;
    }

    .reviewer-detail-title {
        font-size: 1.5rem;
    }

    .reviewer-detail-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .content-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .button-group {
        flex-direction: column;
    }

    .reviewer-content {
        padding: 1.5rem;
    }

    .stats-grid {
        padding: 1.5rem;
    }

    .drawer-panel {
        width: 100%;
        min-width: unset;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .reviewer-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-top: 0.75rem;
    }

    .reviewer-card {
        padding: 0.75rem;
        padding-bottom: 2rem;
        margin: 0;
        min-width: 0; /* Allow cards to shrink below content width */
    }

    .container {
        padding: 0 0.5rem;
        max-width: 100%;
    }

    .main-content {
        padding: 0.25rem 0;
    }

    .hero {
        padding: 1rem 0;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .filter-controls {
        gap: 0.5rem;
    }

    .filter-group {
        min-width: unset;
    }

    .header-content {
        padding: 0.5rem 0;
        grid-template-columns: auto 1fr auto;
    }

    .menu-toggle {
        display: block;
    }

    .cta-group {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
    }

    .header.open .cta-group {
        display: flex;
    }

    .header-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .header-link {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
        white-space: nowrap;
    }

    .theme-switch {
        transform: scale(0.9);
    }

    /* Fix card content overflow */
    .reviewer-title {
        font-size: 1rem;
        line-height: 1.3;
        word-break: break-word;
        white-space: normal;
    }

    .reviewer-description {
        font-size: 0.85rem;
        line-height: 1.4;
        word-break: break-word;
    }

    .reviewer-repo {
        font-size: 0.8rem;
        word-break: break-all;
    }

    .reviewer-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .reviewer-header > div:first-child {
        max-width: 100%;
        width: 100%;
    }

    .reviewer-stats {
        align-self: flex-start;
        width: auto;
        gap: 0.75rem;
    }
}

/* Ultra small screens - aggressive mobile fixes */
@media (max-width: 360px) {
    .container {
        padding: 0 0.25rem;
        margin: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .reviewer-card {
        padding: 0.5rem;
        padding-bottom: 1.5rem;
        margin: 0;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .reviewer-grid {
        gap: 0.5rem;
        margin: 0;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .main-content {
        padding: 0;
        margin: 0;
        width: 100%;
        overflow-x: hidden;
    }

    .reviewer-title {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
        white-space: normal;
        line-height: 1.2;
    }

    .reviewer-description {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .reviewer-repo {
        font-size: 0.75rem;
    }

    .reviewer-header {
        margin-bottom: 0.5rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .reviewer-header > div:first-child {
        max-width: 100%;
        width: 100%;
    }

    .reviewer-stats {
        align-self: flex-start;
        width: auto;
        gap: 0.5rem;
    }

    .reviewer-meta {
        margin-top: 0.5rem;
    }

    .menu-toggle {
        display: block;
    }

    .cta-group {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
    }

    .header.open .cta-group {
        display: flex;
    }

    .tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

.library-header .container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.add-repo-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.add-repo-btn:hover {
    background: var(--accent-hover);
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Avatar displayed in the leaderboard table */
.lb-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 0.25rem;
    vertical-align: middle;
}

/* Ensure leaderboard name cells stay on one line */
.leaderboard-table .lb-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: flex;
    align-items: center;
}

.leaderboard-table .lb-name a {
    display: inline-block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Leaderboard table styles */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.leaderboard-table th,
.leaderboard-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.leaderboard-table th {
    cursor: pointer;
}
.leaderboard-table tr:nth-child(even) {
    background: var(--bg-secondary);
}
.leaderboard-table tr[data-contributor] {
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.leaderboard-table tr[data-contributor]:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.1));
}

.leaderboard-table tr[data-org] {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.leaderboard-table tr[data-org]:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.1));
}

.leaderboard-table .loc-cell,
.leaderboard-table .company-cell,
.leaderboard-table .links-cell {
    white-space: nowrap;
}

.meta-icon {
    width: 12px;
    height: 12px;
    vertical-align: text-bottom;
    margin-right: 0.25rem;
}

.leaderboard-table .links-cell a {
    margin-right: 0.25rem;
    color: var(--text-secondary);
}

.leaderboard-table .links-cell a:hover {
    color: var(--text-primary);
}

.leaderboard-table a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.leaderboard-table a:hover {
    text-decoration: underline;
}

/* Discussion styles */
.discussions-section {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.discussion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.discussion-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.discuss-code,
.diff-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: auto;
    margin-bottom: 1rem;
    font-family: monospace;
    font-size: 0.875rem;
}

.diff-header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.diff-line {
    display: flex;
    padding: 0.25rem 0.5rem;
    border-left: 4px solid transparent;
}

.diff-line .diff-symbol {
    width: 1em;
    margin-right: 0.5em;
    text-align: center;
    user-select: none;
}

.diff-line.added {
    background: var(--success-bg);
    border-left-color: var(--success-border);
    color: var(--success-text);
}

.diff-line.removed {
    background: var(--danger-bg);
    border-left-color: var(--danger-border);
    color: var(--danger-text);
}

.diff-line.context:hover {
    background: var(--bg-secondary);
}

.discussion {
    background: var(--bg-card);
    border-left: 4px solid rgba(99, 102, 241, 0.2);
    padding: 1rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.discussion-footer {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Contributor drawer */
.contrib-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.contrib-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.contrib-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contrib-username {
    color: var(--accent);
    font-size: 0.875rem;
}

.contrib-stats {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.contrib-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex: 1;
}

.contrib-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
}

.contrib-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 1rem;
    overflow: hidden;
}

.contrib-section summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contrib-section ul {
    list-style: none;
    padding: 0.5rem 1rem 1rem;
    margin: 0;
}

.contrib-section li + li {
    margin-top: 0.5rem;
}

.contrib-section a {
    color: var(--accent);
    text-decoration: none;
}

.contrib-section a:hover {
    text-decoration: underline;
}

.contrib-section .chat-thread {
    padding: 0.5rem 1rem 1rem;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.chat-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    max-width: 100%;
}

.chat-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.chat-body {
    white-space: pre-wrap;
    font-size: 0.875rem;
}

/* Contributor profile meta */
.profile-meta {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.profile-meta li + li {
    margin-top: 0.25rem;
}
.verified-badge {
    color: var(--accent);
    margin-left: 0.25rem;
}

/* Trending section */
.trending {
    padding: 2rem 0;
}

.trending-title {
    text-align: center;
    font-size: 1.5rem;
    margin: 0 0 0.25rem;
}

.trending-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.trending-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.trending-column {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.trending-column h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.trending-category-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0 0 0.75rem;
}

.trending-column ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    flex: 1 1 auto;
}

.trending-column li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.trend-name {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-stats {
    display: flex;
    gap: 0.5rem;
}

.trend-stat {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.trend-stat .stat-label {
    color: var(--text-secondary);
    margin-right: 0.25rem;
    font-size: inherit;
}

.browse-link {
    margin-top: auto;
    font-size: 0.875rem;
    color: var(--accent);
    text-decoration: none;
}

.browse-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}
