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

:root {
    --bg: #0f1923;
    --bg-card: #1a2733;
    --primary: #2d7d9e;
    --primary-light: #4ba8c9;
    --accent: #8b5cf6;
    --text: #e8eef2;
    --text-muted: #8a9bab;
    --border: rgba(139, 155, 171, 0.15);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
}

#page {
    width: 100%;
    min-height: 100vh;
}

/* ---------- header ---------- */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(15, 25, 35, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 2rem;
    display: flex;
    align-items: center;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---------- intro ---------- */
#intro {
    min-height: 20vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem 1rem;
    text-align: center;
    background: linear-gradient(180deg, var(--bg) 0%, #162634 100%);
}

.intro-inner {
    max-width: 720px;
}

.intro-inner h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.intro-inner p {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: var(--text-muted);
    line-height: 1.8;
}

/* ---------- models grid ---------- */
#models-section {
    padding: 2rem 2rem 4rem;
}

#models-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.model-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.model-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 16px 40px rgba(45, 125, 158, 0.2);
}

.model-container {
    width: 100%;
    height: 360px;
    background: #172c3c;
}

.model-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.model-label {
    text-align: center;
    padding: 1.2rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    border-top: 1px solid var(--border);
}

/* ---------- loading ---------- */
.model-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    background: rgba(23, 44, 60, 0.9);
    z-index: 5;
    transition: opacity 0.4s ease;
}

.model-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-bar {
    width: 60%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: width 0.2s ease;
}

.loading-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- footer ---------- */
#footer {
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    background: #0c1620;
}

#footer p {
    margin: 0.3rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
}

#footer a:hover {
    color: var(--primary-light);
}

/* ---------- detail overlay ---------- */
#detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: none;
}

#detail-overlay.active {
    display: block;
}

/* ---------- detail view ---------- */
#detail-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 210;
    display: none;
    background: var(--bg);
}

#detail-view.active {
    display: flex;
    flex-direction: column;
}

#detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(15, 25, 35, 0.9);
    border-bottom: 1px solid var(--border);
    z-index: 5;
}

#detail-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#detail-close {
    width: 36px;
    height: 36px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

#detail-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

#detail-close svg {
    width: 100%;
    height: 100%;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

#detail-canvas-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
}

#detail-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#detail-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 1.2rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
}

#detail-controls span {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ---------- detail panel ---------- */
#detail-panel {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    max-height: 40vh;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

#detail-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.detail-item {
    background: rgba(45, 125, 158, 0.08);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: rgba(45, 125, 158, 0.15);
    border-color: var(--primary);
    transform: translateY(-3px);
}

.detail-item h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.detail-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.detail-item-expanded {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.detail-item.open .detail-item-expanded {
    max-height: 200px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    #models-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 480px;
    }

    .model-container {
        height: 300px;
    }

    #detail-items {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #header {
        padding: 0.75rem 1rem;
    }

    .logo {
        font-size: 1rem;
    }

    #intro {
        min-height: 16vh;
        padding: 4rem 1.2rem 0.5rem;
    }

    #models-section {
        padding: 1rem 1rem 3rem;
    }

    .model-container {
        height: 260px;
    }

    #detail-panel {
        padding: 1rem;
    }
}
