/* ---------- 攻撃の舞台 ---------- */
/* オープニングのスタイルが style.css にあった頃、その .cap の指定がこのページにも当たっていた（intro.css へ移したあとも見た目を変えないよう、その分を残す） */
.cap { --blur: 6px; font-size: clamp(1.1rem, 2.4vw, 1.4rem); line-height: 1.75; }
.cap + .cap { margin-top: .45em; }
.cap.em { font-size: clamp(1.45rem, 4.6vw, 2.1rem); line-height: 1.5; }
.cap.big { font-size: clamp(1.55rem, 5.4vw, 2.5rem); line-height: 1.45; }
.cap.sub { font-family: var(--font-body); font-weight: 400; font-size: clamp(.95rem, 2vw, 1.1rem); line-height: 1.85; color: var(--ink-2); margin-top: .9em; letter-spacing: .05em; }
/* オープニングのスタイルが style.css にあった頃、その .ph の指定がこのページにも当たっていた（intro.css へ移したあとも見た目を変えないよう、その分を残す） */
.ph { position: relative; width: min(88%, 300px); height: 118%; margin: 14px auto 0; border-radius: 42px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 0 0 7px var(--bg-2), 0 0 0 8px var(--line), 0 40px 70px -40px rgba(0, 0, 0, .35); font-family: var(--font-body); font-weight: 400; text-align: left; line-height: 1.5; letter-spacing: .02em; }
.stage { background: #17191d; border-radius: var(--radius); overflow: hidden; color: #e9e9e9; }
.scene { width: 100%; height: auto; display: block; }
.scene .g { opacity: 0; transition: opacity .6s ease; }
.scene .g.on { opacity: 1; }
.scene text { font-family: var(--mono); fill: #cfcfcf; }
/* 偵察 */
.g1.active .beam { animation: sweep 2.4s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: rotate(-7deg); } to { transform: rotate(6deg); } }
.beam { transform-origin: 150px 196px; transform-box: view-box; }
.beam { transition: opacity .6s; }
.g1:not(.active) .beam { opacity: 0; }
.g2.on:not(.active) { opacity: .45; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* 武器化 */
.gear { transform-origin: 112px 120px; transform-box: view-box; }
.g2.active .gear { animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.g2.active .bomb { animation: throb .8s ease-in-out infinite alternate; }
.bomb { transform-origin: 168px 120px; transform-box: view-box; }
@keyframes throb { to { transform: scale(1.12); } }
/* デリバリー */
.mail { transform: translateX(0); }
.g3.active .mail { animation: fly 2.2s cubic-bezier(.5, 0, .3, 1) infinite; }
.g3.on:not(.active) .mail { transform: translateX(420px); opacity: 0; }
@keyframes fly { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 50% { transform: translate(210px, -40px); } 90% { opacity: 1; } 100% { transform: translate(420px, 0); opacity: 0; } }
/* エクスプロイト */
.shackle { transform-origin: 626px 214px; transform-box: view-box; transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.g4.on .shackle { transform: rotate(-38deg) translateY(-6px); }
.g4.active .lock { animation: shake .35s ease 3; }
.lock { transform-origin: 634px 230px; transform-box: view-box; }
@keyframes shake { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
/* インストール */
.g5.active .bug { animation: blink .7s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
/* 遠隔操作 */
.c2 { stroke-dasharray: 6 8; }
.g6.on .c2 { animation: flow .8s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.infect { transition: fill .4s; }
/* 目的の実行 */
.loot { opacity: 0; }
.g7.active .loot { animation: steal 1.8s ease-in infinite; }
.g7.active .loot:nth-child(2) { animation-delay: .4s; } .g7.active .loot:nth-child(3) { animation-delay: .8s; }
@keyframes steal { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(-420px, -30px); opacity: 0; } }
/* 一時停止中や段階を選んだときは、繰り返しの動きを二回で止める */
.stage.paused .beam, .stage.paused .gear, .stage.paused .bomb, .stage.paused .mail, .stage.paused .bug, .stage.paused .c2, .stage.paused .loot { animation-iteration-count: 2 !important; }
/* 図の上に重ねた文字（拠点の名前、偵察で集めた情報、身代金の要求）。位置は図の座標（800×330）を割合に直して指定する */
.scene-wrap { position: relative; container-type: inline-size; }
.scene-wrap .sl, .rtag, .rans { position: absolute; font-family: var(--mono); font-size: clamp(12px, 1.3vw, 14px); line-height: 1; white-space: nowrap; pointer-events: none; transform: translateX(-50%); }
.scene-wrap .sl { bottom: 0; height: 12.1%; display: flex; align-items: center; color: #cfcfcf; }
.rtag { top: 12.1%; padding: .5em .8em; border-radius: 4px; background: #2f333b; color: #cfcfcf; opacity: 0; }
.rtag.r1 { left: 59.75%; } .rtag.r2 { left: 46%; } .rtag.r3 { left: 32.25%; }
.rans { top: 9%; right: 7.5%; transform: none; padding: .75em 1.2em; border-radius: 4px; background: #b0001e; color: #fff; opacity: 0; }
.scene-wrap.k1 .rtag { animation: hpop .5s ease forwards; }
.scene-wrap.k1 .rtag.r2 { animation-delay: .6s; } .scene-wrap.k1 .rtag.r3 { animation-delay: 1.2s; }
.scene-wrap.k7 .rans { animation: hpop .6s ease forwards; }
@keyframes hpop { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
/* 図が狭いとき（スマートフォン、横向きで図を縮めたとき）は、偵察で集めた情報を縦に積む */
@container (max-width: 640px) {
  .rtag.r1, .rtag.r2, .rtag.r3 { left: 44%; }
  .rtag.r1 { top: 5%; } .rtag.r2 { top: calc(5% + 2.4em); } .rtag.r3 { top: calc(5% + 4.8em); }
  .rans { top: 5%; right: 5%; }
}
/* 小さなスマートフォンでは、舞台を画面の端まで広げる */
@media (max-width: 480px) { .stage { margin: 0 -20px; border-radius: 0; } }
/* 横向きのスマートフォンでは、図を画面の高さに合わせて縮め、下の段階の列まで一画面に入れる */
@supports (height: 100svh) { @media (max-height: 500px) and (orientation: landscape) { .scene-wrap { max-width: calc((100svh - 150px) * 800 / 330); margin: 0 auto; } } }
@media (prefers-reduced-motion: reduce) {
  .scene * { animation: none !important; }
  /* 動きで現れる情報は、最初から表示する */
  .scene-wrap.k1 .rtag, .scene-wrap.k7 .rans { animation: none; opacity: 1; }
  .g7.active .loot { opacity: 1; }
  .g7.active .loot:nth-child(1) { transform: translate(-100px, -7px); }
  .g7.active .loot:nth-child(2) { transform: translate(-200px, -14px); }
  .g7.active .loot:nth-child(3) { transform: translate(-300px, -21px); }
}

/* 広い画面では段階を横幅いっぱいに並べ、狭い画面では横に流す */
.chainbar { flex: 1; min-width: 0; position: relative; display: flex; overflow-x: auto; border-top: 1px solid #2c2f35; }
.chainbar button { flex: 1 0 auto; appearance: none; border: 0; background: transparent; color: #8b8f97; font: inherit; font-size: .8rem; padding: 14px 12px 12px; cursor: pointer; border-top: 3px solid transparent; white-space: nowrap; transition: color .3s, border-color .3s; }
.chainbar button b { display: block; font-family: var(--mono); font-weight: 400; font-size: .75rem; }
@media (hover: hover) { .chainbar button:hover { color: #fff; } }
.chainbar button.done { color: #c9c9c9; border-top-color: #6b2b24; }
.chainbar button.cur { color: #fff; border-top-color: #f06a50; }
.cap { display: grid; gap: 24px; padding: 24px clamp(20px, 4vw, 36px) 28px; border-top: 1px solid #2c2f35; min-height: 150px; }
@media (min-width: 820px) { .cap { grid-template-columns: 1fr 1fr; } }
.cap .k { font-family: var(--mono); font-size: .75rem; letter-spacing: .15em; display: block; margin-bottom: 6px; }
.cap .k.a { color: #f07468; } .cap .k.d { color: #6fd0a4; }
.cap p { color: #cfcfcf; font-size: .93rem; margin: 0; }
.playbtn { appearance: none; border: 1px solid #444; background: transparent; color: #ddd; border-radius: 999px; width: 44px; height: 44px; cursor: pointer; flex: none; margin: 8px 10px 8px 8px; align-self: center; }
@media (hover: hover) { .playbtn:hover { border-color: #fff; } }

/* ---------- ゲーム ---------- */
.game { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 40px); }
/* 段階名は 12px 以上で描ける幅のときだけ出す */
@media (max-width: 759px) { .gchain text { display: none; } }
.gchain { width: 100%; height: auto; display: block; margin-bottom: 8px; overflow: visible; }
.gchain .lk { transition: stroke .3s; }
.gchain .half { transition: transform .7s cubic-bezier(.3, 1.4, .5, 1), opacity .7s; }
.gchain .half { transform-box: fill-box; }
.gchain .half.l { transform-origin: right center; }
.gchain .half.r { transform-origin: left center; }
/* 断ち切った輪は左右に開く。下の段階名に重ならない幅にとどめる */
.gchain .lk.broken .half.l { transform: translate(-10px, -2px) rotate(-20deg); }
.gchain .lk.broken .half.r { transform: translate(10px, -2px) rotate(20deg); }
.gchain .lk.broken .half { stroke: var(--ok); }
.gchain .token { transition: transform .6s cubic-bezier(.4, 0, .2, 1), opacity .4s; }
.gq { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 8px; }
.gq .st { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; }
.gq .sc { font-family: var(--mono); color: var(--ink-3); }
.timer { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin: 14px 0 20px; }
.timer span { display: block; height: 100%; width: 100%; background: var(--ink-2); transform-origin: left; transition: background-color .3s; }
/* 残りが3秒を切ったら色を変え、急ぐ必要があることを伝える */
.timer span.low { background: var(--accent); animation: tlow .5s ease-in-out infinite alternate; }
@keyframes tlow { to { opacity: .45; } }
.cards { display: grid; gap: 10px; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { text-wrap: pretty; appearance: none; text-align: left; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 18px; cursor: pointer; min-height: 92px; font-family: var(--font-head); font-weight: 700; transition: transform .15s, border-color .2s, background .2s; }
@media (hover: hover) { .card:hover:not([disabled]) { transform: translateY(-3px); border-color: var(--ink); } }
.card:active:not([disabled]) { border-color: var(--ink); }
/* スマートフォンでは、選択肢と結果の説明が一つの画面に収まるようにする */
@media (max-width: 719px) {
  .cards { gap: 8px; }
  .card { min-height: 52px; padding: 12px 16px; line-height: 1.6; }
  .timer { margin: 10px 0 14px; }
  .gatk { font-size: .95rem; line-height: 1.85; }
  .gmsg { margin-top: 12px; font-size: .95rem; line-height: 1.85; }
  .gq .st { font-size: 1.12rem; }
}
.card.right { border-color: var(--ok); background: var(--ok-soft); }
.card.wrong { border-color: var(--danger); background: var(--danger-soft); animation: shakeX .4s; }
@keyframes shakeX { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.gatk { color: var(--ink-2); margin: 8px 0 0; }
.gatk + .cards { margin-top: 20px; }
.gmsg { min-height: 3.4em; margin-top: 18px; color: var(--ink-2); }
.gmsg:empty, .gmsg.quiet { min-height: 0; margin: 0; }
.gmsg .gv { display: block; font-family: var(--font-head); font-weight: 700; }
.gmsg .gv.ok { color: var(--ok); } .gmsg .gv.ng { color: var(--danger); }
.gmsg .gdef { display: block; margin-top: 4px; }
.gstarts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.gnext { margin-top: 12px; }
.game [tabindex="-1"]:focus { outline: none; }
@media (prefers-reduced-motion: reduce) { .card.wrong, .timer span.low { animation: none; } }
.gend { text-align: center; padding: 12px 0; }
.gend .gintro { max-width: 30em; margin: 0 auto; }
.gend .gintro + .small { margin-top: 6px; }
/* 結果画面：どこで止めたかを最初に大きく示し、点数はその下に添える */
.gend .ghead { font-family: var(--font-head); font-weight: 700; font-size: clamp(1.45rem, 5.2vw, 2.2rem); line-height: 1.45; margin: 0 auto 6px; max-width: 18em; }
.gend .ghead .ph { display: inline-block; }
.gend .ghead.ok { color: var(--ok); } .gend .ghead.ng { color: var(--danger); }
.gend .big { font-family: var(--font-head); font-weight: 700; font-size: clamp(2rem, 7vw, 3.2rem); line-height: 1.2; }
.gend .glesson { display: block; margin-top: 10px; font-family: var(--font-head); font-weight: 700; }
.gchain .token.away { opacity: 0; }
.gend .gstarts { margin-top: 28px; }
/* 結果画面の振り返り：段階ごとの成否と、そこで効く守り */
.grecap { list-style: none; padding: 0; margin: 24px auto 0; max-width: 560px; text-align: left; border-top: 1px solid var(--line); }
.grecap li { display: grid; grid-template-columns: auto 10em 1fr; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.grecap .gr { font-family: var(--font-head); font-weight: 700; font-size: .78rem; line-height: 1.8; padding: 0 10px; border-radius: 999px; border: 1px solid; }
.grecap .gr.ok { color: var(--ok); background: var(--ok-soft); }
.grecap .gr.ng { color: var(--danger); background: var(--danger-soft); }
.grecap .gn { font-family: var(--font-head); font-weight: 700; }
@media (max-width: 520px) { .grecap li { grid-template-columns: auto 1fr; gap: 2px 12px; } .grecap li > :last-child { grid-column: 2; color: var(--ink-2); } }

/* 元は style 属性だった指定（CSP の style-src に 'unsafe-inline' を付けないため、ここへ移した） */
.scene-wrap .sl.atk { left: 15.6%; }
.scene-wrap .sl.vic { left: 81.9%; }
.chain-row { display: flex; align-items: stretch; }
