/* ==========================================================================
   METREAL VOL.2 — route.css  (#route-root → .rt)
   Hand-drawn transit diagram: flat hairlines, pixel labels, big numerals,
   square corners only. Oedo line magenta #c4007a, goal red, hints cyan.
   ========================================================================== */
.rt { position: relative; margin-top: clamp(28px, 4vw, 48px); --rt-oedo: #c4007a; }

/* ---------- tabs ---------- */
.rt-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: clamp(20px, 3vw, 32px); }
.rt-tab { position: relative; min-height: 44px; padding: 0 18px; font-family: var(--font-mono); font-size: 15px; letter-spacing: .02em; color: var(--muted); transition: color .2s var(--ease); }
.rt-tab::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease-out); }
.rt-tab.is-active { color: var(--white); }
.rt-tab.is-active::after { transform: scaleX(1); }
.rt-tab:hover { color: var(--white); }

/* ---------- explorer layout ---------- */
.rt-top { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 1120px) {
  .rt-top { grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
}

/* ---------- map stage ---------- */
.rt-stage { position: relative; border: 1px solid var(--line-soft); padding: 10px; overflow: visible; }
.rt-corner { position: absolute; left: 10px; top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--dim); letter-spacing: .02em; }
.rt-map { width: 100%; }
.rt-svg { display: block; width: 100%; height: auto; overflow: visible; }
.rt.is-portrait .rt-svg { max-width: 520px; margin: 0 auto; }

/* svg: paths */
.rt-oedo { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rt-trail { fill: none; stroke: var(--white); stroke-width: 2; stroke-linecap: butt; opacity: .9; pointer-events: none; }
.rt-walk-path { fill: none; stroke: var(--white); stroke-width: 3; stroke-dasharray: 7 7; stroke-linecap: butt; opacity: .85; }
.rt-walk1 .rt-walk-path { stroke-width: 2.5; stroke-dasharray: 5 6; }
.rt-walk-ext { fill: none; stroke: var(--white); stroke-width: 2; stroke-dasharray: 4 6; opacity: .3; }
.rt-guide { pointer-events: none; }

/* svg: text */
.rt-svg text { fill: var(--muted); font-family: var(--font-body); font-weight: 700; letter-spacing: .02em; transition: fill .25s var(--ease); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.rt-svg .rt-t--strong { font-weight: 900; fill: var(--white); }
.rt-svg .rt-t--goal { fill: var(--white); font-weight: 900; }
.rt-svg .rt-tag { font-family: var(--font-mono); font-weight: 400; fill: var(--dim); letter-spacing: .02em; }
.rt-svg .rt-tag--cyan { fill: var(--cyan); }
.rt-svg .rt-tag--red { fill: var(--red); }
.rt-svg .rt-tag--oedo { fill: var(--rt-oedo); }
.rt-svg .rt-min { font-family: var(--font-display); font-weight: 800; fill: var(--dim); letter-spacing: -.02em; }
.rt-svg .rt-min.is-on { fill: var(--white); }

/* svg: stations */
.rt-st-dot { fill: var(--bg); stroke: var(--rt-oedo); stroke-width: 3; transition: fill .25s var(--ease); }
.rt-st.is-on .rt-st-dot { fill: var(--white); }
.rt-st.is-on text.rt-t { fill: var(--white); }

/* svg: landmarks */
.rt-lm-mark { fill: var(--bg); stroke: var(--white); stroke-width: 1.5; opacity: .75; transition: fill .25s var(--ease), stroke .25s var(--ease), opacity .25s; }
.rt-lm-tick { stroke: var(--white); stroke-width: 1; opacity: .35; }
.rt-lm-cross { stroke: var(--white); stroke-width: 2; opacity: .55; }
.rt-lm.is-on .rt-lm-mark { fill: var(--white); opacity: 1; }
.rt-lm.is-on text.rt-t { fill: var(--white); }
.rt-lm.is-now .rt-lm-mark { fill: var(--red); stroke: var(--red); opacity: 1; }
.rt-lm.is-now .rt-lm-cross { stroke: var(--red); opacity: 1; }
.rt-lm--over .rt-lm-mark { stroke: var(--dim); }
.rt-lm--over text.rt-t { fill: var(--dim); }

/* svg: goal / tower / triangle */
.rt-goal-mark { fill: var(--red); stroke: var(--bg); stroke-width: 2; }
.rt-goal.is-on .rt-goal-mark { stroke: var(--white); }
.rt-goal.is-flash .rt-goal-mark { animation: rt-flash .9s steps(1) 1; }
@keyframes rt-flash { 0%, 33%, 66% { fill: var(--white); } 16%, 50%, 83% { fill: var(--red); } 100% { fill: var(--red); } }
.rt-b1 { fill: var(--red); }
.rt-tower path { fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linejoin: round; }
.rt-tri-mark { fill: none; stroke: var(--white); stroke-width: 2; stroke-linejoin: round; }

/* marker (HTML, absolutely positioned over the svg; transform-only updates) */
.rt-marker { position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; display: grid; place-items: center; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; z-index: 3; will-change: transform; }
.rt-marker:active, .rt-marker.is-drag { cursor: grabbing; }
.rt-marker-dot { width: 18px; height: 18px; background: var(--red); border: 3px solid var(--bg); outline: 2px solid var(--white); outline-offset: 0; border-radius: 50%; transition: transform .15s var(--ease); }
.rt-marker.is-drag .rt-marker-dot { transform: scale(1.2); }
.rt-marker:focus-visible { outline: none; }
.rt-marker:focus-visible .rt-marker-dot { outline-color: var(--cyan); outline-width: 3px; }

/* ---------- side panel ---------- */
.rt-side { display: grid; gap: 20px; }
.rt-now { border-top: 2px solid var(--white); padding-top: 12px; min-height: 150px; }
.rt-now-min { display: flex; align-items: baseline; gap: 8px; }
.rt-now-num { font-family: var(--font-display); font-weight: 900; font-size: clamp(56px, 8vw, 88px); line-height: .9; letter-spacing: -.04em; color: var(--white); font-variant-numeric: tabular-nums; min-width: 1.2em; }
.rt-now-unit { font-family: var(--font-body); font-weight: 900; font-size: 20px; color: var(--muted); }
.rt-now-clock { margin-left: auto; font-family: var(--font-mono); font-size: 15px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.rt-now-name { margin-top: 10px; font-family: var(--font-body); font-weight: 900; font-size: clamp(20px, 2.2vw, 26px); line-height: 1.3; min-height: 1.3em; }
.rt-now-sub { margin-top: 4px; font-family: var(--font-mono); font-size: 14px; color: var(--cyan); min-height: 1.5em; }

.rt-stages { border-top: 1px solid var(--line); }
.rt-stages li { border-bottom: 1px solid var(--line-soft); }
.rt-stage-btn { display: grid; grid-template-columns: minmax(64px, auto) minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; min-height: 56px; padding: 10px 10px 10px 12px; text-align: left; border-left: 3px solid transparent; color: var(--muted); transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease); }
.rt-stage-btn:hover { color: var(--white); background: var(--line-soft); }
.rt-stage-btn.is-active { color: var(--white); border-left-color: var(--red); }
.rt-stage-num { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.rt-stage-num b { font-family: var(--font-display); font-weight: 900; font-size: 32px; line-height: 1; letter-spacing: -.03em; }
.rt-stage-num small { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.rt-stage-btn.is-active .rt-stage-num small { color: var(--cyan); }
.rt-stage-txt { display: grid; gap: 2px; min-width: 0; }
.rt-stage-name { font-family: var(--font-body); font-weight: 700; font-size: 15px; line-height: 1.35; }
.rt-stage-sub { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.rt-stage-btn.is-active .rt-stage-sub { color: var(--muted); }

/* ---------- controls: play + range ---------- */
.rt-ctrl { display: flex; align-items: center; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.rt-play { flex: 0 0 auto; min-width: 88px; min-height: 44px; padding: 0 16px; border: 2px solid var(--white); font-family: var(--font-mono); font-size: 15px; letter-spacing: .04em; line-height: 1; color: var(--white); transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease); }
.rt-play:hover, .rt-play:focus-visible { background: var(--white); color: #000; }
.rt-play.is-playing { background: var(--red); border-color: var(--red); color: #fff; }
.rt-slider { position: relative; flex: 1 1 auto; min-width: 0; padding-bottom: 18px; }
.rt-range { display: block; width: 100%; height: 44px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.rt-range:focus { outline: none; }
.rt-range::-webkit-slider-runnable-track { height: 2px; background: var(--line); }
.rt-range::-moz-range-track { height: 2px; background: var(--line); }
.rt-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -11px; background: var(--red); border: 0; border-radius: 0; transition: transform .15s var(--ease); }
.rt-range::-moz-range-thumb { width: 24px; height: 24px; background: var(--red); border: 0; border-radius: 0; }
.rt-range:active::-webkit-slider-thumb, .rt-range:focus-visible::-webkit-slider-thumb { transform: scale(1.15); outline: 2px solid var(--cyan); }
.rt-range:focus-visible::-moz-range-thumb { outline: 2px solid var(--cyan); }
.rt-ticks { position: absolute; left: 12px; right: 12px; top: 15px; height: 14px; pointer-events: none; }
.rt-ticks i { position: absolute; top: 0; width: 1px; height: 14px; background: var(--red); opacity: .8; }
.rt-scale { position: absolute; left: 12px; right: 12px; bottom: 0; height: 16px; pointer-events: none; }
.rt-scale span { position: absolute; transform: translateX(-50%); font-family: var(--font-display); font-weight: 800; font-size: 12px; color: var(--dim); line-height: 1; }
.rt-scale span:first-child { transform: none; }
.rt-scale span:last-child { transform: translateX(-100%); }

/* ---------- departure → arrival ---------- */
.rt-calc { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 24px; border-top: 1px solid var(--line); }
.rt-calc > * { display: grid; gap: 6px; padding: 16px 0 18px; border-bottom: 1px solid var(--line-soft); }
.rt-k { font-family: var(--font-mono); font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.rt-v { font-family: var(--font-display); font-weight: 900; font-size: clamp(34px, 4vw, 48px); line-height: 1; letter-spacing: -.03em; color: var(--white); font-variant-numeric: tabular-nums; }
.rt-v--gap { color: var(--cyan); }
.rt-v--gap.is-open { color: var(--red); font-family: var(--font-body); font-size: clamp(24px, 3vw, 34px); letter-spacing: 0; }
.rt-calc-dep { cursor: pointer; }
.rt-time { width: 100%; max-width: 220px; min-height: 48px; padding: 0 12px; background: var(--bg-2); color: var(--white); border: 1px solid var(--line); border-radius: 0; font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -.02em; color-scheme: dark; }
.rt-time:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.rt-time::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .6; cursor: pointer; }
.rt-calc-share { align-content: end; justify-items: start; }
.rt-calc-post { min-width: 96px; }
@media (min-width: 700px) {
  .rt-calc { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0 24px; }
  .rt-calc > * + * { padding-left: 24px; border-left: 1px solid var(--line-soft); }
}

/* ---------- links ---------- */
.rt-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ==========================================================================
   「歩いてみる」 game
   ========================================================================== */
.rt-game[hidden] { display: none; }
.rt-g-hud { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px 18px; align-items: end; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.rt-g-hud-item { display: grid; gap: 2px; min-width: 0; }
.rt-g-hud-item b { font-family: var(--font-display); font-weight: 900; font-size: 22px; line-height: 1; letter-spacing: -.02em; color: var(--white); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-g-hud-clock b { font-size: clamp(32px, 4vw, 44px); color: var(--cyan); }
.rt-g-seg { font-family: var(--font-body) !important; font-weight: 900 !important; font-size: 16px !important; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .rt-g-hud { grid-template-columns: 1fr 1fr; }
  .rt-g-hud-item b { font-size: 20px; }
}

.rt-g-screen { position: relative; margin-top: 14px; background: var(--bg-2); border: 1px solid var(--line-soft); display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.rt-g-canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; background: var(--bg-2); }
.rt.is-run .rt-g-canvas { touch-action: none; }
/* three.js diorama (route3d.js) mounted into .rt-g3; the 2D hud/screen stay as the fallback */
.rt.is-3d .rt-g-hud, .rt.is-3d .rt-g-screen { display: none; }
.rt-g3 { display: block; }
.rt-g-canvas:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }

.rt-g-msg { position: absolute; left: 50%; top: 14%; transform: translate(-50%, 0); padding: 8px 14px; background: var(--red); color: #fff; font-family: var(--font-body); font-weight: 900; font-size: clamp(15px, 2vw, 20px); line-height: 1.2; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity .15s var(--ease), visibility .15s; pointer-events: none; }
.rt-g-msg.is-show { opacity: 1; visibility: visible; }

/* choice bar: reserved strip under the canvas so buttons never cover the scene */
.rt-g-choices { width: 100%; min-height: 68px; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--line-soft); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s var(--ease), transform .2s var(--ease-out), visibility .15s; pointer-events: none; }
.rt-g-choices.is-show { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.rt-g-btn { min-height: 48px; min-width: 96px; padding: 0 18px; background: var(--bg); color: var(--white); border: 2px solid var(--white); font-family: var(--font-mono); font-size: 16px; letter-spacing: .02em; line-height: 1; transition: background .15s var(--ease), color .15s var(--ease); }
.rt-g-btn:hover, .rt-g-btn:focus-visible { background: var(--white); color: #000; }
.rt-g-btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.rt-g-btn--red:hover, .rt-g-btn--red:focus-visible { background: #fff; border-color: #fff; color: var(--red); }

.rt-g-over { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(7, 8, 12, .86); }
.rt-g-over.is-show { display: flex; }
.rt-g-title { display: grid; justify-items: center; gap: 10px; text-align: center; }
.rt-g-title-h { font-family: var(--font-mono); font-size: clamp(28px, 5vw, 44px); line-height: 1; color: var(--white); }
.rt-g-title-s { font-family: var(--font-body); font-weight: 700; font-size: 14px; color: var(--muted); }
.rt-g-title-best { display: inline-flex; align-items: baseline; gap: 8px; }
.rt-g-title-best b { font-family: var(--font-display); font-weight: 900; font-size: 24px; line-height: 1; color: var(--white); }
.rt-g-title-best i { font-style: normal; font-family: var(--font-display); font-weight: 900; font-size: 18px; color: var(--cyan); }
.rt-g-btn--start { margin-top: 6px; min-width: 160px; background: var(--red); border-color: var(--red); color: #fff; }
.rt-g-btn--start:hover, .rt-g-btn--start:focus-visible { background: #fff; border-color: #fff; color: var(--red); }

.rt-g-fin { width: 100%; max-width: 560px; display: grid; gap: 14px; }
.rt-g-fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.rt-g-fin-grid > div { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 6px; }
.rt-g-fin-grid b { font-family: var(--font-display); font-weight: 900; font-size: clamp(26px, 4vw, 40px); line-height: 1; letter-spacing: -.03em; color: var(--white); font-variant-numeric: tabular-nums; }
.rt-g-fin-score { grid-column: 1 / -1; border-top-width: 2px !important; border-top-color: var(--white) !important; position: relative; }
.rt-g-fin-score b { font-size: clamp(48px, 8vw, 80px); color: var(--white); }
.rt-g-fin-new { position: absolute; right: 0; top: 8px; font-style: normal; font-family: var(--font-mono); font-size: 13px; color: #000; background: var(--cyan); padding: 2px 8px; }
.rt-g-fin-rank b { color: var(--red); }
.rt-g-fin-rank b.is-S { color: var(--red); }
.rt-g-fin-rank b.is-A { color: var(--cyan); }
.rt-g-fin-rank b.is-B, .rt-g-fin-rank b.is-C { color: var(--white); }
.rt-g-fin-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.rt-g-fin-acts .btn { min-height: 44px; }
@media (max-width: 420px) {
  .rt-g-fin-grid b { font-size: 24px; }
  .rt-g-fin-score b { font-size: 44px; }
  .rt-g-over { padding: 10px; align-items: flex-start; overflow: auto; }
}

