:root {
  color-scheme: dark;
  --bg: #090c11;
  --panel: #10161d;
  --line: #28303a;
  --text: #e8edf0;
  --muted: #9aa6b2;
  --accent: #73baff;
  --rose: #fe8496;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
}
* {box-sizing: border-box}
body {margin: 0; min-width: 280px}
button {font: inherit; color: inherit}
button {cursor: pointer}
button, a { -webkit-tap-highlight-color: transparent }
button {border: 0; background: transparent}
button:focus-visible, a:focus-visible, canvas:focus-visible {outline: 2px solid var(--accent); outline-offset: 3px}
a {color: inherit}
button:disabled {opacity: .36; cursor: default}
.icon {width: 18px; height: 18px; flex: none; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round}
.topbar {border-bottom: 1px solid #242c34; background: #0d1218}
.top-inner, .page-heading, main {width: min(100% - 80px, 1620px); margin-inline: auto}
.top-inner {height: 62px; display: flex; align-items: center; gap: 19px}
.brand {display: inline-flex; align-items: center; gap: 9px; font: 650 25px/1 Inter, "Helvetica Neue", sans-serif; letter-spacing: -1.25px}
.brand img {width: 34px; height: 34px}
.brand span {white-space: nowrap}
.page-heading {margin-block: 0; padding: 0 0 16px 43px}
.page-heading h1 {margin: 0; font-size: clamp(1.12rem, 1.6vw, 1.5rem); line-height: 1.4}
.page-heading p {margin: 4px 0 0; color: var(--muted); font-size: .83rem; line-height: 1.5}
.top-status {margin-left: auto; display: flex; align-items: center; gap: 7px; background: #112335; border: 1px solid #253f5a; color: #a6c9eb; font-size: 11px; padding: 5px 10px; border-radius: 5px; letter-spacing: .03em}
.status-dot, .dot {width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); flex: none}
.clock {font: 13px/1 var(--mono); letter-spacing: .025em; color: #cbd3d8; font-variant-numeric: tabular-nums}
.clock small {font-size: 10px; color: var(--muted); margin-left: 2px}
.intro {padding: clamp(26px, 3vw, 49px) 0 clamp(22px, 2.3vw, 36px)}
.main-banner {margin: 0; font-family: monospace; font-size: clamp(2rem, 3.65vw, 3.85rem); font-weight: 900; line-height: 1.32; color: #9acaff; -webkit-text-stroke: .02em currentColor}
.sub-banner {margin: 11px 0 0; color: #a1acb6; font-size: clamp(.875rem, 1.12vw, 1.08rem); letter-spacing: .045em}
.dashboard {display: grid; grid-template-columns: minmax(0, 2.48fr) minmax(280px, 1fr); gap: 18px; align-items: stretch}
.card {min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden}
.globe-card {display: flex; flex-direction: column}
.section-heading, .dialog-head {display: flex; align-items: center; justify-content: space-between; gap: 8px}
.map-modes {right: 15px; top: 15px; display: inline-flex; padding: 2px; border: 1px solid #303d48; border-radius: 6px; background: var(--bg)}
.map-modes button {padding: 4px 10px; border: 1px solid transparent; border-radius: 4px; font-size: 12px; line-height: 18px; color: var(--muted)}
.map-modes button:hover {color: var(--text); background: #18212a}
.map-modes button[aria-pressed="true"] {color: #abd6ff; background: #182d41; border-color: #345776; font-weight: 650}
h2 {margin: 0; display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 1.3; font-weight: 650; letter-spacing: .05em}
h2 .icon {color: #8ca4b0; width: 18px; height: 18px}
.stage {isolation: isolate; position: relative; flex: 1; min-height: clamp(402px, 53vh, 708px); overflow: hidden; background-color: #070c13; background-image: radial-gradient(ellipse at 50% 52%, #10223b70, transparent 67%), linear-gradient(#314a591b 1px, transparent 1px), linear-gradient(90deg, #314a591b 1px, transparent 1px); background-size: auto, 42px 42px, 42px 42px; background-position: center}
.stage canvas {position: absolute; inset: 0; display: block; width: 100%; height: 100%}
#signals {touch-action: none; cursor: grab}
#signals:active {cursor: grabbing}
#signals:focus-visible {outline-offset: -3px}
.map-status, .map-modes, .drag-hint, .view-tools {position: absolute; z-index: 1}
.map-status {left: 16px; top: 15px; display: flex; align-items: center; gap: 7px; font: 600 10px/1 var(--mono); letter-spacing: .1em; color: #8bccff; background: #112335e0; border: 1px solid #28445d; border-radius: 4px; padding: 6px 8px}
.map-status .status-dot {width: 5px; height: 5px; box-shadow: 0 0 7px #54a9ff8a}
.map-status, .drag-hint {pointer-events: none}
.drag-hint {left: 17px; bottom: 13px; display: flex; align-items: center; gap: 6px; font-size: 11px; color: #93a4b1}
.drag-hint .icon {width: 14px; height: 14px}
.view-tools {right: 14px; bottom: 14px; display: grid; border: 1px solid #344049; border-radius: 5px; background: #101a24ed; overflow: hidden}
.view-tools button {display: grid; place-items: center; width: 30px; height: 30px; padding: 0}
.view-tools button + button {border-top: 1px solid #2e3943}
.view-tools .icon {width: 15px; height: 15px}
.view-tools button:hover, .history-button:hover, .close:hover {background-color: #23303b}
.history-button, footer button, .source-mark {display: flex; align-items: center}
.tokyo {color: var(--accent)}
.osaka {color: var(--rose)}
.dot.tokyo, .dot.osaka {background: currentColor}
.history-button {gap: 6px; padding: 5px 8px; color: #c2cbd2; font-size: 12px; border-radius: 4px}
aside {display: flex; flex-direction: column; gap: 16px; min-width: 0}
.section-heading {padding: 17px 18px 0}
.secondary {font-size: 11px; color: var(--muted)}
.stats-body {display: flex; gap: 8px; align-items: end; padding: 14px 19px 15px}
.total {display: flex; align-items: baseline; gap: 7px}
.total strong {font: 700 42px/.95 var(--mono); letter-spacing: -.07em}
.total > span, .split-stats small {font-size: 12px; color: #9caab5}
#history-chart {margin-left: auto; width: 52%; height: 41px; display: block}
.split-stats {border-top: 1px solid var(--line); display: flex; align-items: center; padding: 12px 18px}
.split-stats > div {display: flex; align-items: baseline; flex: 1; gap: 5px}
.split-stats > div + div {border-left: 1px solid var(--line); padding-left: 15px; margin-left: 14px}
.split-stats span {font-size: 12px; color: #b2bdc6; margin-right: auto; display: flex; gap: 6px; align-items: center}
.split-stats strong {font: 700 18px/1 var(--mono); color: #e0e8ec}
.split-stats small {font-size: 11px}
.logs {flex: 1; display: flex; flex-direction: column}
.logs .section-heading {padding-bottom: 13px; padding-top: 14px}
.history-button {color: #a7b2bc; padding-right: 0}
.history-button .icon {width: 13px; height: 13px}
#log-list {list-style: none; display: flex; flex-direction: column; margin: 0 17px; padding: 0 0 4px; flex: 1}
.log-entry {display: flex; gap: 11px; flex: 1; align-items: center; border-top: 1px solid #263039; min-height: 50px; padding: 7px 0}
.route-icon {display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; background: #152638; border: 1px solid #2c4055; border-radius: 7px; color: var(--accent)}
.route-icon.osaka {color: var(--rose); background: #302128; border-color: #473039}
.route-icon .icon {width: 15px; height: 15px}
.route {min-width: 0; flex: 1}
.journey {display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 550; line-height: 1.45; white-space: nowrap}
.journey .origin {overflow: hidden; text-overflow: ellipsis}
.journey .icon {width: 12px; height: 12px; color: #8796a2}
.distance {font: 10px/1.3 var(--mono); color: #93a2af; margin-top: 3px; letter-spacing: .025em}
.log-time {font: 10px var(--mono); color: #92a0ad; align-self: center}
footer {display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 1px 21px; color: #8e9ba6; font-size: 9px; line-height: 1.6}
.source-mark {gap: 6px}
.source-mark .icon, footer button .icon {width: 12px; height: 12px}
.source-mark a {text-decoration-color: #53606b; text-underline-offset: 2px}
footer button {gap: 5px; font-size: 11px; white-space: nowrap; color: #9ba9b5}
footer button:hover, a:hover {color: var(--accent)}
dialog {width: min(530px, calc(100% - 28px)); max-height: 86dvh; margin: auto; background: #121921; color: var(--text); border: 1px solid #35414b; border-radius: 12px; padding: 0; box-shadow: 0 20px 90px #0009}
dialog::backdrop {background: #04080cbf; backdrop-filter: blur(4px)}
.dialog-head {padding: 15px 18px; border-bottom: 1px solid var(--line)}
.close {height: 32px; width: 32px; border-radius: 5px}
.history-filters {display: flex; gap: 4px; padding: 14px 18px}
.history-filters button {font-size: 13px; border-radius: 4px; border: 1px solid transparent; padding: 5px 10px; color: #a3b2bc}
.history-filters button[aria-pressed=true] {color: var(--accent); background: #172739; border-color: #294867}
.history-scroll {max-height: 56vh; overflow: auto; margin: 0 18px 16px}
table {border-collapse: collapse; width: 100%; font-size: 13px}
th, td {text-align: left; padding: 8px 2px; white-space: nowrap; border-bottom: 1px solid var(--line)}
th {font-size: 11px; font-weight: 500; color: #96a8b5; background: #121921; position: sticky; top: 0}
td:first-child, td:last-child {font: 11px var(--mono)}
td:last-child, th:last-child {text-align: right}
.credits-body {padding: 0 20px 10px; color: #c4cfd7; font-size: 14px; line-height: 1.75}
.credits-body dt {font-weight: 650; color: #e8eef2; margin-top: 13px}
.credits-body dd {margin: 2px 0}
.credits-body a {color: var(--accent)}
@media (min-width: 1600px) { .stage {min-height: 560px} }
@media (max-width: 1100px) {
  .top-inner, .page-heading, main {width: calc(100% - 48px)}
  .dashboard {grid-template-columns: minmax(0, 2fr) minmax(270px, 1fr); gap: 13px}
  .section-heading {padding-inline: 14px}
  #log-list {margin-inline: 13px}
}
@media (max-width: 800px) {
  .dashboard {grid-template-columns: 1fr}
  .stage {min-height: clamp(360px, 73vw, 520px)}
  aside {display: grid; grid-template-columns: minmax(205px, .85fr) minmax(0, 1.15fr); align-items: start; gap: 13px}
  .intro {padding: 25px 0 22px}
}
@media (max-width: 590px) {
  .top-inner, .page-heading, main {width: calc(100% - 28px)}
  .top-inner {gap: 8px; height: 54px}
  .brand {font-size: clamp(17px, 4.8vw, 23px); gap: 6px}
  .brand img {width: 30px; height: 30px}
  .page-heading {padding-inline-start: 36px}
  .top-status {font-size: 10px; padding: 4px 6px}
  .clock {font-size: 11px}
  .clock small {display: none}
  .main-banner {font-size: clamp(1.6rem, 7vw, 2.5rem); line-height: 1.4}
  .main-banner span {display: inline-block; max-width: 100%}
  .sub-banner {font-size: 12px; letter-spacing: 0; margin-top: 8px}
  .stage {min-height: clamp(305px, 92vw, 465px)}
  .map-status {top: 10px; left: 10px}
  .map-modes {top: 10px; right: 10px}
  .drag-hint {left: 10px; bottom: 9px; font-size: 10px}
  .view-tools {right: 8px; bottom: 9px}
  .view-tools button {height: 28px; width: 28px}
  aside {display: flex; align-items: stretch}
  footer {align-items: flex-start; gap: 8px}
  .source-mark {align-items: flex-start}
  .source-mark > .icon {margin-top: 1px}
}
@media (max-width: 380px) {
  .top-inner {display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 2px 4px}
  .brand {grid-row: span 2}
  .clock {justify-self: end}
  .map-modes button {padding-inline: 6px}
}
.log-caption {font-size: 11px; line-height: 1.6; color: #a2aebb; margin: -3px 17px 10px}
.protocol {border: 1px solid #35414a; border-radius: 3px; color: #b3c1cc; font: 10px/1.25 var(--mono); letter-spacing: .04em; padding: 1px 4px}
.log-meta {margin-top: 4px; display: flex; align-items: center; gap: 7px}
.log-entry {min-height: 49px}
.empty-log {font-size: 12px; color: var(--muted); padding: 22px 0; text-align: center}
.stage.flat #signals {cursor: default; touch-action: pan-y}
.stage.flat .drag-hint {display: none}
.chart-box {margin-left: auto; width: 52%; text-align: right; color: #93a2ae; font: 9px var(--mono)}
.chart-box #history-chart {width: 100%; height: 36px; margin: 0 0 3px}
.history-limit {margin-right: auto; font-size: 11px; color: var(--muted)}
.log-meta .distance {margin-top: 0}
@media (prefers-reduced-motion: no-preference) {
  .log-entry:first-child {animation: received .35s ease-out}
  @keyframes received {from {background-color: #213346; transform: translateY(-3px)} to {background-color: transparent; transform: none}}
}
