/* ============================================================
 * WebAR 实景导航 Demo — 样式表
 * 手机端适配 · 科技风 · 玻璃拟态 · 类似高德AR导航
 * ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --primary:      #00d4aa;
    --primary-dim:  #00a884;
    --primary-glow: rgba(0, 212, 170, 0.35);
    --bg-dark:      #0a0e14;
    --card-bg:      rgba(10, 14, 20, 0.72);
    --card-border:  rgba(255, 255, 255, 0.12);
    --text:         #e8e8e8;
    --text-dim:     #8899aa;
    --danger:       #ff5c5c;
    --radius:       16px;
    --blur:         20px;
    --font:         "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

/* ---------- 全局重置 ---------- */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: #000;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* ---------- 启动页 ---------- */
#splash-screen {
    position: fixed; inset: 0; z-index: 999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, #0d1b2a 0%, #020508 100%);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#splash-screen.hidden {
    opacity: 0; visibility: hidden; pointer-events: none;
}

.splash-logo {
    width: 80px; height: 80px;
    border: 3px solid var(--primary);
    border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 24px;
    animation: logo-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 40px var(--primary-glow);
}
.splash-logo svg { width: 44px; height: 44px; fill: var(--primary); }

@keyframes logo-pulse {
    0%, 100% { box-shadow: 0 0 20px var(--primary-glow); transform: scale(1); }
    50%      { box-shadow: 0 0 60px var(--primary-glow); transform: scale(1.05); }
}

.splash-title {
    font-size: 28px; font-weight: 700;
    letter-spacing: 2px; color: #fff;
    margin-bottom: 6px;
}
.splash-subtitle {
    font-size: 14px; color: var(--text-dim);
    margin-bottom: 48px; letter-spacing: 1px;
}

/* 启动按钮 */
.btn-start {
    width: 220px; height: 52px;
    border: none; border-radius: 26px;
    background: linear-gradient(135deg, var(--primary), #00e6b8);
    color: #000; font-size: 18px; font-weight: 600;
    letter-spacing: 2px; cursor: pointer;
    box-shadow: 0 4px 30px var(--primary-glow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-start:active { transform: scale(0.95); }
.btn-start:hover  { box-shadow: 0 6px 40px rgba(0, 212, 170, 0.5); }

/* 权限提示 */
.permission-hint {
    margin-top: 16px; font-size: 12px;
    color: var(--text-dim); text-align: center;
    line-height: 1.6;
}

/* ---------- AR 导航容器 ---------- */
#ar-container {
    position: fixed; inset: 0; z-index: 1;
    display: none;
}
#ar-container.active { display: block; }

/* 摄像头视频背景 */
#camera-video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

/* Three.js 画布（透明叠加在视频上） */
#ar-canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;  /* 让触摸事件穿透到UI层 */
    z-index: 2;
}

/* ---------- UI 叠加层 ---------- */
#ui-overlay {
    position: fixed; inset: 0; z-index: 10;
    pointer-events: none;
    display: none;
}
#ui-overlay.active { display: block; }

/* 顶部状态栏 */
.top-bar {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    display: flex; align-items: center; justify-content: space-between;
    pointer-events: auto;
}
.status-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--card-border);
    border-radius: 20px;
    font-size: 13px; color: var(--primary);
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: dot-blink 1.5s ease-in-out infinite;
}
@keyframes dot-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* 模拟模式标记 */
.sim-badge {
    padding: 6px 12px; font-size: 11px; color: #ffb347;
    background: rgba(255, 179, 71, 0.18);
    border: 1px solid rgba(255, 179, 71, 0.35);
    border-radius: 12px;
    display: none;
}
.sim-badge.visible { display: block; }

/* 底部信息卡片 */
.bottom-card {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    pointer-events: auto;
}
.info-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex; flex-direction: column; gap: 12px;
}
.info-row {
    display: flex; align-items: center; justify-content: space-between;
}
.info-label {
    font-size: 12px; color: var(--text-dim);
    letter-spacing: 1px;
}
.info-value {
    font-size: 16px; font-weight: 600; color: #fff;
}
.info-value.distance {
    font-size: 28px; font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.info-value.distance .unit {
    font-size: 14px; font-weight: 500;
    color: var(--text-dim);
}

/* 底部按钮 */
.btn-row {
    display: flex; gap: 12px; margin-top: 4px;
}
.btn-nav {
    flex: 1; height: 44px;
    border: none; border-radius: 22px;
    font-size: 15px; font-weight: 600;
    cursor: pointer; letter-spacing: 1px;
    transition: transform 0.15s, opacity 0.15s;
}
.btn-nav:active { transform: scale(0.95); }

.btn-nav.stop {
    background: rgba(255, 92, 92, 0.2);
    border: 1px solid rgba(255, 92, 92, 0.4);
    color: var(--danger);
}

/* ---------- 错误/提示弹窗 ---------- */
.toast {
    position: fixed; top: 60px; left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 13px;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    pointer-events: none;
    animation: toast-in 0.3s ease, toast-out 0.3s ease 2.5s forwards;
}
@keyframes toast-in  { from { opacity: 0; transform: translateX(-50%) translateY(-12px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(-50%) translateY(-12px); } }

/* ---------- 响应式微调 ---------- */
@media (min-width: 768px) {
    /* 桌面端居中显示 */
    #ar-container, #ui-overlay {
        max-width: 430px; left: 50%; transform: translateX(-50%);
    }
    .splash-title { font-size: 36px; }
}
