:root {
  color-scheme: light;
  --ink: #14283c;
  --muted: #566a7d;
  --line: #c8d6e3;
  --soft-line: #e2ebf2;
  --panel: #ffffff;
  --page: #e9f0f6;
  --brand-navy: #0b3a67;
  --brand-deep: #062846;
  --brand-blue: #0b67ad;
  --accent: #2a7f78;
  --accent-dark: #176761;
  --focus: #72d6ff;
  --shadow: 0 8px 24px rgb(15 48 76 / 12%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 82% 0, rgb(68 160 213 / 9%), transparent 32%),
    linear-gradient(180deg, #e6eff6 0, var(--page) 190px, #f4f7fa 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.55;
}

button,
select,
input {
  font: inherit;
}

button,
select,
input[type="range"] {
  touch-action: manipulation;
}

a {
  color: #075d9a;
  text-underline-offset: 2px;
}

a:hover {
  color: #003f6d;
}

.visually-hidden {
  position: absolute !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.topbar {
  position: relative;
  isolation: isolate;
  min-height: 76px;
  overflow: hidden;
  padding: 8px 18px;
  border-bottom: 2px solid #46b7d4;
  background:
    linear-gradient(108deg, #0a3155 0%, #104f7c 48%, #1d78a3 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgb(5 36 62 / 24%);
}

.topbar::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(112deg, transparent 0 38%, rgb(164 225 244 / 9%) 55%, transparent 73%),
    linear-gradient(180deg, rgb(255 255 255 / 5%), transparent 62%);
  content: "";
  pointer-events: none;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1800px;
  margin: 0 auto;
}

.header-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.brand-home {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 3px 11px 3px 3px;
  border: 1px solid rgb(188 225 246 / 42%);
  border-radius: 7px;
  background: rgb(255 255 255 / 9%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 11%);
  text-decoration: none;
}

.brand-home:hover {
  border-color: rgb(185 232 247 / 80%);
  background: rgb(255 255 255 / 15%);
  color: #fff;
}

.brand-logo {
  display: block;
  width: 50px;
  height: 50px;
  border-radius: 5px;
  background: #fff;
  object-fit: contain;
}

.brand-home-copy {
  display: grid;
  gap: 2px;
  line-height: 1.05;
}

.brand-home-copy strong {
  font-size: 12px;
  letter-spacing: .015em;
}

.brand-home-copy small {
  color: #bfe8f5;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .08em;
}

.title-row {
  display: grid;
  min-width: 0;
  gap: 1px;
  padding-left: 14px;
  border-left: 1px solid rgb(185 219 238 / 34%);
}

.product-kicker {
  margin: 0;
  color: #78d1e4;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .2em;
  line-height: 1.1;
}

.tool-title-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(21px, 1.72vw, 29px);
  line-height: 1.12;
  letter-spacing: .012em;
  text-shadow: 0 1px 5px rgb(0 18 35 / 25%);
}

.tool-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 11px;
  border: 1px solid rgb(157 231 244 / 88%);
  border-radius: 999px;
  background: linear-gradient(135deg, rgb(25 165 202 / 67%), rgb(18 105 151 / 76%));
  box-shadow: 0 2px 8px rgb(0 26 49 / 22%), inset 0 1px 0 rgb(255 255 255 / 18%);
  color: #e7fbff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.tool-chip:hover {
  border-color: #fff;
  background: linear-gradient(135deg, rgb(37 187 220 / 80%), rgb(22 121 169 / 88%));
  color: #fff;
}

.tool-chip:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.tool-subtitle {
  margin: 2px 0 0;
  color: #d3e7f3;
  font-size: 11px;
  font-weight: 650;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.mobile-settings-button,
.mobile-more-button,
.controls-sheet-header,
.settings-backdrop,
.legend-toggle,
.mobile-point-summary {
  display: none;
}

.header-share-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-share-actions button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgb(197 230 246 / 48%);
  border-radius: 6px;
  background: rgb(255 255 255 / 9%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 9%);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.header-share-actions button:hover {
  border-color: #bde9f5;
  background: rgb(255 255 255 / 17%);
}

.header-share-actions button.is-success {
  border-color: #8de0cc;
  background: rgb(31 132 112 / 72%);
}

.header-share-actions button.is-error {
  border-color: #ffb7aa;
  background: rgb(157 52 45 / 78%);
}

.header-share-actions svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sns-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 5px 10px 5px 7px;
  border: 1px solid rgb(197 230 246 / 48%);
  border-radius: 6px;
  background: rgb(255 255 255 / 9%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.sns-link:hover {
  border-color: #bde9f5;
  background: rgb(255 255 255 / 17%);
  color: #fff;
}

.x-mark {
  display: inline-flex;
  width: 24px;
  height: 24px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  background: #000;
}

.x-mark svg {
  display: block;
  width: 24px;
  height: 24px;
}

.x-mark rect {
  fill: #000;
}

.x-mark path {
  fill: #fff;
}

.check-label {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  min-height: 32px;
}

.check-label input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.guide-controls {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--soft-line);
}

.guide-title {
  color: #334250;
  font-size: 12px;
  font-weight: 800;
}

.guide-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 6px;
}

.control-block .guide-toggle-row .check-label {
  min-height: 28px;
  margin-top: 0;
  padding: 2px 6px;
  border: 1px solid #c8d8e4;
  border-radius: 5px;
  background: #f7fafc;
  font-size: 11px;
}

.guide-controls small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 0;
  height: calc(100vh - 130px);
  min-height: 610px;
  max-width: 1800px;
  margin: 0 auto;
  border-right: 1px solid #d5e0e9;
  border-left: 1px solid #d5e0e9;
  background: #fff;
  box-shadow: 0 10px 34px rgb(19 51 78 / 9%);
}

.controls {
  overflow: auto;
  padding: 7px;
  border-right: 1px solid #b9cad8;
  background:
    linear-gradient(rgb(255 255 255 / 68%), rgb(255 255 255 / 68%)),
    repeating-linear-gradient(135deg, #edf3f7 0 26px, #e5edf3 27px 28px);
}

.control-block,
.readout,
.notice,
.privacy-note {
  margin: 0 0 7px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-blue);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 4px 13px rgb(21 57 84 / 7%);
}

.control-block:nth-of-type(2) {
  border-top-color: var(--accent);
}

.readout {
  border-color: #0b4776;
  border-top-color: #55c4dc;
  background:
    radial-gradient(circle at 95% 0, rgb(84 190 216 / 25%), transparent 36%),
    linear-gradient(145deg, #082f54, #0b4776);
  color: #fff;
  box-shadow: 0 7px 18px rgb(7 42 72 / 18%);
}

.notice,
.privacy-note {
  border-top-width: 1px;
}

.control-block h2,
.readout h2,
.notice h2 {
  margin: 0 0 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #163751;
  font-size: 14px;
  line-height: 1.3;
}

.readout h2 {
  color: #fff;
}

.section-index,
.notice-mark {
  display: inline-grid;
  width: 23px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 4px;
  background: #e8f2f8;
  color: var(--brand-navy);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .05em;
}

.control-block:nth-of-type(2) .section-index {
  background: #e5f3f1;
  color: var(--accent-dark);
}

.readout .section-index {
  background: rgb(255 255 255 / 14%);
  color: #bceaf4;
}

.control-block label {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  color: #334250;
  font-size: 12px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #94aabc;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

select {
  padding: 4px 32px 4px 8px;
  box-shadow: inset 0 1px 2px rgb(24 53 76 / 4%);
}

.range-label {
  gap: 3px;
}

.range-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 6px;
}

input[type="range"] {
  width: 100%;
  min-height: 22px;
  accent-color: var(--accent);
}

output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

dl {
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 1px solid rgb(211 235 246 / 18%);
}

dt {
  color: #c4dae8;
  font-size: 12px;
}

dd {
  margin: 0;
  color: #fff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.coordinate,
.notice p,
.privacy-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.readout .coordinate {
  color: #bcd3e1;
}

.important-notice {
  border-color: #d6b963;
  border-left: 4px solid #d9a82f;
  background: linear-gradient(135deg, #fffaf0, #fffefb);
}

.notice-mark {
  width: 22px;
  border-radius: 50%;
  background: #f3d98d;
  color: #6c4512;
  font-size: 13px;
}

.important-notice strong {
  color: #7d2f21;
}

.privacy-note summary {
  color: #29465d;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.analytics-settings-button {
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid #8aa7ba;
  border-radius: 6px;
  background: #f5f9fc;
  color: #173f5c;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.analytics-consent[hidden] {
  display: none !important;
}

.analytics-consent {
  position: fixed;
  z-index: 100;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  width: min(560px, calc(100vw - 32px));
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #6e8aa0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 46px rgb(3 31 54 / 30%);
}

.analytics-consent strong {
  color: #113c5d;
  font-size: 15px;
}

.analytics-consent p {
  margin: 4px 0 0;
  color: #465b6c;
  font-size: 12px;
}

.analytics-consent-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.analytics-consent-actions button {
  min-height: 40px;
  padding: 7px 14px;
  border: 1px solid #8199aa;
  border-radius: 7px;
  background: #f2f6f9;
  color: #17384f;
  font-weight: 800;
  cursor: pointer;
}

.analytics-consent-actions .analytics-accept {
  border-color: #176761;
  background: #176761;
  color: #fff;
}

.map-panel {
  min-width: 0;
  min-height: 0;
  padding: 10px;
  background:
    linear-gradient(rgb(236 243 248 / 88%), rgb(236 243 248 / 88%)),
    repeating-linear-gradient(90deg, transparent 0 39px, rgb(29 91 133 / 8%) 40px),
    repeating-linear-gradient(0deg, transparent 0 39px, rgb(29 91 133 / 8%) 40px);
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 1px solid #668199;
  border-top: 3px solid #1677ae;
  border-radius: 7px;
  background: #dbe7ee;
  box-shadow: 0 8px 24px rgb(20 55 82 / 16%);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.canvas-wrap.dragging {
  cursor: grabbing;
}

#mapCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-wrap.is-3d #mapCanvas {
  opacity: 0;
  pointer-events: none;
}

.terrain-3d-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.terrain-3d-canvas[hidden] {
  display: none;
}

.terrain-3d-canvas.show-center-cross::after {
  content: "+";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #07507e;
  font: 800 29px/1 sans-serif;
  text-shadow: -2px -2px #fff, 2px -2px #fff, -2px 2px #fff, 2px 2px #fff;
  pointer-events: none;
}

.map-view-controls {
  position: absolute;
  right: 9px;
  bottom: 27px;
  z-index: 7;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.map-view-controls button {
  min-width: 58px;
  min-height: 37px;
  padding: 3px 5px;
  border: 1px solid #7896aa;
  border-radius: 7px;
  background: rgb(255 255 255 / 96%);
  color: #123951;
  box-shadow: 0 3px 9px rgb(13 45 69 / 20%);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.map-view-controls button:hover,
.map-view-controls button[aria-pressed="true"] {
  border-color: #156f9e;
  background: #d8f1fb;
}

.map-view-controls .compass-button {
  width: 58px;
  height: 58px;
  padding: 3px;
  border-radius: 50%;
  touch-action: none;
}

.compass-dial {
  position: relative;
  display: block;
  width: 50px;
  height: 50px;
  transform: rotate(var(--bearing-rotation, 0deg));
  border: 1px solid #9ab2c2;
  border-radius: 50%;
  background: #f5fbfd;
}

.compass-dial b {
  position: absolute;
  font-size: 9px;
  line-height: 1;
}

.compass-n { top: 2px; left: 21px; color: #bd2b3a; }
.compass-e { top: 21px; right: 2px; }
.compass-s { bottom: 2px; left: 21px; }
.compass-w { top: 21px; left: 2px; }

.compass-dial i {
  position: absolute;
  top: 12px;
  left: 21px;
  width: 7px;
  height: 13px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #bd2b3a;
}

.terrain-3d-hint {
  position: absolute;
  right: 76px;
  bottom: 31px;
  z-index: 5;
  max-width: min(300px, calc(100% - 110px));
  margin: 0;
  padding: 5px 8px;
  border-radius: 5px;
  background: rgb(5 43 75 / 87%);
  color: #fff;
  font-size: 11px;
  pointer-events: none;
}

.terrain-3d-hint[hidden],
.canvas-wrap.is-3d .map-scale,
.canvas-wrap.is-3d .mobile-map-hint {
  display: none;
}

.terrain-3d-hint .touch-hint {
  display: none;
}

.map-stamp {
  position: absolute;
  top: 12px;
  left: 56px;
  z-index: 4;
  display: grid;
  gap: 2px;
  max-width: min(550px, calc(100% - 240px));
  padding: 7px 10px;
  border: 1px solid rgb(170 210 230 / 42%);
  border-radius: 6px;
  background: linear-gradient(125deg, rgb(5 43 75 / 94%), rgb(9 77 116 / 92%));
  color: #fff;
  box-shadow: 0 5px 16px rgb(7 42 70 / 26%);
  pointer-events: none;
}

.map-stamp strong {
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
}

.map-stamp span {
  color: #cde5f0;
  font-size: 12px;
}

.map-zoom-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 6;
  display: grid;
  overflow: hidden;
  width: 36px;
  border: 1px solid rgb(62 87 108 / 62%);
  border-radius: 6px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 4px 12px rgb(13 45 69 / 23%);
}

.map-zoom-controls button {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #bbc5cf;
  background: transparent;
  color: #15202a;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}

.map-zoom-controls button:last-child {
  border-bottom: 0;
  font-size: 12px;
}

.map-zoom-controls button:hover {
  background: #e7f2f8;
  color: #075c91;
}

.zoom-track {
  position: relative;
  width: 36px;
  height: 76px;
  border-bottom: 1px solid #bbc5cf;
  background: rgba(250, 252, 253, 0.92);
}

.zoom-track::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 16px;
  width: 4px;
  border-radius: 3px;
  background: #8795a2;
  content: "";
}

.zoom-thumb {
  position: absolute;
  top: var(--thumb-top, 28px);
  left: 18px;
  width: 21px;
  height: 21px;
  transform: translate(-50%, -50%);
  border: 1px solid #687684;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 30, 40, 0.26);
}

.legend {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: grid;
  gap: 4px;
  width: 150px;
  padding: 9px 10px;
  border: 1px solid rgb(72 102 125 / 56%);
  border-top: 3px solid #2a7f78;
  border-radius: 6px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 5px 16px rgb(20 50 73 / 16%);
  pointer-events: none;
}

.legend strong {
  font-size: 13px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #33414e;
  font-size: 12px;
  font-weight: 700;
}

.legend small {
  margin-top: 2px;
  color: #8a3127;
  font-size: 10px;
  font-weight: 800;
}

.legend-color {
  width: 25px;
  height: 12px;
  border: 1px solid rgba(16, 37, 54, 0.25);
}

.legend-color.c1 { background: #66d3f2; }
.legend-color.c2 { background: #45bfea; }
.legend-color.c3 { background: #2aa5dc; }
.legend-color.c4 { background: #167cc1; }
.legend-color.c5 { background: #315fb8; }
.legend-color.c6 { background: #4d49b5; }
.legend-color.c7 { background: #6b38a6; }
.legend-color.c8 { background: #9d277d; }

.loading-panel {
  position: absolute;
  inset: auto 50% 42px auto;
  z-index: 8;
  min-width: 210px;
  max-width: calc(100% - 28px);
  transform: translateX(50%);
  padding: 8px 12px;
  border: 1px solid #6f8090;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.96);
  color: #243340;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 2px 8px rgba(22, 34, 44, 0.18);
  pointer-events: none;
}

.loading-panel button {
  display: block;
  min-height: 44px;
  margin: 8px auto 0;
  padding: 6px 18px;
  border: 1px solid #075780;
  border-radius: 5px;
  background: #075780;
  color: #fff;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}

.tooltip {
  position: absolute;
  z-index: 9;
  max-width: 220px;
  padding: 7px 9px;
  border: 1px solid #778797;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  color: #17212b;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(22, 34, 44, 0.18);
  pointer-events: none;
}

.map-scale {
  position: absolute;
  bottom: 8px;
  left: 12px;
  z-index: 5;
  display: grid;
  justify-items: start;
  padding: 3px 6px 5px;
  border-radius: 4px;
  border: 1px solid rgb(175 215 233 / 35%);
  background: rgb(5 43 75 / 86%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  pointer-events: none;
}

.map-scale i {
  display: block;
  height: 7px;
  margin-top: 1px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.mobile-map-hint {
  display: none;
  position: absolute;
  bottom: 30px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  background: rgb(5 43 75 / 84%);
  color: #fff;
  font-size: 11px;
  pointer-events: none;
}

.gsi-attribution {
  position: absolute;
  right: 5px;
  bottom: 4px;
  z-index: 5;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgb(103 139 166 / 28%);
  background: rgb(255 255 255 / 91%);
  color: #164f77;
  font-size: 10px;
}

.page-footer {
  max-width: 1800px;
  min-height: 54px;
  margin: 0 auto;
  padding: 6px 14px 8px;
  border-top: 1px solid #2d6f9d;
  background: linear-gradient(105deg, #062846, #0b3a67);
  color: #d0dfeb;
  font-size: 10px;
  line-height: 1.45;
}

.page-footer a {
  color: #83d4ea;
}

.page-footer a:hover {
  color: #fff;
}

.page-footer p {
  margin: 1px 0;
}

@media (max-width: 820px), (max-width: 900px) and (max-height: 520px) {
  :root {
    --mobile-header-height: 66px;
    --mobile-viewport-height: 100vh;
  }

  @supports (height: 100svh) {
    :root {
      --mobile-viewport-height: 100svh;
    }
  }

  @supports (height: 100dvh) {
    :root {
      --mobile-viewport-height: 100dvh;
    }
  }

  body {
    min-width: 0;
  }

  .topbar {
    z-index: 30;
    min-height: 58px;
    overflow: visible;
    padding: 5px 9px;
  }

  .topbar-inner {
    gap: 10px;
  }

  .header-identity {
    gap: 9px;
  }

  .brand-home {
    min-height: 44px;
    padding: 4px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-home-copy,
  .product-kicker,
  .tool-subtitle,
  .tool-chip {
    display: none;
  }

  .title-row {
    padding-left: 9px;
  }

  h1 {
    font-size: 16px;
  }

  .sns-link {
    padding: 4px 8px 4px 6px;
  }

  .header-share-actions {
    gap: 5px;
  }

  .header-share-actions button {
    padding: 5px 8px;
    font-size: 10px;
  }

  .mobile-settings-button,
  .mobile-more-button {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 4px 7px;
    border: 1px solid rgb(197 230 246 / 54%);
    border-radius: 7px;
    background: rgb(255 255 255 / 10%);
    color: #fff;
    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
  }

  .header-actions {
    position: fixed;
    z-index: 50;
    top: calc(var(--mobile-header-height) - 2px);
    right: 8px;
    display: none;
    width: min(240px, calc(100vw - 16px));
    padding: 8px;
    border: 1px solid #8ba8bd;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 12px 34px rgb(4 30 52 / 30%);
  }

  .header-actions.is-open {
    display: grid;
    gap: 7px;
  }

  .header-share-actions {
    display: grid;
    gap: 7px;
  }

  .header-share-actions button,
  .sns-link {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    padding: 7px 10px;
    border-color: #aec0cf;
    background: #f4f8fb;
    color: #17344b;
    font-size: 13px;
  }

  .header-share-actions button:hover,
  .sns-link:hover {
    border-color: #438aad;
    background: #e7f2f8;
    color: #075c91;
  }

  .header-action-label,
  .sns-label {
    position: static;
    overflow: visible;
    width: auto;
    height: auto;
    clip: auto;
    white-space: nowrap;
  }

  .app {
    grid-template-columns: minmax(0, 1fr);
    height: max(260px, calc(var(--mobile-viewport-height) - var(--mobile-header-height)));
    min-height: 260px;
  }

  .controls {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    overflow: auto;
    width: min(100%, 640px);
    max-height: min(84vh, calc(var(--mobile-viewport-height) - 12px));
    max-height: min(84dvh, calc(var(--mobile-viewport-height) - 12px));
    margin: 0 auto;
    padding: 0 10px max(18px, env(safe-area-inset-bottom));
    transform: translateY(calc(100% + 18px));
    border: 1px solid #9db3c5;
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    background: #eef4f8;
    box-shadow: 0 -14px 42px rgb(4 30 52 / 30%);
    overscroll-behavior: contain;
    touch-action: pan-y;
    transition: transform 180ms ease-out;
    visibility: hidden;
  }

  .controls.is-open {
    transform: translateY(0);
    visibility: visible;
  }

  .controls-sheet-header {
    position: sticky;
    z-index: 3;
    top: 0;
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -10px 8px;
    padding: 7px 10px;
    border-bottom: 1px solid #b8c9d6;
    background: rgb(238 244 248 / 96%);
    backdrop-filter: blur(10px);
  }

  .controls-sheet-header h2 {
    margin: 0;
    color: #163751;
    font-size: 18px;
  }

  .controls-sheet-header button {
    min-height: 44px;
    padding: 7px 12px;
    border: 1px solid #1b6d9c;
    border-radius: 7px;
    background: #fff;
    color: #0b4f7b;
    font-weight: 800;
    cursor: pointer;
  }

  .settings-backdrop {
    position: fixed;
    z-index: 35;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgb(3 27 48 / 46%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease-out;
  }

  .settings-backdrop.is-open {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  body.settings-open {
    overflow: hidden;
  }

  .control-block,
  .readout,
  .notice,
  .privacy-note {
    margin: 0;
  }

  .map-panel {
    height: auto;
    min-height: 0;
    padding: 6px;
  }

  .canvas-wrap {
    min-height: 0;
  }

  .map-stamp {
    right: 8px;
    left: 54px;
    max-width: none;
  }

  .map-stamp strong {
    white-space: normal;
  }

  .legend-toggle {
    position: absolute;
    z-index: 7;
    top: 62px;
    right: 8px;
    display: grid;
    min-height: 44px;
    padding: 5px 8px;
    border: 1px solid rgb(72 102 125 / 66%);
    border-radius: 7px;
    background: rgb(255 255 255 / 94%);
    color: #17344b;
    box-shadow: 0 4px 12px rgb(13 45 69 / 20%);
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
  }

  .legend-toggle small {
    color: #8a3127;
    font-size: 8px;
    font-weight: 800;
  }

  .legend {
    top: 112px;
    right: 8px;
    max-height: calc(100% - 126px);
    overflow: auto;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity 140ms ease-out, transform 140ms ease-out;
    visibility: hidden;
  }

  .legend.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
  }

  .mobile-point-summary {
    position: absolute;
    z-index: 7;
    bottom: max(42px, calc(env(safe-area-inset-bottom) + 34px));
    left: 8px;
    display: grid;
    min-height: 44px;
    max-width: calc(100% - 150px);
    padding: 5px 9px;
    border: 1px solid rgb(181 222 239 / 62%);
    border-radius: 7px;
    background: rgb(5 43 75 / 91%);
    color: #fff;
    box-shadow: 0 4px 12px rgb(13 45 69 / 24%);
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
  }

  .mobile-point-summary[hidden] {
    display: none;
  }

  .mobile-point-summary span {
    color: #bfe8f5;
    font-size: 9px;
  }

  .mobile-point-summary strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-point-summary:not([hidden]) ~ .mobile-map-hint {
    display: none;
  }

  .mobile-map-hint {
    display: block;
  }

  .terrain-3d-hint {
    right: 77px;
    bottom: max(25px, calc(env(safe-area-inset-bottom) + 17px));
    max-width: calc(100% - 168px);
  }

  .terrain-3d-hint .mouse-hint {
    display: none;
  }

  .terrain-3d-hint .touch-hint {
    display: inline;
  }

  .analytics-consent {
    right: auto;
    left: 8px;
    width: min(440px, calc(100vw - 92px));
  }

  .page-footer {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  :root {
    --mobile-header-height: 56px;
  }

  .topbar {
    min-height: 54px;
    padding: 4px 6px;
  }

  .topbar-inner {
    gap: 6px;
  }

  .header-identity {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    gap: 6px;
  }

  .brand-home {
    min-height: 44px;
    padding: 4px;
    border-radius: 6px;
  }

  .brand-home-copy {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .title-row {
    flex: 1 1 auto;
    gap: 0;
    overflow: hidden;
    padding-left: 7px;
  }

  .product-kicker,
  .tool-subtitle {
    display: none;
  }

  .tool-title-line {
    align-items: center;
  }

  h1 {
    flex: 1 1 auto;
    min-width: 0;
    display: -webkit-box;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.18;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .tool-chip {
    display: none;
  }

  .mobile-settings-button,
  .mobile-more-button {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    border: 1px solid rgb(197 230 246 / 54%);
    border-radius: 7px;
    background: rgb(255 255 255 / 10%);
    color: #fff;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
  }

  .header-actions {
    position: fixed;
    z-index: 50;
    top: calc(var(--mobile-header-height) - 2px);
    right: 6px;
    display: none;
    width: min(240px, calc(100vw - 12px));
    padding: 8px;
    border: 1px solid #8ba8bd;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 12px 34px rgb(4 30 52 / 30%);
  }

  .header-actions.is-open {
    display: grid;
    gap: 7px;
  }

  .header-share-actions {
    display: grid;
    gap: 7px;
  }

  .header-share-actions button,
  .sns-link {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    padding: 7px 10px;
    border-color: #aec0cf;
    background: #f4f8fb;
    color: #17344b;
    font-size: 13px;
  }

  .header-share-actions button:hover,
  .sns-link:hover {
    border-color: #438aad;
    background: #e7f2f8;
    color: #075c91;
  }

  .header-action-label,
  .sns-label {
    position: static;
    overflow: visible;
    width: auto;
    height: auto;
    clip: auto;
    white-space: nowrap;
  }

  .map-stamp {
    left: 54px;
    max-width: calc(100% - 62px);
    padding: 6px 8px;
  }

  .map-stamp strong {
    font-size: 13px;
    line-height: 1.25;
    white-space: normal;
  }

  .map-stamp span {
    font-size: 10px;
  }

  .legend {
    top: 112px;
    right: 8px;
    width: 128px;
    padding: 7px 8px;
  }

  .legend span {
    font-size: 10px;
  }

  .legend-color {
    width: 19px;
    height: 10px;
  }

  .mobile-map-hint {
    right: auto;
    bottom: max(50px, calc(env(safe-area-inset-bottom) + 42px));
    left: 8px;
    max-width: calc(100% - 150px);
    transform: none;
  }

  .analytics-consent {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 12px;
  }

  .analytics-consent-actions button {
    flex: 1 1 0;
  }
}

@media (max-width: 360px) {
  .topbar-inner {
    gap: 4px;
  }

  .header-identity {
    gap: 3px;
  }

  .title-row {
    padding-left: 4px;
  }

  h1 {
    font-size: 12px;
    line-height: 1.15;
  }

  .mobile-settings-button,
  .mobile-more-button {
    padding: 4px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
