:root {
  --bg: #F2F4F3;
  --surface: #FFFFFF;
  --surface-2: #E9EDEB;
  --ink: #1C2B33;
  --muted: #5C6B73;
  --line: #D8DEDC;
  --accent: #24557C;
  --ok: #1F8A4C;
  --warn: #C77D0A;
  --stale: #8A949B;
  --err: #C2403A;
  --err-soft: #F9E5E4;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.hidden { display: none !important; }

.banner {
  background: var(--err-soft);
  color: var(--err);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--line);
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.head .title { font-weight: 700; }
.tabs { display: flex; gap: 6px; }
.tab {
  font: inherit;
  font-size: 13px;
  padding: 5px 16px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cond {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.cond label { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.cond select, .cond input {
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.cond button {
  font: inherit;
  font-weight: 700;
  padding: 4px 20px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.h-empty { color: var(--muted); }

.main { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; }

.vlist {
  width: 190px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 10px;
}
.vlist .lbl {
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.vcard {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  cursor: pointer;
}
.vcard:hover { border-color: var(--accent); }
.vcard.follow { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.vcard .r1 { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.vcard .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.vcard.stale { color: var(--stale); }
.vcard.stale .r1 { font-weight: 400; }
.vcard.stale .dot { background: var(--stale); }
.vcard .r2 { font-size: 11px; color: var(--muted); padding-left: 15px; }

.status {
  display: flex;
  gap: 22px;
  padding: 6px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.status b { font-weight: 700; color: var(--ink); }
.status b.ok { color: var(--ok); }
.status b.err { color: var(--err); }

/* 車両マーカー */
.marker { cursor: pointer; text-align: center; color: var(--ok); }
.marker.stale { color: var(--stale); }
.marker .micon {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}
.marker .micon svg { position: absolute; inset: 0; display: none; }
/* 既定(走行中・bearing あり)は矢印。停車中は点、方位不明は破線円に切り替える */
.marker .micon .i-arrow {
  display: block;
  transition: transform .8s ease;
  will-change: transform;
}
.marker.stopped .micon .i-arrow,
.marker.noheading .micon .i-arrow { display: none; }
.marker.stopped .micon .i-dot { display: block; }
.marker.noheading .micon .i-ring { display: block; }
.marker .mlabel {
  font-size: 10px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.marker.stale .mlabel { color: var(--stale); }
.marker .mlabel small { font-weight: 400; color: var(--muted); }

.se-marker {
  width: 22px; height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.se-marker.s { background: var(--ok); }
.se-marker.e { background: var(--err); }

.maplibregl-popup-content {
  font-family: inherit;
  font-size: 12px;
  padding: 10px 14px;
}
.popup-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.popup-row { display: flex; justify-content: space-between; gap: 18px; }
.popup-row .k { color: var(--muted); }
.popup-link {
  margin-top: 7px; padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.login {
  position: fixed; inset: 0;
  background: rgba(28,43,51,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
.login-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 28px 32px;
  width: 320px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-title { font-weight: 700; font-size: 16px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-box input {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.login-box button {
  font: inherit; font-weight: 700;
  padding: 9px 0;
  border: none; border-radius: 8px;
  background: var(--accent); color: #fff;
  cursor: pointer;
}
.login-err { color: var(--err); font-size: 12px; }

/* ---- Blazor Server 再接続 UI(画面設計 §5.4 の赤バナーとして表示) ---- */
#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected { display: block; }
