/* 共享样式：iOS 风格浅色主题，移动优先 */
:root {
  --bg: #f2f3f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --text2: #6e6e73;
  --line: #e5e5ea;
  --blue: #007aff;
  --blue-press: #0062d6;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.05);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }

/* 顶部导航 */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(242, 243, 247, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line);
}
.nav-inner {
  max-width: 640px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.nav .title { font-size: 17px; font-weight: 600; }
.nav .spacer { flex: 1; }

/* 卡片与列表 */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 17px; margin-bottom: 8px; }
.card .desc { color: var(--text2); font-size: 14px; margin-bottom: 12px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; }
.row + .row { border-top: 0.5px solid var(--line); }
.row .label { color: var(--text2); font-size: 14px; flex-shrink: 0; }
.row .value { font-size: 15px; text-align: right; word-break: break-all; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: var(--text2); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text);
  outline: none; transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--blue); }

/* 按钮 */
.btn {
  display: block; width: 100%; padding: 14px; font-size: 17px; font-weight: 600;
  color: #fff; background: var(--blue); border: none; border-radius: 14px;
  cursor: pointer; transition: opacity 0.15s; text-decoration: none; text-align: center;
}
.btn:active { opacity: 0.75; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.ghost { background: #fff; color: var(--blue); border: 1.5px solid var(--blue); }
.btn.small { width: auto; display: inline-block; padding: 8px 16px; font-size: 14px; border-radius: 10px; }

/* 提示条 */
.tip {
  border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px;
  display: flex; gap: 10px; align-items: flex-start; line-height: 1.45;
}
.tip.info { background: #e8f1ff; color: #0a5bc4; }
.tip.warn { background: #fff4e5; color: #b25e00; }
.tip.danger { background: #ffe9e7; color: #c0261f; }
.tip.ok { background: #e6f9ec; color: #1d7a3a; }
.tip .icon { font-size: 16px; flex-shrink: 0; }

/* token 大字展示 */
.token-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px; font-weight: 700; letter-spacing: 1px;
  background: #f7f8fa; border: 1.5px dashed var(--line); border-radius: 12px;
  padding: 18px 14px; text-align: center; word-break: break-all; margin: 12px 0;
}

/* 步骤卡片（安装引导） */
.step { border-left: 3px solid var(--blue); }
.step.done { border-left-color: var(--green); }
.step .step-head { display: flex; align-items: center; gap: 10px; }
.step .num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.step.done .num { background: var(--green); }
.step h2 { flex: 1; }
.step .body { margin: 10px 0 0 36px; font-size: 15px; color: var(--text2); }
.step .body ol { padding-left: 20px; }
.step .body li { margin: 4px 0; }
.step .check { margin: 12px 0 0 36px; }

/* 进度条（流量） */
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 4px; transition: width 0.3s; }
.bar.warn > i { background: var(--orange); }
.bar.full > i { background: var(--red); }

/* 地图页布局 */
#map-page { display: flex; flex-direction: column; height: 100vh; }
#map { flex: 1; min-height: 0; }
.map-panel {
  background: var(--card); border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}
.coords { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--text2); }

/* 管理后台表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 0.5px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--text2); font-weight: 500; }
.tbl-wrap { overflow-x: auto; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge.on { background: #e6f9ec; color: #1d7a3a; }
.badge.off { background: #f0f0f2; color: #8e8e93; }
.badge.bad { background: #ffe9e7; color: #c0261f; }

.muted { color: var(--text2); font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.hidden { display: none !important; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.78); color: #fff; padding: 10px 18px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 999;
  max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Safari 拦截层（iOS 非 Safari 环境全屏拦截） */
#safari-guard {
  position: fixed; inset: 0; z-index: 2000;
  background: linear-gradient(180deg, #f5f5f7 0%, #fff 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
#safari-guard .sg-card {
  text-align: center; max-width: 340px; animation: sg-in 0.35s ease;
}
#safari-guard .sg-icon { font-size: 52px; margin-bottom: 12px; }
#safari-guard h2 { font-size: 20px; margin-bottom: 10px; }
#safari-guard p { font-size: 15px; color: var(--text2); line-height: 1.6; margin-bottom: 8px; }
#safari-guard .sg-tip {
  background: var(--card); border-radius: 14px; padding: 14px 16px;
  border: 0.5px solid var(--line); font-size: 14px;
}
@keyframes sg-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
