/* ==============================================
   Star Evolution - 星海演化器 样式表
   响应式布局：桌面端左右分栏，移动端上下布局
   ============================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    user-select: none;
}

/* ==============================================
   主容器布局 - 桌面端左右分栏
   ============================================== */

#game-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* 3D 可视化区域 */
#canvas-container {
    flex: 1;
    position: relative;
    cursor: crosshair;
    overflow: hidden;
}

/* 控制面板容器 */
#ui-panel {
    width: 320px;
    min-width: 280px;
    max-width: 380px;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(15px);
    border-left: 1px solid rgba(0, 242, 254, 0.3);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    color: #00f2fe;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 10;
}

/* 移动端可折叠面板 */
#ui-panel.collapsed {
    transform: translateX(100%);
}

/* 面板切换按钮（仅移动端显示） */
#panel-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 242, 254, 0.2);
    border: 2px solid #00f2fe;
    border-radius: 50%;
    color: #00f2fe;
    font-size: 24px;
    cursor: pointer;
    z-index: 200;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
    transition: all 0.3s;
}

#panel-toggle:active {
    transform: scale(0.9);
}

/* 面板内容 */
.panel-content {
    padding: 24px;
}

h1 {
    margin: 0 0 20px 0;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
    border-bottom: 2px solid rgba(0, 242, 254, 0.3);
    padding-bottom: 12px;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

/* 控制组 */
.control-group {
    margin-bottom: 20px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
    font-weight: 600;
    opacity: 0.9;
}

/* 自定义滑块 */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    height: 20px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #00f2fe;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px #00f2fe;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

input[type=range]::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #00f2fe;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px #00f2fe;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* 按钮组 */
.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.btn {
    padding: 10px 6px;
    border: 1px solid rgba(0, 242, 254, 0.4);
    background: rgba(0, 242, 254, 0.05);
    color: #00f2fe;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    border-radius: 8px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn:hover {
    background: rgba(0, 242, 254, 0.2);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    grid-column: span 2;
    background: rgba(0, 242, 254, 0.15);
    border-color: #00f2fe;
    padding: 12px 8px;
}

/* 图标按钮 - 更小更紧凑 */
.btn.icon-btn {
    padding: 10px 4px;
    font-size: 16px;
    grid-column: span 1;
}

/* 特殊功能按钮 */
.btn.special-btn {
    font-size: 18px;
    padding: 10px 4px;
    grid-column: span 1;
}

.btn.sun-btn {
    background: rgba(255, 170, 0, 0.15);
    border-color: #ffaa00;
}

.btn.sun-btn:hover {
    background: rgba(255, 170, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.4);
}

.btn.giant-btn {
    background: rgba(255, 165, 0, 0.15);
    border-color: #ff9900;
}

.btn.giant-btn:hover {
    background: rgba(255, 165, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.4);
}

.btn.hole-btn {
    background: rgba(100, 0, 200, 0.15);
    border-color: #6600ff;
    color: #aa66ff;
}

.btn.hole-btn:hover {
    background: rgba(100, 0, 200, 0.3);
    box-shadow: 0 0 15px rgba(100, 0, 200, 0.4);
}

.btn.boom-btn {
    background: rgba(255, 0, 0, 0.15);
    border-color: #ff3300;
    color: #ff6600;
}

.btn.boom-btn:hover {
    background: rgba(255, 0, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

.btn.white-hole-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
    color: #ffffff;
}

.btn.white-hole-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.btn.wormhole-btn {
    background: rgba(0, 255, 255, 0.15);
    border-color: #00ffff;
    color: #00ffff;
}

.btn.wormhole-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
}

/* 成就解锁通知 */
.achievement-notification {
    position: fixed;
    top: 100px;
    right: -400px;
    width: 350px;
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.95), rgba(255, 100, 0, 0.95));
    border: 2px solid #ffaa00;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 5000;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-notification.show {
    right: 20px;
}

.achievement-icon {
    font-size: 48px;
    animation: achievementBounce 0.6s ease-in-out;
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.achievement-name {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
}

.achievement-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

@keyframes achievementBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(10deg); }
}

@media (max-width: 768px) {
    .achievement-notification {
        width: calc(100% - 40px);
        right: -100%;
        top: 80px;
    }

    .achievement-notification.show {
        right: 20px;
    }
}

/* 统计信息 */
.stats {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ==============================================
   瞄准系统和辅助 UI
   ============================================== */

#reticle {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    display: none;
    z-index: 100;
    mix-blend-mode: difference;
    transition: width 0.1s, height 0.1s;
}

#reticle.active {
    border-color: #00f2fe;
    box-shadow: 0 0 20px #00f2fe;
    width: 60px;
    height: 60px;
}

#aim-line {
    position: fixed;
    height: 2px;
    background: linear-gradient(90deg, #00f2fe, transparent);
    transform-origin: left center;
    pointer-events: none;
    display: none;
    z-index: 99;
}

/* ==============================================
   启动页
   ============================================== */

#start-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #1a2a40 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    text-align: center;
    color: white;
    transition: opacity 0.6s;
}

.hero-title {
    font-size: 5vw;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #00f2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 30px rgba(0, 242, 254, 0.4));
}

.start-btn {
    padding: 18px 60px;
    font-size: 18px;
    background: transparent;
    color: #00f2fe;
    border: 2px solid #00f2fe;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 2px;
    transition: 0.3s;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.2);
    text-transform: uppercase;
}

.start-btn:hover {
    background: #00f2fe;
    color: #000;
    box-shadow: 0 0 50px #00f2fe;
}

/* Toast 提示 */
#toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 30px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    font-size: 14px;
    letter-spacing: 1px;
    z-index: 500;
}

/* ==============================================
   响应式设计 - 移动端
   ============================================== */

@media (max-width: 768px) {

    /* 移动端：上下布局，面板可折叠 */
    #game-container {
        flex-direction: column-reverse;
    }

    /* 控制面板固定在右侧，默认隐藏 */
    #ui-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 85vw;
        max-width: 320px;
        min-width: unset;
        border-left: 2px solid rgba(0, 242, 254, 0.5);
        z-index: 100;
    }

    /* 显示面板切换按钮 */
    #panel-toggle {
        display: flex;
    }

    /* 3D 区域占满整个屏幕 */
    #canvas-container {
        width: 100vw;
        height: 100vh;
    }

    /* 优化移动端按钮大小和布局 */
    .btn-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 6px;
    }

    .btn {
        padding: 12px 4px;
        font-size: 10px;
        touch-action: manipulation;
    }

    .btn.primary {
        padding: 14px 6px;
        font-size: 11px;
    }

    .btn.icon-btn {
        padding: 12px 2px;
        font-size: 18px;
    }

    .btn.special-btn {
        padding: 12px 2px;
        font-size: 20px;
    }

    /* 滑块更易触摸 */
    input[type=range] {
        height: 30px;
    }

    input[type=range]::-webkit-slider-thumb {
        height: 20px;
        width: 20px;
        margin-top: -8px;
    }

    input[type=range]::-moz-range-thumb {
        height: 20px;
        width: 20px;
    }

    /* 移动端标题更小 */
    .hero-title {
        font-size: 12vw;
    }

    /* Toast 位置调整 */
    #toast {
        bottom: 100px;
        font-size: 12px;
        padding: 10px 24px;
    }

    h1 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {

    /* 小屏手机优化 */
    .panel-content {
        padding: 14px;
    }

    .btn-grid {
        gap: 5px;
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    .btn {
        padding: 10px 2px;
        font-size: 9px;
    }

    .btn.primary {
        padding: 12px 4px;
        font-size: 10px;
    }

    .btn.icon-btn {
        padding: 10px 1px;
        font-size: 16px;
    }

    .btn.special-btn {
        padding: 10px 1px;
        font-size: 18px;
    }

    h1 {
        font-size: 14px;
        letter-spacing: 2px;
    }

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

    .label-row {
        font-size: 11px;
    }

    .stats {
        font-size: 10px;
    }

    #profile-btn {
        font-size: 12px;
        padding: 6px;
    }

    #help-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
}

/* 平板横屏优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    #ui-panel {
        width: 280px;
    }

    .panel-content {
        padding: 20px;
    }
}

/* 滚动条美化（仅 Webkit 浏览器） */
#ui-panel::-webkit-scrollbar {
    width: 6px;
}

#ui-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#ui-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 254, 0.3);
    border-radius: 3px;
}

#ui-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 242, 254, 0.5);
}