:root {
  --bg: #f6f7f9;
  --fg: #1d232b;
  --muted: #5f6b7a;
  --card: #ffffff;
  --line: #d8dde4;
  --accent: #d9480f;
  --accent-fg: #ffffff;
  --danger: #c92a2a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --fg: #e7eaee;
    --muted: #9aa5b1;
    --card: #1e2329;
    --line: #333b45;
    --accent: #ff8a3d;
    --accent-fg: #14171b;
    --danger: #ff6b6b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  display: flex;
  flex-direction: column;
}
header { padding: 8px 16px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
h1 { font-size: 20px; margin: 0; color: var(--accent); }
.sub { color: var(--muted); font-size: 13px; }
main { flex: 1; display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
#map { min-height: 300px; }
.panel { overflow-y: auto; padding: 8px 16px 32px; border-left: 1px solid var(--line); }
@media (max-width: 800px) {
  /* スマホ：地図は上に固定せず、ページ全体をスクロールさせる */
  body { display: block; height: auto; }
  main { display: block; }
  #map { height: 50vh; }
  .panel { overflow: visible; border-left: 0; padding-bottom: 48px; }
}
details { background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 8px 12px; }
summary { font-weight: 600; cursor: pointer; }
.row { display: flex; gap: 8px; margin: 8px 0; align-items: center; }
.wrap { flex-wrap: wrap; }
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]), select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
#search-input { flex: 1; }
#target-km { width: 80px; }
button { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 6px; padding: 7px 12px; cursor: pointer; }
button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); padding: 2px 8px; }
button.danger { background: var(--danger); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
ul, ol { padding-left: 0; margin: 4px 0; list-style: none; }
#search-results li { padding: 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
#points li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--line); }
#points .idx { min-width: 24px; height: 24px; border-radius: 12px; background: var(--accent); color: var(--accent-fg); text-align: center; font-size: 12px; line-height: 24px; }
#points .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
#segments a { display: block; padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line); border-radius: 6px; color: var(--fg); text-decoration: none; }
#segments a:visited { opacity: 0.6; }
#segments a strong { color: var(--accent); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 20px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
.num-icon { background: var(--accent); color: var(--accent-fg); border-radius: 50%; text-align: center; font-weight: 700; font-size: 12px; line-height: 22px; border: 2px solid #fff; }

.num { width: 72px; }
.col { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.file-btn { background: var(--accent); color: var(--accent-fg); border-radius: 6px; padding: 7px 12px; cursor: pointer; }
.file-btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
#points .dwell { width: 52px; padding: 2px 4px; }
.summary-grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0; }
.summary-grid dt { color: var(--muted); }
.summary-grid dd { margin: 0; font-weight: 600; }
.warn { color: var(--danger); font-size: 13px; margin: 4px 0; }
.ok { color: #2b8a3e; }
.timeline li { display: grid; grid-template-columns: 52px 1fr; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.timeline .time { font-variant-numeric: tabular-nums; font-weight: 600; }
.timeline .meta { color: var(--muted); font-size: 12px; }
.timeline .rest .name::before { content: "☕ "; }
.timeline .fuel .name::before { content: "⛽ "; }
#ridden-list li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kind-icon { background: #1c7ed6; color: #fff; border-radius: 50%; text-align: center; font-size: 13px; line-height: 22px; border: 2px solid #fff; }
