@charset "UTF-8";
:root {
  color-scheme: dark;
  --bg: #09100e;
  --panel: #101a16;
  --line: #26382e;
  --muted: #91a599;
  --green: #b7f76b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0 max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  font-family:
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Noto Sans", sans-serif;
  color: #ecf2eb;
  background: var(--bg);
}
button,
select {
  font: inherit;
}
button,
a,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
h1,
h2,
p {
  margin: 0;
}
h2 {
  font-size: 16px;
  font-weight: 600;
}
.trace-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1400px;
  min-height: 88px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.trace-header__brand {
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.6px;
}
.trace-header__symbol {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 10px;
  border: 1px solid var(--green);
  border-radius: 50%;
  font-size: 24px;
  color: var(--green);
}
.trace-header__accent {
  color: var(--green);
}
.trace-header__tagline {
  display: none;
  font: 11px monospace;
  color: var(--muted);
  letter-spacing: 2px;
  @media (min-width: 800px) {
    display: block;
  }
}
.trace-header__privacy {
  font: 11px monospace;
  color: var(--muted);
}
.trace-header__privacy span {
  margin-right: 5px;
  color: var(--green);
}
.trace-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  @media (min-width: 800px) {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  }
}
.trace-intro {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 40px 0 12px;
}
.trace-eyebrow {
  margin-bottom: 9px;
  font: 10px monospace;
  color: var(--muted);
  letter-spacing: 1.8px;
}
h1 {
  font-size: clamp(28px, 3.2vw, 44px);
  font-weight: 650;
  letter-spacing: -0.04em;
}
.trace-intro__description {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.trace-intro__actions {
  width: 100%;
  @media (min-width: 800px) {
    width: auto;
  }
}
.trace-intro__hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.trace-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #dae5dc;
  background: #18241d;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.trace-button:hover:not(:disabled) {
  border-color: #648064;
  background: #243729;
}
.trace-button--primary {
  width: 100%;
  min-width: 180px;
  min-height: 52px;
  border-color: var(--green);
  color: #16220b;
  background: var(--green);
  font-size: 15px;
}
.trace-button--primary:hover:not(:disabled) {
  background: #d2ff9e;
}
.trace-button--small {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 11px;
  background: transparent;
}
.trace-button--danger {
  color: #e6a79d;
  background: transparent;
}
.trace-panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px;
}
.trace-map,
.trace-speed,
.trace-metrics,
.trace-history {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: clip;
}
.trace-map {
  display: flex;
  flex-direction: column;
}
.trace-map__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plotMap_Tactical,
.plotMap_Real {
  position: relative;
  flex-grow: 1;
  height: clamp(300px, 46dvh, 540px);
  min-height: 300px;
  border-top: 1px solid var(--line);
  background-color: #0c1511;
  background-image:
    linear-gradient(#a8d69b0a 1px, transparent 1px),
    linear-gradient(90deg, #a8d69b0a 1px, transparent 1px);
  background-size: 30px 30px;
}
#tacticalCanvas,
#osmMap {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
}
.trace-map__empty {
  display: flex;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}
.trace-map__empty[hidden] {
  display: none;
}
.trace-map__empty strong {
  font-size: 15px;
  font-weight: 500;
  color: #b6c8b8;
}
.trace-map__empty span:last-child {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.trace-map__crosshair {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 10px;
  border: 1px solid #65824a;
  border-radius: 50%;
  font-size: 32px;
  font-weight: 200;
  color: var(--green);
  box-shadow:
    0 0 0 12px #b7f76b04,
    0 0 50px #b7f76b0a;
}
#tacticalScale {
  position: absolute;
  bottom: 18px;
  left: 22px;
  font: 11px monospace;
  color: var(--muted);
}
.scale-label {
  font-size: 10px;
  letter-spacing: 2px;
}
.scale-bar-container {
  display: flex;
  align-items: center;
  margin: 8px 0;
}
.scale-bar-line {
  width: 80px;
  height: 1px;
  background: #648064;
}
.scale-bar-edge {
  width: 1px;
  height: 5px;
  background: #648064;
}
.trace-map__coordinate {
  position: absolute;
  right: 20px;
  bottom: 20px;
  max-width: 55%;
  font: 10px monospace;
  color: var(--muted);
  text-align: right;
}
.trace-map__status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}
.trace-map__indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #718073;
}
.trace-map__indicator--active {
  background: var(--green);
  box-shadow: 0 0 10px #b7f76466;
}
#gpsStatus {
  flex: 1;
  font-size: 12px;
  color: #b8c9bb;
  line-height: 1.6;
}
.trace-instruments {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.trace-speed {
  flex-grow: 1;
}
.trace-speed__source {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: 10px monospace;
  color: var(--muted);
}
.speedMeter {
  position: relative;
  width: 100%;
  height: clamp(210px, 24vw, 290px);
  margin: 0 auto;
  padding: 0 10px 20px;
}
#analogMeter {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.digitalMeter {
  display: flex;
  position: absolute;
  bottom: 28px;
  left: 50%;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}
#speed {
  font-size: clamp(64px, 6vw, 90px);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -4px;
}
.digitalMeter div:last-child {
  margin-top: 8px;
  font: 12px monospace;
  color: var(--muted);
  letter-spacing: 2px;
}
.trace-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metricBox {
  min-width: 0;
  padding: 22px 18px;
}
.metricBox:first-child {
  border-right: 1px solid var(--line);
}
.metricBox--accuracy {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}
.metricLabel {
  margin-bottom: 12px;
  font: 10px monospace;
  color: var(--muted);
  letter-spacing: 1px;
}
.metricValue {
  font-size: clamp(18px, 2vw, 26px);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metricBox--accuracy .metricLabel {
  margin: 0;
}
.metricBox--accuracy .metricValue {
  font: 13px monospace;
  color: var(--green);
}
.trace-metrics__caption {
  margin-top: 10px;
  font-size: 10px;
  color: var(--muted);
}
.trace-metrics__reset {
  min-height: 32px;
  margin-top: 2px;
  padding: 4px 0;
  border: 0;
  font-size: 11px;
  color: var(--muted);
  background: transparent;
}
.trace-history {
  grid-column: 1 / -1;
}
.trace-history__count {
  font: 11px monospace;
  color: var(--muted);
}
.trace-history__body {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 20px;
  padding: 0 22px 22px;
}
.trace-history__label {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
#historySelect {
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: #e0eadf;
  background: #0c1511;
}
.trace-history__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.trace-history__message {
  margin: 0 22px 22px;
  font-size: 13px;
  color: #f3cc92;
  line-height: 1.6;
}
.trace-history__message:empty {
  display: none;
}
.trace-footer {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 20px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}
.trace-footer > p {
  font: 10px monospace;
  letter-spacing: 1.5px;
}
.trace-footer details {
  width: 100%;
}
.trace-footer summary {
  cursor: pointer;
}
.trace-footer details p {
  max-width: 800px;
  margin-top: 10px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none;
  }
}
/* モバイルの一画面を基準に、余った高さを地図へ割り当てる。 */
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 480px;
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.trace-header {
  flex: none;
  width: 100%;
  min-height: 44px;
  gap: 8px;
}
.trace-header__brand {
  font-size: 15px;
}
.trace-header__symbol {
  width: 24px;
  height: 24px;
  margin-right: 7px;
  font-size: 19px;
}
.trace-header__privacy {
  font-size: 9px;
}
.trace-dashboard {
  flex-grow: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(90px, 1fr) 188px auto;
  gap: 8px;
  width: 100%;
  min-height: 0;
  margin-top: 8px;
  padding-bottom: 0;
  @media (min-width: 800px) {
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
  }
}
.trace-intro {
  flex-wrap: nowrap;
  gap: 10px;
  padding: 0;
}
.trace-intro .trace-eyebrow,
.trace-intro__description,
.trace-intro__hint {
  display: none;
}
h1 {
  font-size: 17px;
  letter-spacing: -0.03em;
  @media (min-width: 800px) {
    font-size: 26px;
  }
}
.trace-intro__actions {
  width: auto;
}
.trace-button--primary {
  min-width: 118px;
  min-height: 42px;
  padding: 8px 16px;
  font-size: 14px;
}
.trace-panel-heading {
  flex: none;
  gap: 6px;
  padding: 10px 12px;
}
.trace-panel-heading .trace-eyebrow {
  display: none;
}
h2 {
  font-size: 12px;
}
.trace-map {
  min-height: 0;
  border-radius: 10px;
}
.trace-map__actions {
  gap: 4px;
}
.trace-button--small {
  min-height: 32px;
  padding: 6px;
  font-size: 10px;
}
.plotMap_Tactical,
.plotMap_Real {
  flex-grow: 1;
  height: 0;
  min-height: 0;
}
#tacticalCanvas,
#osmMap {
  min-height: 0;
}
.trace-map__empty {
  gap: 8px;
  padding: 12px 12px 44px;
}
.trace-map__empty strong {
  font-size: 12px;
}
.trace-map__empty span:last-child {
  font-size: 10px;
}
.trace-map__crosshair {
  width: 36px;
  height: 36px;
  margin-bottom: 0;
  font-size: 22px;
  box-shadow: 0 0 0 8px #b7f76b04;
}
#tacticalScale {
  bottom: 10px;
  left: 12px;
  font-size: 10px;
}
.scale-label {
  display: none;
}
.scale-bar-container {
  margin: 4px 0;
}
.trace-map__coordinate {
  right: 12px;
  bottom: 10px;
  font-size: 9px;
}
.trace-map__status {
  flex: none;
  min-height: 32px;
  padding: 6px 12px;
}
#gpsStatus {
  font-size: 11px;
  line-height: 1.4;
}
.trace-instruments {
  flex-direction: row;
  gap: 8px;
  min-height: 0;
  @media (min-width: 800px) {
    flex-direction: column;
  }
}
.trace-speed {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  @media (min-width: 800px) {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) auto;
  }
}
.trace-speed .trace-panel-heading {
  padding: 8px 10px;
}
.trace-speed__source {
  padding: 2px 4px;
  font-size: 9px;
}
.speedMeter {
  flex-grow: 1;
  height: 0;
  min-height: 0;
  padding: 0 0 4px;
}
#analogMeter {
  width: 100%;
  height: 100%;
}
.digitalMeter {
  bottom: 14px;
}
#speed {
  font-size: 52px;
  letter-spacing: -2px;
  @media (min-width: 800px) {
    font-size: clamp(48px, 7vh, 90px);
  }
}
.digitalMeter div:last-child {
  margin-top: 2px;
  font-size: 10px;
}
.trace-metrics {
  display: flex;
  flex: 0 0 34%;
  flex-direction: column;
  width: 34%;
  min-width: 0;
  @media (min-width: 800px) {
    display: grid;
    flex: none;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) auto;
  }
}
.metricBox {
  flex: 1 1 0;
  min-height: 0;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.metricBox:last-child { border-bottom: 0; }
.metricLabel {
  margin-bottom: 8px;
  font-size: 8px;
  letter-spacing: 0.4px;
}
.metricValue {
  font-size: 14px;
  @media (min-width: 800px) {
    font-size: 22px;
  }
}
.trace-metrics__caption {
  display: none;
}
.trace-metrics__reset {
  min-height: 28px;
  margin: 0;
  font-size: 10px;
}
.metricBox--accuracy {
  display: block;
  flex: 0 0 auto;
  padding: 8px 5px;
}
.metricBox--accuracy .metricLabel { margin-bottom: 8px; }
.metricBox--accuracy .metricValue {
  font-size: 11px;
}
@media (min-width: 800px) {
  .metricBox { padding: 12px 8px; border-bottom: 0; }
  .metricBox--accuracy { grid-column: 1 / -1; }
}
.trace-history {
  border-radius: 10px;
}
.trace-history .trace-panel-heading {
  padding: 8px 12px 0;
}
.trace-history__count {
  font-size: 9px;
}
.trace-history__body {
  flex-wrap: nowrap;
  gap: 8px;
  padding: 8px 12px;
}
.trace-history__label {
  gap: 0;
  font-size: 0;
}
#historySelect {
  min-height: 34px;
  padding: 6px;
  font-size: 11px;
}
.trace-history__actions {
  flex-wrap: nowrap;
  gap: 4px;
}
.trace-history__actions .trace-button {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 10px;
}
.trace-history__message {
  margin: 0 12px 8px;
  font-size: 11px;
}
.trace-footer {
  display: none;
}
/* 極端に低い画面や文字拡大時はスクロールを許容し、操作を欠落させない。 */
.trace-history__actions {
  flex: none;
}
.trace-history__actions .trace-button {
  min-height: 40px;
  padding: 6px;
  white-space: nowrap;
}
#historySelect {
  min-height: 40px;
}
.trace-header__privacy {
  min-height: 36px;
  padding: 4px 0;
  border: 0;
  background: transparent;
}
.trace-info {
  max-width: min(440px, calc(100% - 32px));
  max-height: 85dvh;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #e0eadf;
  background: var(--panel);
}
.trace-info::backdrop {
  background: #000a;
}
.trace-info p {
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.8;
  color: #b8c9bb;
}
body {
  @media (min-width: 800px) {
    min-height: 320px;
  }
}
/* 横向きの低い画面は幅だけでは判定できないため、高さ条件で計器を横並びにする。 */
.metricValue {
  @media (orientation: landscape) and (max-height: 500px) {
    font-size: 15px;
  }
}
#speed {
  @media (orientation: landscape) and (max-height: 500px) {
    font-size: 38px;
  }
}
.trace-map__crosshair {
  @media (orientation: landscape) and (max-height: 500px) {
    display: none;
  }
}
/* Keep speed centered over the dial and enlarge the digits for phone screens. */
#speed {
  font-size: clamp(52px, 16vw, 66px);
  line-height: 0.95;
  letter-spacing: -2px;
  white-space: nowrap;
}
.digitalMeter div:last-child {
  margin-top: 2px;
  font-size: 10px;
}

/* 記録操作をヘッダー内に収め、空いた行を地図へ戻す。 */
.trace-header {
  flex-wrap: nowrap;
  min-height: 52px;
}
.trace-header__record {
  width: auto;
  min-width: 96px;
  min-height: 40px;
  margin-left: auto;
  padding: 8px 12px;
  font-size: 12px;
  white-space: nowrap;
}
.trace-header__privacy {
  width: 32px;
  min-height: 40px;
  font-size: 18px;
}
.trace-header__privacy span {
  margin: 0;
  color: var(--muted);
}

.trace-history__capacity {
  margin: 0 12px 6px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}
.trace-history__capacity--warning {
  color: #f3cc92;
}


/* 地図コンテナのサイズを安定させる */
.trace-map {
  min-height: 0;
}

.plotMap_Real {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

#osmMap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
}
