/* 本地字体 */
@font-face {
    font-family: 'Tomorrow';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('assets/fonts/Tomorrow-SemiBold.ttf') format('truetype');
}

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #0a0a1a;
    color: white;
    overflow: hidden;
    min-height: 100vh;
}

/* Canvas */
#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 加载动画 */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1e1b4b;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

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

.loader-ping {
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 导航 */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 50;
    text-transform: uppercase;
    font-size: 12px;
    pointer-events: none;
}

.nav a, .nav button, .nav span {
    pointer-events: auto;
}

.nav a {
    color: white;
    text-decoration: none;
    transition: text-decoration 0.2s;
}

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

.nav-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tags {
    display: flex;
    gap: 8px;
}

.nav-center {
    display: flex;
    gap: 16px;
}

.effect-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    padding: 4px 0;
    transition: all 0.2s;
}

.effect-btn:hover {
    text-decoration: underline;
}

.effect-btn.active {
    text-decoration: underline;
}

.nav-right {
    text-align: right;
}

/* 主内容 */
.content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 40;
    pointer-events: none;
    text-transform: uppercase;
}

.title {
    font-family: 'Tomorrow', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 8vw, 8rem);
    display: flex;
    gap: clamp(8px, 2vw, 24px);
    justify-content: center;
    overflow: hidden;
}

.title-word {
    display: inline-block;
    transform: translateY(-100%);
    opacity: 0;
}

.subtitle {
    font-size: clamp(0.75rem, 2vw, 1.5rem);
    margin-top: 8px;
    opacity: 0;
    transform: translateY(100%);
}

/* 原理说明面板 */
.principle-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    max-width: 420px;
    z-index: 50;
    font-size: 12px;
    line-height: 1.6;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.principle-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #fbbf24;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.principle-title:hover {
    color: #fcd34d;
}

.toggle-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.principle-panel:not(.collapsed) .toggle-icon {
    transform: rotate(90deg);
}

.principle-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.principle-panel.collapsed .principle-list {
    max-height: 0;
    opacity: 0;
}

.principle-panel.collapsed .principle-title {
    margin-bottom: 0;
}

.principle-list li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
}

.principle-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.principle-list li strong {
    color: #60a5fa;
    font-weight: 500;
}

/* WebGPU 警告 */
.webgpu-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 38, 38, 0.9);
    padding: 40px 60px;
    border-radius: 12px;
    text-align: center;
    z-index: 200;
}

.webgpu-warning h2 {
    margin-bottom: 16px;
    font-size: 24px;
}

.webgpu-warning p {
    font-size: 14px;
    opacity: 0.9;
}

/* 响应式 */
@media (max-width: 768px) {
    .nav {
        padding: 16px 20px;
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .nav-left, .nav-right {
        text-align: center;
    }
    
    .title {
        flex-wrap: wrap;
    }

    .principle-panel {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }
}
