/* その振込、待った！ — ポップ＆コミック調デザインシステム */

:root {
  --navy: #16264c;
  --navy-soft: #294073;
  --cyan: #15aabf;
  --cyan-light: #e5fafc;
  --coral: #ff5b69;
  --coral-dark: #d93848;
  --yellow: #ffd43b;
  --yellow-soft: #fff9db;
  --green: #20b486;
  --green-soft: #e6fcf5;
  --blue-soft: #e7f5ff;
  --cream: #fffdf7;
  --border: #16264c;
  --shadow: 0 4px 0 #16264c;
  --shadow-sm: 0 2px 0 #16264c;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(circle at top, #e7fbfc 0%, #c8f1f5 55%, #b5e7f0 100%);
  color: var(--navy);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 12px 28px;
}

.view {
  animation: fadeIn 0.22s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== 共通ボタン ==================== */
.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 18px;
  border: 2.5px solid var(--border);
  border-radius: 14px;
  font: inherit;
  font-weight: 800;
  color: var(--navy);
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--border); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--border); }
.btn small { font-size: 0.78rem; font-weight: 600; opacity: 0.9; }

.btn-primary {
  background: linear-gradient(180deg, #ff6b78 0%, #f03e51 100%);
  color: #fff;
}
.btn-accent {
  background: linear-gradient(180deg, #ffe066 0%, #fcc419 100%);
  color: var(--navy);
}
.btn-secondary {
  background: #fff;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow-sm);
  padding: 8px 14px;
  font-size: 0.9rem;
}
.btn-lg { width: 100%; padding: 14px 20px; font-size: 1.1rem; }

.btn-mini {
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn-mini:hover { background: var(--yellow-soft); }
.btn-mini.danger-text { color: var(--coral-dark); }

.btn-icon-text {
  background: transparent;
  border: none;
  color: var(--navy);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.btn-icon-text:hover { background: rgba(22, 38, 76, 0.08); }

/* ==================== タイトル画面 ==================== */
.title-hero {
  position: relative;
  border: 3px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 6px 0 var(--border);
  background: #0d8b9c;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.title-hero-bg {
  position: absolute;
  inset: 0;
}
.title-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.08);
}
.title-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22, 38, 76, 0.08) 0%, rgba(22, 38, 76, 0.72) 100%);
}

.title-actors {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  padding: 18px 14px 0;
}
.title-main-grandpa {
  width: clamp(135px, 28vw, 185px);
  height: auto;
  filter: drop-shadow(0 6px 0 rgba(22, 38, 76, 0.45));
  animation: gentleBob 2.8s ease-in-out infinite;
}
.title-sub-card {
  width: clamp(72px, 15vw, 96px);
  height: clamp(82px, 17vw, 108px);
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(22, 38, 76, 0.45);
  background: #fff;
  margin-bottom: 14px;
}
.title-sub-card.left { transform: rotate(-6deg); }
.title-sub-card.right { transform: rotate(6deg); }

@keyframes gentleBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.title-logo-wrap {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 8px 16px 18px;
  color: #fff;
}
.title-kicker {
  display: inline-block;
  background: var(--yellow);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 999px;
  border: 2px solid var(--border);
  margin-bottom: 6px;
}
.title-logo {
  margin: 0;
  font-size: clamp(1.9rem, 7vw, 2.9rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 0 var(--navy), 0 0 18px rgba(22, 38, 76, 0.5);
}
.title-logo .accent { color: var(--yellow); }
.title-tagline {
  margin: 4px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.65);
}

.title-body {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.howto-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--cream);
  border: 2.5px solid var(--border);
  border-radius: 14px;
  padding: 10px 11px;
  box-shadow: var(--shadow-sm);
}
.howto-num {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cyan);
  color: #fff;
  font-weight: 900;
  font-size: 0.88rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
}
.howto-card strong { display: block; font-size: 0.88rem; line-height: 1.3; margin-bottom: 2px; }
.howto-card p { margin: 0; font-size: 0.76rem; color: #364b75; line-height: 1.4; }

.title-actions { display: grid; gap: 10px; }
.title-actions-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.title-actions-row.two-col {
  grid-template-columns: repeat(2, 1fr);
}
.title-actions-row .btn {
  flex-direction: row;
  gap: 6px;
  white-space: nowrap;
  padding: 11px 12px;
  font-size: 0.94rem;
}

.title-stats-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 700;
}

/* ==================== ケース選択画面 ==================== */
.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.sub-header h2 { margin: 0; font-size: 1.25rem; }
.header-spacer { width: 84px; }
.cases-desc { margin: 0 0 12px; font-size: 0.9rem; font-weight: 600; color: var(--navy-soft); }

.cases-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.case-card {
  text-align: left;
  background: var(--cream);
  border: 2.5px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: transform 0.12s;
  font: inherit;
  color: inherit;
}
.case-card:hover { transform: translateY(-2px); background: #fff; }
.case-thumb {
  width: 64px;
  height: 72px;
  border-radius: 10px;
  border: 2px solid var(--border);
  object-fit: cover;
  flex: 0 0 64px;
  background: #e5fafc;
}
.case-card-body { flex: 1; min-width: 0; }
.case-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.case-num { font-size: 0.74rem; font-weight: 900; color: #fff; background: var(--navy); padding: 2px 8px; border-radius: 999px; }
.case-rank-badge { font-size: 0.75rem; font-weight: 900; padding: 2px 8px; border-radius: 999px; border: 1.5px solid var(--border); }
.case-rank-badge.good { background: var(--yellow); color: var(--navy); }
.case-rank-badge.normal { background: #dbe4ff; color: var(--navy); }
.case-rank-badge.bad { background: #ffe3e3; color: var(--coral-dark); }
.case-title { font-weight: 900; font-size: 0.95rem; line-height: 1.3; margin-bottom: 3px; }
.case-sub { font-size: 0.76rem; color: #4a608a; font-weight: 600; }

/* ==================== ゲームプレイ画面 ==================== */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.game-case-info { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.game-topbar-right { display: flex; gap: 6px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  border: 2px solid var(--border);
}
.pill-navy { background: var(--navy); color: #fff; }
.pill-soft { background: var(--yellow-soft); color: var(--navy); }

/* ビジュアルステージ */
.stage {
  position: relative;
  height: clamp(185px, 28dvh, 248px);
  border: 3px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: #0e899a;
  box-shadow: var(--shadow);
  margin-bottom: 6px;
}
.stage.danger-pulse {
  border-color: var(--coral);
  animation: dangerBorder 1s ease-in-out infinite;
}
@keyframes dangerBorder {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 91, 105, 0.6), var(--shadow); }
  50% { box-shadow: 0 0 0 6px rgba(255, 91, 105, 0.25), var(--shadow); }
}

.stage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.stage-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22, 38, 76, 0.14) 0%, transparent 45%, rgba(22, 38, 76, 0.22) 100%);
  pointer-events: none;
}
.stage.danger-pulse .stage-vignette {
  background: radial-gradient(circle, transparent 50%, rgba(240, 62, 81, 0.35) 100%);
}

/* ATMミニモニター */
.atm-monitor {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  width: min(200px, 46%);
  background: rgba(15, 31, 61, 0.92);
  color: #fff;
  border: 2.5px solid #4dd0e1;
  border-radius: 12px;
  padding: 7px 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
.atm-monitor.paused {
  border-color: var(--yellow);
}
.atm-monitor.danger {
  border-color: var(--coral);
  background: rgba(95, 16, 28, 0.93);
}
.atm-monitor-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #a5f3fc;
}
.atm-monitor-head strong { margin-left: auto; color: #fff; font-size: 0.78rem; }
.atm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #20c997;
  animation: blink 1.2s infinite;
}
.atm-monitor.danger .atm-dot { background: var(--coral); }
.atm-monitor.paused .atm-dot { background: var(--yellow); animation: none; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.atm-screen-text {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--yellow);
  margin: 3px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atm-bar-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
}
.atm-bar-fill {
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, #3bc9db, #ffd43b);
  transition: width 0.35s ease;
}
.atm-monitor.danger .atm-bar-fill {
  background: linear-gradient(90deg, #ff922b, #ff4757);
}
.atm-step-label {
  font-size: 0.68rem;
  margin-top: 3px;
  opacity: 0.92;
  font-weight: 700;
}

/* 右上の小道具・状況カード */
.stage-prop-wrap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
}
.prop-card-frame {
  background: #fff;
  border: 2.5px solid var(--border);
  border-radius: 14px;
  padding: 5px 6px 4px;
  box-shadow: 0 4px 0 rgba(22, 38, 76, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(82px, 18vw, 108px);
  transform: rotate(3deg);
  transition: transform 0.2s;
}
.prop-card-frame.pop {
  animation: cardPop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes cardPop {
  0% { transform: scale(0.75) rotate(-5deg); }
  100% { transform: scale(1) rotate(3deg); }
}
.prop-card-frame img {
  width: 100%;
  height: clamp(66px, 13dvh, 88px);
  object-fit: contain;
  border-radius: 8px;
}
.prop-label {
  font-size: 0.68rem;
  font-weight: 900;
  margin-top: 2px;
  color: var(--navy);
  white-space: nowrap;
}

/* 中央おじいちゃん立ち絵 */
.stage-grandpa-wrap {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  height: 86%;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}
.stage-grandpa-img {
  height: 100%;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  filter: drop-shadow(0 5px 0 rgba(22, 38, 76, 0.35));
}
.stage-grandpa-img.bounce {
  animation: charBounce 0.34s cubic-bezier(0.25, 1.5, 0.5, 1);
}
@keyframes charBounce {
  0% { transform: translateY(10px) scale(0.95); }
  50% { transform: translateY(-8px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

/* 左下：店員・警察スライドイン */
.stage-side-wrap {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 5;
  animation: slideInLeft 0.28s ease-out;
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: translateX(0); }
}
.side-actor-frame {
  position: relative;
  width: clamp(78px, 16vw, 98px);
  height: clamp(84px, 17vw, 106px);
  border: 3px solid #fff;
  outline: 2.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
.side-actor-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.side-actor-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
  padding: 2px;
}

/* カットイン演出 */
.stage-cutin {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(22, 38, 76, 0.52);
  animation: fadeIn 0.15s ease-out;
}
.cutin-box {
  background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
  color: #fff;
  border: 4px solid #fff;
  outline: 3px solid var(--border);
  border-radius: 18px;
  padding: 14px 26px;
  text-align: center;
  transform: rotate(-3deg);
  box-shadow: 0 8px 0 var(--border);
  animation: slamIn 0.28s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.stage-cutin.success .cutin-box { background: linear-gradient(135deg, #15aabf 0%, #20c997 100%); }
.stage-cutin.warm .cutin-box { background: linear-gradient(135deg, #fab005 0%, #fd7e14 100%); }
.cutin-text { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 900; text-shadow: 0 3px 0 rgba(22, 38, 76, 0.5); }
.cutin-sub { font-size: 0.85rem; font-weight: 800; margin-top: 2px; }
@keyframes slamIn {
  0% { transform: scale(1.6) rotate(4deg); opacity: 0; }
  100% { transform: scale(1) rotate(-3deg); opacity: 1; }
}

/* 3連ミニHUD */
.hud-strip {
  display: grid;
  grid-template-columns: 0.9fr 1.05fr 1.05fr;
  gap: 8px;
  margin-bottom: 8px;
}
.hud-metric {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: var(--shadow-sm);
}
.hud-metric-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--navy-soft);
}
.hud-metric-val {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.2;
}
.hud-metric-val span { font-size: 0.78rem; margin-left: 2px; }

.mini-bar {
  position: relative;
  height: 9px;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
  border: 1.5px solid var(--border);
}
.mini-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}
.mini-bar-fill.trust { background: linear-gradient(90deg, #ffd43b, #20c997); }
.mini-bar-fill.wary { background: linear-gradient(90deg, #ffa94d, #ff4757); }
.wary-limit {
  position: absolute;
  left: 75%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--navy);
}

/* 手がかりメモストリップ */
.clues-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  margin-bottom: 8px;
  overflow-x: auto;
}
.clues-strip-title {
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 900;
  color: var(--navy);
}
.clues-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.clues-empty { font-size: 0.76rem; color: #5c7194; font-weight: 600; }
.clue-chip {
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s;
}
.clue-chip:hover { transform: scale(1.04); }
.clue-chip.red { background: #ffe3e3; color: #c92a2a; }
.clue-chip.green { background: var(--green-soft); color: #087f5b; }
.clue-chip.blue { background: var(--blue-soft); color: #1864ab; }

/* トースト */
.toast-bar {
  padding: 7px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-size: 0.84rem;
  font-weight: 900;
  margin-bottom: 8px;
  animation: fadeIn 0.2s ease-out;
}
.toast-bar.red { background: #ffe3e3; color: #b51f29; }
.toast-bar.green { background: var(--green-soft); color: #087f5b; }
.toast-bar.blue, .toast-bar.info { background: var(--yellow-soft); color: var(--navy); }
.toast-bar.warn { background: #ff4757; color: #fff; }

/* セリフボックス */
.dialog-box {
  background: #fff;
  border: 3px solid var(--border);
  border-radius: 16px;
  padding: 8px 13px 10px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  min-height: 76px;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.speaker-tag {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 8px;
}
.speaker-tag.clerk { background: var(--green); }
.speaker-tag.observe { background: var(--cyan); }
.speaker-tag.danger { background: var(--coral-dark); }
.mood-chip { font-size: 0.74rem; font-weight: 700; color: #5c7194; }

.dialog-line {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.55;
}
.dialog-line mark {
  background: #fff3bf;
  color: #c92a2a;
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 900;
}

/* コマンドパネル */
.command-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 2.5px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.command-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.cmd-tab {
  position: relative;
  padding: 9px 6px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #eef6fa;
  color: var(--navy);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s;
}
.cmd-tab.active {
  background: var(--yellow);
  box-shadow: var(--shadow-sm);
}
.cmd-tab.tab-decide.ready-glow {
  background: #ffe3e3;
  color: #b51f29;
  animation: pulseBtn 1.5s infinite;
}
.cmd-tab.tab-decide.active {
  background: var(--coral);
  color: #fff;
  animation: none;
}
@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 91, 105, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(255, 91, 105, 0); }
}

.tab-badge {
  background: var(--navy);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
}
.tab-badge.zero { background: #adb5bd; }
.tab-badge-dot { color: #ff2e4c; font-size: 0.75rem; }

.command-choices {
  display: grid;
  gap: 8px;
}
.choice-btn {
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border: 2.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, background 0.12s;
}
.choice-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--cyan-light);
}
.choice-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f1f3f5;
  box-shadow: none;
}
.choice-btn.done {
  background: #f8f9fa;
  color: #6c757d;
  border-style: dashed;
}
.choice-btn.style-matta {
  background: linear-gradient(180deg, #fff5f5 0%, #ffe3e3 100%);
  border-color: #c92a2a;
  color: #a5111c;
}
.choice-btn.style-matta.highlight {
  background: linear-gradient(180deg, #ff6b78 0%, #e03131 100%);
  color: #fff;
}
.choice-btn.style-coop,
.choice-btn.style-special {
  background: linear-gradient(180deg, #ffe066 0%, #fcc419 100%);
  color: var(--navy);
}
.choice-btn.style-safe {
  background: linear-gradient(180deg, #d3f9d8 0%, #8ce99a 100%);
  color: #164e2a;
}

.choice-meta {
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(22, 38, 76, 0.1);
  color: inherit;
  white-space: nowrap;
}
.choice-btn.style-matta.highlight .choice-meta {
  background: rgba(255, 255, 255, 0.25);
}

.mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  margin-bottom: 10px;
}
.mode-banner.matta { background: #ffe3e3; color: #a5111c; }
.mode-banner.danger { background: #ff4757; color: #fff; }
.mode-banner p { margin: 2px 0 0; font-size: 0.82rem; font-weight: 700; }

/* ==================== 結果画面 ==================== */
.result-card {
  background: var(--cream);
  border: 3px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 6px 0 var(--border);
}
.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.result-rank {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 18px;
  border: 3px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 900;
  background: var(--yellow);
  box-shadow: var(--shadow-sm);
}
.result-rank.bad { background: #ffa8a8; color: #9c1420; }
.result-rank.normal { background: #d0ebff; color: var(--navy); }
.result-badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  margin-bottom: 3px;
}
.result-titles h2 { margin: 0; font-size: clamp(1.2rem, 4.5vw, 1.55rem); line-height: 1.25; }

.result-visual {
  position: relative;
  height: 190px;
  border-radius: 16px;
  border: 2.5px solid var(--border);
  overflow: hidden;
  margin-bottom: 12px;
  background: #0e899a;
}
.result-bg { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.result-portrait {
  position: absolute;
  bottom: -6px;
  left: 16%;
  height: 92%;
  filter: drop-shadow(0 5px 0 rgba(22, 38, 76, 0.35));
}
.result-subcard-wrap {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(4deg);
  width: 112px;
  height: 132px;
  background: #fff;
  border: 3px solid var(--border);
  border-radius: 14px;
  padding: 5px;
  box-shadow: 0 5px 0 rgba(22, 38, 76, 0.75);
}
.result-subcard-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

.result-summary { margin: 0 0 8px; font-weight: 800; font-size: 0.96rem; }
.result-epilogue {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: #fff;
  border-left: 5px solid var(--cyan);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
}

.truth-box {
  background: #eef6ff;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.truth-box h3 { margin: 0 0 4px; font-size: 1rem; color: var(--navy); }
.truth-box p { margin: 0 0 8px; font-size: 0.86rem; font-weight: 600; }
.feedback-list { margin: 0; padding-left: 18px; font-size: 0.82rem; font-weight: 700; color: var(--navy-soft); }
.feedback-list li { margin-bottom: 3px; }

.result-share-row {
  margin-bottom: 10px;
}
.btn-x {
  background: linear-gradient(180deg, #272b33 0%, #0f1419 100%);
  color: #fff;
  border-color: #0f1419;
}
.btn-x:hover {
  background: linear-gradient(180deg, #343a45 0%, #1b222a 100%);
}
.result-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.result-next-main {
  grid-column: 1 / -1;
}

/* ==================== 全8話 総合結果画面 ==================== */
.summary-kicker {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--coral-dark);
  margin-bottom: 8px;
}
.summary-title-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #fff9db 0%, #ffe066 100%);
  border: 3px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}
.summary-rank-badge {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 16px;
  background: var(--navy);
  color: var(--yellow);
  border: 3px solid #fff;
  outline: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 900;
}
.summary-label {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 900;
  color: var(--navy-soft);
}
.summary-title-text h2 {
  margin: 0;
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  line-height: 1.25;
}
.summary-comment {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  color: var(--navy-soft);
}
.summary-visual {
  position: relative;
  height: 165px;
  border-radius: 16px;
  border: 2.5px solid var(--border);
  overflow: hidden;
  margin-bottom: 12px;
  background: #0e899a;
}
.summary-actors {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  padding-bottom: 4px;
}
.summary-main {
  height: 92%;
  width: auto;
  filter: drop-shadow(0 5px 0 rgba(22, 38, 76, 0.4));
}
.summary-side {
  width: 78px;
  height: 88px;
  object-fit: cover;
  border: 3px solid #fff;
  outline: 2px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: #fff;
}
.summary-scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.score-tile {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.score-tile span {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--navy-soft);
}
.score-tile strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--navy);
  margin-top: 2px;
}
.summary-case-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.summary-case-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}
.summary-case-row .mini-rank {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  font-size: 0.72rem;
  flex: 0 0 auto;
}
.summary-case-row .mini-rank.good { background: var(--yellow); }
.summary-case-row .mini-rank.normal { background: #d0ebff; }
.summary-case-row .mini-rank.bad { background: #ffe3e3; color: var(--coral-dark); }

/* ==================== モーダル ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 14px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 38, 76, 0.58);
}
.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 580px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border: 3px solid var(--border);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 8px 0 var(--border);
}
.modal-sm { max-width: 400px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.btn-close-modal {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.gallery-list {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding-right: 4px;
}
.gallery-item {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.gallery-item.locked { opacity: 0.55; background: #e9ecef; }
.gallery-thumb {
  width: 48px;
  height: 54px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  object-fit: cover;
  flex: 0 0 48px;
  background: #dee2e6;
}
.gallery-meta strong { display: block; font-size: 0.82rem; line-height: 1.25; }
.gallery-meta small { display: block; font-size: 0.7rem; color: #5c7194; margin-top: 2px; }

.log-list {
  overflow-y: auto;
  display: grid;
  gap: 6px;
}
.log-entry {
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.84rem;
}
.log-entry strong { display: block; font-size: 0.74rem; color: var(--navy-soft); }
.log-entry.player { background: #e7f5ff; border-color: #74c0fc; }
.log-entry.danger { background: #fff5f5; border-color: #ffa8a8; }

.clue-modal-text { margin: 0; font-size: 0.94rem; font-weight: 700; line-height: 1.6; }

/* ==================== 共通フッター ==================== */
.site-footer {
  margin-top: 18px;
  padding: 12px 14px 6px;
  border-top: 2px dashed rgba(22, 38, 76, 0.22);
  text-align: center;
  color: var(--navy-soft);
}
.footer-disclaimer {
  margin: 0 auto 6px;
  max-width: 640px;
  font-size: 0.72rem;
  line-height: 1.55;
  opacity: 0.88;
}
.footer-copy {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: var(--navy);
}

/* ==================== レスポンシブ ==================== */
@media (max-width: 600px) {
  #app { padding: 8px 8px 20px; }
  .howto-grid { grid-template-columns: 1fr; gap: 7px; }
  .title-actions-row { grid-template-columns: 1fr; }
  .title-actions-row.two-col { grid-template-columns: repeat(2, 1fr); }
  .cases-grid { grid-template-columns: 1fr; }
  .gallery-list { grid-template-columns: 1fr; }
  .result-actions { grid-template-columns: 1fr; }
  .summary-scores { grid-template-columns: repeat(2, 1fr); }
  .summary-case-list { grid-template-columns: 1fr; }
  .cmd-tab { font-size: 0.78rem; padding: 8px 4px; }
  .choice-btn { font-size: 0.86rem; padding: 10px; }
}
