/* 星継ぎの旅団 — 深い藍の夜 × ランタンの琥珀 */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --night: #070c24;
  --night2: #0d1638;
  --panel: rgba(12, 20, 50, .86);
  --panel2: rgba(20, 32, 72, .9);
  --line: rgba(242, 185, 94, .55);
  --line-soft: rgba(242, 185, 94, .25);
  --amber: #f2b95e;
  --amber-hi: #ffd99a;
  --ink: #eef0fb;
  --muted: #9aa6cf;
  --blue: #6fa8ff;
  --red: #ff6b6b;
  --green: #7fe0a0;
  --violet: #b98cff;
  --serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", "Source Han Serif JP", serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --top-h: 48px;
  --panel-h: 196px;
  --side-w: 300px;
}
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: var(--night); color: var(--ink);
  font-family: var(--serif);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#layer { position: absolute; inset: 0; pointer-events: none; }
#layer > * { pointer-events: auto; }
#layer .pass { pointer-events: none; }
#layer .pass > * { pointer-events: auto; }
.hidden { display: none !important; }
.noscript { position: absolute; top: 40%; width: 100%; text-align: center; }

button {
  font-family: var(--serif); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 共通パーツ ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .03);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.btn {
  min-height: 44px; min-width: 44px; padding: 8px 18px;
  background: linear-gradient(180deg, rgba(34, 48, 98, .92), rgba(16, 24, 58, .92));
  border: 1px solid var(--line); border-radius: 4px;
  font-size: 15px; letter-spacing: .08em; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s, opacity .2s;
  position: relative;
}
.btn:hover:not(:disabled), .btn:focus-visible { border-color: var(--amber-hi); background: linear-gradient(180deg, rgba(58, 72, 130, .95), rgba(24, 34, 76, .95)); outline: none; }
/* キーボード操作時のフォーカスははっきり白枠で */
.btn:focus-visible, .rcard:focus-visible, .adv-btn:focus-visible, .b-top .obj:focus-visible, summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn.ghost { background: transparent; border-color: var(--line-soft); color: var(--muted); }
.row.wrap { flex-wrap: wrap; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.off { opacity: .42; cursor: not-allowed; }
.btn.primary { border-color: var(--amber); color: var(--amber-hi); box-shadow: 0 0 12px rgba(242, 185, 94, .18) inset; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn .sub { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.btn.on { border-color: var(--red); color: #ffd0d0; }
.gold { color: var(--amber-hi); }
.muted { color: var(--muted); }
.red { color: var(--red); }
.green { color: var(--green); }
.blue { color: var(--blue); }
h1, h2, h3 { font-weight: 600; margin: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; }
.center { text-align: center; }
canvas.icon { image-rendering: pixelated; display: inline-block; vertical-align: middle; flex: none; }

/* ---------- タイトル ---------- */
.title-wrap {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%);
  width: min(96vw, 680px); text-align: center; pointer-events: none;
}
.title-main {
  font-size: min(12vw, 76px); font-weight: 900; letter-spacing: .16em; white-space: nowrap;
  color: #fff4dc; text-shadow: 0 0 18px rgba(242, 185, 94, .75), 0 0 48px rgba(242, 185, 94, .35), 0 2px 0 #3b2a10;
  writing-mode: horizontal-tb; margin-right: -.16em;
  animation: titleIn 2.2s ease-out both;
}
.title-sub { margin-top: 10px; font-size: clamp(13px, 3.6vw, 17px); color: var(--amber-hi); letter-spacing: .3em; opacity: .95; animation: titleIn 2.8s ease-out both; text-shadow: 0 0 4px #04071a, 0 0 10px #04071a, 0 1px 2px #000; }
.title-tag { margin-top: 14px; font-size: 13px; color: #b7c1e6; text-shadow: 0 0 4px #04071a, 0 0 10px #04071a, 0 1px 2px #000; letter-spacing: .12em; line-height: 1.8; animation: titleIn 3.4s ease-out both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes titleIn { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.title-menu {
  position: absolute; left: 50%; bottom: calc(10% + var(--safe-b)); transform: translateX(-50%);
  width: min(80vw, 300px); display: flex; flex-direction: column; gap: 10px;
  animation: fadeIn 2.4s ease-out both;
}
.title-menu .btn { font-size: 17px; }
.title-menu .row.two { gap: 10px; }
.title-menu .row.two .btn { flex: 1; font-size: 15px; padding-left: 8px; padding-right: 8px; }
.title-foot { position: absolute; bottom: calc(8px + var(--safe-b)); width: 100%; text-align: center; font-size: 11px; color: rgba(154, 166, 207, .6); pointer-events: none; }

/* ---------- 上部バー ---------- */
.topbar {
  position: absolute; left: 0; right: 0; top: 0; height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) 8px 0; display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, rgba(6, 10, 30, .95), rgba(6, 10, 30, .72));
  border-bottom: 1px solid var(--line-soft); font-size: 13px; white-space: nowrap; overflow: hidden;
}
.topbar .chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(20, 30, 70, .6); }
.topbar .ttl { font-weight: 600; color: var(--amber-hi); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .btn { min-height: 44px; padding: 4px 10px; font-size: 13px; }
.topbar .chip[title] { cursor: help; }
@media (max-width: 599px) { .topbar .lbl { display: none; } }
.tut-glow { animation: tutGlow 1.2s ease-in-out infinite; }
@keyframes tutGlow { 50% { box-shadow: 0 0 0 3px rgba(255, 217, 154, .85), 0 0 16px rgba(255, 217, 154, .7); } }
.bottombar {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px calc(8px + var(--safe-b));
  display: flex; gap: 8px; justify-content: center; align-items: center;
  background: linear-gradient(0deg, rgba(6, 10, 30, .95), rgba(6, 10, 30, .6));
  border-top: 1px solid var(--line-soft);
}
.party-strip { display: flex; gap: 4px; overflow: hidden; flex: 1; min-width: 0; }
.party-mini { display: flex; flex-direction: column; align-items: center; font-size: 10px; min-width: 38px; }
.hpbar { height: 4px; background: rgba(255, 255, 255, .12); border-radius: 2px; overflow: hidden; width: 100%; }
.hpbar > i { display: block; height: 100%; background: linear-gradient(90deg, #6fe39a, #b8f07a); }
.hpbar.low > i { background: linear-gradient(90deg, #ff6b6b, #ffae6b); }
.map-tip { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(72px + var(--safe-b)); padding: 6px 14px; font-size: 13px; pointer-events: none; white-space: nowrap; }
#layer .map-tip { pointer-events: none; }
#layer .map-tip.at-top { bottom: auto; top: calc(var(--top-h) + var(--safe-t) + 10px); }
#layer .map-tip.armed { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 14px; text-align: center; }
.map-tip.armed .btn { min-width: 160px; min-height: 44px; }
@media (max-width: 520px) { .map-tip { white-space: normal; width: calc(100% - 24px); text-align: center; } }

/* ---------- 章扉 ---------- */
.door { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.door .no { font-size: clamp(16px, 4.5vw, 22px); letter-spacing: .6em; color: var(--amber-hi); opacity: 0; animation: doorIn 1.4s ease-out .1s forwards; margin-right: -.6em; }
.door .name { font-size: clamp(36px, 11vw, 68px); font-weight: 900; letter-spacing: .2em; margin: 14px 0 12px; color: #fff3da; text-shadow: 0 0 24px rgba(242, 185, 94, .6); opacity: 0; animation: doorIn 1.8s ease-out .5s forwards; margin-right: -.2em; }
.door .subt { font-size: clamp(13px, 3.6vw, 16px); color: var(--muted); letter-spacing: .2em; opacity: 0; animation: doorIn 1.6s ease-out 1.1s forwards; padding: 0 16px; }
.door .rule { margin-bottom: 12px; width: min(60vw, 280px); height: 1px; background: linear-gradient(90deg, transparent, var(--amber), transparent); opacity: 0; animation: doorIn 1.4s ease-out .8s forwards; }
@keyframes doorIn { from { opacity: 0; transform: translateY(8px); letter-spacing: .5em; } to { opacity: 1; transform: none; } }
.fast .door .no, .fast .door .name, .fast .door .subt, .fast .door .rule { animation-duration: .3s; animation-delay: 0s; }

/* ---------- ADV ---------- */
#adv { position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 30; cursor: pointer; }
.adv-box {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b));
  width: min(calc(100% - 20px), 860px); min-height: 128px; padding: 22px 18px 16px;
  background: linear-gradient(180deg, rgba(10, 16, 44, .96), rgba(8, 12, 34, .98));
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, .55);
}
.adv-name {
  position: absolute; top: -15px; left: 14px; padding: 3px 14px; min-width: 80px; text-align: center;
  background: linear-gradient(180deg, #3a2a12, #22180a); border: 1px solid var(--amber); border-radius: 3px;
  color: var(--amber-hi); font-weight: 600; font-size: 15px; letter-spacing: .12em;
}
.adv-name:empty { display: none; }
.adv-text { font-size: clamp(15px, 4.2vw, 18px); line-height: 1.85; white-space: pre-wrap; min-height: 3.6em; letter-spacing: .03em; }
.adv-text.narr { color: #dfe4ff; font-style: normal; }
.adv-next { position: absolute; right: 14px; bottom: 6px; color: var(--amber); font-size: 12px; animation: blink 1s infinite; }
.adv-next.hide { visibility: hidden; }
@keyframes blink { 50% { opacity: .2; } }
.adv-tools { position: absolute; top: calc(var(--top-h) + 8px + var(--safe-t)); right: 8px; display: flex; gap: 6px; }
.adv-btn { min-height: 40px; min-width: 56px; padding: 4px 10px; font-size: 13px; background: rgba(10, 16, 44, .75); border: 1px solid var(--line-soft); border-radius: 4px; cursor: pointer; }
.adv-btn.on { border-color: var(--amber); color: var(--amber-hi); }
.adv-btn.hot { border-color: var(--amber); color: #1a1206; background: linear-gradient(180deg, #ffd99a, #f2b95e); font-weight: 600; animation: hotPulse 1.6s ease-in-out infinite; }
@keyframes hotPulse { 50% { box-shadow: 0 0 14px rgba(255, 217, 154, .8); } }
/* 物語シーン中は戦闘パネル/上部ボタンを隠す(透けと取り違えを防ぐ) */
.adv-on .b-panel, .adv-on .b-top .btn, .adv-on .tut { visibility: hidden; }

/* ---------- バナー・トースト・モーダル・フェード ---------- */
#banner { position: absolute; left: 0; right: 0; top: 40%; z-index: 40; text-align: center; pointer-events: none; }
#banner .bn {
  display: inline-block; padding: 12px 48px; font-size: clamp(22px, 7vw, 34px); font-weight: 900; letter-spacing: .3em;
  background: linear-gradient(90deg, transparent, rgba(10, 16, 44, .92) 20%, rgba(10, 16, 44, .92) 80%, transparent);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  animation: bannerIn .9s ease-out both;
}
#banner .bn.enemy { color: #ffb0b0; border-color: rgba(255, 107, 107, .6); }
#banner .bn.ally { color: #cfe1ff; }
#banner .bn.gold { color: var(--amber-hi); }
@keyframes bannerIn { 0% { opacity: 0; transform: scaleX(.3); } 25% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
#toast { position: absolute; left: 50%; top: calc(58px + var(--safe-t)); transform: translateX(-50%); z-index: 45; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 520px); }
#toast .ts { padding: 8px 16px; font-size: 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; animation: toastIn 2.6s ease-out both; text-align: center; }
@keyframes toastIn { 0% { opacity: 0; transform: translateY(-6px); } 10% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
#modal { position: absolute; inset: 0; z-index: 50; background: rgba(3, 6, 18, .72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: min(100%, 640px); max-height: calc(100% - 20px); overflow: auto; padding: 18px 16px; }
.modal-card h2 { font-size: 20px; color: var(--amber-hi); letter-spacing: .12em; }
.modal-head {
  position: sticky; top: -18px; z-index: 2; margin: -18px -16px 12px; padding: 12px 8px 10px 16px;
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  background: rgba(12, 20, 50, .98); border-bottom: 1px solid var(--line-soft);
}
.modal-head h2:empty { visibility: hidden; }
.modal-x.btn { min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; line-height: 1; flex: none; }
.modal-card h3 { font-size: 15px; color: var(--amber); margin: 14px 0 6px; letter-spacing: .1em; }
.modal-card .foot { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-card p { line-height: 1.7; margin: 6px 0; }
#fade { position: absolute; inset: 0; z-index: 60; background: #000; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
#fade.on { opacity: 1; pointer-events: auto; }

/* ---------- ステータス一覧 ---------- */
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.ucard { padding: 10px; border: 1px solid var(--line-soft); border-radius: 4px; background: rgba(18, 28, 64, .7); font-size: 13px; }
.ucard .nm { font-size: 16px; font-weight: 600; }
.ucard .cls { color: var(--muted); font-size: 12px; margin-left: 6px; }
.stats { display: grid; grid-template-columns: repeat(4, auto); gap: 2px 10px; margin-top: 6px; font-size: 12px; }
.stats b { color: var(--muted); font-weight: 400; margin-right: 3px; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.list-item .t { font-weight: 600; }
.list-item .d { color: var(--muted); font-size: 12px; }

/* ---------- 戦闘 ---------- */
.b-top { justify-content: space-between; }
.b-top .obj {
  min-width: 0; flex: 1; min-height: 44px; padding: 2px 4px; margin: 0; text-align: left; cursor: pointer;
  background: none; border: none; font-size: 13px; line-height: 1.3;
  white-space: normal; overflow: hidden; display: flex; align-items: center;
}
.b-top .obj .obj-t {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-height: 2.6em;
  text-decoration: underline dotted rgba(242, 185, 94, .5); text-underline-offset: 3px;
}
.obj-card {
  position: absolute; left: 50%; top: 30%; transform: translateX(-50%); z-index: 41; width: min(calc(100% - 32px), 380px);
  padding: 14px 16px; animation: pop .25s ease-out both; pointer-events: none;
}
.obj-card h3 { color: var(--amber-hi); font-size: 16px; letter-spacing: .15em; margin-bottom: 8px; text-align: center; }
.obj-sec { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); font-size: 14px; line-height: 1.6; }
.obj-sec:last-of-type { border-bottom: none; }
.obj-k { flex: none; width: 5em; font-weight: 600; }
.obj-n { font-size: 12px; }
.obj-tap { text-align: center; font-size: 11px; margin-top: 6px; }
.tut {
  position: absolute; z-index: 20; left: 10px; right: 10px; top: calc(var(--top-h) + var(--safe-t) + 10px);
  padding: 8px 12px 6px; font-size: 12.5px; line-height: 1.55; pointer-events: none !important;
  border-color: var(--amber); background: rgba(22, 30, 70, .95); box-shadow: 0 0 18px rgba(242, 185, 94, .25);
}
.tut::after { content: ""; position: absolute; right: 90px; top: -8px; border: 8px solid transparent; border-top: none; border-bottom-color: var(--amber); }
.wide .tut { left: 12px; right: auto; top: auto; width: min(420px, calc(100% - var(--side-w) - 24px)); bottom: 12px; }
.wide .tut::after { display: none; }
.tut-b { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.tut-b .btn { pointer-events: auto; min-height: 40px; }
.b-panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--panel-h) + var(--safe-b));
  padding: 8px 10px 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
  background: rgba(12, 20, 50, .95);
  border-radius: 0; border-left: none; border-right: none; border-bottom: none;
  font-size: 13px;
}
.wide .b-panel { top: var(--top-h); left: auto; width: var(--side-w); height: auto; border-left: 1px solid var(--line); border-top: none; }
.b-info .nm { font-size: 16px; font-weight: 600; }
.b-info .nm.enemy { color: #ffb4b4; }
.b-info .nm.ally { color: #d6e6ff; }
.b-info .lv { font-size: 12px; color: var(--muted); margin-left: 6px; }
.b-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; }
.b-head .lv { margin-left: 0; }
.b-info .hpline { display: flex; align-items: center; gap: 8px; margin: 2px 0; flex: 1 1 130px; font-size: 12px; }
.wide .b-info .hpline { flex-basis: 100%; }
.b-info .hpline .hpbar { height: 6px; flex: 1; }
.b-skill summary { cursor: pointer; list-style: none; }
.b-skill summary::-webkit-details-marker { display: none; }
.b-skill summary::before { content: "▸ "; color: var(--amber); }
.b-skill[open] summary::before { content: "▾ "; }
/* 行動コマンドはパネル下端に固定(中身が長くても見切れない) */
.b-cmds {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 6px;
  position: sticky; bottom: 0; z-index: 1; margin: auto -10px 0; padding: 8px 10px calc(8px + var(--safe-b));
  background: rgba(12, 20, 50, .98); border-top: 1px solid var(--line-soft);
}
.b-panel > :last-child:not(.b-cmds) { margin-bottom: 8px; }
.wide .b-cmds { grid-template-columns: 1fr 1fr; margin-top: 10px; }
.b-cmds .btn { padding: 4px 4px; font-size: 14px; letter-spacing: .02em; }
.b-cmds .btn .sub { font-size: 10px; }
@media (max-width: 859px) {
  .b-panel .stats { grid-template-columns: repeat(8, auto); gap: 0 6px; font-size: 11px; margin-top: 2px; justify-content: start; }
  .b-panel .stats b { margin-right: 1px; }
  .b-panel .b-hint { margin-top: 2px; line-height: 1.5; }
}
.b-hint { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.6; }
.b-row2 { display: flex; gap: 10px; align-items: flex-start; }
.b-row2 > * { min-width: 0; }
.fc { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px 8px; align-items: center; margin: 4px 0; font-size: 13px; }
.fc .side { padding: 6px; border-radius: 4px; background: rgba(255, 255, 255, .04); }
.fc .side.a { border-left: 3px solid var(--blue); }
.fc .side.d { border-right: 3px solid var(--red); text-align: right; }
.fc .vs { color: var(--amber); font-size: 12px; }
.fc .big { font-size: 18px; font-weight: 600; }
.fc .kv { display: flex; justify-content: space-between; gap: 6px; }
.wide .fc { grid-template-columns: 1fr; }
.wide .fc .vs { text-align: center; }
.wide .fc .side.d { text-align: left; border-right: none; border-left: 3px solid var(--red); }
.lvup {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%); z-index: 42; width: min(90vw, 340px); padding: 14px 16px;
  animation: pop .25s ease-out both; pointer-events: none;
}
.lvup h3 { color: var(--amber-hi); font-size: 18px; letter-spacing: .2em; margin-bottom: 6px; }
.lvup .gains { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; font-size: 14px; }
.lvup .gains .up { color: var(--green); }
.lvup .quote { margin-top: 8px; font-size: 13px; color: #e6dcc4; }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%); } }

/* ---------- 画面共通の中央カード(報酬・イベント・野営・店) ---------- */
.screen-card {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(var(--top-h) + var(--safe-t) + 10px); bottom: calc(10px + var(--safe-b));
  width: min(calc(100% - 20px), 720px); padding: 16px 14px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.screen-card.notop { top: calc(16px + var(--safe-t)); }
.screen-card h2 { font-size: 22px; letter-spacing: .16em; color: var(--amber-hi); text-align: center; }
.screen-card .lead { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices .btn { text-align: left; font-size: 15px; line-height: 1.5; }
.choices .btn .why { display: block; font-size: 11px; color: var(--red); margin-top: 2px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.rcard {
  padding: 12px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(20, 30, 70, .75);
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; min-height: 44px;
  transition: border-color .15s, transform .15s;
}
.rcard:hover, .rcard:focus-visible { border-color: var(--amber-hi); transform: translateY(-2px); outline: none; }
.rcard .t { font-weight: 600; font-size: 15px; }
.rcard .d { font-size: 12px; color: var(--muted); line-height: 1.6; }
.rcard .r { font-size: 11px; color: var(--amber); letter-spacing: .2em; }
.rcard.dis { opacity: .45; cursor: not-allowed; }
.msgs { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.msgs div::before { content: "✦ "; color: var(--amber); }
.fallen { padding: 8px 10px; border-left: 2px solid var(--red); background: rgba(255, 80, 80, .06); font-size: 13px; line-height: 1.7; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stat-table td { padding: 6px 4px; border-bottom: 1px dashed var(--line-soft); }
.stat-table td:last-child { text-align: right; color: var(--amber-hi); }

/* ---------- エンドロール ---------- */
.credits { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.credits .roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; line-height: 2.2; font-size: 15px; text-shadow: 0 0 3px #020412, 0 0 6px #020412, 0 1px 2px #000; }
.credits .roll h2 { font-size: 28px; letter-spacing: .3em; color: var(--amber-hi); margin: 20px 0; }
.credits .roll .k { color: #b9c3e8; font-size: 12px; letter-spacing: .2em; display: block; margin-top: 18px; }

@media (max-width: 420px) {
  .topbar { font-size: 12px; gap: 5px; padding-left: 6px; padding-right: 6px; }
  .topbar .chip { padding: 1px 6px; }
  .b-top { gap: 4px; }
  .b-top .obj { font-size: 12px; padding: 0 2px; }
  .b-top .btn { padding: 4px 6px; letter-spacing: .02em; }
  .b-top .turn { padding: 1px 5px; }
  .btn { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #banner .bn, #toast .ts { animation: none !important; } /* 消える側のアニメは使わず、JS の時間で閉じる */
}

/* ---------- 下部ドック(選択肢・メッセージ) ---------- */
.dock {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b));
  width: min(calc(100% - 20px), 640px); max-height: calc(100% - var(--top-h) - 40px); overflow-y: auto;
  padding: 14px 14px 12px; z-index: 5;
}
.dock h3 { color: var(--amber-hi); font-size: 16px; letter-spacing: .12em; margin-bottom: 8px; }
.dock .muted { margin-bottom: 8px; }
.sticky-foot {
  position: sticky; bottom: -16px; margin: auto -14px -16px; padding: 10px 14px calc(12px + var(--safe-b));
  display: flex; justify-content: center; background: rgba(12, 20, 50, .97); border-top: 1px solid var(--line-soft);
}
.help p { font-size: 14px; }
.help-t td:last-child { text-align: left; color: var(--ink); font-size: 13px; }
.help-t td:first-child { width: 4.5em; color: var(--amber-hi); }

@media (max-width: 520px) { .map-hint { display: none; } }
