/* ─── Reset & Base ─── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1d1d1f;
    background: #fff;
}

/* ─── Layout ─── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

.container.narrow {
    max-width: 780px;
}

.container.wide {
    max-width: 1400px;
}

/* ─── TOC Navigation ─── */
.toc-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    pointer-events: none;
}

.toc-nav.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.toc-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 20px;
    flex-wrap: wrap;
}

.toc-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: #6e6e73;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 980px;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.toc-link:hover {
    color: #1d1d1f;
    background: #f0f0f5;
}

.toc-link.active {
    color: #fff;
    background: #1d1d1f;
    font-weight: 600;
}

/* ─── Hero ─── */
.hero {
    text-align: center;
    padding: 100px 40px 80px;
    background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
}

.hero-logo {
    width: 220px;
    margin-bottom: 24px;
    animation: fadeUp 0.5s ease both;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #1d1d1f;
    margin-bottom: 16px;
    animation: fadeUp 0.6s ease 0.05s both;
}

.hero h1 .accent {
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1.5;
    color: #6e6e73;
    margin-bottom: 36px;
    animation: fadeUp 0.6s ease 0.1s both;
}

.hero-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
    animation: fadeUp 0.6s ease 0.15s both;
}

.pill {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 10px 28px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: #fff !important;
    background-color: #1d1d1f !important;
    text-decoration: none !important;
    border: 1px solid #1d1d1f !important;
    border-radius: 980px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.pill:hover {
    background-color: #000 !important;
    border-color: #000 !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
}

.pill.pill-outline {
    background-color: transparent !important;
    color: #1d1d1f !important;
    border-color: #d2d2d7 !important;
}

.pill.pill-outline:hover {
    background-color: #f5f5f7 !important;
    border-color: #1d1d1f !important;
}

.hero-authors {
    font-size: 0.9rem;
    font-weight: 400;
    color: #6e6e73;
    margin-bottom: 4px;
    animation: fadeUp 0.6s ease 0.2s both;
}

.hero-affiliation {
    font-size: 0.8rem;
    font-weight: 400;
    color: #86868b;
    animation: fadeUp 0.6s ease 0.22s both;
}

.author-link {
    color: #6e6e73 !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.author-link:hover {
    color: #1d1d1f !important;
}

/* ─── Sections ─── */
.section-dark {
    background: #f5f5f7;
    padding: 96px 40px;
}

.section-light {
    background: #fff;
    padding: 96px 40px;
}

.section-accent {
    background: linear-gradient(135deg, #faf5ff 0%, #f0f4ff 100%);
    padding: 96px 40px;
}

.section-header {
    text-align: center;
    margin-bottom: 56px;
}

h2 {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #1d1d1f;
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 1.05rem;
    font-weight: 400;
    color: #6e6e73;
    line-height: 1.55;
    max-width: 680px;
    margin: 0 auto;
}

.body-large {
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1.7;
    color: #424245;
    margin-bottom: 20px;
}

.body-large strong {
    font-weight: 600;
    color: #1d1d1f;
}

.container.narrow h2 {
    text-align: center;
    margin-bottom: 24px;
}

.container.narrow .body-large {
    text-align: center;
}

/* ─── Dimension Cards ─── */
.dim-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.dim-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.04);
}

.dim-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}

.dim-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
}

.dim-icon.if-icon { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.dim-icon.rq-icon { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.dim-icon.ee-icon { background: linear-gradient(135deg, #fef3c7, #fde68a); }

.dim-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.dim-card .dim-abbr {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.dim-abbr.if-abbr { background: #dbeafe; color: #1d4ed8; }
.dim-abbr.rq-abbr { background: #dcfce7; color: #15803d; }
.dim-abbr.ee-abbr { background: #fef3c7; color: #a16207; }

.dim-card p {
    font-size: 0.88rem;
    font-weight: 400;
    color: #6e6e73;
    line-height: 1.55;
}

/* ─── Showcase ─── */
.showcase-row {
    margin-bottom: 64px;
    animation: fadeUp 0.7s ease both;
}

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

.showcase-prompt {
    font-size: 1rem;
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 20px;
    padding: 14px 20px;
    background: #f5f5f7;
    border-radius: 12px;
    border-left: 4px solid #6366f1;
    line-height: 1.5;
}

.showcase-prompt .prompt-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6366f1;
    display: block;
    margin-bottom: 4px;
}

.showcase-prompt .edit-type {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: #6366f1;
    color: #fff;
    margin-right: 8px;
    vertical-align: middle;
}

.showcase-videos {
    display: grid;
    gap: 16px;
}

.showcase-videos.cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.showcase-videos.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.video-cell {
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f7;
    transition: transform 0.3s ease;
}

.video-cell:hover {
    transform: translateY(-2px);
}

.video-cell video {
    width: 100%;
    display: block;
    aspect-ratio: auto;
}

.video-cell.portrait video {
    max-height: 360px;
    object-fit: contain;
    background: #000;
}

.video-cell-info {
    padding: 10px 12px 12px;
}

.video-cell-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-cell-label .original-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 4px;
    background: #e0e7ff;
    color: #4338ca;
}

.scores {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.score-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.score-4 { background: #dcfce7; color: #15803d; }
.score-3 { background: #dbeafe; color: #1d4ed8; }
.score-2 { background: #fef3c7; color: #92400e; }
.score-1 { background: #fee2e2; color: #991b1b; }

/* ─── Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.stat-card {
    text-align: center;
    padding: 32px 16px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.04);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6e6e73;
}

/* ─── Leaderboard Table ─── */
.leaderboard-date {
    font-size: 0.82rem;
    font-weight: 500;
    color: #86868b;
    margin-top: 8px;
}

.leaderboard-live-banner {
    max-width: 900px;
    margin: 0 auto 20px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #4338ca;
    flex-wrap: wrap;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.live-link {
    font-weight: 700;
    color: #4338ca;
    text-decoration: none;
    margin-left: auto;
    padding: 6px 16px;
    background: #4338ca;
    color: #fff;
    border-radius: 980px;
    font-size: 0.82rem;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.live-link:hover {
    background: #3730a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.3);
}

.leaderboard-wrapper {
    max-width: 900px;
    margin: 0 auto;
    overflow-x: auto;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.leaderboard-table thead {
    background: #f8f9fa;
}

.leaderboard-table th {
    padding: 14px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #6e6e73;
    border-bottom: 2px solid #e8e8ed;
}

.leaderboard-table th:first-child {
    text-align: left;
    padding-left: 24px;
}

.leaderboard-table td {
    padding: 14px 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid #f0f0f5;
}

.leaderboard-table td:first-child {
    text-align: left;
    font-weight: 600;
    padding-left: 24px;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.leaderboard-table tr:hover {
    background: #fafaff;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 8px;
}

.rank-1 { background: #fef3c7; color: #92400e; }
.rank-2 { background: #e0e7ff; color: #4338ca; }
.rank-3 { background: #fce7f3; color: #9d174d; }
.rank-other { background: #f3f4f6; color: #6b7280; }

.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.type-commercial { background: #ede9fe; color: #6d28d9; }
.type-opensource { background: #d1fae5; color: #065f46; }

.best-score {
    font-weight: 700;
    color: #15803d;
}

.second-best-score {
    font-weight: 600;
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.worst-score {
    color: #991b1b;
}

/* ─── Citation ─── */
pre {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 24px 28px;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.7;
    color: #424245;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #fff;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    cursor: pointer;
    color: #6e6e73;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #e8e8ed;
    color: #1d1d1f;
}

/* ─── Footer ─── */
footer {
    text-align: center;
    padding: 40px 40px 28px;
    border-top: 1px solid #e8e8ed;
}

footer p {
    font-size: 0.8rem;
    color: #86868b;
}

/* ─── Animations ─── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hero h1,
.hero-tagline,
.hero-links,
.section-header,
.dim-card,
.stat-card {
    animation: fadeUp 0.7s ease both;
}

/* Stagger dimension cards */
.dim-card:nth-child(1) { animation-delay: 0.1s; }
.dim-card:nth-child(2) { animation-delay: 0.2s; }
.dim-card:nth-child(3) { animation-delay: 0.3s; }

/* Stagger stat cards */
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

/* ─── Scroll-triggered animations ─── */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .showcase-videos.cols-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    .showcase-videos.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 860px) {
    .hero h1 { font-size: 2.4rem; }
    .hero-tagline { font-size: 1.1rem; }
    h2 { font-size: 1.9rem; }
    .dim-grid { grid-template-columns: 1fr; gap: 16px; max-width: 400px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .showcase-videos.cols-5,
    .showcase-videos.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero { padding: 72px 24px 56px; }
    .section-dark, .section-light, .section-accent { padding: 64px 24px; }
    .container { padding: 0 24px; }
    .leaderboard-table { font-size: 0.82rem; }
    .leaderboard-table th, .leaderboard-table td { padding: 10px 12px; }
    .toc-inner { gap: 2px; padding: 8px 12px; }
    .toc-link { font-size: 0.72rem; padding: 5px 10px; }
    .leaderboard-live-banner { font-size: 0.82rem; padding: 12px 16px; flex-direction: column; align-items: flex-start; }
    .live-link { margin-left: 0; }
}

@media (max-width: 560px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-tagline { font-size: 1rem; }
    h2 { font-size: 1.5rem; }
    .pill { padding: 8px 20px !important; font-size: 0.82rem !important; }
    .showcase-videos.cols-5,
    .showcase-videos.cols-4 {
        grid-template-columns: 1fr;
    }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-number { font-size: 2.2rem; }
}
