* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #111; color: #eee; font-family: -apple-system, sans-serif; }

.screen { display: none; position: fixed; inset: 0; overflow-y: auto; }
.screen.active { display: block; }

/* 開始画面 */
#scr-start { padding: max(24px, env(safe-area-inset-top)) 24px 24px; }
#scr-start h1 { font-size: 26px; margin: 24px 0 16px; }
.note { color: #aaa; line-height: 1.7; margin-bottom: 28px; }

button.big {
  display: block; width: 100%; padding: 16px; font-size: 20px;
  border: none; border-radius: 12px; background: #2b7de9; color: #fff;
}
button.big:active { opacity: .8; }
button.big.stop { background: #e94b3c; }
button.big.sub { background: #333; margin-top: 12px; font-size: 16px; }

/* かんたん計測 */
#scr-tap { padding: max(20px, env(safe-area-inset-top)) 16px 24px; }
#scr-tap h2 { font-size: 18px; margin: 8px 0 10px; }
#scr-tap .note { margin-bottom: 14px; }
#tapmap { width: 100%; border-radius: 12px; background: #1e1e1e; touch-action: manipulation; }
#tap-status { color: #ccc; font-size: 15px; margin: 12px 0 16px; text-align: center; }

#past-sessions { margin-top: 36px; }
#past-sessions h3 { font-size: 14px; color: #888; margin-bottom: 8px; }
.session-row {
  display: block; width: 100%; text-align: left; padding: 12px;
  margin-bottom: 8px; border: none; border-radius: 8px;
  background: #222; color: #ddd; font-size: 15px;
}
.session-row small { color: #888; }
.session-del { float: right; color: #e94b3c; background: none; border: none; font-size: 15px; padding: 12px; }

/* 計測画面 */
#scr-measure { overflow: hidden; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

#hud {
  position: absolute; top: max(16px, env(safe-area-inset-top)); left: 0; right: 0;
  text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,.9);
}
#hud-mbps { font-size: 64px; font-weight: 700; }
#hud-mbps .unit { font-size: 22px; font-weight: 400; margin-left: 6px; }
#hud-sub { font-size: 15px; color: #ddd; }

#minimap {
  position: absolute; right: 12px; bottom: 110px;
  width: 140px; height: 140px;
  background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.4); border-radius: 10px;
}
#minimap-hint {
  position: absolute; right: 12px; bottom: 88px; width: 140px;
  font-size: 10px; color: #ccc; text-align: center; text-shadow: 0 1px 3px #000;
}
#btn-stop {
  position: absolute; left: 16px; right: 16px; bottom: max(20px, env(safe-area-inset-bottom));
  width: auto;
}

/* 結果画面 */
#scr-result { padding: max(20px, env(safe-area-inset-top)) 16px 24px; }
#scr-result h2 { font-size: 18px; margin: 8px 0 12px; }
#heatmap { width: 100%; border-radius: 12px; background: #1a1a1a; }
#legend { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 13px; color: #ccc; }
#legend .bar { flex: 1; height: 12px; border-radius: 6px;
  background: linear-gradient(to right, hsl(0,80%,50%), hsl(60,80%,50%), hsl(120,70%,45%)); }
#result-stats { color: #aaa; font-size: 14px; line-height: 1.8; margin-bottom: 20px; }
