/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00ff9f;
    --primary-dim: #00cc7f;
    --accent: #00d4ff;
    --bg-dark: #0a0e17;
    --bg-card: #111827;
    --bg-card-light: #1a2332;
    --text-primary: #e0e0e0;
    --text-secondary: #8b9bb4;
    --danger: #ff4757;
    --warning: #ffa502;
    --border: #1e2d3f;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ===== 屏幕切换 ===== */
.screen {
    display: none;
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen.active {
    display: flex;
}

/* ===== 第一页：输入页 ===== */
#input-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
}

/* 背景网格 */
.bg-grid {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image:
        linear-gradient(rgba(0, 255, 159, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 159, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
    pointer-events: none;
}

/* 背景扫描线 */
.bg-scan {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.4;
    animation: scanDown 4s linear infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes scanDown {
    0% { top: 0; }
    100% { top: 100%; }
}

.input-container {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 48px;
    width: 460px;
    max-width: 90vw;
    box-shadow:
        0 0 60px rgba(0, 255, 159, 0.08),
        0 0 1px rgba(0, 255, 159, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Logo 区域 */
.logo-area {
    text-align: center;
    margin-bottom: 28px;
}

.satellite-icon {
    font-size: 48px;
    animation: float 3s ease-in-out infinite;
    margin-bottom: 8px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(0, 255, 159, 0.3);
    margin-bottom: 4px;
}

.subtitle {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
    margin-bottom: 2px;
}

.version {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* 状态栏 */
.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 255, 159, 0.05);
    border: 1px solid rgba(0, 255, 159, 0.15);
    border-radius: 20px;
    padding: 6px 16px;
    margin-bottom: 28px;
    font-size: 12px;
    color: var(--primary-dim);
    font-family: 'Courier New', monospace;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px var(--primary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* 输入区域 */
.input-area {
    width: 100%;
    margin-bottom: 24px;
}

.input-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.phone-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card-light);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0 16px;
    transition: all 0.3s;
    overflow: hidden;
}

.phone-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 255, 159, 0.1);
}

.phone-prefix {
    color: var(--primary);
    font-size: 18px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    padding-right: 14px;
    border-right: 1px solid var(--border);
    margin-right: 14px;
}

.phone-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 18px;
    padding: 14px 0;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.phone-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.4;
    letter-spacing: 1px;
}

.error-msg {
    color: var(--danger);
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
    transition: opacity 0.2s;
}

/* 定位按钮 */
.locate-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dim));
    border: none;
    border-radius: 10px;
    color: var(--bg-dark);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    letter-spacing: 2px;
    box-shadow: 0 4px 20px rgba(0, 255, 159, 0.2);
}

.locate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 255, 159, 0.35);
}

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

.locate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

/* 加载动画区域 */
.loading-area {
    width: 100%;
    margin-top: 20px;
}

.loading-steps {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--primary-dim);
    min-height: 120px;
    line-height: 1.8;
    margin-bottom: 16px;
}

.loading-steps .step {
    opacity: 0;
    animation: fadeInStep 0.3s forwards;
}

.loading-steps .step.done {
    color: var(--primary);
}

.loading-steps .step .check {
    color: var(--primary);
}

@keyframes fadeInStep {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.progress-bar-wrapper {
    width: 100%;
    height: 6px;
    background: var(--bg-card-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 159, 0.5);
}

.progress-text {
    text-align: right;
    font-size: 12px;
    color: var(--primary);
    font-family: 'Courier New', monospace;
    margin-top: 4px;
}

/* 功能标签 */
.features {
    display: flex;
    gap: 20px;
    margin-top: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-card-light);
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.feature-icon {
    font-size: 14px;
}

/* 免责声明 */
.disclaimer {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
    text-align: center;
    line-height: 1.6;
}

/* ===== 第二页：地图页 ===== */
#map-screen {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#map {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

/* 地图深色遮罩 */
#map::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10, 14, 23, 0.15);
    pointer-events: none;
    z-index: 500;
}

/* 顶部信息栏 */
.map-topbar {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    z-index: 1000;
    background: linear-gradient(180deg, rgba(10, 14, 23, 0.95), rgba(10, 14, 23, 0.7));
    backdrop-filter: blur(10px);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 255, 159, 0.1);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.tracking-icon {
    font-size: 18px;
    animation: pulse 1.5s infinite;
}

.tracking-label {
    color: var(--text-secondary);
}

.tracking-phone {
    color: var(--primary);
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 1px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 信号条 */
.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.bar {
    width: 4px;
    background: var(--primary);
    border-radius: 1px;
    box-shadow: 0 0 4px var(--primary);
}

.bar1 { height: 5px; }
.bar2 { height: 8px; }
.bar3 { height: 11px; }
.bar4 { height: 16px; }

.signal-text {
    font-size: 12px;
    color: var(--primary-dim);
    font-family: 'Courier New', monospace;
}

.back-btn {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255, 71, 87, 0.2);
}

/* 左下角信息面板 */
.map-info-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 159, 0.15);
    border-radius: 10px;
    padding: 16px 20px;
    min-width: 280px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    color: var(--primary);
    font-weight: 600;
}

/* 雷达扫描 */
.scan-radar {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    width: 120px;
    height: 120px;
}

.radar-circle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    border: 1px solid rgba(0, 255, 159, 0.3);
    border-radius: 50%;
}

.radar-circle::before,
.radar-circle::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(0, 255, 159, 0.2);
    border-radius: 50%;
}

.radar-circle::before {
    width: 66%; height: 66%;
}

.radar-circle::after {
    width: 33%; height: 33%;
}

.radar-sweep {
    position: absolute;
    top: 50%; left: 50%;
    width: 50%; height: 50%;
    transform-origin: 0 0;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(0, 255, 159, 0.3) 30deg, transparent 60deg);
    border-radius: 0 0 50% 0;
    animation: radarSweep 3s linear infinite;
}

@keyframes radarSweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.radar-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 6px; height: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary);
}

/* ===== 弹窗 ===== */
.popup-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 23, 0.7);
    backdrop-filter: blur(4px);
}

.popup-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 159, 0.3);
    border-radius: 16px;
    padding: 36px 40px;
    width: 420px;
    max-width: 90vw;
    text-align: center;
    box-shadow:
        0 0 80px rgba(0, 255, 159, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.5);
    animation: popupIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupIn {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.popup-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: float 2s ease-in-out infinite;
}

.popup-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.popup-body {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.popup-data {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-card-light);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 24px;
    text-align: left;
    line-height: 1.8;
    border: 1px solid var(--border);
}

.popup-data .data-key {
    color: var(--text-secondary);
}

.popup-data .data-val {
    color: var(--accent);
    float: right;
}

.popup-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dim));
    border: none;
    border-radius: 10px;
    color: var(--bg-dark);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 2px;
    box-shadow: 0 4px 20px rgba(0, 255, 159, 0.2);
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 255, 159, 0.35);
}

/* ===== 最终结果面板 ===== */
.result-panel {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 159, 0.3);
    border-radius: 16px;
    padding: 32px 36px;
    width: 440px;
    max-width: 90vw;
    box-shadow:
        0 0 80px rgba(0, 255, 159, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.5);
    animation: popupIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.result-icon {
    font-size: 28px;
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.result-body {
    margin-bottom: 20px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.result-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-value {
    font-size: 14px;
    color: var(--primary);
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.result-disclaimer {
    font-size: 11px;
    color: var(--warning);
    opacity: 0.8;
    text-align: center;
    line-height: 1.6;
    padding: 12px;
    background: rgba(255, 165, 2, 0.05);
    border-radius: 8px;
    margin-bottom: 20px;
}

.result-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-card-light);
    border: 1px solid var(--primary);
    border-radius: 10px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.result-btn:hover {
    background: rgba(0, 255, 159, 0.1);
}

/* ===== Leaflet 地图样式覆盖 ===== */
.leaflet-container {
    background: var(--bg-dark) !important;
}

.leaflet-control-attribution {
    background: rgba(10, 14, 23, 0.7) !important;
    color: var(--text-secondary) !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: var(--primary-dim) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--primary) !important;
    border: 1px solid var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-card-light) !important;
}

/* 定位圆圈动画 */
.locate-circle {
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 定位标记 */
.location-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 32px;
    filter: drop-shadow(0 0 10px rgba(0, 255, 159, 0.6));
    animation: markerBounce 0.6s ease-out;
}

@keyframes markerBounce {
    0% { transform: translateY(-100px) scale(0); opacity: 0; }
    60% { transform: translateY(10px) scale(1.2); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* 脉冲圆圈 */
.pulse-ring {
    position: relative;
}

/* ===== 响应式 ===== */
@media (max-width: 500px) {
    .input-container {
        padding: 28px 24px;
    }

    .title {
        font-size: 20px;
    }

    .map-topbar {
        padding: 10px 14px;
        font-size: 12px;
    }

    .map-info-panel {
        min-width: auto;
        max-width: calc(100vw - 40px);
        font-size: 11px;
        padding: 12px 14px;
    }

    .scan-radar {
        width: 80px;
        height: 80px;
    }

    .popup-card,
    .result-panel {
        padding: 28px 24px;
    }

    .topbar-right {
        gap: 8px;
    }

    .signal-text {
        display: none;
    }
}
