/* ==========================================================================
   METREAL VOL.2 — route3d.css  (「歩いてみる」 three.js diorama, mounted by route.js)
   Square corners, pixel labels (--font-mono), numerals (--font-display), flat colours.
   ========================================================================== */
.r3 { display: grid; gap: 14px; }

/* ---------- HUD ---------- */
.r3-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); }
.r3-hud-item { display: grid; gap: 2px; min-width: 0; }
.r3-k { font-family: var(--font-mono); font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.r3-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; }
.r3-hud-clock b { font-size: clamp(32px, 4vw, 44px); color: var(--cyan); }
.r3-seg { font-family: var(--font-body) !important; font-weight: 900 !important; font-size: 16px !important; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .r3-hud { grid-template-columns: 1fr 1fr; }
  .r3-hud-item b { font-size: 20px; }
}

/* ---------- screen ---------- */
.r3-screen { position: relative; background: var(--bg-2); border: 1px solid var(--line-soft); overflow: hidden; }
.r3-view { position: relative; width: 100%; line-height: 0; }
.r3-canvas { display: block; width: 100%; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; background: #12142a; cursor: pointer; outline: none; }
.r3.is-run .r3-canvas { touch-action: none; }
.r3-canvas:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }

/* feedback: single short flash (correct = cyan, mistake = red) */
.r3-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.r3-flash.is-cyan { background: var(--cyan); animation: r3-flash .4s steps(2, end) 1; }
.r3-flash.is-red { background: var(--red); animation: r3-flash .4s steps(2, end) 1; }
@keyframes r3-flash { 0% { opacity: .5; } 50% { opacity: 0; } 75% { opacity: .35; } 100% { opacity: 0; } }

.r3-msg { position: absolute; left: 50%; top: 12%; 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; }
.r3-msg.is-cyan { background: var(--cyan); color: #000; }
.r3-msg.is-show { opacity: 1; visibility: visible; }

.r3-fade { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .22s linear; }
.r3-fade.is-on { opacity: 1; }

/* choice bar: reserved strip under the canvas so buttons never cover the scene */
.r3-choices { width: 100%; min-height: 68px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; 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; }
.r3-choices.is-show { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.r3-btn { min-height: 48px; min-width: 96px; padding: 0 18px; background: var(--bg); color: var(--white); border: 2px solid var(--white); border-radius: 0; font-family: var(--font-mono); font-size: 16px; letter-spacing: .02em; line-height: 1; cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease); }
.r3-btn:hover, .r3-btn:focus-visible { background: var(--white); color: #000; }
.r3-btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.r3-btn--red:hover, .r3-btn--red:focus-visible { background: #fff; border-color: #fff; color: var(--red); }

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

.r3-fin { width: 100%; max-width: 560px; display: grid; gap: 14px; }
.r3-fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.r3-fin-grid > div { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 6px; }
.r3-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; }
.r3-fin-score { grid-column: 1 / -1; border-top-width: 2px !important; border-top-color: var(--white) !important; position: relative; }
.r3-fin-score b { font-size: clamp(48px, 8vw, 80px); color: var(--white); }
.r3-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; }
.r3-fin-rank b.is-S { color: var(--red); }
.r3-fin-rank b.is-A { color: var(--cyan); }
.r3-fin-rank b.is-B, .r3-fin-rank b.is-C { color: var(--white); }
.r3-fin-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.r3-fin-acts .btn { min-height: 44px; }
@media (max-width: 420px) {
  .r3-fin-grid b { font-size: 24px; }
  .r3-fin-score b { font-size: 44px; }
  .r3-over { padding: 10px; align-items: flex-start; overflow: auto; }
}
