/* 运动世界控制台 · iOS / Web 版
   配色与安卓版 Ui.java 一一对应：#0E1218 底 / #161D26 卡片 / #4C8DFF 强调 / #2FBF71 绿 */
:root {
  --bg: #0E1218;
  --card: #161D26;
  --card2: #1E2731;
  --text: #F2F5F8;
  --sub: #8B98A6;
  --accent: #4C8DFF;
  --green: #2FBF71;
  --red: #FF5D5D;
  --amber: #FFB020;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ---------- 登录页 ---------- */
#login {
  min-height: 100vh;
  padding: 40px 20px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .5px;
}
.brand-sub {
  font-size: 12px;
  color: var(--sub);
  margin-top: 4px;
}
.ver {
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 18px;
}

label.field {
  display: block;
  font-size: 12.5px;
  color: var(--sub);
  margin: 4px 0 6px;
}

input[type="text"], input[type="password"], input[type="number"], select, input[type="datetime-local"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid #26313E;
  background: var(--card);
  color: var(--text);
  font-size: 16px;         /* iOS 上 <16px 会触发自动放大 */
  outline: none;
  appearance: none;
}
input:focus, select:focus { border-color: var(--accent); }

button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
button.ghost { background: var(--card2); color: var(--text); font-weight: 500; }
button.green { background: var(--green); }
button.red { background: #3A2530; color: #FF8A8A; }
button:active { opacity: .82; }
button:disabled { opacity: .5; }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.card .note {
  font-size: 11.5px;
  color: var(--sub);
  line-height: 1.5;
  margin: 0 0 10px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #1F2937;
}
.row:last-child { border-bottom: none; }
.row .k { font-size: 13.5px; color: var(--sub); flex: 0 0 auto; }
.row .v {
  font-size: 14px;
  text-align: right;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .v.green { color: var(--green); }
.row .v.accent { color: var(--accent); }
.row.tap .v { color: var(--accent); }

.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; }
.kv .k { color: var(--sub); }
.kv .v { color: var(--text); }

/* ---------- 主界面 ---------- */
#app { display: none; min-height: 100vh; padding-bottom: 84px; }

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, #0E1218 70%, rgba(14, 18, 24, .86));
  padding: 14px 18px 12px;
  border-bottom: 1px solid #1B2430;
  backdrop-filter: blur(8px);
}
.header .t { font-size: 19px; font-weight: 700; }
.header .by { font-size: 10.5px; color: #7D8B9C; margin-top: 3px; }
.header .st { font-size: 11.5px; color: var(--green); margin-top: 4px; }

.page { padding: 14px 14px 20px; display: none; }
.page.on { display: block; }

/* 底部 tab */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  background: #10161F;
  border-top: 1px solid #1E2731;
  padding-bottom: var(--safe-bottom);
}
.tabbar button {
  flex: 1;
  background: none;
  color: var(--sub);
  font-size: 11px;
  font-weight: 500;
  padding: 9px 0 8px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.tabbar button .ico { font-size: 17px; line-height: 1; }
.tabbar button.on { color: var(--accent); }

.log {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--sub);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
  max-height: 300px;
  overflow: auto;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card2);
  color: var(--sub);
}
.badge.ok { background: rgba(47, 191, 113, .16); color: var(--green); }
.badge.bad { background: rgba(255, 93, 93, .16); color: var(--red); }
.badge.warn { background: rgba(255, 176, 32, .16); color: var(--amber); }

#map { width: 100%; height: 320px; border-radius: 14px; overflow: hidden; }
.leaflet-container { background: #0B0F14; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: rgba(30, 39, 49, .96);
  color: var(--text);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  max-width: 86vw;
  text-align: center;
  z-index: 90;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

dialog {
  border: none;
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  padding: 0;
  width: min(88vw, 420px);
  max-height: 76vh;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog .dlg-body { padding: 18px; overflow: auto; max-height: 62vh; }
dialog .dlg-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
dialog .dlg-actions { display: flex; gap: 10px; padding: 0 18px 16px; }
dialog .dlg-actions button { flex: 1; }

.mono { font-family: ui-monospace, Menlo, monospace; }
.small { font-size: 11.5px; color: var(--sub); }