*{margin:0;padding:0;box-sizing:border-box}
html,body{width:100%;height:100%;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}
#map{width:100%;height:100%;z-index:1}

/* 顶部指南针 */
#compass-box{position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:100;width:90px;height:90px;background:rgba(0,0,0,.65);border-radius:50%;border:2px solid rgba(255,255,255,.2);backdrop-filter:blur(6px);display:flex;flex-direction:column;align-items:center;justify-content:center}
#compass-ring{width:60px;height:60px;border-radius:50%;border:1px solid rgba(255,255,255,.15);position:relative;transition:transform .2s ease-out}
.compass-dir{position:absolute;font-size:9px;font-weight:bold;color:#fff}
.compass-n{top:2px;left:50%;transform:translateX(-50%);color:#e74c3c}
.compass-s{bottom:2px;left:50%;transform:translateX(-50%);color:#aaa}
.compass-e{right:2px;top:50%;transform:translateY(-50%);color:#aaa}
.compass-w{left:2px;top:50%;transform:translateY(-50%);color:#aaa}
#compass-deg{color:#fff;font-size:13px;font-weight:bold;margin-top:4px}
#compass-dir{color:#ccc;font-size:10px}
#compass-box.unsupported{width:auto;height:auto;padding:8px 14px;border-radius:10px;font-size:11px;color:#aaa}

/* 水平仪 */
#level-panel{position:fixed;top:12px;left:10px;z-index:100;width:62px;background:rgba(0,0,0,.65);border-radius:10px;padding:6px;backdrop-filter:blur(6px);display:none}
#level-ring{width:38px;height:38px;border-radius:50%;border:1.5px solid rgba(255,255,255,.25);position:relative;margin:0 auto 4px;background:radial-gradient(circle,rgba(255,255,255,.05) 0%,transparent 70%)}
#level-crosshair{position:absolute;top:50%;left:50%;width:7px;height:7px;transform:translate(-50%,-50%);border:1px solid rgba(255,255,255,.25);border-radius:50%}
#level-bubble{position:absolute;top:50%;left:50%;width:8px;height:8px;margin:-4px 0 0 -4px;border-radius:50%;background:radial-gradient(circle at 30% 30%,#5dade2,#2e86c1);border:1px solid rgba(255,255,255,.4);box-shadow:0 0 4px rgba(93,173,226,.5);transition:transform .1s ease-out;z-index:2}
#level-info{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:10px;color:#fff}

/* 侧边按钮 */
#side-btns{position:fixed;right:10px;bottom:90px;z-index:100;display:flex;flex-direction:column;gap:8px}
.side-btn{width:44px;height:44px;background:rgba(255,255,255,.92);border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:18px;box-shadow:0 2px 8px rgba(0,0,0,.15);cursor:pointer;border:none;outline:none}

/* 底部信息栏 */
#bottom-bar{position:fixed;bottom:0;left:0;right:0;z-index:100;background:rgba(0,0,0,.7);backdrop-filter:blur(8px);padding:8px 14px calc(env(safe-area-inset-bottom,0px) + 8px);display:flex;align-items:center;gap:10px;color:#fff;font-size:11px;flex-wrap:wrap}
#bottom-bar .item{display:flex;flex-direction:column}
#bottom-bar .label{color:#aaa;font-size:9px}
#bottom-bar .value{font-family:Consolas,monospace;font-size:11px}
#bottom-bar .divider{width:1px;height:20px;background:rgba(255,255,255,.2)}
.coord-item{flex:1;min-width:180px}

/* 菜单 */
#menu-mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:199;background:transparent;display:none}
#menu-popup{position:fixed;right:10px;bottom:145px;z-index:200;background:rgba(255,255,255,.96);border-radius:12px;padding:6px 0;min-width:140px;box-shadow:0 4px 20px rgba(0,0,0,.2);display:none}
#menu-popup.show{display:block}
.menu-item{display:flex;align-items:center;padding:10px 16px;gap:8px;cursor:pointer;font-size:14px;color:#333}
.menu-item:hover{background:#f0f0f0}
.menu-divider{height:1px;background:#eee;margin:2px 10px}

/* 测量工具栏 */
#measure-bar{position:fixed;top:120px;left:50%;transform:translateX(-50%);z-index:150;background:rgba(0,0,0,.8);border-radius:12px;padding:8px 14px;backdrop-filter:blur(6px);display:none;flex-direction:column;align-items:center;gap:6px;color:#fff;min-width:200px}
#measure-bar.show{display:flex}
#measure-bar .actions{display:flex;gap:6px}
#measure-bar .btn{padding:4px 12px;border-radius:6px;font-size:12px;background:rgba(255,255,255,.15);color:#fff;border:none;cursor:pointer}
#measure-bar .btn-end{background:#e74c3c}
#measure-result{font-size:12px;color:#5dade2;padding-top:6px;border-top:1px solid rgba(255,255,255,.1);width:100%;text-align:center}

/* 弹窗遮罩 */
.modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:300;background:rgba(0,0,0,.4);display:none}
.modal-mask.show{display:block}
.modal-box{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:310;background:#fff;border-radius:14px;padding:20px;width:88%;max-width:380px;max-height:85vh;overflow-y:auto;box-shadow:0 8px 30px rgba(0,0,0,.2);display:none}
.modal-box.show{display:block}
.modal-title{font-size:16px;font-weight:bold;color:#333;margin-bottom:6px}
.modal-subtitle{font-size:12px;color:#999;margin-bottom:10px}
.modal-coord{font-size:13px;color:#2e86c1;font-family:Consolas,monospace;background:#f5f8fb;padding:8px;border-radius:8px;margin-bottom:12px;text-align:center}
.modal-input{border:1px solid #ddd;border-radius:8px;padding:10px 12px;font-size:14px;margin-bottom:14px;width:100%;box-sizing:border-box}
.modal-textarea{border:1px solid #ddd;border-radius:8px;padding:10px 12px;font-size:13px;width:100%;height:160px;max-height:160px;margin-bottom:14px;box-sizing:border-box;resize:none;font-family:Consolas,monospace}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}
.modal-btn{padding:8px 20px;border-radius:8px;font-size:14px;border:none;cursor:pointer}
.modal-btn-sm{padding:6px 14px;font-size:13px}
.btn-cancel{background:#f0f0f0;color:#666}
.btn-confirm{background:#2e86c1;color:#fff}
.btn-danger{background:#e74c3c;color:#fff}

/* 选项行 */
.opt-row{display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap}
.opt-item{flex:1;min-width:60px;text-align:center;padding:6px 2px;border:1.5px solid #ddd;border-radius:8px;font-size:12px;color:#666;background:#fafafa;cursor:pointer}
.opt-item.active{border-color:#2e86c1;background:#eaf2f8;color:#2e86c1;font-weight:bold}
.opt-item:hover{background:#eaf2f8}
.import-hint{font-size:11px;color:#aaa;text-align:center;margin-bottom:10px;line-height:1.5}
.file-btn{display:block;margin:0 auto 8px;padding:6px 16px;border:1.5px dashed #2e86c1;border-radius:8px;font-size:13px;color:#2e86c1;background:#f5f8fb;cursor:pointer}

/* 收藏列表面板 */
#fav-panel{position:fixed;bottom:0;left:3%;right:3%;z-index:310;background:#fff;border-radius:16px 16px 0 0;max-height:65vh;display:none;flex-direction:column;box-shadow:0 -4px 20px rgba(0,0,0,.2)}
#fav-panel.show{display:flex}
#fav-panel .panel-header{display:flex;justify-content:space-between;align-items:center;padding:16px 18px 10px;border-bottom:1px solid #f0f0f0}
#fav-panel .panel-title{font-size:16px;font-weight:bold;color:#333}
#fav-panel .panel-close{font-size:18px;color:#999;cursor:pointer;padding:4px}
#fav-list{flex:1;overflow-y:auto;padding:0 12px;max-height:45vh}
.fav-empty{text-align:center;padding:40px 0;color:#bbb;font-size:14px}
.fav-item{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:1px solid #f5f5f5}
.fav-main{flex:1;min-width:0;cursor:pointer}
.fav-seq{background:#2e86c1;color:#fff;border-radius:4px;padding:1px 6px;font-size:11px;font-weight:bold;display:inline;margin-right:6px}
.fav-note{font-size:13px;color:#333;font-weight:500}
.fav-coord{font-size:11px;color:#888;font-family:Consolas,monospace;display:block;margin-top:2px}
.fav-actions{display:flex;flex-shrink:0;gap:4px}
.fav-btn{border:none;background:none;font-size:16px;cursor:pointer;padding:6px;opacity:.5}
.fav-btn:hover{opacity:1}
#fav-panel .panel-footer{padding:10px 18px;border-top:1px solid #f0f0f0;text-align:center}
#fav-panel .clear-btn{color:#e74c3c;border:none;background:none;font-size:14px;cursor:pointer;padding:8px}

@media(max-width:480px){
  .modal-box{width:94%;padding:16px}
  #compass-box{width:72px;height:72px}
  #compass-ring{width:48px;height:48px}
  #compass-deg{font-size:11px}
}
