/* 梦幻粒子圣诞树 - 样式表 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: #0a0a1a;
    color: #e0e0ff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 加载动画 */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 60px;
    height: 60px;
    position: relative;
    margin-bottom: 20px;
}

.spinner-inner {
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top: 3px solid #4dff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: relative;
}

.spinner-inner::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 3px solid transparent;
    border-top: 3px solid #ff4d8d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite reverse;
}

.spinner-inner::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 3px solid transparent;
    border-top: 3px solid #4dccff;
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 18px;
    font-weight: 300;
    color: #a0a0ff;
    text-shadow: 0 0 10px rgba(77, 255, 136, 0.3);
    letter-spacing: 1px;
}

/* 覆盖层 */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

.header {
    text-align: center;
    pointer-events: auto;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 600;
    background: linear-gradient(90deg, #4dff88, #4dccff, #ff4d8d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
    text-shadow: 0 0 15px rgba(77, 255, 136, 0.3);
}

.subtitle {
    font-size: 1rem;
    color: #a0a0ff;
    font-weight: 300;
    letter-spacing: 2px;
    opacity: 0.8;
}

/* 控制面板 */
.controls-panel {
    position: absolute;
    top: 120px;
    right: 20px;
    background: rgba(10, 10, 26, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    width: 320px;
    border: 1px solid rgba(160, 160, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    transition: all 0.3s ease;
}

/* 控制面板头部 */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(160, 160, 255, 0.1);
    display: none; /* 默认隐藏，移动端显示 */
}

.panel-title {
    color: #4dccff;
    font-size: 1.1rem;
    font-weight: 600;
}

.panel-toggle {
    background: none;
    border: none;
    color: #4dff88;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.panel-toggle:hover {
    background: rgba(77, 255, 136, 0.1);
    transform: scale(1.1);
}

.panel-toggle:active {
    transform: scale(1);
}

/* 展开状态图标旋转 */
.controls-panel.expanded .panel-toggle i {
    transform: rotate(180deg);
}

.control-group {
    margin-bottom: 25px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group h3 {
    font-size: 1.1rem;
    color: #4dccff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-hint {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #b0b0ff;
    font-size: 0.9rem;
}

.hint-item i {
    color: #4dff88;
    width: 20px;
    text-align: center;
}

/* 滑块控件 */
.slider-container {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.slider-container label {
    color: #b0b0ff;
    font-size: 0.95rem;
    width: 100px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: linear-gradient(90deg, #1a1a2e, #4dccff);
    border-radius: 3px;
    outline: none;
    margin: 0 15px;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4dff88;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(77, 255, 136, 0.8);
}

.slider-container span {
    color: #4dff88;
    font-weight: 600;
    width: 30px;
    text-align: right;
}

/* 复选框 */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4dccff;
    cursor: pointer;
}

.checkbox-container label {
    color: #b0b0ff;
    font-size: 0.95rem;
    cursor: pointer;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.action-button {
    flex: 1;
    padding: 10px 15px;
    background: linear-gradient(135deg, #1a1a2e, #4dccff);
    border: 1px solid rgba(160, 160, 255, 0.2);
    color: #e0e0ff;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.action-button:hover {
    background: linear-gradient(135deg, #4dccff, #4dff88);
    border-color: #4dff88;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(77, 255, 136, 0.3);
}

.action-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(77, 255, 136, 0.3);
}

.action-button i {
    font-size: 1rem;
}

/* 描述文本 */
.description {
    color: #a0a0ff;
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.9;
}

.description span {
    color: #4dff88;
    font-weight: 600;
}

/* 页脚 */
.footer {
    text-align: center;
    pointer-events: auto;
    padding: 15px;
    background: rgba(10, 10, 26, 0.5);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    margin-top: 20px;
}

.footer-content p {
    color: #a0a0ff;
    font-size: 0.9rem;
    margin: 5px 0;
}

.footer-content .hint {
    color: #ff4d8d;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 10px;
}

.footer-content i {
    color: #f0db4f;
    margin: 0 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        display: none; /* 移动端隐藏独立标题 */
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .controls-panel {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        margin: 10px 0 20px 0; /* 减少顶部边距 */
        padding: 15px;
        height: 60px; /* 默认折叠状态高度 */
        overflow: hidden;
    }

    .panel-header {
        display: flex; /* 移动端显示折叠按钮 */
        align-items: center;
        justify-content: center; /* 居中显示标题 */
        position: relative; /* 为折叠按钮定位 */
    }

    .panel-header .panel-toggle {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
    }

    .panel-title {
        color: #4dccff;
        font-size: 1.4rem;
        font-weight: 600;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .panel-title .main-title {
        background: linear-gradient(90deg, #4dff88, #4dccff, #ff4d8d);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        font-size: 1.4rem;
        font-weight: 600;
    }

    .panel-title .subtitle {
        color: #a0a0ff;
        font-size: 0.85rem;
        font-weight: 300;
        letter-spacing: 1px;
        opacity: 0.8;
        display: none; /* 竖屏时完全隐藏副标题 */
    }

    .controls-panel.expanded {
        height: auto; /* 展开状态 */
        overflow: visible;
    }

    .controls-panel.expanded .panel-header {
        margin-bottom: 15px;
        border-bottom: 1px solid rgba(160, 160, 255, 0.1);
    }

    /* 副标题在竖屏时完全隐藏（已通过.panel-title .subtitle的display: none实现） */

    .overlay {
        padding: 15px;
        justify-content: flex-start; /* 移动端内容从顶部开始 */
    }

    .footer {
        padding: 10px;
        margin-top: auto; /* 页脚推到底部 */
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .controls-panel {
        padding: 12px;
    }

    .control-group h3 {
        font-size: 1rem;
    }

    .hint-item {
        font-size: 0.85rem;
    }
}

/* 加载完成后的动画 */
#container.loaded .header h1 {
    animation: fadeInUp 0.8s ease forwards;
}

#container.loaded .controls-panel {
    animation: fadeInRight 0.8s ease 0.2s forwards;
    opacity: 0;
}

#container.loaded .footer {
    animation: fadeInUp 0.8s ease 0.4s forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}