/* 『サイコロ振ったら、会社が終わった。』 styles — モバイル縦優先・外部フォント不使用 */
:root {
  --bg: #f4f1ea;
  --paper: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #d6d3cc;
  --accent: #f59e0b;
  --accent-ink: #1e293b;
  --conf: #ef4444;
  --ready: #10b981;
  --primary: #1e293b;
  --primary-ink: #ffffff;
  --cell: #fffdf7;
  --visited: #fef3c7;
  --radius: 14px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
.screen { display: none; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.screen.active { display: block; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.3; }
.small { font-size: 13px; }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%;
  min-height: 48px; padding: 12px 16px; margin: 10px 0 0;
  border: 2px solid var(--primary); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 16px;
  cursor: pointer; text-align: center; text-decoration: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.secondary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.big { min-height: 56px; font-size: 18px; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--paper); font-size: 18px; cursor: pointer; touch-action: manipulation;
}
.icon-btn.on { border-color: var(--accent); background: #fff7e6; }

/* ---------- title ---------- */
.title-wrap { text-align: center; padding-top: 6vh; }
.badge {
  display: inline-block; margin: 0; padding: 4px 12px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .05em;
}
.title-pre { margin: 18px 0 4px; color: var(--muted); font-size: 15px; }
.title-logo { margin: 0; font-size: clamp(28px, 8.6vw, 42px); font-weight: 900; letter-spacing: .02em; }
.title-logo span { display: block; }
.title-logo span:last-child { color: var(--conf); transform: rotate(-2deg); }
.title-dice { font-size: 64px; margin: 14px 0 6px; animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(10deg) translateY(-4px); } }
.title-note { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.title-brand { font-weight: 900; letter-spacing: .3em; margin: 22px 0 0; }
.title-disclaimer { color: var(--muted); font-size: 11px; margin: 6px 0 0; }

/* ---------- panels ---------- */
.panel { background: var(--paper); border-radius: var(--radius); padding: 18px 16px; box-shadow: 0 2px 0 var(--line); }
.howto-list { padding-left: 1.3em; margin: 0; }
.howto-list li { margin: 0 0 10px; }
.howto-meters p { margin: 6px 0; }

/* ---------- HUD ---------- */
.hud { background: var(--paper); border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 2px 0 var(--line); }
.hud-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.hud-turn { font-size: 26px; font-weight: 900; line-height: 1; }
.hud-turn small { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.hud-left { flex: 1; font-size: 14px; color: var(--muted); }
.hud-left b { color: var(--ink); font-size: 18px; }
.meter { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.meter-label { width: 6.2em; font-size: 13px; font-weight: 700; flex: none; }
.meter-bar { display: flex; gap: 4px; flex: 1; }
.meter-bar i { flex: 1; height: 12px; border-radius: 4px; background: #e7e5e4; transition: background .3s; }
.meter-bar.conf i.on { background: var(--conf); }
.meter-bar.ready i.on { background: var(--ready); }
.meter-bar.pulse { animation: pulse .5s ease; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.meter-num { width: 2.6em; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }

/* ---------- board ---------- */
.board {
  display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(4, auto);
  gap: 4px; margin: 12px 0; padding: 8px; border-radius: var(--radius);
  background: #e9e4d8;
}
.cell {
  position: relative; min-height: 58px; padding: 4px 3px 3px;
  background: var(--cell); border: 1px solid var(--line); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  overflow: hidden;
}
.cell.visited { background: var(--visited); }
.cell.start { background: #dbeafe; }
.cell.goal { background: #ccfbf1; border-color: #14b8a6; border-width: 2px; }
.cell-no { font-size: 11px; font-weight: 900; color: var(--muted); line-height: 1; }
.cell-name { font-size: 9.5px; line-height: 1.2; text-align: center; word-break: keep-all; overflow-wrap: anywhere; margin-top: 2px; }
.piece {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  font-size: 22px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25));
  animation: hop .25s ease;
}
@keyframes hop { 50% { transform: translate(-50%, -8px); } }

/* ---------- dice ---------- */
.dice-area { text-align: center; }
.dice {
  width: 76px; height: 76px; margin: 4px auto 0; padding: 10px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px;
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.dice.rolling { animation: shake .14s linear infinite; }
@keyframes shake { 0% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } 100% { transform: rotate(-10deg); } }
.pip { border-radius: 50%; }
.pip.on { background: var(--ink); }
.dice[data-value="1"] .pip.on { background: var(--conf); }
.log-line { min-height: 1.6em; margin: 10px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- overlay / cards ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px 10px calc(10px + env(safe-area-inset-bottom));
}
.card {
  width: 100%; max-width: 500px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--paper); border-radius: 18px; padding: 14px 16px 18px;
  border-top: 8px solid var(--ev, var(--accent));
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-kicker { font-weight: 900; color: var(--conf); }
.card.final .card-kicker { color: #0f766e; }
.card-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.card-title { margin: 8px 0 4px; font-size: 22px; }
.card-intro { margin: 0 0 8px; }

.art {
  position: relative; margin-top: 8px; border-radius: 12px; overflow: hidden;
  aspect-ratio: 16 / 9; background: var(--ev, #ccc);
}
.art-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--ev, #94a3b8), #1e293b);
  color: #fff;
}
.art-icon { font-size: 44px; line-height: 1.1; }
.art-title { font-weight: 900; font-size: 16px; margin-top: 4px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.reactions { list-style: none; margin: 6px 0 0; padding: 0; }
.reaction { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.avatar { width: 36px; height: 36px; flex: none; }
.reaction-body { background: #f1f5f9; border-radius: 4px 12px 12px 12px; padding: 6px 10px; }
.reaction-name { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.reaction-line { font-size: 14px; }

.choices { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 6px; }
.choices-q { margin: 4px 0 0; font-weight: 900; text-align: center; }
.btn.choice {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border-radius: 14px; border-color: var(--ev, var(--ink)); padding: 10px 12px; min-height: 56px;
}
.btn.choice:disabled { opacity: .5; }
.btn.choice.picked { opacity: 1; background: #fff7e6; border-width: 3px; }
.choice-key {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ev, var(--ink)); color: #fff; font-weight: 900;
}
.choice-label { flex: 1; }
.outcome { margin-top: 12px; padding: 12px; border-radius: 12px; background: #fffbeb; animation: rise .2s ease-out; }
.outcome-text { margin: 0 0 8px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #e2e8f0; }
.chip.conf { background: #fee2e2; color: #b91c1c; }
.chip.ready { background: #d1fae5; color: #047857; }
.chip.flag { background: #ede9fe; color: #5b21b6; }
.teaser { margin: 4px 0 0; font-size: 13px; color: #6d28d9; font-style: italic; }

.card.chain { border-top-color: #7c3aed; background: linear-gradient(#faf5ff, #fff 40%); text-align: left; }
.chain-banner {
  text-align: center; font-weight: 900; font-size: 22px; color: #7c3aed;
  animation: flash .6s ease 2;
}
@keyframes flash { 50% { transform: scale(1.12); } }
.chain-icon { text-align: center; font-size: 48px; line-height: 1.2; }
.chain-cause { margin: 4px 0 8px; padding: 8px 10px; border-left: 4px solid #a78bfa; background: #f5f3ff; font-size: 14px; }
.chain-count { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

/* ---------- ending ---------- */
.ending-wrap { text-align: center; padding: 8vh 8px 0; }
.ending-kicker { letter-spacing: .3em; font-weight: 900; color: var(--muted); margin: 0; }
.ending-icon { font-size: 72px; line-height: 1.2; margin: 10px 0; animation: rise .5s ease-out; }
.ending-title { font-size: 28px; margin: 0 0 14px; }
.ending-lines p { margin: 6px 0; }
.ending-tagline { margin: 18px 0 8px; font-weight: 900; }
.ending-why { margin: 14px 0 0; padding: 8px 12px; border-radius: 10px; background: #fff; font-size: 14px; text-align: left; box-shadow: 0 1px 0 var(--line); }
.ending-rival { margin: 8px 0 10px; font-size: 13px; color: #6d28d9; }
.dex-item.now { outline: 2px solid var(--accent); }
.hint.sub { background: #f8fafc; color: var(--muted); }
.ending-wrap.ed01 .ending-title { color: #0f766e; }
.ending-wrap.ed02 .ending-title { color: #db2777; }
.ending-wrap.ed03 .ending-title { color: #a16207; }

/* ---------- result ---------- */
.result-kicker { margin: 0; letter-spacing: .3em; font-weight: 900; color: var(--muted); font-size: 12px; }
.result-title { margin: 4px 0 10px; font-size: 22px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 0; }
.stat { background: #f8fafc; border-radius: 10px; padding: 6px 10px; }
.stat dt { font-size: 12px; color: var(--muted); }
.stat dd { margin: 0; font-weight: 900; font-size: 18px; }
.panel h3 { font-size: 16px; margin: 16px 0 6px; }
.timeline { margin: 0; padding-left: 1.4em; font-size: 14px; }
.timeline li { margin: 0 0 6px; }
.tl-ev { font-weight: 700; display: block; }
.tl-choice { display: block; color: var(--muted); }
.tl-chain { display: block; color: #6d28d9; font-weight: 700; }
.dex { display: flex; flex-wrap: wrap; gap: 6px; }
.dex-item { padding: 4px 10px; border-radius: 8px; background: #e7e5e4; color: var(--muted); font-size: 13px; }
.dex-item.got { background: #fef3c7; color: var(--ink); font-weight: 700; }
.dex-count { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.hint { margin: 8px 0 0; padding: 8px 10px; background: #f5f3ff; border-radius: 10px; font-size: 14px; }
.result-actions { margin-top: 12px; }
.feedback { margin-top: 18px; padding-top: 6px; border-top: 1px dashed var(--line); }
.fb-q { margin: 0; padding-left: 1.3em; font-size: 14px; }
.fb-text {
  display: block; width: 100%; margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14px; line-height: 1.5; background: #f8fafc; color: var(--ink); resize: vertical;
}

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 40; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; max-width: calc(100% - 32px); text-align: center;
}
.debug-log {
  position: fixed; right: 4px; top: 4px; z-index: 50; width: 46vw; max-width: 300px; max-height: 40vh; overflow: auto;
  margin: 0; padding: 6px; background: rgba(0,0,0,.75); color: #a7f3d0; font-size: 10px; white-space: pre-wrap;
  pointer-events: none;
}
.noscript { padding: 16px; }

@media (max-width: 359px) {
  .cell-name { font-size: 8.5px; }
  .cell { min-height: 52px; }
}
@media (min-width: 700px) {
  .screen { padding-top: 24px; }
  .cell { min-height: 64px; }
  .cell-name { font-size: 11px; }
  .overlay { align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- v0.3.0：暴走ゲージ・帰宅パワー・深呼吸・暴走カード ---------- */
.meter-bar.conf.danger i.on { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.rampage-badge { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: #e2e8f0; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.rampage-badge.hot { background: #fee2e2; color: #b91c1c; }
#btn-breathe { min-height: 44px; font-size: 15px; margin-top: 8px; }
.choice-cost { display: block; font-size: 12px; font-weight: 700; color: #047857; margin-top: 2px; }
.choice-cost.short { color: #b91c1c; }
.teaser.warn { color: #b91c1c; font-style: normal; font-weight: 700; }
.card.rampage { border-top-color: #dc2626; background: linear-gradient(#fef2f2, #fff 45%); }
.rampage-banner { text-align: center; font-weight: 900; font-size: 22px; color: #dc2626; animation: flash .5s ease 3; }
.tl-rampage { display: block; color: #b91c1c; font-weight: 700; }
@media (max-width: 359px) { #btn-breathe { font-size: 13px; } }

/* ---------- v0.5.0：3択と主人公ツッコミ ---------- */
.hero-line { margin: 8px 0 0; padding: 6px 10px; border-left: 4px solid #3b82f6; background: #eff6ff; border-radius: 0 10px 10px 0; font-size: 14px; font-weight: 700; color: #1e3a8a; }
.hero-line .hero-name { display: block; font-size: 11px; font-weight: 700; color: #3b82f6; }
.hero-line.intro { font-weight: 600; }
.hero-line.ending { text-align: left; margin: 12px auto 4px; max-width: 420px; }
.choices.three .btn.choice { min-height: 64px; padding: 8px 12px; }
.choice-kind { display: block; font-size: 11px; font-weight: 800; letter-spacing: .02em; color: var(--muted); margin-bottom: 1px; }
.btn.choice.kind-A .choice-kind { color: #b91c1c; }
.btn.choice.kind-B .choice-kind { color: #1d4ed8; }
.btn.choice.kind-C .choice-kind { color: #a16207; }
.btn.choice.kind-C .choice-key { background: #a16207; }

/* ===== v0.6.0候補：社内支持度・同僚に頼る・表情アイコン・ツッコミ表示切替 ===== */
.meter-bar.support { gap: 2px; }
.meter-bar.support i { height: 10px; border-radius: 3px; }
.meter-bar.support i.on { background: #f59e0b; }
.meter-bar.support.high i.on { background: #ea580c; }
.meter-bar.support.low i.on { background: #94a3b8; }
.chip.support { background: #ffedd5; color: #9a3412; }
.meter-num { width: 3em; }
.sub-actions { display: flex; gap: 8px; margin-top: 8px; }
.sub-actions .btn { flex: 1; min-height: 48px; margin-top: 0; padding: 6px 8px; font-size: 14px; line-height: 1.25; }
.sub-actions .btn small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.sub-actions .btn[hidden] { display: none; }
#btn-breathe { margin-top: 0; }
@media (max-width: 359px) { .sub-actions .btn { font-size: 13px; padding: 6px 4px; } .sub-actions .btn small { font-size: 10px; } }

/* 主人公のツッコミ：顔アイコン＋表情名つき */
.hero-line { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; }
.hero-line .hero-body { margin: 0; flex: 1; min-width: 0; }
.hero-line .hero-text { display: block; }
.hero-line.mood-shout { border-left-color: #dc2626; background: #fef2f2; color: #7f1d1d; }
.hero-line.mood-shout .hero-name { color: #dc2626; }
.hero-line.mood-grin { border-left-color: #f59e0b; background: #fffbeb; color: #78350f; }
.hero-line.mood-grin .hero-name { color: #b45309; }
.hero-line.mood-confused { border-left-color: #8b5cf6; background: #f5f3ff; color: #4c1d95; }
.hero-line.mood-confused .hero-name { color: #7c3aed; }
.face { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: #fff; display: inline-flex; align-items: center; justify-content: center; }
.face .face-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face .face-fallback { display: none; }
.face.no-img .face-img { display: none; }
.face.no-img .face-fallback { display: inline-flex; }
.face .face-emoji { font-size: 26px; line-height: 1; }
.reaction .face.npc-face { width: 36px; height: 36px; }
.reaction .face.npc-face .avatar { width: 36px; height: 36px; }
body.no-talk .hero-line { display: none; }
.title-hero { display: flex; justify-content: center; margin: 8px 0 4px; }
.title-hero .face { width: auto; height: 210px; border-radius: 0; background: transparent; overflow: visible; }
.title-hero .face .face-img { width: auto; height: 210px; object-fit: contain; }
.title-hero .face.no-img .face-fallback { font-size: 64px; }
.tl-tag { display: inline-block; font-size: 11px; color: #9a3412; background: #ffedd5; border-radius: 6px; padding: 0 6px; margin: 2px 4px 0 0; }
.ending-wrap.ed08 .ending-title { color: #ea580c; }
.ending-wrap.ed09 .ending-title { color: #2563eb; }
.title-hero .face .face-img { mix-blend-mode: multiply; }

/* ===== v0.6.1候補 BOARD01：盤面3レイヤー（背景・SVG盤面・主人公駒） ===== */
.board-viewport { position: relative; overflow: hidden; border-radius: 14px; margin: 8px 0; background: #1e293b; box-shadow: 0 2px 0 var(--line, #d6d3cc); touch-action: manipulation; }
.board-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; transition: transform .35s ease; will-change: transform; }
.board-viewport.zoomed .board-stage { width: 165%; }
.board-layer { position: absolute; inset: 0; }
.board-bg { overflow: hidden; }
.board-bg-img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.9); }
.board-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(15,23,42,.30), rgba(15,23,42,.42)); }
.board-stage.no-bg .board-bg { background: linear-gradient(135deg, #fde68a, #fdba74 45%, #94a3b8); }
.board-stage.no-bg .board-bg-img { display: none; }
.board-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.board-path { fill: none; stroke: rgba(255,255,255,.75); stroke-width: 16; stroke-dasharray: 2 26; stroke-linecap: round; stroke-linejoin: round; }
.tile .tile-bg { fill: rgba(255,255,255,.88); stroke: #334155; stroke-width: 4; transition: fill .2s, stroke .2s; }
.tile .tile-no { font: 900 60px "Hiragino Sans","Noto Sans JP","Yu Gothic UI","Meiryo",sans-serif; fill: #1e293b; text-anchor: middle; dominant-baseline: middle; }
.tile .tile-name { font: 700 30px "Hiragino Sans","Noto Sans JP","Yu Gothic UI","Meiryo",sans-serif; fill: #334155; text-anchor: middle; dominant-baseline: middle; }
.tile .tile-name.long { font-size: 25px; }
.tile.kind-start .tile-bg { fill: rgba(219,234,254,.95); }
.tile.kind-goal .tile-bg { fill: rgba(204,251,241,.97); stroke: #0d9488; stroke-width: 8; }
.tile.is-visited .tile-bg { fill: rgba(254,243,199,.92); }
.tile.is-target .tile-bg { stroke: #f59e0b; stroke-width: 10; stroke-dasharray: 18 10; }
.tile.is-current .tile-bg { fill: rgba(253,224,71,.97); stroke: #b45309; stroke-width: 10; }
.tile.is-event .tile-bg { animation: tilePulse 1s ease-in-out infinite; }
@keyframes tilePulse { 50% { fill: rgba(251,146,60,.97); } }
.board-pieces { pointer-events: none; }
.piece { position: absolute; width: 8%; aspect-ratio: 256 / 330; transform: translate(-50%, -100%); transition: left .14s linear, top .14s linear; z-index: 2; }
.piece .piece-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; background: transparent; overflow: visible; display: none; }
.piece .piece-img .face-img { object-fit: contain; object-position: center bottom; filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }
.piece[data-mood="normal"] .piece-normal, .piece[data-mood="joy"] .piece-joy, .piece[data-mood="confused"] .piece-confused,
.piece[data-mood="shout"] .piece-shout, .piece[data-mood="idea"] .piece-idea, .piece[data-mood="run"] .piece-run { display: block; }
.piece .piece-img.no-img .face-fallback { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; font-size: 28px; }
.piece.face-left .piece-img .face-img { transform: scaleX(-1); }
.piece.landing { animation: pieceHop .32s ease-out; }
@keyframes pieceHop { 0% { transform: translate(-50%, -100%); } 40% { transform: translate(-50%, -122%); } 70% { transform: translate(-50%, -97%) scaleY(.94); } 100% { transform: translate(-50%, -100%); } }
.board-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px 2px 6px; font-size: 12px; color: var(--muted, #64748b); }
.board-zoom { min-height: 36px; padding: 4px 10px; border-radius: 999px; border: 0; background: rgba(15,23,42,.78); color: #fff; font: 700 13px/1 "Hiragino Sans","Noto Sans JP","Yu Gothic UI","Meiryo",sans-serif; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .piece.landing { animation: none; } .board-stage, .piece { transition: none; } .tile.is-event .tile-bg { animation: none; fill: rgba(251,146,60,.97); } }
/* PC：盤面だけ横に広げて全体を大きく表示（アプリの幅 520px はそのまま） */
@media (min-width: 900px) {
  .board-viewport, .board-tools { width: min(880px, calc(100vw - 48px)); position: relative; left: 50%; transform: translateX(-50%); }
}

/* ===== v0.7.0候補 Phase C-8：プロローグ・思い出の一言・結末の回収 ===== */
.btn[hidden] { display: none; }
.prologue { padding: 4px 0 16px; }
.pro-kicker { margin: 0 0 8px; font-size: 12px; font-weight: 900; letter-spacing: .08em; color: var(--muted); text-align: center; }
.pro-stage { position: relative; border-radius: 14px; overflow: hidden; background: #1e293b; box-shadow: 0 2px 0 var(--line); }
.story-art { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #fde68a, #fdba74 45%, #94a3b8); border-radius: 12px; overflow: hidden; }
.story-art .story-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.story-art.no-img .story-img { display: none; }
.pro-stage .story-art { border-radius: 0; }
.pro-label { position: absolute; left: 8px; bottom: 8px; padding: 3px 10px; border-radius: 999px; background: rgba(15,23,42,.82); color: #fff; font-size: 13px; font-weight: 800; }
.story-lines { margin: 10px 0 0; }
.pro-lines { min-height: 220px; cursor: pointer; }
.story-narr { margin: 8px 2px; font-size: 15px; line-height: 1.7; color: var(--ink); }
.story-line { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.story-line .face.story-face { width: 44px; height: 44px; }
.story-line .story-body { margin: 0; flex: 1; min-width: 0; background: #f1f5f9; border-radius: 4px 12px 12px 12px; padding: 6px 10px; }
.story-line.message .story-body { background: #dcfce7; border-radius: 12px 12px 12px 4px; }
.story-name { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.story-text { font-size: 15px; }
body.no-talk .hero-line.story { display: flex; } /* 物語の主人公セリフは 💬 OFF でも出す */
.hero-line.story { margin: 8px 0; }
.hero-line.story.message { background: #e0f2fe; }
.hero-line.story.last { font-size: 16px; margin-top: 12px; }
.story-lines .reveal { opacity: 0; animation: storyIn .35s ease-out forwards; }
.story-lines.all-shown .reveal { animation: none; opacity: 1; }
@keyframes storyIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pro-actions { margin-top: 6px; }
.pro-progress { margin: 6px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
/* 思い出の一言 */
.memory { display: flex; gap: 8px; align-items: center; margin: 8px 0 0; padding: 6px 10px 6px 6px; border-radius: 12px; background: #fff7ed; border: 1px dashed #fdba74; }
.memory .story-art.memory-thumb { flex: none; width: 52px; aspect-ratio: 1; border-radius: 50%; }
.memory-body { margin: 0; flex: 1; min-width: 0; }
.memory-name { display: block; font-size: 11px; font-weight: 700; color: #c2410c; }
.memory-text { font-size: 14px; font-weight: 700; color: #7c2d12; }
/* 結末の回収 */
.epilogue { margin: 18px 0 0; padding: 12px; border-radius: 14px; background: #fff; text-align: left; box-shadow: 0 1px 0 var(--line); }
.epilogue-head { margin: 0 0 8px; font-size: 16px; }
.epilogue .story-lines { margin-top: 8px; }
/* 事件画像の吹き出しと重複した本文を短くした印 */
.reaction.deduped .reaction-line { font-style: normal; }
/* UI-REACTION の効果帯（文字なし）を見出しの背景に */
.card.rampage .rampage-banner { background: url("../assets/story/FX_red.jpg") center / cover no-repeat; border-radius: 10px; padding: 10px 4px; color: #991b1b; text-shadow: 0 0 6px #fff, 0 0 2px #fff; }
.card.chain .chain-banner { background: url("../assets/story/FX_purple.jpg") center / cover no-repeat; border-radius: 10px; padding: 10px 4px; color: #fff; text-shadow: 0 1px 3px rgba(46,16,101,.9); }
.ending-kicker { background: url("../assets/story/FX_yellow.jpg") center / cover no-repeat; border-radius: 10px; padding: 8px 4px; color: #78350f; }
@media (prefers-reduced-motion: reduce) { .story-lines .reveal { opacity: 1; } }
/* PC：プロローグの絵だけ横に広げる（文章の列は 520px のまま） */
@media (min-width: 900px) {
  .pro-stage { width: min(760px, calc(100vw - 48px)); left: 50%; transform: translateX(-50%); }
}

/* ---------- v0.7.1（Phase C-8.1）：すごろく時計・初回スキップ・あらすじ ---------- */
.hud-left { min-width: 0; }
.hud-clock { margin: -2px 0 4px; font-size: 12px; color: var(--muted); }
.hud-clock b { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud-clock small { margin-left: 2px; font-size: 11px; }
.hud-clock.final b { color: #dc2626; }
.pro-skip-note { margin: 4px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
/* ---------- v0.7.2（Phase C-8.2）：画面上部の簡略表示（残りターン・現在マス） ---------- */
.hud-turn, .hud-pos { white-space: nowrap; }
.hud-turn small:first-child { margin: 0 2px 0 0; }
.hud-pos { margin-right: 4px; }
@media (max-width: 360px) {
  .hud-row { gap: 6px; }
  .hud-turn { font-size: 22px; }
  .hud-turn small, .hud-pos small { font-size: 11px; }
}

/* ---------- v0.7.4（Phase C-10）：正式タイトル画像 TITLE01 ---------- */
.title-wrap.has-art { padding-top: 10px; }
.title-visual { margin: 10px auto 0; }
.title-art {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain;
  border-radius: 12px; background: #241a4d; box-shadow: 0 6px 18px rgba(15, 23, 42, .25);
}
/* 画像に作品タイトルがあるので、文字ロゴは読み上げ用に残して見た目は隠す。主人公の立ち絵も画像にいるので隠す */
.title-wrap.has-art .title-logo {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.title-wrap.has-art .title-hero { display: none; }
.title-wrap.has-art .title-pre { margin: 10px 0 0; font-size: 14px; }
/* 画像が読めないとき：v0.7.3 までのタイトル表示 */
.title-wrap.no-art .title-visual { display: none; }
.title-menu { max-width: 440px; margin: 0 auto; }
.title-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.title-sub .btn { padding: 10px 6px; font-size: 15px; white-space: nowrap; }
.title-wrap.has-art .title-note { margin-top: 12px; }
.title-wrap.has-art .title-brand { margin-top: 14px; }
@media (max-width: 360px) {
  .title-sub .btn { font-size: 14px; padding: 10px 2px; }
  .title-sub .btn .ic { display: none; }
}
/* PC：タイトル画面のときだけ 520px の枠を外し、画像を中央に大きく。左右は画像の色の帯でつなぐ（横スクロールは出ない） */
@media (min-width: 700px) {
  body.on-title #app { max-width: none; }
  body.on-title .title-wrap.has-art .title-visual {
    width: min(100%, clamp(560px, calc((100vh - 330px) * 16 / 9), 960px));
    padding: 14px 0; background: #241a4d;
    box-shadow: 0 0 0 100vmax #241a4d; clip-path: inset(0 -100vmax);
  }
  body.on-title .title-wrap.has-art .title-art { box-shadow: none; }
  body.on-title .title-disclaimer { max-width: 520px; margin-left: auto; margin-right: auto; }
}
