:root {
    --primary: #009688;               /* 地图中心自定义 Marker 样式 */
    --accent: #009688; 
    --bg-light: hsla(0, 0%, 100%, 0.9);
    --text-main: #333;
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --border-radius: 12px;
}

/* 地图容器 */
#map-container {
    width: 100%; height: 100vh; position: absolute; top: 0; left: 0; z-index: 0; background-color: #f0f0f0;
}

/* 右侧工具栏 */
.side-tools {
    position: absolute; right: 15px; top: 100px; /* 移到搜索栏下方 */
    display: flex; flex-direction: column; gap: 10px; z-index: 100;
}
.tool-btn {
    width: 40px; height: 40px; background: white; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); cursor: pointer;
}


body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    font-family: 'Outfit', 'PingFang SC', sans-serif;
    overflow: hidden; /* 防止页面滚动，地图固定 */
}

/* 下拉菜单系统 - 还原截图 UI */
.top-search-bar {
    position: absolute; top: 15px; left: 15px; right: 15px;
    z-index: 600;
}
.search-input-wrap {
    background: white; border-radius: 50px; padding: 12px 25px; /* 全圆角药丸状 */
    display: flex; align-items: center; box-shadow: 0 2px 15px rgba(0,0,0,0.08); /* 轻微阴影 */
    cursor: pointer;
}
.search-icon { margin-right: 12px; color: #666; font-size: 18px; }
#selected-ref-name { flex: 1; font-size: 15px; color: #666; }
.arrow-down { font-size: 10px; color: #ccc; margin-left: 10px; }

.dropdown-menu {
    position: absolute; top: 60px; left: 0; right: 0; background: white;
    border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.12); list-style: none;
    padding: 10px 0; margin: 0; z-index: 700; max-height: 400px; overflow-y: auto;
    display: none; /* 默认完全隐藏 */
}
.dropdown-menu.active { display: block; } /* 仅在 active 时显示 */


/* 中心准星系统：大头针版 (修改避免漂移) */
.map-center-aim {
    position: absolute; top: 50%; left: 50%; width: 0; height: 0;
    z-index: 400; pointer-events: none;
}
.label-group {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 5px; align-items: center; width: max-content;
} 
.float-tag {
    background: rgba(30,39,46,0.85); color: white; padding: 6px 14px; border-radius: 18px;
    font-size: 13px; line-height: 1.4; white-space: nowrap; backdrop-filter: blur(8px); text-align: center;
}
.aim-cross { position: absolute; top: 0; left: 0; }
.aim-pin {
    font-size: 32px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    transform: translate(-50%, -100%); color: #ff3f34;
}
.set-point-btn {
    pointer-events: auto; background: #2ecc71; color: white; padding: 6px 16px;
    border-radius: 20px; font-size: 13px; font-weight: 600; margin-bottom: 4px;
}

/* 底部功能面板 */
#function-panel {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: white; border-top-left-radius: 20px; border-top-right-radius: 20px;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.08); z-index: 500;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 极简拖拽拉手 - iOS 风格 */
.bottom-bar-toggle {
    width: 100%; height: 20px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: transparent;
}
.drag-handle {
    width: 36px; height: 4px; background: #e0e0e0; border-radius: 2px;
}

/* 收回状态：只露出一小截拉手 (20px) */
.panel-collapsed #function-panel { transform: translateY(calc(100% - 20px)); }
.panel-collapsed .drag-handle { background: var(--primary); opacity: 0.6; }

.location-cards { padding: 8px 15px; display: flex; flex-direction: column; gap: 8px; }

/* 底部功能导航：深度瘦身版 */
.bottom-nav {
    display: flex; justify-content: space-around;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom)) 0;
    background: white; border-top: 1px solid #f1f2f6;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.nav-icon {
    width: 42px; height: 42px; background: #f8f9fa; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
    transition: all 0.2s;
}
.nav-item:active .nav-icon { transform: scale(0.9); background: #eee; }
.nav-item span { font-size: 11px; color: #333; font-weight: 500; }

.loc-card.white-card {
    background: white; border-radius: 12px; padding: 12px 15px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.card-left { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.dot-icon { width: 8px; height: 8px; border-radius: 50%; }
.dot-icon.orange { background: #f39c12; }
.dot-icon.blue { background: #3498db; }
.card-label { font-size: 14px; font-weight: 600; color: #333; white-space: nowrap; }
.card-addr { font-size: 14px; color: #009688; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-actions { display: flex; align-items: center; gap: 10px; }
.action-btn-small {
    background: #2ecc71; color: white; border: none; padding: 6px 15px;
    border-radius: 6px; font-size: 13px; font-weight: 600;
}
.delete-icon { font-size: 18px; cursor: pointer; filter: grayscale(1); }
.delete-icon:active { transform: scale(0.9); }
.hidden { display: none !important; }



/* 键盘系统 */
#custom-keyboard {
    position: absolute; bottom: 0; left: 0; width: 100%; background: #dfe6e9;
    z-index: 1000; transition: transform 0.3s ease; box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
}
.keyboard-hidden { transform: translateY(100%); }

.kb-header {
    display: flex; justify-content: space-between; padding: 12px 20px; background: white; border-bottom: 1px solid #eee;
}
#kb-title { font-weight: 600; color: #2d3436; }
#kb-done { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 16px; }

.kb-display {
    padding: 15px; text-align: center; font-size: 24px; font-family: monospace; background: #f8f9fa;
}

.kb-keys {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #ccc;
}
.key {
    background: white; border: none; padding: 20px 0; font-size: 22px; transition: background 0.1s;
}
.key:active { background: #eee; }
.action-del { background: #f1f2f6; }

/* 模态框样式 */
#speed-modal {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.5); z-index: 2000; display: flex; align-items: center; justify-content: center;
}
.modal-hidden { display: none !important; }
.modal-content {
    background: white; width: 85%; padding: 25px; border-radius: var(--border-radius);
}
.form-item { margin-bottom: 15px; }
.form-item label { display: block; font-size: 13px; color: #666; margin-bottom: 8px; }
.form-item input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; box-sizing: border-box;}

.speed-result {
    text-align: center; padding: 20px 0; border-top: 1px dashed #eee; margin-top: 15px;
}
.speed-result .label { display: block; font-size: 14px; margin-bottom: 10px; }
#final-speed { font-size: 48px; color: var(--primary); font-weight: 600; }

.modal-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 20px; }
.cancel-btn { background: #eee; border: none; border-radius: 12px; font-weight: 600; }

.save-area { border-top: 1px solid #eee; padding-top: 20px; display: flex; gap: 10px; }
.save-area input { flex: 1; border: 1px solid #eee; padding: 10px; border-radius: 8px; background: #fafafa; }
.save-btn { background: #2ecc71; color: white; border: none; padding: 0 15px; border-radius: 8px; font-weight: 600; }

/* ============================================================
   坐标精调面板 (样式严格还原截图二)
   ============================================================ */
#edit-panel {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: white; border-top-left-radius: 20px; border-top-right-radius: 20px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.12); z-index: 1200;
    padding-bottom: env(safe-area-inset-bottom);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.panel-hidden { transform: translateY(100%); }

/* 顶部地址确认行 */
.edit-addr-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px; border-bottom: 1px solid #f1f2f6; gap: 10px;
}
.addr-text { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 14px; color: #333; overflow: hidden; }
#edit-addr-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-btn {
    background: #009688; color: white; border: none; padding: 10px 18px;
    border-radius: 8px; font-weight: 600; font-size: 14px; white-space: nowrap;
}

/* ============================================================
   坐标精调面板 - 赛事参考分段选择器 (Segmented Control)
   ============================================================ */
.segmented-control-wrap {
    padding: 15px 15px 0 15px; /* 设置顶部和两边边距 */
}
.segmented-control {
    display: flex;
    background: #f1f2f6; /* 浅灰色背景 */
    border-radius: 10px; /* 大一点的圆角包裹 */
    padding: 3px;
    overflow-x: auto; /* 支持横向滑动 */
    -webkit-overflow-scrolling: touch; /* 增强 iOS 滑动顺畅感 */
    scrollbar-width: none; /* 隐藏 Firefox 滚动条 */
}
.segmented-control::-webkit-scrollbar {
    display: none; /* 隐藏 Chrome/Safari 的滚动条 */
}
.seg-item {
    flex: 0 0 auto; /* 必须设置，防止 flex 项被挤压，保持原生宽度 */
    padding: 8px 20px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    border-radius: 8px; /* 选中块的圆角 */
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s; /* 丝滑过渡 */
    text-align: center;
    position: relative; /* 应对可能的分割线或定位 */
}
/* 选中状态：变成一块白色卡片 */
.seg-item.active {
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08); /* 轻微阴影，悬浮感 */
    font-weight: 600;
}


/* DMS 精调网格区 */
.dms-editor-grid {
    padding: 15px 15px 25px;
    display: grid;
    grid-template-columns: auto 1fr 1fr 1fr 90px; /* 标签 + 3个输入单元格 + 动作按钮 */
    grid-template-rows: auto auto;
    gap: 12px 10px;
    align-items: center;
}

.dms-row {
    display: contents; /* 让子元素直接参与 grid 布局 */
}

.dms-label {
    font-size: 15px; font-weight: 600; color: #333; width: 40px;
}

/* 输入框单元格：灰色背景，包含单位 */
.input-cell {
    position: relative; background: #f1f3f7; border-radius: 8px;
    height: 48px; display: flex; align-items: center; padding: 0 5px;
}
.input-cell input {
    width: 100%; height: 100%; background: transparent; border: none;
    text-align: center; font-size: 14px; color: #333; padding-right: 14px;
    box-sizing: border-box; font-family: monospace;
}
/* 隐藏数字滚轮按钮 (Chrome/Safari) */
.input-cell input::-webkit-inner-spin-button, 
.input-cell input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* 专门针对秒数输入框（带小数，可能更长）缩小字体 */
#lng-s, #lat-s {
    font-size: 11px;
    padding-right: 11px;
}

.input-cell .unit {
    position: absolute; right: 4px; font-size: 12px; color: #99a; pointer-events: none;
}
/* 秒数单位进一步靠右，给数字留空间 */
.input-cell:has(#lng-s) .unit,
.input-cell:has(#lat-s) .unit {
    right: 2px;
}

/* 大号修改定位按钮 (跨两行) */
.update-action-btn {
    grid-column: 5 / 6;
    grid-row: 1 / 3;
    background: #009688; /* 默认绿色 */
    color: white; font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px; height: 100%; text-align: center;
    padding: 0 10px; cursor: pointer; transition: all 0.2s;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,150,136,0.2);
}
.update-action-btn.active {
    background: #00796b; color: white; box-shadow: 0 4px 12px rgba(0,150,136,0.3);
}
.update-action-btn:active { transform: scale(0.96); opacity: 0.9; }

/* 精调独占模式：隐藏主面板 */
.edit-mode #function-panel {
    display: none !important;
}

/* 搜索点击态反馈 */
#btn-search-addr {
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: background 0.2s;
}
#btn-search-addr:active {
    background: #f0f0f0;
}

/* ============================================================
   全屏搜索层与联想列表适配 (极简高级感)
   ============================================================ */
#search-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: white; z-index: 3000; /* 调高等级 */
    display: flex; flex-direction: column;
    transition: opacity 0.3s, transform 0.3s;
}
.search-hidden { opacity: 0; pointer-events: none; transform: translateY(100%); } /* 从底部弹出更自然 */

.search-bar-wrap {
    display: flex; align-items: center; padding: 15px; background: white;
    border-bottom: 1px solid #eee; gap: 12px;
}
.search-back { font-size: 24px; color: #333; cursor: pointer; padding: 5px; }
.search-input-box { flex: 1; background: #f5f6f9; border-radius: 10px; padding: 8px 15px; }
.search-input-box input { width: 100%; border: none; background: transparent; font-size: 16px; outline: none; }

/* 联想列表容器：让高德列表在里面自由生长 */
#search-results-panel { flex: 1; overflow-y: auto; background: white; position: relative; }

/* 联想项美化：增强层级 */
.amap-sug-result {
    z-index: 3100 !important; width: 100% !important; border: none !important;
    box-shadow: none !important; background: white !important;
    position: relative !important; top: 0 !important; left: 0 !important;
}
.auto-item {
    padding: 15px 20px !important; border-bottom: 1px solid #f0f0f0 !important;
    font-size: 15px !important; color: #333 !important; line-height: 1.5 !important;
}
.auto-item span { color: #99a !important; font-size: 12px !important; }

/* ============================================================
   自定义提示组件 (Toast) - 移除域名显示
   ============================================================ */
#custom-toast {
    position: fixed; top: 12%; left: 50%; transform: translateX(-50%);
    background: rgba(30, 39, 46, 0.9); color: white; padding: 12px 28px;
    border-radius: 50px; font-size: 14px; font-weight: 500; z-index: 9999;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2); backdrop-filter: blur(8px);
    transition: all 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    white-space: nowrap; pointer-events: none;
}
.toast-hidden { opacity: 0; transform: translate(-50%, -20px) scale(0.9) !important; }

