/* joho-robot（順番に めいれいする）部品。
   色の約束：みぎ手・みぎを むく＝オレンジ（四角）／ひだり手・ひだりを むく＝むらさき（丸）／まえへ＝みどり／がめんの 向き＝青
   通った マス＝うすい みどりと 足あと／止まった マス＝オレンジの わくと ●／こう うごいて ほしい道＝青の 点線／じっさいの 道＝こい みどりの 線
   ずれた 1歩・今の めいれい＝黄色く 光る（まちがい＝赤 は 使わない。せめない） */
.jr-w { --jr-r: #ea580c; --jr-rl: #fff1e6; --jr-rd: #9a3412; --jr-l: #7c3aed; --jr-ll: #f3edff; --jr-ld: #5b21b6;
  --jr-f: #0f8a72; --jr-fl: #e6f6f1; --jr-fd: #0b6b58; --jr-a: #2563eb; --jr-al: #e8efff; --jr-ad: #1d4ed8;
  --jr-y: #f59e0b; --jr-yl: #fff4d6; --jr-stop: #c2410c; --jr-ink: var(--ink, #1f2937); --jr-sub: var(--sub, #4b5563); --jr-line: var(--line, #e5e7eb);
  color: var(--jr-ink); }
.jr-w * { box-sizing: border-box; }
.jr-w [hidden] { display: none !important; }
.jr-stage { margin: 0 0 4px; font-size: .95rem; font-weight: 700; color: var(--jr-fd); }
.jr-lead { margin: 0 0 10px; font-size: 1.02rem; line-height: 1.8; }
.jr-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 720px) {
  .jr-body { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; gap: 18px; }
}
.jr-left, .jr-right { min-width: 0; }
.jr-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 0; margin-bottom: 6px; }
.jr-top:empty { display: none; }
.jr-vnote { font-size: .88rem; color: var(--jr-fd); font-weight: 700; }

/* ボタン */
.jr-w button { font: inherit; cursor: pointer; touch-action: manipulation; }
.jr-w button:focus-visible, .jr-svg:focus-visible { outline: 3px solid var(--jr-a); outline-offset: 2px; }
.jr-b { min-height: 48px; padding: 4px 14px; border: 2px solid #cbd5e1; border-radius: 12px; background: #fff; color: var(--jr-ink); font-weight: 700; font-size: 1rem; line-height: 1.3; }
.jr-b:disabled { opacity: .45; cursor: default; }
.jr-b.run { background: var(--jr-f); border-color: var(--jr-f); color: #fff; }
.jr-b.go { background: var(--jr-a); border-color: var(--jr-a); color: #fff; }
.jr-b.hint { border-style: dashed; color: var(--jr-sub); }
.jr-view { min-height: 44px; padding: 4px 12px; border: 2px solid var(--jr-fd); border-radius: 22px; background: #fff; color: var(--jr-fd); font-weight: 700; font-size: .95rem; }
.jr-view[aria-pressed="true"] { background: var(--jr-fd); color: #fff; }
.jr-view::before { content: "◎ "; }

/* 盤面 */
.jr-svg { display: block; width: 100%; height: auto; margin: 0 auto; touch-action: manipulation; border-radius: 12px; }
.jr-m-predict .jr-svg { cursor: pointer; }
.jr-cell { fill: #f8fafc; stroke: #d6dde6; stroke-width: 2; }
.jr-wall { fill: #64748b; }
.jr-brick { stroke: #94a3b8; stroke-width: 2; fill: none; }
.jr-goal { fill: #fff6cc; stroke: #eab308; stroke-width: 3; }
.jr-star { fill: #eab308; }
.jr-gtx, .jr-stx { font-size: 13px; font-weight: 700; text-anchor: middle; fill: #854d0e; }
.jr-stx { fill: var(--jr-sub); font-size: 11.5px; }
.jr-flag line { stroke: #475569; stroke-width: 3; stroke-linecap: round; }
.jr-flag path { fill: #db2777; }
.jr-passed { fill: var(--jr-fl); }
.jr-foot ellipse { fill: #7cc9b8; }
.jr-act { fill: none; stroke: var(--jr-fd); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.jr-want { fill: none; stroke: var(--jr-a); stroke-width: 5; stroke-dasharray: 2 10; stroke-linecap: round; stroke-linejoin: round; }
.jr-want-end { fill: none; stroke: var(--jr-a); stroke-width: 3; stroke-dasharray: 4 4; }
.jr-num circle { fill: #fff; stroke: var(--jr-fd); stroke-width: 2.5; }
.jr-num text { font-size: 14px; font-weight: 700; text-anchor: middle; fill: var(--jr-fd); }
.jr-stop { fill: none; stroke: var(--jr-stop); stroke-width: 4; }
.jr-stopdot { fill: var(--jr-stop); }
.jr-guess rect { fill: none; stroke: var(--jr-a); stroke-width: 4; stroke-dasharray: 7 5; }
.jr-guess text { font-size: 16px; font-weight: 700; fill: var(--jr-a); text-anchor: middle; }
.jr-cur { fill: none; stroke: #94a3b8; stroke-width: 3; opacity: 0; }
.jr-svg:focus-visible .jr-cur { opacity: 1; stroke: var(--jr-a); }
.jr-div { fill: none; stroke: var(--jr-y); stroke-width: 6; animation: jr-pulse 1.2s ease-in-out infinite; }
@keyframes jr-pulse { 50% { stroke-width: 2; opacity: .5; } }
.jr-ghost { fill: none; stroke: #64748b; stroke-width: 3; stroke-dasharray: 5 4; opacity: .8; }
/* ロボット */
.jr-torso { fill: #fff; stroke: #0f766e; stroke-width: 3; }
.jr-nose { fill: #0f766e; }
.jr-visor { fill: #1f2937; }
.jr-eye { fill: #7dd3fc; }
.jr-belly { fill: #ccefe7; }
.jr-hr { fill: var(--jr-r); stroke: var(--jr-rd); stroke-width: 1.5; }
.jr-hl { fill: var(--jr-l); stroke: var(--jr-ld); stroke-width: 1.5; }
.jr-turn-r .jr-hr, .jr-turn-l .jr-hl { stroke: var(--jr-y); stroke-width: 5; }
.jr-bumpm path { fill: var(--jr-y); stroke: #b45309; stroke-width: 1.5; }
.jr-legend { margin: 6px 0 0; font-size: .82rem; line-height: 1.9; color: var(--jr-sub); }
.jr-legend .jr-li { display: inline-block; white-space: nowrap; margin-right: 12px; }
.jr-legend .jr-li > span { display: inline-block; vertical-align: middle; margin-right: 3px; }
.jr-legend .k-foot { width: 16px; height: 16px; border-radius: 4px; background: var(--jr-fl); box-shadow: inset 0 0 0 4px #b9e3d8; }
.jr-legend .k-stop { color: var(--jr-stop); font-size: 1rem; }
.jr-legend .k-r { width: 12px; height: 14px; border-radius: 3px; background: var(--jr-r); }
.jr-legend .k-l { width: 13px; height: 13px; border-radius: 50%; background: var(--jr-l); }
.jr-legend .k-want { width: 22px; border-top: 4px dotted var(--jr-a); }
.jr-legend .k-act { width: 22px; border-top: 4px solid var(--jr-fd); }
.jr-legend .k-guess { color: var(--jr-a); font-weight: 700; border: 2px dashed var(--jr-a); border-radius: 4px; padding: 0 3px; line-height: 1.2; }

/* 実行 */
.jr-run { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.jr-run .jr-b { flex: 1 1 auto; }
.jr-run[hidden], .jr-pal[hidden], .jr-edit[hidden], .jr-guessrow[hidden] { display: none; }
.jr-msg { min-height: 1.5em; margin-top: 8px; }
.jr-msg p { margin: 0; padding: 8px 12px; border-radius: 10px; background: #f1f5f9; font-size: 1rem; line-height: 1.75; }
.jr-msg.ok p { background: var(--ok-l, #e7f7ef); color: #065f46; font-weight: 700; }
.jr-msg.warn p { background: var(--jr-yl); color: #7c3b06; }
.jr-msg:empty { display: none; }
.jr-after { margin-top: 8px; }
.jr-after:empty { display: none; }

/* プログラム */
.jr-h { margin: 0 0 6px; font-size: .92rem; font-weight: 700; color: var(--jr-sub); }
.jr-prog { list-style: none; margin: 0; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; min-height: 64px; border: 2px dashed #cbd5e1; border-radius: 12px; background: #fbfcfd; }
.jr-prog li { margin: 0; padding: 0; }
.jr-empty { color: #94a3b8; font-size: .9rem; align-self: center; padding: 0 6px !important; }
.jr-count { margin: 4px 0 0; font-size: .92rem; font-weight: 700; color: var(--jr-fd); min-height: 1.4em; }

/* ブロック：色＋形＋絵。まえへ＝角の 四角／みぎを むく＝みぎが まるい／ひだりを むく＝ひだりが まるい／がめんの 向き＝角の 四角に やじるし */
.jr-blk { word-break: keep-all; display: inline-flex; align-items: center; gap: 4px; min-height: 52px; padding: 4px 10px; border: 2.5px solid; font-weight: 700; font-size: .98rem; line-height: 1.2; text-align: left; background: #fff; }
.jr-blk .jr-ic { width: 26px; height: 26px; flex: none; }
.jr-blk.abs { border-color: var(--jr-a); background: var(--jr-al); color: var(--jr-ad); border-radius: 6px; }
.jr-blk.fwd { border-color: var(--jr-f); background: var(--jr-fl); color: var(--jr-fd); border-radius: 4px; }
.jr-blk.tr { border-color: var(--jr-r); background: var(--jr-rl); color: var(--jr-rd); border-radius: 6px 26px 26px 6px; }
.jr-blk.tl { border-color: var(--jr-l); background: var(--jr-ll); color: var(--jr-ld); border-radius: 26px 6px 6px 26px; }
.jr-blk.sm { min-height: 44px; padding: 3px 8px 3px 4px; font-size: .9rem; }
.jr-blk.sm .jr-ic { width: 20px; height: 20px; }
.jr-no { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; background: #fff; color: var(--jr-ink); font-size: .8rem; border: 1.5px solid currentColor; }
.jr-blk[aria-pressed="true"] { outline: 3px solid var(--jr-ink); outline-offset: 2px; }
.jr-blk.now { box-shadow: 0 0 0 4px var(--jr-y), 0 0 14px 4px rgba(245, 158, 11, .55); transform: translateY(-2px); }
.jr-blk.done { opacity: .62; }
.jr-blk.skip { opacity: .35; border-style: dashed; }
.jr-blk.okl::after { content: "✓"; margin-left: 2px; color: var(--jr-fd); }
.jr-blk.bad { box-shadow: 0 0 0 4px var(--jr-y), 0 0 16px 6px rgba(245, 158, 11, .7); animation: jr-glow 1.2s ease-in-out infinite; opacity: 1; }
.jr-blk.bad::after { content: "ここ？"; margin-left: 4px; font-size: .8rem; color: #92400e; }
.jr-blk.fixed { border-style: double; border-width: 4px; }
@keyframes jr-glow { 50% { box-shadow: 0 0 0 2px var(--jr-y), 0 0 4px 1px rgba(245, 158, 11, .4); } }
@media (prefers-reduced-motion: reduce) { .jr-div, .jr-blk.bad { animation: none; } .jr-blk.now { transform: none; } }

.jr-pal { margin-top: 10px; padding: 8px; border-radius: 12px; background: #f6f7f4; }
.jr-palnote { margin: 0 0 6px; font-size: .9rem; font-weight: 700; color: var(--jr-ink); min-height: 0; }
.jr-palnote:empty { display: none; }
.jr-pal.rel { display: flex; flex-wrap: wrap; gap: 8px; }
.jr-pal.rel .jr-palnote { flex: 1 1 100%; }
.jr-pal.rel .jr-blk { flex: 1 1 28%; justify-content: center; flex-direction: column; gap: 2px; text-align: center; padding: 6px 4px; }
/* がめんの 向き：十字の ならび（うえ が 上、した が 下） */
.jr-pal.abs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.jr-pal.abs .jr-palnote { grid-column: 1 / -1; }
.jr-pal.abs .jr-blk { justify-content: center; padding: 4px 4px; font-size: .9rem; flex-direction: column; gap: 0; text-align: center; }
.jr-pal.abs .p-up, .jr-pal.abs .p-up2 { grid-column: 2; }
.jr-pal.abs .p-left, .jr-pal.abs .p-left2 { grid-column: 1; }
.jr-pal.abs .p-right, .jr-pal.abs .p-right2 { grid-column: 3; }
.jr-pal.abs .p-down, .jr-pal.abs .p-down2 { grid-column: 2; }
.jr-edit, .jr-guessrow, .jr-hintrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.jr-guessrow .jr-b { flex: 1 1 auto; }
.jr-hint:empty { display: none; }
.jr-hint { margin-top: 8px; padding: 8px 12px; border-left: 4px solid var(--jr-y); background: var(--jr-yl); border-radius: 0 10px 10px 0; }
.jr-hint p { margin: 0; line-height: 1.75; }
.jr-hint .jr-hh { font-weight: 700; font-size: .88rem; color: #92400e; }
.jr-legend .k-div { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--jr-y); box-shadow: 0 0 6px var(--jr-y); }
/* スマホ（720px 未満）：盤面の すぐ 下に いまの プログラム（光る 行）と ▶。ブロックの えらびは その下。
   往復 スクロール なしで「ならべる → うごかす → 見る」が 1画面で できる */
@media (max-width: 719px) {
  .jr-body { display: flex; flex-direction: column; gap: 0; }
  .jr-left, .jr-right { display: contents; }
  .jr-top { order: 1; } .jr-svg { order: 2; }
  .jr-h { order: 3; margin-top: 8px; margin-bottom: 4px; } .jr-prog { order: 4; min-height: 56px; padding: 6px; } .jr-count { order: 5; }
  .jr-guessrow { order: 6; } .jr-run { order: 7; margin-top: 6px; } .jr-msg { order: 8; } .jr-after { order: 9; }
  .jr-pal { order: 10; } .jr-edit { order: 11; } .jr-legend { order: 12; } .jr-hintrow { order: 13; } .jr-hint { order: 14; }
  .jr-run .jr-b { min-height: 46px; }
  .jr-pal { margin-top: 6px; padding: 6px; }
  .jr-pal.abs { gap: 4px; }
  .jr-pal.abs .jr-blk { flex-direction: row; gap: 3px; min-height: 46px; font-size: .84rem; padding: 2px; }
  .jr-pal.abs .jr-blk .jr-ic { width: 20px; height: 20px; }
}
/* その場で（むく ブロックの 小さい そえ字） */
.jr-blk .jr-sub { display: block; font-size: .72rem; font-weight: 700; opacity: .85; line-height: 1.1; }
.jr-blk.sm .jr-sub { display: inline; margin-left: 3px; }
/* ゴールで 止まった：金の わく（★を かくさない・赤に 見えない） */
.jr-stop.goal { stroke: #ca8a04; stroke-width: 3; stroke-dasharray: none; fill: none; }
/* みぎ・ひだりが ぎゃくの とき「ロボットの目で 見る」を 光らせる */
.jr-view.jr-glow { box-shadow: 0 0 0 4px var(--jr-y), 0 0 14px 4px rgba(245, 158, 11, .6); animation: jr-glow 1.2s ease-in-out infinite; }
/* むきの よそう */
.jr-msg.ask p { background: var(--jr-al); color: var(--jr-ad); font-weight: 700; }
.jr-askrow { display: flex; gap: 8px; margin-top: 6px; }
.jr-b.ask { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border-color: var(--jr-a); color: var(--jr-ad); background: #fff; }
.jr-b.ask .jr-ic { width: 24px; height: 24px; }
@media (prefers-reduced-motion: reduce) { .jr-view.jr-glow { animation: none; } }

/* 読み上げ（🔊）の ボタン：部品の button の きまりで 大きさが かわらない ように（2026-11-15） */
.jr-w .say { font-size: 18px; line-height: 1; flex: none; padding: 0; }
