    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { background: #000; overflow: hidden; width: 100vw; height: 100vh; touch-action: none; }

    .site-header {
      align-items: start;
      display: grid;
      gap: 18px;
      grid-template-columns: auto minmax(0, 1fr);
      left: 0;
      min-height: 88px;
      padding: clamp(12px, calc(3vw + 3vh), 50px) clamp(12px, calc(3vw + 3vh), 50px) 0;
      pointer-events: none;
      position: fixed;
      right: 0;
      top: 0;
      z-index: 20000;
    }

    .site-header::before {
      background: linear-gradient(to bottom, rgba(51,51,51,.5) 0%, rgba(51,51,51,0) 100%);
      content: "";
      height: 40vh;
      left: 0;
      pointer-events: none;
      position: absolute;
      right: 0;
      top: 0;
      z-index: -1;
    }

    .site-logo,
    .site-nav {
      pointer-events: auto;
    }

    .site-logo img {
      filter: brightness(0) invert(1);
      height: auto;
      object-fit: contain;
      width: calc(12vw + 12vh);
    }

    .site-nav {
      align-items: center;
      align-self: start;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      gap: 4px;
      justify-content: flex-end;
      justify-self: end;
      min-width: 0;
      transform-origin: top right;
      transition: transform .5s cubic-bezier(.16, 1, .3, 1);
    }

    .site-nav a {
      background: #fff;
      border-radius: 24px;
      color: #111;
      cursor: pointer;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      font-size: 1rem;
      font-weight: 900;
      padding: 9px 18px;
      text-align: center;
      text-decoration: none;
      white-space: nowrap;
    }

    .site-nav a:hover,
    .site-nav a.is-active {
      background: #111;
      box-shadow: 0 0 0 1px rgba(255,255,255,.2);
      color: #fff;
    }

    .site-nav a.site-nav__social {
      align-items: center;
      border-radius: 999px;
      display: flex;
      height: 42px;
      justify-content: center;
      padding: 9px;
      width: 42px;
    }

    .site-nav__label {
      display: inline-block;
      opacity: 1;
      transition: opacity .3s ease;
    }

    .site-nav__socialIcon {
      display: block;
      height: 18px;
      width: 18px;
    }

    .site-nav__social:hover .site-nav__socialIcon {
      filter: invert(1);
    }

    @media screen and (max-width: 980px) {
      .site-nav {
        align-items: flex-end;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 2px;
        transform: scale(.3333);
      }

      body:not(.is-menu-open) .site-nav a,
      body:not(.is-menu-open) .site-nav a:hover,
      body:not(.is-menu-open) .site-nav a.is-active {
        background: #728ca6;
        color: #111;
        pointer-events: none;
      }

      body:not(.is-menu-open) .site-nav__social:hover .site-nav__socialIcon {
        filter: none;
      }

      .site-nav__label {
        opacity: 0;
      }

      body.is-menu-open .site-nav {
        transform: scale(1);
      }

      body.is-menu-open .site-nav a {
        background: #fff;
      }

      body.is-menu-open .site-nav a:hover,
      body.is-menu-open .site-nav a.is-active {
        background: #111;
        color: #fff;
      }

      body.is-menu-open .site-nav__label {
        opacity: 1;
        transition: opacity .4s ease .12s;
      }

      body.is-menu-open .site-header::before {
        height: 100vh;
      }
    }

    #video {
      position: absolute;
      height: 1px;
      left: -9999px;
      opacity: 0;
      top: 0;
      width: 1px;
    }

    #camera-canvas {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      filter: saturate(.95) contrast(.96) brightness(.84);
      image-rendering: auto;
    }

    /* Mode nav */
    #mode-nav {
      align-items: flex-end;
      --tool-nav-icon-height: 200px;
      --tool-nav-overlap: 40px;
      position: fixed;
      bottom: -40px; right: 18px;
      display: flex;
      gap: 0;
      z-index: 20;
    }
    #mode-nav button {
      align-items: center;
      background: transparent;
      border: 0;
      color: #111;
      cursor: pointer;
      display: flex;
      flex: 0 0 auto;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      font-size: 12px;
      font-weight: 900;
      height: var(--tool-nav-icon-height);
      justify-content: center;
      padding: 0;
      position: relative;
      transition: transform .42s cubic-bezier(.65, 0, .35, 1);
      white-space: nowrap;
    }
    #mode-nav button::after {
      background: #fff;
      border-radius: 50%;
      bottom: 35px;
      content: "";
      display: none;
      height: 10px;
      left: 50%;
      position: absolute;
      transform: translateX(-50%);
      width: 10px;
      z-index: 3;
    }
    .mode-nav__icon {
      display: block;
      height: var(--tool-nav-icon-height);
      max-width: none;
      position: relative;
      transform: translateY(30px);
      transition: transform .35s cubic-bezier(.16, 1, .3, 1);
      width: auto;
      z-index: 1;
    }
    .mode-nav__title {
      display: block;
      height: auto;
      left: 50%;
      max-width: none;
      position: absolute;
      top: 100px;
      transform: translateX(-50%);
      width: 92px;
      z-index: 2;
    }
    #mode-nav button.is-active {
      color: #111;
    }
    #mode-nav button.is-active .mode-nav__icon {
      transform: translateY(0);
    }
    #mode-nav button.is-active::after {
      display: block;
    }
    #mode-nav button + button {
      margin-left: calc(var(--tool-nav-overlap) * -1);
    }
    @media screen and (max-width: 720px) {
      #mode-nav {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
      }

      body.is-standalone-app.is-menu-open #mode-nav button:first-child {
        transform: translateX(34px);
      }
    }

    /* ── Mode B: AR overlay ── */
    #ar-layer {
      position: fixed; inset: 0;
      pointer-events: none;
      z-index: 10;
      display: none;
    }

    .ar-marker {
      position: absolute;
      width: 220px;
      height: 0;
      transform: translateX(-50%);
      pointer-events: none;
      display: none;
    }
    .ar-dot {
      position: absolute;
      left: 50%;
      top: 0;
      border-radius: 50%;
      background: white;
      transform: translate(-50%, -50%);
    }
    .ar-dist {
      position: absolute;
      left: 50%;
      color: white;
      font-size: 10.5px;
      font-weight: 700;
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      transform: translate(-50%, -50%);
      white-space: nowrap;
      letter-spacing: 0.02em;
    }
    .ar-name {
      position: absolute;
      left: 50%;
      color: rgba(255,255,255,0.95);
      font-size: 18px;
      font-weight: 700;
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      transform: translate(-50%, -100%);
      white-space: nowrap;
      writing-mode: vertical-rl;
      text-orientation: upright;
      line-height: 1.05;
    }
    .ar-name .ar-latin-run {
      letter-spacing: -0.18em;
    }

    /* 点から画面外側へ逃がす集中線 */
    .ar-line {
      position: absolute;
      left: 50%;
      top: 0;
      height: 1.5px;
      background: linear-gradient(to right, rgba(255,255,255,0.88), rgba(255,255,255,0.24));
      transform-origin: left center;
      pointer-events: none;
    }

    /* Compass HUD (top center) */
    #hud {
      position: fixed;
      top: 18px; left: 50%;
      transform: translateX(-50%);
      color: rgba(255,255,255,0.95);
      font-size: 11px;
      line-height: 1.6;
      font-family: -apple-system, BlinkMacSystemFont, 'Courier New', monospace;
      text-shadow: 0 1px 4px rgba(0,0,0,0.9);
      text-align: center;
      pointer-events: none;
      z-index: 15;
      display: none !important;
      background: rgba(0,0,0,0.35);
      padding: 4px 10px;
      border-radius: 8px;
      white-space: nowrap;
    }

    /* ── Mode C: rotating map ── */
    #c-layer {
      position: fixed; inset: 0;
      display: none;
      z-index: 10;
      overflow: hidden;
      background: #dfe0e0;
    }
    #map-wrap {
      position: absolute;
      /* 200vmax で回転時の四隅白抜けを防ぐ */
      width: 200vmax; height: 200vmax;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%) rotate(0deg);
      transform-origin: center center;
      will-change: transform;
    }
    #map {
      width: 100%; height: 100%;
    }
    /* Leaflet タイルを暗くして、白いスポット表示が浮くようにする */
    #map .leaflet-tile { filter: none; }

    /* C モード固定 HUD */
    #c-hud {
      position: fixed;
      bottom: max(16px, env(safe-area-inset-bottom));
      left: max(16px, env(safe-area-inset-left));
      pointer-events: none;
      z-index: 20;
      display: flex;
      align-items: flex-start;
    }
    #c-info {
      color: rgba(255,255,255,.74);
      font-size: 10px;
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      background: rgba(0,0,0,0.22);
      padding: 4px 8px;
      border-radius: 999px;
      text-align: left;
    }
    #gps-alert {
      background: rgba(255,255,255,.94);
      border-radius: 16px;
      bottom: calc(max(16px, env(safe-area-inset-bottom)) + 30px);
      box-shadow: 0 10px 28px rgba(0,0,0,.16);
      color: #111;
      display: none;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      left: max(16px, env(safe-area-inset-left));
      max-width: min(320px, calc(100vw - 32px));
      padding: 14px;
      position: fixed;
      width: max-content;
      z-index: 30000;
    }
    .gps-alert__title {
      font-size: .95rem;
      font-weight: 900;
      margin-bottom: 5px;
    }
    .gps-alert__text {
      font-size: .78rem;
      font-weight: 600;
      line-height: 1.55;
      margin-bottom: 10px;
    }
    .gps-alert__actions {
      display: flex;
      gap: 6px;
    }
    .gps-alert__button {
      background: #111;
      border: 0;
      border-radius: 999px;
      color: #fff;
      cursor: pointer;
      font-size: .78rem;
      font-weight: 900;
      padding: 8px 12px;
      white-space: nowrap;
    }
    .gps-alert__button--ghost {
      background: #eee;
      color: #111;
    }
    /* 自分位置マーカー（左右中央・下から20%固定） */
    #c-self {
      position: fixed;
      top: 80%; left: 50%;
      transform: translate(-50%, -50%);
      width: 20px; height: 20px;
      border-radius: 50%;
      background: #fff;
      box-shadow: 0 0 0 2px rgba(255,255,255,0.86);
      pointer-events: none;
      z-index: 21;
    }
    /* 進行方向の視界 */
    #c-self::before {
      content: '';
      position: absolute;
      bottom: 50%;
      left: 50%;
      transform: translateX(-50%);
      width: min(62vw, 460px);
      height: min(29vh, 260px);
      background: linear-gradient(to top, rgba(255,255,255,0.34) 0%, rgba(255,255,255,0.18) 42%, rgba(255,255,255,0) 100%);
      clip-path: polygon(50% 100%, 0 0, 100% 0);
      transform-origin: 50% 100%;
      z-index: 1;
    }

    /* C mode: divIcon カスタムマーカー */
    .mm-wrap {
      position: relative;
      width: 6px; height: 6px;
    }
    .mm-dot {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: #fff;
      box-sizing: border-box;
    }
    .mm-line {
      display: none;
    }
    .mm-dist {
      display: none;
    }
    .mm-label {
      display: none;
    }
    #c-label-layer {
      inset: 0;
      pointer-events: none;
      position: fixed;
      z-index: 22;
    }
    .c-leader {
      display: none;
      height: 0;
      left: 0;
      pointer-events: none;
      position: absolute;
      top: 0;
      width: 0;
    }
    .c-leader__line {
      background: linear-gradient(to right, rgba(255,255,255,0.9), rgba(255,255,255,0));
      height: 1.5px;
      left: 0;
      position: absolute;
      top: 0;
      transform-origin: left center;
    }
    .c-leader__dist {
      color: #fff;
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      font-size: 10px;
      font-weight: 700;
      left: 0;
      position: absolute;
      text-align: center;
      top: 0;
      white-space: nowrap;
    }
    .c-leader__name {
      color: #fff;
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      font-size: 14px;
      font-weight: 700;
      left: 0;
      line-height: 1.05;
      position: absolute;
      top: 0;
      white-space: nowrap;
      writing-mode: vertical-rl;
      text-orientation: upright;
    }

    /* iOS compass permission dialog */
    #perm-panel {
      position: fixed;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      background: rgba(255,255,255,.94);
      color: #111;
      border: 0;
      border-radius: 18px;
      padding: 24px;
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      max-width: 360px;
      text-align: left;
      width: min(calc(100% - 48px), 360px);
      z-index: 30000;
      display: none;
    }

    .perm-panel__title {
      font-size: 1.25rem;
      font-weight: 900;
      margin-bottom: 18px;
    }

    #perm-btn {
      background: #111;
      border: 0;
      border-radius: 999px;
      color: #fff;
      cursor: pointer;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      font-size: 1rem;
      font-weight: 900;
      padding: 12px 20px;
      width: 100%;
      -webkit-tap-highlight-color: transparent;
    }

    #permission-intro {
      align-items: center;
      background: rgba(0,0,0,.52);
      color: #fff;
      display: flex;
      inset: 0;
      justify-content: center;
      padding: 24px;
      position: fixed;
      z-index: 30000;
    }

    .permission-intro__panel {
      background: rgba(255,255,255,.94);
      border-radius: 18px;
      color: #111;
      max-width: 360px;
      padding: 24px;
      text-align: left;
      width: min(100%, 360px);
    }

    .permission-intro__title {
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      font-size: 1.25rem;
      font-weight: 900;
      margin-bottom: 10px;
    }

    .permission-intro__text {
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      font-size: .92rem;
      font-weight: 600;
      line-height: 1.7;
      margin-bottom: 18px;
    }

    .permission-intro__button {
      background: #111;
      border: 0;
      border-radius: 999px;
      color: #fff;
      cursor: pointer;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      font-size: 1rem;
      font-weight: 900;
      padding: 12px 20px;
      width: 100%;
    }

    .app-refresh-button {
      background: rgba(255,255,255,.94);
      border: 0;
      border-radius: 999px;
      bottom: max(18px, env(safe-area-inset-bottom));
      box-shadow: 0 8px 24px rgba(0,0,0,.12);
      color: #111;
      cursor: pointer;
      display: none;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
      font-size: .82rem;
      font-weight: 900;
      left: max(18px, env(safe-area-inset-left));
      padding: 9px 14px;
      position: fixed;
      z-index: 30010;
    }

    body.is-standalone-app.is-menu-open .app-refresh-button {
      display: block;
    }
