body {
    margin: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
}


#container {
    position: absolute;
    width: 100%;
    height: 100%;
}

/* 欢迎界面样式 */
#welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    transition: opacity 0.5s ease;
}

.welcome-content {
    text-align: center;
    color: white;
    max-width: 600px;
    padding: 40px;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    line-height: 1.2;
}

.welcome-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

#welcome-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 15px;
    border-radius: 8px;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    min-width: 400px;
    max-width: calc(100vw - 40px);
    width: auto;
    transition: all 0.3s ease;
    z-index: 1000;
}

#controls.collapsed {
    padding: 8px;
    min-width: auto;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}



.button-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

#file-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

label[for="file-input"] {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.2s ease;
}

label[for="file-input"]:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}



#file-input {
    margin-bottom: 10px;
}

#preview-btn {
    padding: 5px 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#preview-btn:hover {
    background: #45a049;
}

#thumbnail-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    max-width: calc(100vw - 80px);
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    padding: 5px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) rgba(0,0,0,0.1);
}

#thumbnail-container::-webkit-scrollbar {
    height: 6px;
}

#thumbnail-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

#thumbnail-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

#thumbnail-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.thumbnail {
    width: 120px;
    height: 60px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.thumbnail:hover {
    border-color: white;
}

.thumbnail.active {
    border-color: white;
}

.scene-title {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 18px;
    z-index: 100;
}

.annotation {
    position: absolute;
    background: rgba(255,255,255,0.9);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    cursor: move;
    max-width: 200px;
}

.edit-mode {
    background: #ffeb3b !important;
    color: #000 !important;
}

.thumbnail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    min-width: 120px;
}

.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 10px 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 100;
}

.nav-arrow:hover {
    background: rgba(0,0,0,0.6);
    transform: translateY(-50%) scale(1.2);
}

.left {
    left: 20px;
}

.right {
    right: 20px;
}



.thumbnail-wrapper {
    position: relative;
    display: inline-block;
}

.delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.delete-btn:hover {
    background: #ff0000;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.name-label {
    width: 120px;
    padding: 2px;
    font-size: 14px;
    text-align: center;
    color: white;
    background: none;
    border: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
}

.add-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    min-width: 120px;
}

.add-tile-button {
    width: 120px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255,255,255,0.5);
    color: white;
    cursor: pointer;
    user-select: none;
    border-radius: 4px;
    font-size: 36px;
    background: rgba(255,255,255,0.05);
    box-sizing: border-box;
}

.add-tile-button:hover {
    border-color: #fff;
    background: rgba(255,255,255,0.1);
}

.add-tile-placeholder {
    width: 80px;
    height: 16px;
    visibility: hidden;
}


/* 移除顶部控制区旧按钮样式：label[for="file-input"], #preview-btn */
/* 可以保留通用 .icon-btn 如果未来还会用到，这里暂不删除 */

/* 响应式设计 - 小屏幕适配 */
@media (max-width: 768px) {
    #controls {
        min-width: 320px;
        padding: 12px;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        position: fixed;
    }
    
    #thumbnail-container {
        max-width: calc(100vw - 60px);
        gap: 8px;
    }
    
    .thumbnail {
        width: 100px;
        height: 55px;
        box-sizing: border-box;
    }
    
    .add-tile-button {
         width: 100px;
         height: 55px;
         font-size: 28px;
         box-sizing: border-box;
     }
     
     .add-tile-placeholder {
         width: 100px;
         height: 18px;
     }
    
    .thumbnail-item {
        min-width: 100px;
    }
    
    .name-label {
        width: 100px;
        font-size: 12px;
    }
    
    .delete-btn {
        width: 18px;
        height: 18px;
        font-size: 12px;
        top: -6px;
        right: -6px;
    }
    
    .welcome-title {
        font-size: 2rem;
    }
    
    .welcome-subtitle {
        font-size: 1rem;
    }
    
    .welcome-content {
        padding: 30px 20px;
    }
    
    .scene-title {
        font-size: 14px;
        padding: 6px 16px;
    }
}

@media (max-width: 480px) {
    #controls {
        min-width: 280px;
        padding: 10px;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        position: fixed;
        max-width: calc(100vw - 20px);
    }
    
    #thumbnail-container {
        max-width: calc(100vw - 30px);
        gap: 6px;
    }
    
    .thumbnail {
         width: 90px;
         height: 50px;
     }
     
     .add-tile-button {
         width: 90px;
         height: 50px;
         font-size: 26px;
     }
     
     .add-tile-placeholder {
         width: 90px;
         height: 16px;
     }
     
     .thumbnail-item {
         min-width: 90px;
     }
     
     .name-label {
         width: 90px;
         font-size: 11px;
     }
    
    .delete-btn {
         width: 16px;
         height: 16px;
         font-size: 10px;
         top: -5px;
         right: -5px;
      }
      
      .welcome-title {
          font-size: 1.8rem;
      }
      
      .welcome-subtitle {
          font-size: 0.9rem;
      }
      
      .welcome-content {
           padding: 20px 15px;
       }
       
       .scene-title {
           font-size: 12px;
           padding: 4px 12px;
       }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .delete-btn {
        width: 24px;
        height: 24px;
        font-size: 16px;
        top: -10px;
        right: -10px;
    }
    
    .icon-btn, label[for="file-input"] {
        padding: 10px 16px;
        min-height: 44px;
        box-sizing: border-box;
    }
    
    .thumbnail {
        min-height: 44px;
    }
}
