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

body {
    font-family: Arial, sans-serif;
    background-color: #000;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 顶部悬浮按钮 */
#mode-buttons {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}
#mode-buttons .mode-btn {
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}
#mode-buttons .mode-btn.active {
    background: rgba(76, 175, 80, 0.85);
}
#mode-buttons .mode-btn:hover,
#mode-buttons .mode-btn.touch-active {
    background: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
#mode-buttons #open-view-link {
    display: inline-block;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
}
#mode-buttons #open-view-link:hover {
    background: rgba(255,255,255,0.2);
}

nav button {
    background-color: #555;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}

nav button.active {
    background-color: #4CAF50;
}

#container {
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
}

#pano-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    overflow: hidden;
}

#edit-panel {
    position: absolute;
    top: 64px;
    right: 16px;
    width: 360px;
    max-height: calc(100vh - 80px);
    background: rgba(0, 123, 255, 0.8);
    color: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

.panel-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.panel-section h4 {
    margin-bottom: 0.5rem;
    color: #fff;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.control-group input[type="number"] {
    width: 60px;
    padding: 0.25rem;
    margin-right: 0.5rem;
}

.control-group input[type="range"] {
    width: 150px;
}

button {
    background-color: rgba(76,175,80,0.9);
    color: white;
    border: none;
    padding: 0.5rem;
    margin: 0.25rem 0;
    cursor: pointer;
    border-radius: 6px;
    width: 100%;
    transition: transform 0.15s ease, background 0.2s ease;
}

button:hover {
    background-color: #45a049;
}

select {
    width: 100%;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.25);
    color: #fff;
}

.hotspot {
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: rgba(255, 0, 0, 0.7);
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.hotspot:hover {
    background-color: rgba(255, 0, 0, 1);
    transform: translate(-50%, -50%) scale(1.2);
}

.hotspot.selected {
    background-color: rgba(0, 255, 0, 0.7);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
}

/* 圆形视觉跟随效果 */
#follower-circle {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    transition: transform 0.1s ease;
}

/* 优化后的锚点样式 */
.hotspot {
    position: absolute;
    width: 30px;
    height: 40px;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

.hotspot-arrow {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 15px solid rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
}

.hotspot-base {
    width: 30px;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.hotspot:hover .hotspot-arrow {
    border-bottom-color: rgba(255, 255, 255, 0.8);
}

.hotspot:hover .hotspot-base {
    background-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.hotspot.selected .hotspot-arrow {
    border-bottom-color: rgba(255, 255, 255, 0.9);
}

.hotspot.selected .hotspot-base {
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* 锚点确认动画 */
@keyframes hotspot-confirm {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 悬浮切换按钮 */
.nav-buttons {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 50;
    pointer-events: none;
}

.nav-buttons button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
}

.nav-buttons button:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.nav-buttons button.touch-active {
    background-color: rgba(0, 0, 0, 0.75);
    transform: scale(0.96);
}

.grid-item.touch-active {
    outline: 2px solid rgba(255,255,255,0.6);
}

button.touch-active {
    transform: scale(0.98);
}

/* 网格列表（两列，可滚动） */
.grid-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}
.grid-item {
    position: relative;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    padding: 10px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.grid-item:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.35);
}
.grid-item.selected {
    outline: 2px solid #ffd54f;
    background: rgba(255, 213, 79, 0.15);
}
.grid-item .title {
    font-size: 12px;
    margin-bottom: 6px;
}
.grid-item .thumb {
    width: 100%;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(0,0,0,0.2);
}
.grid-item .check {
    position: absolute;
    top: 8px;
    right: 8px;
}
.bulk-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* 指南针组件样式 */
.pano-compass-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 100;
    backdrop-filter: blur(4px);
    transition: right 0.3s ease-in-out; /* 平滑移动动画 */
}

.pano-compass-container.mini {
    position: relative;
    top: 0;
    right: 0;
    transform: none;
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    pointer-events: auto;
    cursor: default;
}

.pano-compass-container.mini:hover {
    background: rgba(255, 255, 255, 0.1);
}

.compass-ring {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transition: transform 0.1s ease-out;
}

.direction {
    position: absolute;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.dir-n { top: 5px; left: 50%; transform: translateX(-50%); color: #ff5252; }
.dir-e { right: 5px; top: 50%; transform: translateY(-50%); }
.dir-s { bottom: 5px; left: 50%; transform: translateX(-50%); }
.dir-w { left: 5px; top: 50%; transform: translateY(-50%); }

.compass-pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 40%;
    background: linear-gradient(to top, transparent, #fff);
    transform: translate(-50%, -100%);
}

/* 指南针按钮 */
.pano-compass-btn {
    display: none; /* 默认隐藏，由编辑面板控制 */
}

/* 校准面板 */
.pano-compass-calibration-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 12px;
    color: white;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 320px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.calibration-points-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.point-row.global {
    border-left: 3px solid #ff9800;
}

.point-row.scene {
    border-left: 3px solid #2196f3;
}

.point-label small {
    display: block;
    font-size: 10px;
    opacity: 0.6;
}

.offset-control {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 6px;
    margin-top: 5px;
}

.offset-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #fff;
}

.offset-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.offset-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #2196f3;
    border-radius: 50%;
    cursor: pointer;
}

.point-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.point-status.set { background: #4caf50; color: #fff; }
.point-status.unset { background: #666; color: #ccc; }

.point-actions {
    display: flex;
    gap: 5px;
}

.point-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-bind { background: #2196f3; color: white; }
.btn-clear { background: #f44336; color: white; }
.point-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.calibration-actions {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.calibration-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.calibration-info {
    text-align: center;
    color: #fff;
}

#pano-compass-angle-diff {
    display: block;
    font-size: 14px;
    margin-bottom: 10px;
    color: #ffd54f;
}

.calibration-actions {
    display: flex;
    gap: 10px;
}

.calibration-actions button {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: opacity 0.2s;
}

#pano-compass-save-btn { background: #4caf50; color: white; }
#pano-compass-cancel-btn { background: #f44336; color: white; }

.calibration-tip {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 8px;
}
.scene-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 5px;
}

.scene-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.scene-item:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.scene-item.selected {
    background: rgba(103, 58, 183, 0.3);
    border-color: #673ab7;
    box-shadow: 0 0 8px rgba(103, 58, 183, 0.4);
}

.scene-item .title {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scene-item.selected .title {
    color: #fff;
    font-weight: 600;
}

/* 自定义滚动条样式 */
.scene-grid::-webkit-scrollbar {
    width: 6px;
}

.scene-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.scene-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.scene-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    #edit-panel {
        left: 12px;
        right: 12px;
        width: auto;
        max-height: calc(100vh - 120px);
    }
    
    .nav-buttons button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    #edit-panel {
        padding: 12px;
    }
    
    .panel-section h4 {
        font-size: 0.9rem;
    }
    
    .control-group input[type="number"] {
        width: 50px;
    }
    
    .control-group input[type="range"] {
        width: 120px;
    }
}

/* 确保画布元素尺寸为100%宽度和高度 */
canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
