@font-face {
    font-family: 'Space Grotesk';
    src: url('assets/fonts/space-grotesk.ttf') format('truetype');
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
}

@font-face {
    font-family: 'Source Sans 3';
    src: url('assets/fonts/source-sans-3.ttf') format('truetype');
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
}

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

body {
    font-family: 'Source Sans 3', 'Microsoft YaHei', sans-serif;
    font-size: 18px;
    font-weight: 400;
    background: linear-gradient(135deg, #FFFFFF 0%, #E3F2FD 35%, #BBDEFB 65%, #E1BEE7 100%);
    background-attachment: fixed;
    color: #1A1A1A;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
h1, h2, h3, .nav-logo, .task-name, .hero-stats {
    font-family: 'Space Grotesk', 'Microsoft YaHei', sans-serif;
    font-weight: 600;
    letter-spacing: 0;
}

/* Shine Overlay */
.shine-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 45%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0.3) 55%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shine 10s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes shine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 59, 122, 0.1);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 24px;
    font-weight: 600;
}

.logo-vibe {
    color: #003B7A;
}

.logo-gaming {
    color: #0288D1;
    margin-left: 4px;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: #003B7A;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #0288D1;
}

/* Hero */
.hero {
    min-height: 640px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    position: relative;
}

.hero-container {
    max-width: 1400px;
    width: 100%;
    position: relative;
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) 160px;
    gap: 28px;
    align-items: center;
}

/* Corner Placeholders */
.corner-placeholder {
    position: relative;
    width: 100%;
    height: 150px;
    border: 1px solid rgba(0, 59, 122, 0.15);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
}

.corner-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.top-left {
    grid-area: 1 / 1;
    top: 0;
    left: 0;
    animation: float 3s ease-in-out infinite;
}

.top-right {
    grid-area: 1 / 3;
    top: 0;
    right: 0;
    animation: float 3s ease-in-out 0.5s infinite;
}

.bottom-left {
    grid-area: 2 / 1;
    bottom: 0;
    left: 0;
    animation: float 3s ease-in-out 1s infinite;
}

.bottom-right {
    grid-area: 2 / 3;
    bottom: 0;
    right: 0;
    animation: float 3s ease-in-out 1.5s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* Hero Content */
.hero-content {
    text-align: center;
    padding: 0;
    grid-area: 1 / 2 / 3 / 3;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 64px;
    font-weight: 600;
    line-height: 1.1;
    color: #003B7A;
    margin-bottom: 16px;
    letter-spacing: 0;
}

.hero-subtitle {
    font-size: 24px;
    color: #003B7A;
    margin-bottom: 8px;
    font-weight: 500;
}

.hero-brand { line-height: 0; }
.hero-logo {
    display: block;
    width: min(100%, 420px);
    height: auto;
    max-height: 180px;
    object-fit: contain;
    margin: 0 auto;
}
@media (max-width: 768px) {
    .hero-logo { width: min(100%, 260px); max-height: 110px; }
}

.hero-subtitle-small {
    font-size: 20px;
    color: #0288D1;
    margin-bottom: 32px;
}

/* Buttons */
.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 48px;
}

.btn {
    padding: 12px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.btn-primary {
    background: #003B7A;
    color: #FFFFFF;
    border-color: #003B7A;
}

.btn-primary:hover {
    background: #002855;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 59, 122, 0.3);
}

.btn-secondary {
    background: transparent;
    color: #003B7A;
    border-color: #003B7A;
}

.btn-secondary:hover {
    background: rgba(0, 59, 122, 0.05);
}

/* Demo Flow */
.demo-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 48px;
}

.flow-section {
    flex: 1;
    min-width: 0;
}

.flow-section h3 {
    font-size: 18px;
    color: #0288D1;
    margin-bottom: 16px;
}

.flow-frames {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.frame-box {
    width: 100px;
    min-width: 0;
    aspect-ratio: 1;
    border: 1px solid rgba(0, 59, 122, 0.15);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.8);
}

.frame-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.arrow {
    font-size: 24px;
    color: #003B7A;
}

.flow-arrow-main {
    font-size: 48px;
    color: #0288D1;
    font-weight: bold;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Hero Stats */
.hero-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    flex-wrap: wrap;
    color: #0288D1;
    font-weight: 600;
}

.stat-divider {
    color: rgba(0, 59, 122, 0.3);
}

/* Section */
.section {
    padding: 80px 40px;
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section h2 {
    font-size: 40px;
    line-height: 1.2;
    text-align: center;
    color: #003B7A;
    margin-bottom: 48px;
}

.section-intro {
    text-align: center;
    font-size: 18px;
    color: #555;
    max-width: 700px;
    margin: 0 auto 48px;
}

/* Benchmark Overview */
.overview-image {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 16px rgba(0, 59, 122, 0.1);
}

.overview-image img {
    max-width: 100%;
    height: auto;
}

/* Task Grid */
.task-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.case-guide {
    --case-columns: 4;
    --case-gap: 20px;
    height: 92px;
    margin: 4px 0 8px;
}

.case-guide[hidden] {
    display: none;
}

.case-guide-target {
    position: relative;
    width: calc((100% - (var(--case-columns) - 1) * var(--case-gap)) / var(--case-columns));
    height: 100%;
    color: #0b4f86;
    font-family: "Comic Sans MS", "Comic Sans", cursive;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.case-guide-target span {
    display: inline-block;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.case-guide-arrow {
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 140px;
    height: 64px;
    overflow: visible;
    transform: translateX(-50%);
    filter: drop-shadow(0 3px 3px rgba(0, 59, 122, 0.14));
}

.case-guide-arrow-rail,
.case-guide-arrow-flow,
.case-guide-arrow-head-rail,
.case-guide-arrow-head {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.case-guide-arrow-rail {
    stroke: rgba(11, 79, 134, 0.2);
    stroke-width: 5;
}

.case-guide-arrow-flow {
    stroke: #ef5b45;
    stroke-width: 3.5;
    stroke-dasharray: 92;
    stroke-dashoffset: 92;
    animation: guide-draw 2.8s cubic-bezier(0.55, 0.08, 0.25, 1) infinite;
}

.case-guide-arrow-head-rail {
    stroke: rgba(11, 79, 134, 0.2);
    stroke-width: 5;
    transform: rotate(-30deg);
    transform-origin: 70px 53px;
}

.case-guide-arrow-head {
    stroke: #ef5b45;
    stroke-width: 4;
    opacity: 0;
    transform-origin: 70px 53px;
    animation: guide-head-light 2.8s ease-in-out infinite;
}

@keyframes guide-draw {
    0%, 8% { stroke-dashoffset: 92; }
    46%, 58% { stroke-dashoffset: 0; }
    88%, 100% { stroke-dashoffset: -92; }
}

@keyframes guide-head-light {
    0%, 50% {
        opacity: 0;
        transform: rotate(-30deg) scale(0.9);
        filter: drop-shadow(0 0 0 rgba(239, 91, 69, 0));
    }
    56%, 64% {
        opacity: 1;
        transform: rotate(-30deg) scale(1.06);
        filter: drop-shadow(0 0 4px rgba(239, 91, 69, 0.8));
    }
    64%, 88% {
        opacity: 1;
        transform: rotate(-30deg) scale(1.06);
        filter: drop-shadow(0 0 4px rgba(239, 91, 69, 0.8));
    }
    94%, 100% {
        opacity: 0;
        transform: rotate(-30deg) scale(0.9);
        filter: drop-shadow(0 0 0 rgba(239, 91, 69, 0));
    }
}

.task-card {
    display: block;
    width: 100%;
    min-width: 0;
    text-align: left;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 59, 122, 0.05);
}

.task-card:hover {
    border-color: #0288D1;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(2, 136, 209, 0.2);
}

.task-card.active {
    border-color: #003B7A;
    box-shadow: 0 0 24px rgba(0, 59, 122, 0.3);
}

.task-card img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: #f4f7f8;
}

.task-info {
    display: block;
    padding: 16px;
}

.task-name {
    display: block;
    font-size: 20px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    color: #003B7A;
    margin-bottom: 4px;
}

.task-detail {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    color: #777;
}

/* Compact Player Container */
.player-container-compact {
    grid-column: 1 / -1;
    scroll-margin-top: 90px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #0288D1;
    border-radius: 12px;
    padding: 24px;
    margin-top: 32px;
    position: relative;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.5s ease, padding 0.5s ease;
    box-shadow: 0 8px 32px rgba(2, 136, 209, 0.2);
}

.player-container-compact.active {
    max-height: none;
    opacity: 1;
    padding: 24px;
}

.player-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 59, 122, 0.1);
    border: none;
    color: #003B7A;
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
}

.player-close:hover {
    background: rgba(0, 59, 122, 0.2);
    transform: rotate(90deg);
}

/* Compact Layout */
.player-layout-compact {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: 24px;
    align-items: start;
}

.player-input-compact h3,
.player-output-compact h3 {
    font-size: 20px;
    color: #003B7A;
    margin-bottom: 16px;
}

/* Compact Sections */
.compact-section {
    margin-bottom: 16px;
}

.compact-section h4 {
    font-size: 15px;
    text-transform: none;
    letter-spacing: 0.5px;
    color: #777;
    margin-bottom: 8px;
}

.model-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #FFFFFF;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.demo-video-small {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.demo-video-small video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rules-text-small {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    background: rgba(0, 59, 122, 0.05);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #0288D1;
    white-space: pre-line;
}

/* Player Screen Compact */
.player-screen-compact {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.player-screen-compact img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.player-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #003B7A;
    background: #F4F8FB;
}

.player-loading-overlay[hidden] {
    display: none;
}

.player-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(2, 136, 209, 0.2);
    border-top-color: #EF5B45;
    border-radius: 50%;
    animation: player-loading-spin 0.8s linear infinite;
}

.player-loading-overlay strong {
    font-family: "Source Sans 3", "Microsoft YaHei", sans-serif;
    font-size: 16px;
}

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

.player-result-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #fff;
    background: rgba(0, 35, 66, 0.76);
    backdrop-filter: blur(3px);
    pointer-events: none;
    animation: result-reveal 0.32s ease-out;
}

.player-result-overlay[hidden] {
    display: none;
}

.result-complete {
    font-family: "Space Grotesk", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    font-weight: 600;
}

.result-metrics {
    display: flex;
    align-items: center;
    gap: 32px;
}

.result-metrics > span {
    display: grid;
    gap: 2px;
    min-width: 72px;
    text-align: center;
}

.result-metrics > span + span {
    padding-left: 32px;
    border-left: 1px solid rgba(255, 255, 255, 0.34);
}

.result-metrics small {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.76);
}

.result-metrics strong {
    font-family: "Space Grotesk", "Microsoft YaHei", sans-serif;
    font-size: 30px;
    line-height: 1.1;
    color: #fff;
}

.player-result-overlay.is-pass #resultPass {
    color: #7ce7a7;
}

.player-result-overlay:not(.is-pass) #resultPass {
    color: #ff8a78;
}

@keyframes result-reveal {
    from { opacity: 0; transform: scale(0.985); }
    to { opacity: 1; transform: scale(1); }
}

.player-controls-compact {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.player-controls-compact button,
.player-controls-compact select {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #0288D1;
    background: #FFFFFF;
    color: #003B7A;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.player-controls-compact button:hover {
    background: #0288D1;
    color: #FFFFFF;
}

.player-controls-compact button:disabled,
.player-controls-compact select:disabled,
#frameSeek:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.player-controls-compact button:disabled:hover {
    background: #FFFFFF;
    color: #003B7A;
}

#playBtn.playing {
    background: #0288D1;
    color: #FFFFFF;
}

.player-info-compact {
    display: flex;
    justify-content: space-around;
    font-size: 14px;
    color: #555;
    background: rgba(0, 59, 122, 0.05);
    padding: 12px;
    border-radius: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.player-info-compact strong {
    color: #003B7A;
    margin-left: 8px;
}

/* Results Table */
.results-table-wrapper {
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 59, 122, 0.1);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table thead {
    background: rgba(2, 136, 209, 0.1);
}

.results-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #003B7A;
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0.5px;
}

.results-table td {
    padding: 16px;
    border-top: 1px solid rgba(0, 59, 122, 0.1);
    font-size: 15px;
}

.results-table .highlight-row {
    background: rgba(2, 136, 209, 0.1);
}

.results-table .highlight-row td {
    color: #003B7A;
    font-weight: 600;
}

/* Trajectory Viz */
.trajectory-viz {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 16px rgba(0, 59, 122, 0.1);
}

.trajectory-viz img {
    max-width: 100%;
    height: auto;
}

/* Footer */
footer {
    background: rgba(255, 255, 255, 0.9);
    padding: 32px 0;
    text-align: center;
    color: #777;
    border-top: 1px solid rgba(0, 59, 122, 0.1);
}

/* Responsive */
@media (max-width: 1100px) {
    .task-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .case-guide { --case-columns: 3; }
    .hero-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }
    .hero-content {
        grid-area: 1 / 1 / 2 / 5;
        padding: 0;
    }
    .top-left { grid-area: 2 / 1; }
    .top-right { grid-area: 2 / 2; }
    .bottom-left { grid-area: 2 / 3; }
    .bottom-right { grid-area: 2 / 4; }
    .corner-placeholder {
        height: 100px;
        animation: none;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 40px;
    }

    .hero-content {
        padding: 0;
    }

    .corner-placeholder {
        height: 70px;
    }

    .demo-flow {
        flex-direction: column;
        gap: 24px;
    }

    .flow-arrow-main {
        transform: rotate(90deg);
    }

    .player-layout-compact {
        grid-template-columns: 1fr;
    }

    .task-grid {
        grid-template-columns: 1fr;
    }
    .hero { padding: 32px 16px; min-height: 0; }
    .hero-subtitle { font-size: 20px; }
    .hero-subtitle-small { font-size: 16px; margin-bottom: 20px; }
    .hero-buttons { gap: 8px; margin-bottom: 24px; }
    .btn { padding: 9px 16px; }
    .demo-flow { gap: 8px; margin-bottom: 24px; }
    .flow-section h3 { font-size: 16px; margin-bottom: 8px; }
    .flow-arrow-main { font-size: 24px; line-height: 1; animation: none; }
    .frame-box { width: 74px; }
    .hero-stats { gap: 8px; font-size: 16px; }
    .section { padding: 40px 16px; }
    .section h2 { font-size: 30px; margin-bottom: 24px; }
    .nav-container { padding: 0 16px; gap: 12px; }
    .nav-logo { font-size: 18px; }
    .nav-links { gap: 12px; font-size: 13px; }
    .overview-image, .trajectory-viz { padding: 12px; }
    .player-container-compact.active { padding: 16px; }
}

#caseTitle { padding-right: 40px; margin-bottom: 20px; color: #003B7A; }
#frameSeek { width: 100%; margin-bottom: 12px; accent-color: #0288D1; }
.demo-caption { font-size: 12px; color: #666; margin-top: 8px; overflow-wrap: anywhere; }
.task-card:focus-visible { outline: 3px solid #0288D1; outline-offset: 3px; }
.player-container-compact[hidden] { display: none; }
.player-layout-compact > * { min-width: 0; }
.compact-section h4, .results-table th { letter-spacing: 0; }
.hero-stats, .player-info-compact, .results-table { font-variant-numeric: tabular-nums; }
.case-toolbar { display: flex; align-items: end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.case-toolbar label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: #315166; }
.case-search { flex: 1; min-width: 180px; }
.case-toolbar input, .case-toolbar select {
    height: 44px; width: 100%; padding: 8px 12px; border: 1px solid #a8bcc8;
    border-radius: 6px; background: #fff; color: #1a1a1a; font-size: 16px;
}
#caseCount { min-width: 100px; padding-bottom: 10px; font-size: 16px; color: #526779; }
#caseEmpty { text-align: center; padding: 32px 0; }
@media (min-width: 521px) and (max-width: 768px) {
    .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .case-guide { --case-columns: 2; }
}
@media (max-width: 520px) {
    .case-toolbar { gap: 12px; }
    .case-search { flex-basis: 100%; }
    .case-toolbar label:not(.case-search) { flex: 1; }
    .hero-title { font-size: 38px; }
    .case-guide { --case-columns: 1; height: 92px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
    .case-guide-arrow-flow { stroke-dashoffset: 0; }
    .case-guide-arrow-head { opacity: 1; transform: rotate(-30deg); }
}
