*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(120% 70% at 50% 0%, #f6f8f8 0%, rgba(246, 248, 248, 0) 60%),
    var(--bg);
}

.sheet {
  width: 100%;
  max-width: 452px;
  min-width: 0;
}

.brand {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.brand::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 1px;
  background: var(--accent);
  transform: translateY(-1px);
}

h1 {
  margin: 16px 0 12px;
  font-family: var(--serif);
  font-size: clamp(26px, 7.6vw, 34px);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lede {
  margin: 0;
  max-width: 34em;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.banner {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------------------------------------------------- 核心动作：一个大圆 */

.action {
  margin: 40px 0 6px;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.dial {
  position: relative;
  width: 182px;
  height: 182px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-content: center;
  gap: 3px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 16px 34px -18px rgba(14, 107, 96, 0.95);
  transition: transform 0.16s ease, background 0.16s ease;
}
.dial:hover { background: var(--accent-press); }
.dial:active { transform: scale(0.975); }
.dial:focus-visible { outline: 3px solid var(--accent); outline-offset: 7px; }
.dial:disabled { cursor: progress; }

.dial-label {
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.dial-sub {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

/* 定位中：两道同心圆向外扩散，只在等待时有动效 */
.dial::before,
.dial::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
.dial.is-locating::before { animation: ping 2.1s cubic-bezier(0.2, 0.6, 0.3, 1) infinite; }
.dial.is-locating::after { animation: ping 2.1s cubic-bezier(0.2, 0.6, 0.3, 1) 0.7s infinite; }

@keyframes ping {
  0% { opacity: 0.5; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.42); }
}

.status {
  margin: 0;
  min-height: 1.6em;
  text-align: center;
  font-size: 15px;
  color: var(--ink-2);
}
.status[data-kind="done"] { color: var(--accent); font-weight: 500; }
.status[data-kind="error"] { color: var(--danger); }

/* ---------------------------------------------------- 读数面板 */

.readout {
  margin: 28px 0 0;
  padding: 4px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

dl { margin: 0; }

.row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}
.row:first-child { border-top: 0; }

dt {
  font-size: 13px;
  color: var(--ink-3);
}

dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.mono {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.maplink {
  display: inline-block;
  margin-top: 4px;
  font-size: 14.5px;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.maplink:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.fine {
  margin: 30px 0 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-3);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
/* 兜底：改发大致位置（文字按钮，弱化但可见） */
.fallback {
  margin: 0;
  padding: 6px 2px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.fallback:hover { color: var(--accent-press); }
.fallback:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* IP 粗定位的精度读数要看起来"没那么确定" */
.mono.coarse, dd.coarse { color: #8a5a1c; }
