* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg-primary: #0f1117;
    --bg-surface: #1a1d27;
    --bg-surface2: #252836;
    --bg-card: rgba(255,255,255,0.06);
    --border-color: #2e3245;
    --text-primary: #e4e6f0;
    --text-secondary: #8b8fa3;
    --text-tertiary: rgba(255,255,255,0.3);
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0,0,0,0.5);
    --input-bg: rgba(255,255,255,0.06);
    --input-border: rgba(255,255,255,0.1);
    --input-text: #e4e6f0;
    --toast-bg: #1a1d27;
    --transition: 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-surface: #ffffff;
    --bg-surface2: #d1d1d6;
    --bg-card: rgba(0,0,0,0.04);
    --border-color: #d1d1d6;
    --text-primary: #1a1a1e;
    --text-secondary: #6c6c70;
    --text-tertiary: rgba(0,0,0,0.3);
    --shadow: 0 8px 32px rgba(0,0,0,0.12);
    --input-bg: rgba(0,0,0,0.04);
    --input-border: rgba(0,0,0,0.1);
    --input-text: #1a1a1e;
    --toast-bg: #ffffff;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    user-select: none;
    transition: background var(--transition), color var(--transition);
}

#map {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}
.amap-container { background: var(--bg-primary) !important; }

.titlebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 8px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    transition: background var(--transition), border var(--transition);
}
.titlebar .left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.titlebar .left .dots {
    display: flex;
    gap: 6px;
    align-items: center;
}
.titlebar .left .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.titlebar .left .dot-red { background: #ff5f57; }
.titlebar .left .dot-yellow { background: #ffbd2e; }
.titlebar .left .dot-green { background: #28c840; }
.titlebar .left .title {
    font-size: 15px;
    font-weight: 600;
    margin-left: 6px;
}
.titlebar .center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 12px;
    min-width: 0;
}
.titlebar .right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.titlebar .right .menu-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
}
.titlebar .right .menu-btn:hover { background: var(--bg-surface2); }

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-surface2);
    border-radius: 20px;
    padding: 4px 12px;
    width: 280px;
    max-width: 100%;
    border: 1px solid var(--border-color);
    transition: border 0.2s;
}
.search-wrap:focus-within {
    border-color: var(--accent);
}
.search-wrap .search-icon {
    color: var(--text-secondary);
    font-size: 14px;
    margin-right: 8px;
    flex-shrink: 0;
}
.search-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 6px 0;
    min-width: 0;
}
.search-wrap input::placeholder {
    color: var(--text-secondary);
    font-size: 13px;
}
#searchResults {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow);
    display: none;
}
#searchResults.show {
    display: block;
}
#searchResults .result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    font-size: 13px;
}
#searchResults .result-item:last-child {
    border-bottom: none;
}
#searchResults .result-item:hover {
    background: var(--bg-surface2);
}
#searchResults .result-item .name {
    font-weight: 500;
    color: var(--text-primary);
}
#searchResults .result-item .addr {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
#searchResults .result-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.float-group {
    position: fixed;
    right: 20px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    top: 50%;
    transform: translateY(-50%);
}
.float-group .float-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    user-select: none;
    background: transparent;
    border: none;
    padding: 0;
}
.float-group .float-item:hover {
    transform: scale(1.12);
    color: var(--accent);
}
.float-group .float-item:active { transform: scale(0.92); }
.float-group .float-item .icon {
    font-size: 30px;
    line-height: 1.2;
    color: var(--text-primary);
    transition: color 0.2s;
}
.float-group .float-item:hover .icon { color: var(--accent); }
.float-group .float-item .label {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.1;
    letter-spacing: 0.3px;
}
.float-group .float-item.locating {
    animation: pulse-locate 0.8s ease-in-out infinite;
}
.float-group .float-item.locating .icon { color: var(--accent); }

@keyframes pulse-locate {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 10px 16px 16px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    transition: background var(--transition), border var(--transition);
}
.bottom-bar .coords {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Menlo', monospace;
    margin-bottom: 8px;
}
.bottom-bar .coords .value { color: var(--text-primary); font-weight: 500; }
.bottom-bar .actions {
    display: flex;
    gap: 10px;
}
.bottom-bar .actions .btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius);
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.bottom-bar .actions .btn-lock {
    background: var(--accent);
    color: #fff;
}
.bottom-bar .actions .btn-lock:hover { background: var(--accent-hover); }
.bottom-bar .actions .btn-lock:active { transform: scale(0.98); }
.bottom-bar .actions .btn-lock:disabled { opacity: 0.4; cursor: not-allowed; }
.bottom-bar .actions .btn-fav {
    background: var(--bg-surface2);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    flex: 0.5;
}
.bottom-bar .actions .btn-fav:hover { border-color: var(--accent); }

#sidePanel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    z-index: 200;
    background: var(--bg-card);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    padding: 20px 18px;
    padding-top: calc(env(safe-area-inset-top) + 12px);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 4px 0 30px var(--shadow);
}
#sidePanel.open { transform: translateX(0); }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.panel-header .panel-title {
    font-size: 17px;
    font-weight: 600;
    opacity: 0.85;
}
.panel-header .close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
}
.panel-header .close-btn:hover {
    opacity: 1;
    background: var(--bg-surface2);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-item {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--bg-surface2);
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}
.panel-item .label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.panel-item .value {
    font-size: 14px;
    font-weight: 500;
    margin-top: 4px;
    word-break: break-all;
    color: var(--text-primary);
}
.panel-item .value .mono {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.panel-actions {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.panel-actions .btn {
    padding: 11px;
    border-radius: var(--radius);
    background: var(--bg-surface2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    opacity: 0.8;
}
.panel-actions .btn:hover {
    opacity: 1;
    background: var(--bg-card);
}
.panel-actions .btn-danger {
    color: var(--danger);
    border-color: rgba(239,68,68,0.2);
}
.panel-actions .btn-danger:hover {
    background: rgba(239,68,68,0.08);
}

#favPanel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 180;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: -4px 0 30px var(--shadow);
}
#favPanel.open { transform: translateX(0); }

.fav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.fav-header .fav-title { font-size: 17px; font-weight: 600; }
.fav-header .close-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
}
.fav-header .close-btn:hover { background: var(--bg-surface2); }

.fav-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.fav-list::-webkit-scrollbar { width: 4px; }
.fav-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.fav-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--bg-surface2);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.fav-item:hover { border-color: var(--accent); background: var(--bg-card); }
.fav-item .fav-info { flex: 1; min-width: 0; }
.fav-item .fav-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-item .fav-coords { font-size: 10px; color: var(--text-secondary); font-family: 'SF Mono', monospace; }
.fav-item .fav-del {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}
.fav-item .fav-del:hover { border-color: var(--danger); color: var(--danger); }
.fav-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 40px 0;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    display: none;
    backdrop-filter: blur(4px);
}
#overlay.active { display: block; }
#overlay-fav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 170;
    display: none;
    backdrop-filter: blur(4px);
}
#overlay-fav.active { display: block; }

#toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    bottom: 90px;
    padding: 10px 22px;
    background: var(--toast-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: var(--shadow);
    pointer-events: none;
    max-width: 90%;
    color: var(--text-primary);
    text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--danger); }
#toast.success { border-color: var(--success); }

#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.75);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
#loginOverlay.hidden { display: none; }
.login-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 36px 28px;
    width: 380px;
    max-width: 92vw;
    box-shadow: var(--shadow);
}
.login-box h2 {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}
.login-box .sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}
.login-box .error {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    min-height: 22px;
    margin-bottom: 10px;
}
.login-box .form-group { margin-bottom: 14px; }
.login-box .form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: var(--input-text);
    font-size: 16px;
    outline: none;
    font-family: 'SF Mono', 'Menlo', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: border 0.2s;
}
.login-box .form-group input:focus { border-color: var(--accent); }
.login-box .btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-box .btn-login:hover { background: var(--accent-hover); }
.login-box .btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

#guideOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.75);
    z-index: 15000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    padding: 20px;
}
#guideOverlay.show { display: flex; }
.guide-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px 28px;
    width: 420px;
    max-width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.guide-box::-webkit-scrollbar { width: 4px; }
.guide-box::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.guide-box h2 {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}
.guide-box .sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
}
.guide-box .step {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--bg-surface2);
    border-radius: var(--radius);
    align-items: flex-start;
}
.guide-box .step-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.guide-box .step-content { flex: 1; }
.guide-box .step-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.guide-box .step-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.guide-box .step-desc strong { color: var(--text-primary); }
.guide-box .important {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 12px 0 16px;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
}
.guide-box .btn-guide {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.guide-box .btn-guide:hover { background: var(--accent-hover); }

@media (max-width: 480px) {
    #sidePanel { width: 260px; }
    #favPanel { width: 260px; }
    .bottom-bar .coords { font-size: 10px; flex-wrap: wrap; gap: 4px; }
    .bottom-bar .coords span { flex: 1; min-width: 45%; }
    .bottom-bar .actions .btn { font-size: 13px; padding: 10px; }
    .bottom-bar .actions .btn-fav { flex: 0.4; }
    .float-group { right: 12px; gap: 12px; }
    .float-group .float-item .icon { font-size: 24px; }
    .float-group .float-item .label { font-size: 9px; }
    .search-wrap { width: 160px; }
    .search-wrap input { font-size: 12px; }
    .login-box { padding: 24px 20px; }
    .guide-box { padding: 24px 20px; width: 100%; }
    .titlebar .title { font-size: 14px; }
}
@media (min-width: 768px) {
    #sidePanel { width: 320px; padding: 20px 24px; }
    #favPanel { width: 320px; padding: 20px 24px; }
    .bottom-bar { padding: 12px 20px 18px; }
    .titlebar { padding: 12px 20px 10px; }
    .float-group { right: 24px; gap: 20px; }
    .float-group .float-item .icon { font-size: 34px; }
    .search-wrap { width: 320px; }
}

/* ============================================================
   圆角优化
   ============================================================ */

/* 顶部状态栏 - 底部圆角 */
.titlebar {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* 底部状态栏 - 顶部圆角 */
.bottom-bar {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

/* 左侧面板 - 右侧圆角 */
#sidePanel {
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* 右侧收藏面板 - 左侧圆角 */
#favPanel {
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
}