/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
    background: #000;
}

/* 视频背景层 */
#video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #1a1a1a;
}

#video-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#video-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

#video-placeholder p {
    font-size: 24px;
    margin-bottom: 10px;
}

#video-placeholder small {
    font-size: 14px;
}

/* 控制层 */
#control-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#control-layer > * {
    pointer-events: auto;
}

/* 顶部状态栏 */
#status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 15px;
    color: #fff;
    font-size: 14px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: #4CAF50;
    box-shadow: 0 0 10px #4CAF50;
}

.status-dot.offline {
    background: #f44336;
}

.icon {
    font-size: 16px;
}

/* 摇杆容器 */
.joystick-container {
    position: absolute;
    bottom: 60px;
    width: 280px;
    height: 280px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.joystick-container.left {
    left: 20px;
}

.joystick-container.right {
    right: 20px;
}

.joystick-label {
    display: none; /* 隐藏文字标签 */
}

/* 摇杆 */
.joystick {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.joystick-base {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.15));
    border: 3px solid rgba(255, 255, 255, 0.4);
    position: relative;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 方向指示器 - 上下左右箭头 */
.joystick-base::before,
.joystick-base::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
}

/* 垂直线（上下指示） */
.joystick-container.left .joystick-base::before {
    width: 3px;
    height: 80px;
    left: 50%;
    top: 15px;
    transform: translateX(-50%);
}

.joystick-container.left .joystick-base::after {
    width: 3px;
    height: 80px;
    left: 50%;
    bottom: 15px;
    transform: translateX(-50%);
}

/* 水平线（左右指示） */
.joystick-container.right .joystick-base::before {
    width: 80px;
    height: 3px;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
}

.joystick-container.right .joystick-base::after {
    width: 80px;
    height: 3px;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
}

/* 方向箭头 */
.joystick-base .direction-indicator {
    position: absolute;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* 左侧摇杆 - 上下箭头 */
.joystick-container.left .direction-up {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
}

.joystick-container.left .direction-down {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}

/* 右侧摇杆 - 左右箭头 */
.joystick-container.right .direction-left {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.joystick-container.right .direction-right {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
}

/* 摇杆手柄 - 可以超出边界 */
.joystick-stick {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4CAF50, #2d7a2f);
    border: 4px solid rgba(255, 255, 255, 0.9);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.6),
        inset 0 -2px 5px rgba(0, 0, 0, 0.3),
        inset 0 2px 5px rgba(255, 255, 255, 0.3);
    transition: all 0.05s ease-out;
    z-index: 10;
    cursor: grab;
}

.joystick-stick:active {
    cursor: grabbing;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.8),
        inset 0 -2px 5px rgba(0, 0, 0, 0.4),
        inset 0 2px 5px rgba(255, 255, 255, 0.2);
}

/* 摇杆中心点 */
.joystick-stick::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.joystick-value {
    display: none; /* 隐藏百分比显示 */
}

/* 底部控制按钮 */
#bottom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    align-items: center;
}

.control-button {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 12px 20px;
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.control-button:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

.control-button.small {
    padding: 12px;
    font-size: 20px;
}

/* GPS信息面板 */
.info-panel {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 10px 15px;
    color: #fff;
    font-size: 12px;
}

.info-item {
    display: flex;
    gap: 5px;
    margin: 3px 0;
}

.info-item .label {
    color: #aaa;
}

/* 设置面板 */
#settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

#settings-panel.hidden {
    display: none;
}

.panel-content {
    background: #2a2a2a;
    border-radius: 15px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    color: #fff;
}

.panel-content h2 {
    margin-bottom: 20px;
    text-align: center;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 14px;
}

.setting-group input[type="text"],
.setting-group select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #1a1a1a;
    color: #fff;
    font-size: 16px;
}

.setting-group input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4CAF50;
    color: #fff;
}

.btn-primary:active {
    background: #45a049;
}

.btn-secondary {
    background: #666;
    color: #fff;
}

.btn-secondary:active {
    background: #555;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .joystick-container {
        width: 140px;
        height: 180px;
    }

    .joystick-container.left {
        left: 15px;
    }

    .joystick-container.right {
        right: 15px;
    }

    .joystick-base {
        width: 120px;
        height: 120px;
    }

    .joystick-stick {
        width: 50px;
        height: 50px;
    }
}

@media (max-height: 600px) {
    .joystick-container {
        bottom: 60px;
    }

    #bottom-controls {
        bottom: 10px;
    }
}

