/* 黒を基調にした、静かなドキュメンタリー調の見た目 */
:root {
  --bg: #0e0e0e;
  --surface: #181818;
  --surface-2: #222222;
  --line: #333333;
  --text: #e4e1da;
  --text-dim: #9a968e;
  --text-faint: #6b6862;
  --accent: #c9b98f;
  --up: #9fbf8f;
  --down: #d08a7a;
  --danger: #d08a7a;
  --choice: #8fb0c9; /* プレイヤーが答える話の枠 */
  --serif: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --display: "Shippori Mincho", "Noto Serif JP", "Yu Mincho", serif;
  --sans: "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* 背景の街並み（記録映像の一場面） */
.stage {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 16 / 7;
  background: #050506;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px clamp(16px, 4vw, 40px) clamp(12px, 2.5vw, 24px);
  background: linear-gradient(to top, rgba(5, 5, 6, 0.88) 0%, rgba(5, 5, 6, 0.55) 55%, rgba(5, 5, 6, 0) 100%);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.caption-era { color: var(--accent); font-size: clamp(0.72rem, 1.5vw, 0.85rem); letter-spacing: 0.18em; }
.caption-year { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 4.2vw, 2.5rem); letter-spacing: 0.06em; line-height: 1.15; }
.caption-news { font-family: var(--display); font-size: clamp(0.8rem, 1.8vw, 1rem); line-height: 1.7; margin: 2px 0 0; max-width: 46em; }
.caption-label { color: var(--text-dim); margin-right: 0.8em; }
.caption-label:empty { display: none; }

@media (max-width: 600px) {
  .stage { aspect-ratio: 4 / 3; }
}

h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; }
h1 { font-size: 1.9rem; letter-spacing: 0.08em; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 0; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 4px;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
button.ghost { background: none; color: var(--text-dim); }
button.small { padding: 4px 12px; font-size: 0.85rem; }

.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 0.85rem; }
.rank-far { color: var(--text-faint); } /* 仕事タブ：2つ以上先の役職 */
.up { color: var(--up); }
.down { color: var(--down); }
.alarm { color: #ff5a4f; font-size: 1.5rem; font-weight: 700; }

/* タイトル */
/* 入口の絵（設計書18章）。題字は夕空に、ボタンは暗くした通りの上に来るよう、下へ行くほど黒へ沈める */
body.on-title::before {
  content: "";
  position: fixed;
  /* 高さは「アドレスバーが隠れたときの画面」に固定する。inset: 0 だと、スマホでスクロールしてアドレスバーが
     出入りするたびに箱の高さが変わり、絵が大きくなったり小さくなったりして見える（ユーザー指摘 2026-11-22） */
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(5, 5, 6, 0.4) 0%, rgba(5, 5, 6, 0.08) 28%, rgba(5, 5, 6, 0.22) 55%, rgba(5, 5, 6, 0.55) 80%, rgba(5, 5, 6, 0.9) 100%),
    #050506 url("../img/title/tokyo-1960.jpg") 62% 40% / cover no-repeat;
  animation: title-art-in 2.4s ease both;
}
@keyframes title-art-in { from { opacity: 0; } to { opacity: 1; } }
/* 最初の画面は題字（夕空）とボタン（通りの下のほう）だけ。そのあいだに絵を見せ、記録の引き継ぎなどはスクロールした先に置く */
.title { position: relative; }
.title-hero {
  width: 100%;
  min-height: calc(100vh - 24px);
  min-height: calc(100svh - 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(48px, 13vh, 140px);
}
.title-actions {
  margin-top: auto;
  padding: 24px 0 clamp(28px, 8vh, 80px);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.title-lang { position: absolute; top: -8px; right: 0; display: flex; gap: 2px; z-index: 1; }
.title-lang button { background: none; border: none; padding: 4px 8px; font-size: 0.8rem; color: var(--text-faint); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
.title-lang button.on { color: var(--accent); }
.title-ask { margin: 0; font-family: var(--serif); letter-spacing: 0.12em; color: #d8cdb8; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); }
.title-actions .countries { max-width: 560px; }
body.on-title .title-sub { margin-top: 14px; color: #d8cdb8; text-shadow: 0 0 12px rgba(0, 0, 0, 0.85), 0 1px 3px rgba(0, 0, 0, 0.9); }
body.on-title .title .dim,
body.on-title .title .faint { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); }
@media (prefers-reduced-motion: reduce) {
  body.on-title::before { animation: none; }
}
.title {
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 16px;
}
/* タイトル。古い活字の数字を、映画の題字のように大きく、ゆっくり浮かび上がらせる */
.title-mark {
  margin: 0;
  padding-left: 0.14em; /* 字間の分だけ右へ寄せて、見た目の中央をそろえる */
  font-family: "Playfair Display", var(--display);
  font-weight: 400;
  font-size: clamp(4.5rem, 15vw, 7rem);
  line-height: 1;
  letter-spacing: 0.14em;
  color: #eadfc8;
  text-shadow: 0 0 34px rgba(226, 186, 130, 0.32), 0 2px 10px rgba(0, 0, 0, 0.7);
}
.title-mark.rise { animation: title-rise 2.6s ease both; }
.title-sub { margin: 0 0 16px; padding-left: 0.42em; font-family: var(--display); font-size: clamp(1rem, 3vw, 1.3rem); letter-spacing: 0.42em; color: var(--text-dim); }
.title-mark.rise + .title-sub { animation: rite-in 1.6s ease 1.6s both; }
@keyframes title-rise {
  from { opacity: 0; letter-spacing: 0.26em; filter: blur(6px); }
  to { opacity: 1; letter-spacing: 0.14em; filter: blur(0); }
}
@media (prefers-reduced-motion: reduce) {
  .title-mark.rise, .title-mark.rise + .title-sub { animation: none; }
}
.title .buttons { display: flex; flex-direction: column; gap: 12px; width: min(280px, 100%); }
.title .lang { display: flex; gap: 8px; margin-top: -12px; }
.title .lang button { padding: 4px 14px; font-size: 0.85rem; }
.title .lang button.on { border-color: var(--accent); color: var(--accent); }
.title .countries { margin-top: 0; flex-wrap: wrap; justify-content: center; }
/* 課金で開く国：鍵の付いたボタン。押すと買う画面が開く。名前は読めるように薄くしすぎない */
.title .countries button.locked { opacity: 0.6; display: inline-flex; align-items: center; gap: 0.35em; }
.title .countries button.locked:hover, .title .countries button.locked:focus-visible { opacity: 0.9; }
.lock-icon { flex: none; }
.title .unlock { margin: 0; color: var(--accent); font-family: var(--serif); }
.title .lang-note { margin: -4px 0 0; font-size: 0.8rem; max-width: 420px; }
.title .past { margin-top: 32px; width: 100%; text-align: left; }

/* 見出し */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
/* 新聞と裏の筋の札（見出しの下、時の操作の左） */
.newsstand { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px 8px; flex-basis: 100%; margin-top: 6px; }
.stand {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 5px 12px 6px; border: 0; border-radius: 2px; cursor: pointer;
  color: #1a1712; background: #ece5d3; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 2px 2px 0 rgba(0, 0, 0, 0.25);
  text-shadow: 0 0 0.5px rgba(26, 23, 18, 0.6);
  line-height: 1.25;
}
.stand:hover:not(:disabled) { background: #f5efe0; }
.stand:disabled { opacity: 0.45; cursor: default; }
.stand-name { font-family: "Shippori Mincho", serif; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.12em; border-bottom: 2px solid #1a1712; }
.stand-note { margin-top: 2px; font-size: 0.7rem; font-family: system-ui, sans-serif; }
.stand.digital { background: #ffffff; text-shadow: none; }
.tip-stand { background: #cdbf9f; }
.tip-stand .stand-name { letter-spacing: 0.05em; border-bottom-style: dashed; }
/* 画面の小さな動き（ユーザー提案 2026-11-08） */
.tab-enter { animation: tab-rise 0.32s ease both; }
@keyframes tab-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tabs button { transition: background-color 0.2s ease, color 0.2s ease; }
.card { transition: border-color 0.2s ease; }
/* 札が消えるとき：Windows の通知のように、姿を保ったまま右へ滑り出し、終わりぎわに薄れる（約0.26秒）。
   消えきったあとで下の札がなめらかに上へ詰まる（約0.2秒）。ユーザー決定 2026-11-11 */
.card.leaving { overflow: hidden; pointer-events: none; animation: card-slide 0.26s cubic-bezier(0.4, 0, 1, 1) forwards, card-collapse 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.26s forwards; }
:has(> .card.leaving) { overflow-x: clip; } /* 滑っていく札で、横にスクロールが出ないように */
@keyframes card-slide {
  0% { transform: none; opacity: 1; }
  60% { opacity: 0.85; }
  100% { transform: translateX(100%); opacity: 0; }
}
@keyframes card-collapse {
  from { height: var(--leave-h); }
  to { height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; border-width: 0; }
}
/* 買い物で品を手に入れたとき（ユーザー提案 2026-11-11）：売り場の札はほのかに金色に光り、
   「持っているもの」の札は少し上から降りてきて、金色の光をまとって収まる */
.card.acquired { animation: card-acquired 1.4s ease-out; }
@keyframes card-acquired {
  0% { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(201, 185, 143, 0.45); }
  100% { box-shadow: 0 0 0 1px rgba(201, 185, 143, 0), 0 0 24px rgba(201, 185, 143, 0); }
}
.card.arrived { animation: card-arrive 1.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes card-arrive {
  0% { opacity: 0; transform: translateY(-10px); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(201, 185, 143, 0.5); }
  25% { opacity: 1; transform: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(201, 185, 143, 0.5); }
  100% { opacity: 1; transform: none; box-shadow: 0 0 0 1px rgba(201, 185, 143, 0), 0 0 24px rgba(201, 185, 143, 0); }
}
.deal-note { margin: 10px 0 0; color: var(--down); font-size: 0.9rem; }
.card.shake { animation: card-shake 0.38s ease; }
@keyframes card-shake {
  0%, 100% { transform: none; }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}
.message-in { animation: message-in 0.4s ease both; }
@keyframes message-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
button:not(:disabled):active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .tab-enter, .card.leaving, .message-in, .card.shake, .card.acquired, .card.arrived { animation: none; }
  button:not(:disabled):active { transform: none; }
}
.header .year { font-family: var(--serif); font-size: 1.6rem; }
.header .who { color: var(--text-dim); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 14px;
}

/* 指標 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 20px;
}
/* スマホでは1列だと縦に長くなりすぎるので2列にする（ユーザー指示 2026-11-11） */
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
}
.stat .label { color: var(--text-dim); font-size: 0.8rem; }
/* 物価と銀行の評判が「？ 不明」のときの説明 */
.stat .value { font-size: 1.05rem; }
.bar { font-family: ui-monospace, "Consolas", monospace; letter-spacing: 1px; color: var(--accent); font-size: 0.85rem; }

/* ナレーション */
.narration {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.9;
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  margin: 0;
}

.report { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; font-size: 0.9rem; margin-top: 10px; }
.report .total { border-top: 1px solid var(--line); padding-top: 4px; font-weight: 600; }

.message { margin-top: 14px; padding: 8px 14px; border-radius: 4px; background: var(--surface-2); color: var(--accent); }
.feed .message { margin-top: 0; margin-bottom: 10px; }
.feed:empty { display: none; }

/* 時の流れの操作と、1年の進み具合の線 */
.clock { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.header .clock { margin-left: auto; margin-top: 14px; align-self: center; } /* 名前の行とのあいだを空ける（ユーザー指摘 2026-11-08） */
.clock .speeds { display: inline-flex; gap: 2px; }
.clock .speeds button.active { border-color: var(--accent); color: var(--accent); }
.clock-bar { flex-basis: 100%; height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.clock-fill { height: 100%; background: var(--accent); transition: width 0.1s linear; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.events li.fresh { animation: feed-in 0.5s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .events li.fresh { animation: none; }
  .clock-fill { transition: none; }
}

/* タブ：見出しの札のように縁取り、押せることがわかるようにする。選んでいるタブは下の線とつながる */
.tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 2px solid var(--accent); overflow-x: auto; scrollbar-width: none; }
/* タブの並びの端の影と矢印。まだ先や手前にタブがある側だけに出る（main.js の updateTabArrows） */
.tabs-wrap { position: relative; margin-top: 20px; }
.tabs-wrap .tabs { margin-top: 0; }
.tabs-arrow {
  position: absolute;
  top: 0;
  bottom: 2px;
  z-index: 2;
  width: 40px;
  display: none;
  align-items: center;
  padding: 0 6px;
  border: none;
  border-radius: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
}
.tabs-arrow.prev { left: 0; justify-content: flex-start; background: linear-gradient(to right, var(--bg) 45%, rgba(14, 14, 14, 0)); }
.tabs-arrow.next { right: 0; justify-content: flex-end; background: linear-gradient(to left, var(--bg) 45%, rgba(14, 14, 14, 0)); }
.tabs-wrap.can-prev .tabs-arrow.prev,
.tabs-wrap.can-next .tabs-arrow.next { display: flex; }
/* タブの見出し絵（設計書18.8）。左右と下の端を画面の黒へぼかす */
.tab-art {
  height: clamp(96px, 26vw, 190px);
  margin: 2px 0 14px; /* 下の札（選べるもの）と少し離して、ここからが選択肢だと分かるように（ユーザー指示 2026-11-11） */
  background:
    linear-gradient(to right, var(--bg) 0%, rgba(14, 14, 14, 0) 10%, rgba(14, 14, 14, 0) 90%, var(--bg) 100%),
    linear-gradient(to bottom, rgba(14, 14, 14, 0.1) 0%, rgba(14, 14, 14, 0) 35%, rgba(14, 14, 14, 0.75) 75%, var(--bg) 92%),
    var(--art) center / cover no-repeat;
}
.tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  padding: 9px 16px;
}
.tabs button:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* 物件カード */
.cards { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
/* 物件カードの背景の絵（設計書18.4）。上の帯に絵を見せ、下へ行くほどカードの地の色へ溶かして文字を読みやすくする */
/* 絵はカードの上端から高さ205pxの帯に固定する（カードの長さで位置がずれないように。スマホで文字が折り返してカードが伸びると、絵が文字の後ろへ沈んでいた） */
.card.has-art { position: relative; overflow: hidden; padding-top: 118px; }
.card.has-art::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 205px;
  background:
    linear-gradient(to bottom, rgba(24, 24, 24, 0) 0px, rgba(24, 24, 24, 0.15) 70px, rgba(24, 24, 24, 0.7) 128px, rgba(24, 24, 24, 0.94) 165px, var(--surface) 205px),
    var(--art) center 68% / cover no-repeat;
  pointer-events: none;
}
.card.has-art > * { position: relative; }
/* 移住の行き先カードは街並みの絵（空が広い）なので、街の側を見せる（設計書18.15） */
.card.has-art.is-stage::before { background-position: center, center 62%; }
.card.has-art .card-head h3 { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.8); }
.card.has-art .card-head .price { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card .price { font-size: 1.1rem; font-weight: 600; white-space: nowrap; }
.card .meta { color: var(--text-dim); font-size: 0.85rem; margin-top: 2px; }
.card .text { font-family: var(--serif); font-size: 0.92rem; margin: 8px 0; color: var(--text); }
.card .trait { font-size: 0.85rem; color: var(--accent); }
.card .trait.bad { color: var(--down); }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.empty { color: var(--text-dim); padding: 20px 0; text-align: center; }
/* プレイヤーに選択を求める話（持ち込まれた話など）は、枠の色を変えて少しだけ目立たせる */
.job-result { font-size: 0.85rem; color: var(--text); }
.job-result.up { color: var(--up); }
.job-result.down { color: var(--down); }
.card.pride { border-color: var(--accent); border-left-width: 3px; }
.card.danger { border-color: var(--down); border-left-width: 3px; }
.card.choice { border-color: var(--choice); border-left-width: 3px; }

/* 交渉・支払い・建築の操作欄 */
.deal { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.deal select {
  flex: 1 1 260px;
  min-width: 0;
  font: inherit;
  font-size: 0.85rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
}
.deal select option { color: var(--text); }
.deal select option:disabled { color: var(--text-faint); }
.deal select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 遺言 */
/* 遺言の言葉の欄：上の説明と離し、見出しとして見せる */
.will .will-words-label { display: block; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--text); font-weight: 600; }
.will .will-words-help { margin: 4px 0 0; font-size: 0.85rem; }
.will textarea { width: 100%; min-height: 64px; margin-top: 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 8px; font: inherit; }
.will .comment-count { text-align: right; margin: 4px 0 0; font-size: 0.85rem; }
.will-plans { border: 0; padding: 0; margin: 10px 0 0; }
.will-plan { display: block; margin: 6px 0; cursor: pointer; }
.will-prop span { flex: 0 1 12em; }
.build { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
/* 才能表：Lv1以上は色を変える */
.card.skill-active { border-color: var(--accent); }
.card.skill-active h3 { color: var(--accent); }

/* 出来事欄 */
.events { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.9rem; }
.events li { padding: 6px 0 6px 12px; border-left: 2px solid var(--line); margin-bottom: 4px; }
.events li.tone-up { border-left-color: var(--up); }
.events li.tone-down { border-left-color: var(--down); }
/* 履歴は控えめに（ユーザー決定 2026-11-11。分かりやすさは、のちにイベント絵で補う）。
   よい知らせ（結婚・子の誕生など）は緑の線でやや太く、悪い知らせ（銀行の破綻など）は赤の線でやや太く。
   死と代替わりは、色を付けずにやや太く */
.events li.tone-milestone { border-left-color: var(--up); font-weight: 600; }
.events li.tone-crisis { border-left-color: var(--down); font-weight: 600; }
.events li.tone-mark { border-left-color: var(--text-dim); font-weight: 600; }
.feed .events + h2 { margin-top: 20px; }
.milestone { color: var(--accent); font-weight: 600; }
.events .source { display: block; color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }
.small { font-size: 0.8rem; }
.section-title { margin-top: 22px; font-size: 1rem; color: var(--text-dim); }

/* 人生の記録 */
.chronicle { list-style: none; padding: 0; margin: 0; }
.chronicle li { display: grid; grid-template-columns: 4.5em 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--surface-2); font-size: 0.92rem; }
.chronicle .y { color: var(--text-dim); }
dl.profile { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; }
dl.profile dt { color: var(--text-dim); }
dl.profile dd { margin: 0; }

.end-turn { margin-top: 28px; display: flex; justify-content: center; }
.end-turn .clock { justify-content: center; max-width: 520px; width: 100%; }
.end-turn .clock button:not(.small) { padding: 10px 20px; }

/* リザルト */
.result { text-align: center; padding-top: 40px; }
/* 終わりの画面の題の後ろに「遺されたもの」の静物を敷く（設計書18.14）。四方を地の色へ溶かし、題が読めるよう暗く沈める */
.result-head { position: relative; margin: -40px 0 0; padding: clamp(56px, 12vw, 110px) 0 clamp(28px, 6vw, 48px); }
.result-head > :not(.result-art) { position: relative; }
.result-art {
  position: absolute;
  inset: 0 -16px;
  background:
    linear-gradient(to right, var(--bg) 0%, rgba(14, 14, 14, 0) 12%, rgba(14, 14, 14, 0) 88%, var(--bg) 100%),
    linear-gradient(to bottom, var(--bg) 0%, rgba(14, 14, 14, 0) 18%, rgba(14, 14, 14, 0) 60%, var(--bg) 100%),
    linear-gradient(rgba(14, 14, 14, 0.42), rgba(14, 14, 14, 0.42)),
    var(--art) center 40% / cover no-repeat;
}
.result .digest { font-family: var(--serif); font-size: 1.05rem; line-height: 2; text-align: left; margin: 24px 0; }
.result .last-words { font-family: var(--serif); text-align: left; margin: 0 0 24px; line-height: 1.9; }
.result .last-words p { margin: 0 0 12px; }
.result .records { text-align: left; margin: 32px 0 0; border-top: 1px solid var(--line); padding-top: 16px; }
.result .records > summary { cursor: pointer; text-align: center; color: var(--text-dim); font-size: 0.95rem; }
.result .record-gen { margin: 12px 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.result .record-gen > summary { cursor: pointer; font-family: var(--serif); }
.result .record-gen h4 { margin: 14px 0 6px; font-size: 0.9rem; color: var(--text-dim); }
.result .record-gen p { margin: 0; font-size: 0.9rem; line-height: 1.8; }
.result .record-gen .chronicle { font-size: 0.9rem; }
.result .record-gen .plain li { grid-template-columns: 1fr; }
.result .record-gen .bonds li { grid-template-columns: 9em 1fr; }
.result .summary { color: var(--text-dim); }
.result .closing { font-family: var(--serif); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; margin: 28px 0; }
.result textarea, .share-box textarea {
  width: 100%;
  min-height: 72px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  font: inherit;
}
.result .buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
/* シェアの箱（リザルト、代替わりの場面、「人生」のタブ） */
.share-box .buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.share-box .share-label { margin: 20px 0 0; text-align: center; font-size: 0.9rem; }
.share-box .share-buttons { margin-top: 8px; }
.share-box .share-buttons button { min-width: 6.5em; }
.share-box .share-hint { text-align: center; margin: 8px 0 0; font-size: 0.85rem; }
.share-box .comment-count { text-align: right; margin: 4px 0 0; font-size: 0.85rem; }
.panel.share-box label { display: block; margin-top: 8px; }
.legacy-share { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--line); font-family: var(--sans); }

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .header .year { font-size: 1.35rem; }
}

/* 画面の金額の通貨を切り替えるボタンと、記録の文章に添える注 */
.money-view { text-align: right; margin-bottom: 8px; }
.record-note { font-size: 12px; margin-top: 8px; }

/* 国を渡る場面（js/ui/voyage.js） */
.voyage { position: fixed; inset: 0; z-index: 100; background: #000; opacity: 0; transition: opacity 0.7s ease; cursor: pointer; }
.voyage.voyage-in { opacity: 1; }
.voyage.voyage-up { opacity: 0; pointer-events: none; }
.voyage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.7s ease; }
.voyage.voyage-out canvas, .voyage.voyage-out .voyage-caption { opacity: 0; }
.voyage-caption { position: absolute; inset: 0 0 auto 0; padding: clamp(24px, 7vh, 64px) 16px 0; text-align: center; color: #f4f0e6; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75); transition: opacity 0.7s ease; }
.voyage-route { display: flex; align-items: center; justify-content: center; gap: 14px; font-family: var(--display); font-size: clamp(1.1rem, 3vw, 1.7rem); letter-spacing: 0.08em; }
.voyage-route i { display: block; width: clamp(40px, 12vw, 120px); height: 1px; background: currentColor; opacity: 0.7; }
.voyage-text { font-family: var(--display); font-size: clamp(0.9rem, 2vw, 1.1rem); line-height: 1.9; max-width: 40em; margin: 14px auto 0; opacity: 0; animation: voyage-text 1.2s ease 1s forwards; }
.voyage-skip { font-size: 0.75rem; opacity: 0.6; margin: 10px 0 0; }
@keyframes voyage-text { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .voyage-text { animation: none; opacity: 1; }
}
/* 代替わりの場面（js/ui/rite.js） */
.rite canvas { opacity: 0; transition: opacity 1.2s ease; }
.rite[data-step="scene"] canvas { opacity: 1; }
.rite[data-step="will"] canvas { opacity: 0.22; }
.rite-notice, .rite-scene, .rite-will { display: none; }
.rite[data-step="notice"] .rite-notice { display: flex; }
.rite[data-step="scene"] .rite-scene { display: block; }
.rite[data-step="will"] .rite-will { display: block; }
.rite.voyage-out .rite-notice, .rite.voyage-out .rite-will, .rite.voyage-out .rite-hint { opacity: 0; transition: opacity 0.7s ease; }
.rite-notice { position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; padding: 16px; text-align: center; color: #f4f0e6; font-family: var(--display); animation: rite-in 1.4s ease both; }
.rite-place { margin: 0 0 18px; font-size: clamp(0.9rem, 2.2vw, 1.1rem); letter-spacing: 0.12em; opacity: 0.7; }
.rite-line { margin: 0; font-size: clamp(1.15rem, 3.4vw, 1.8rem); line-height: 1.8; }
.rite-will { position: absolute; inset: 0 0 48px 0; overflow-y: auto; padding: clamp(24px, 8vh, 72px) 16px 16px; color: #f4f0e6; font-family: var(--display); }
.rite-narration, .rite-results { max-width: 44rem; margin-left: auto; margin-right: auto; }
.rite-narration { margin-top: 0; margin-bottom: 26px; font-size: clamp(1rem, 2.4vw, 1.2rem); line-height: 2; animation: rite-in 1.2s ease both; }
.rite-results { list-style: none; padding: 0; }
.rite-results li { padding: 10px 0 10px 14px; border-left: 2px solid rgba(244, 240, 230, 0.3); margin-bottom: 8px; line-height: 1.8; animation: rite-in 0.7s ease both; }
.rite-results li.up { color: var(--up); border-left-color: var(--up); }
.rite-results li.down { color: var(--down); border-left-color: var(--down); }
.rite-mourner { display: block; margin-bottom: 4px; }
.rite-results li.will { color: var(--accent); border-left-color: var(--accent); }
.rite-results li.narration { border-left-color: transparent; padding-left: 0; }
.rite-results li.milestone { color: var(--accent); border-left-color: var(--accent); }
.rite-hint { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; text-align: center; font-size: 0.75rem; color: #f4f0e6; opacity: 0.6; }
@keyframes rite-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .rite-notice, .rite-narration, .rite-results li { animation: none; }
}

/* 始まりの語り */
.opening { position: fixed; inset: 0; z-index: 90; display: flex; padding: 16px; overflow-y: auto; background: rgba(0, 0, 0, 0.74); animation: rite-in 0.9s ease both; }
/* ポップアップの右上の×。スクロールしても、画面の右上に留まる */
.pop-x { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); z-index: 2; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; font-size: 1.5rem; line-height: 1; color: #f4f0e6; background: rgba(20, 18, 14, 0.88); border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.pop-x:hover { border-color: var(--accent); color: var(--accent); }
/* スマホでは、下のボタンがブラウザの帯に隠れないよう、下に余白を足す */
@media (max-width: 720px) { .opening { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); } }
/* 確かめる画面の、了承してもらう前に知らせておくこと */
.ask-notes { margin: 4px 0 18px; padding-left: 1.2em; color: var(--text-dim); font-size: 0.92rem; line-height: 1.8; text-align: left; }
.ask-notes li { margin: 4px 0; }
.opening-card { margin: auto; width: 100%; max-width: 42rem; padding: clamp(20px, 5vw, 40px); background: var(--surface); border: 1px solid var(--line); font-family: var(--display); line-height: 2; }
.opening-city { margin: 0; color: var(--text-dim); letter-spacing: 0.12em; }
/* 始まりの画面の上の絵（設計書18.13）。カードの余白を打ち消して端まで敷き、下と左右をカードの色へ溶かす */
.opening-art {
  --pad: clamp(20px, 5vw, 40px);
  height: clamp(130px, 30vw, 230px);
  margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 18px;
  background:
    linear-gradient(to right, var(--surface) 0%, rgba(0, 0, 0, 0) 7%, rgba(0, 0, 0, 0) 93%, var(--surface) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 55%, var(--surface) 100%),
    var(--art) center 55% / cover no-repeat;
}
/* 街並みの絵は空が広いので、少し下（街の側）を見せる */
.opening-art.is-stage { background-position: center, center, center 62%; }
.opening-year { margin: 0 0 16px; font-size: clamp(2rem, 7vw, 2.8rem); line-height: 1.3; }
.opening-you { color: var(--accent); }
.opening-question { margin: 26px 0 20px; font-size: clamp(1.1rem, 3vw, 1.3rem); text-align: center; }
.opening-card > button { display: block; margin: 0 auto; }
.ask-card { max-width: 30rem; text-align: center; }
/* 年の終わりぎわに届いた話（ユーザー決定 2026-11-11）。札の中は、ふだんの持ち込まれた話と同じ書き方 */
.offer-pop { max-width: 36rem; text-align: center; }
.offer-pop .opening-question { margin: 8px 0 18px; }
.offer-pop .cards { text-align: left; font-family: var(--sans); line-height: 1.6; }
.offer-pop .faint { margin: 14px 0 0; font-family: var(--sans); font-size: 0.85rem; }
.ask-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.opening-name { display: flex; gap: 12px; justify-content: center; margin: 0 0 18px; }
.opening-name label { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 0.9rem; }
.opening-name input { width: 7em; min-width: 0; padding: 6px 8px; }
.opening-family { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--text-dim); }
.opening-family h3 { margin: 0 0 6px; font-size: 0.95rem; color: var(--text); }
.opening-family p { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .opening { animation: none; }
}
.opening-legacy { margin-top: 18px; }
.opening-legacy h3 { margin: 0 0 4px; font-size: 0.95rem; color: var(--text-dim); }
.opening-legacy p { margin: 0; }

/* 記録の引き継ぎ */
.backup { width: 100%; max-width: 42rem; margin: 20px auto 0; text-align: left; }
.backup summary { cursor: pointer; color: var(--text-dim); }
.backup p { font-size: 0.85rem; line-height: 1.8; }
.backup .backup-code { margin: 8px 0; font-family: var(--sans); font-size: 1.2rem; letter-spacing: 0.08em; text-align: center; color: var(--accent); user-select: all; }
.backup-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.backup-row input { flex: 1 1 12em; min-width: 0; padding: 6px 10px; text-transform: uppercase; letter-spacing: 0.06em; }
/* ファイルを選ぶ欄そのものは隠す（ブラウザの言語で「ファイルを選択」と出てしまうため）。押すのは、ゲームの言葉で書いたボタン */
.backup-file { display: inline-block; position: relative; margin-top: 10px; }
.backup-file input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.backup-file-button { display: inline-block; padding: 4px 12px; font-size: 0.85rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.backup-file:hover .backup-file-button { border-color: var(--accent); }
.backup-file:focus-within .backup-file-button { outline: 2px solid var(--accent); outline-offset: 2px; }
.backup .backup-message { margin: 10px 0 0; color: var(--accent); }

/* プレイ前の注意 */
.opening-card.notice { font-family: var(--serif); font-size: 0.9rem; line-height: 1.9; }
.notice h2 { margin: 0 0 14px; font-size: 1.15rem; }
.notice section { margin-bottom: 16px; }
.notice h3 { margin: 0 0 4px; font-size: 0.95rem; color: var(--accent); }
.notice p { margin: 0 0 6px; }

/* 課金で開く国を買う画面 */
.opening-card.shop { font-family: var(--serif); font-size: 0.9rem; line-height: 1.85; }
.shop h2 { margin: 0 0 14px; font-size: 1.15rem; }
.shop-item { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.shop-item.set { border-color: var(--accent); }
.shop-item h3 { margin: 0 0 4px; font-size: 1rem; color: var(--accent); }
.shop-item p { margin: 0 0 8px; }
.shop-buy { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.shop-price { font-family: var(--sans); font-size: 1.05rem; }
.shop-price small { font-size: 0.75rem; color: var(--text-dim); }
.shop-notes { margin: 14px 0 6px; padding-left: 1.2em; font-size: 0.8rem; color: var(--text-dim); line-height: 1.75; }
.shop-notes li { margin-bottom: 4px; }
.shop-message { margin: 0 0 10px; color: var(--text-dim); }
.shop-message.ok { color: var(--accent); }
.shop .backup-code { margin: 4px 0; font-family: var(--sans); font-size: 1.2rem; letter-spacing: 0.08em; text-align: center; color: var(--accent); user-select: all; }
.backup-row.center { justify-content: center; margin: 0 0 14px; }
.shop > button.ghost { display: block; margin: 16px auto 0; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 12px 0 0; font-size: 0.78rem; }
.legal-links a { color: var(--text-dim); }

/* パニック市場の投げ売り */
.panic-note { margin: 2px 0 0; font-size: 0.85rem; color: var(--down); }

/* 一族の資産のグラフ（js/ui/chart.js）。線は1本なので色は1色、文字は文字の色のまま */
.wealth { text-align: left; }
.wealth h3 { margin: 0 0 8px; font-size: 1rem; }
.wealth h3 .faint { margin-left: 6px; font-size: 0.8rem; font-weight: 400; }
.wealth-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-color: var(--line) transparent; }
.wealth-plot { position: relative; max-width: 460px; margin: 0 auto; touch-action: pan-x pan-y; }
.wealth-plot svg { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-grid.zero { stroke: var(--text-faint); }
.chart-generation { stroke: var(--text-dim); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-move { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart-tick { fill: var(--text-dim); font-family: var(--sans); font-size: 11px; }
.chart-value { fill: var(--text); font-family: var(--sans); font-size: 11px; font-weight: 600; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-end { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-cross { stroke: var(--text-dim); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-tip { position: absolute; top: 0; padding: 3px 8px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--sans); font-size: 0.8rem; color: var(--text); white-space: nowrap; pointer-events: none; }
.chart-tip[hidden], .chart-cross[hidden] { display: none; }
.wealth-table { margin-top: 8px; font-size: 0.85rem; color: var(--text-dim); }
.wealth-table summary { cursor: pointer; }
.wealth-table table { width: 100%; margin-top: 6px; border-collapse: collapse; font-family: var(--sans); }
.wealth-table td { padding: 2px 8px 2px 0; border-bottom: 1px solid var(--line); }
/* スマホでも画面の幅に収め、スクロールせずに全体を見せる（ユーザー指示 2026-11-12。以前は広く描いて指で左右に動かしていた）。
   縮むぶん、目盛りの文字を少し大きくする（画面上で約11.5px） */
@media (max-width: 520px) {
  .chart-tick, .chart-value { font-size: 12px; }
}

/* 来年の見通しの新聞（forecast.js）。画面の色の切り替えに関わらず、紙の色で見せる（ユーザーの見本：欧米の新聞の一面） */
.paper-wrap { background: rgba(0, 0, 0, 0.8); }
.paper {
  margin: auto;
  width: 100%;
  max-width: 44rem;
  padding: clamp(16px, 4vw, 32px);
  color: #1a1712;
  /* 古い新聞：紙の粒と、縁の黄ばみ */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at center, transparent 55%, rgba(150, 120, 60, 0.18) 100%),
    #f5f0e2;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  /* 刷りのインクが、わずかに滲む */
  text-shadow: 0 0 0.6px rgba(26, 23, 18, 0.65), 0 0 1.6px rgba(26, 23, 18, 0.18);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: rite-in 0.6s ease both;
}
.paper-head { text-align: center; }
.paper-name { margin: 0; font-family: "Shippori Mincho", serif; font-weight: 700; font-size: clamp(2.4rem, 10vw, 4rem); letter-spacing: 0.06em; line-height: 1.15; }
.paper-motto { margin: 0 0 8px; font-style: italic; font-size: 0.8rem; }
.paper-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; margin: 0; padding: 5px 0; border-top: 3px solid #1a1712; border-bottom: 1px solid #1a1712; font-family: system-ui, sans-serif; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.04em; }
.paper-kicker { display: inline-block; margin: 14px 0 2px; font-family: system-ui, sans-serif; font-weight: 700; font-size: 0.75rem; letter-spacing: 0.12em; border-bottom: 2px solid #1a1712; }
.paper-name, .paper-headline { text-shadow: 0 0 1px rgba(26, 23, 18, 0.7), 0 0 2.5px rgba(26, 23, 18, 0.25); }
/* 図はにじませない（スマホでは粗く引き伸ばされて、数字が読めなくなる。ユーザー指摘 2026-11-22） */
.paper-headline { text-wrap: balance; margin: 2px 0 0; font-family: "Shippori Mincho", serif; font-weight: 700; font-size: clamp(1.8rem, 7vw, 2.9rem); line-height: 1.25; }
.paper-sub { display: flex; flex-wrap: wrap; gap: 0 1.5em; margin: 4px 0 0; font-weight: 600; font-size: clamp(0.95rem, 3vw, 1.1rem); }
.paper-sub span { white-space: nowrap; }
.paper-byline { margin: 6px 0 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(26, 23, 18, 0.35); font-family: system-ui, sans-serif; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.1em; color: #4a443a; }
.paper-body { column-count: 2; column-gap: 22px; column-rule: 1px solid rgba(26, 23, 18, 0.3); font-size: 0.86rem; line-height: 1.8; text-align: justify; }
.paper-body p { margin: 0 0 8px; text-indent: 1em; }
.paper-body p:first-child::first-letter { font-weight: 700; font-size: 1.25em; }
.paper-figure { margin: 12px 0 0; padding: 10px; background: #ebe6da; }
.paper-figure svg { display: block; width: 100%; height: auto; }
.paper-figure text { font-family: system-ui, sans-serif; font-size: 17px; fill: #1a1712; }
.paper-figure text.v { font-weight: 700; }
.paper-figure figcaption { margin-top: 4px; font-size: 0.72rem; color: #4a443a; }
.paper-table { width: 100%; margin: 12px 0 0; border-collapse: collapse; font-size: 0.85rem; }
.paper-table caption { padding: 3px 0; border-top: 3px solid #1a1712; border-bottom: 1px solid #1a1712; text-align: left; font-family: system-ui, sans-serif; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.1em; }
.paper-table th, .paper-table td { padding: 5px 4px; border-bottom: 1px solid rgba(26, 23, 18, 0.25); }
.paper-table th { text-align: left; font-weight: 600; }
.paper-table td { text-align: right; font-weight: 700; }
.paper-world { margin-top: 12px; }
.paper-world h3 { margin: 0 0 6px; padding: 3px 0; border-top: 3px solid #1a1712; border-bottom: 1px solid #1a1712; font-family: system-ui, sans-serif; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.1em; }
.paper-world p { margin: 0 0 6px; font-size: 0.82rem; line-height: 1.7; break-inside: avoid; }
@media (min-width: 560px) { .paper-world { column-count: 2; column-gap: 22px; column-rule: 1px solid rgba(26, 23, 18, 0.3); } .paper-world h3 { column-span: all; } }
.paper-note { margin: 8px 0 0; font-size: 0.72rem; color: #4a443a; }
.paper-close { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.paper .paper-close .ghost { color: #1a1712; border-color: rgba(26, 23, 18, 0.5); text-shadow: none; }
@media (max-width: 480px) { .paper-body { column-count: 1; } }

/* 電子版（パソコンが売りに出る年から）：紙の粒も黄ばみもインクの滲みもない、画面の文字 */
.paper.digital { background: #ffffff; text-shadow: none; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px #c9c9c9; }
.paper.digital .paper-name, .paper.digital .paper-headline { text-shadow: none; }
.paper.digital .paper-figure { background: #f1f1f1; }
.paper.digital .paper-figure svg { filter: none; }

/* 裏の筋の走り書き：古い紙の切れ端。インクがわずかに滲む */
.tip-frame { margin: auto; width: 100%; max-width: 34rem; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.75)); transform: rotate(0.6deg); animation: rite-in 0.6s ease both; }
.tip {
  padding: clamp(22px, 5vw, 34px);
  color: #2a2016;
  background: #e9dfcc url("../img/paper-old.jpg") center / 100% 100% no-repeat; /* 古い紙の画像（ユーザーが生成したもの 2026-11-08） */
  font-family: "Shippori Mincho", serif;
  line-height: 1.9;
  text-shadow: 0 0 0.6px rgba(42, 32, 22, 0.7), 0 0 1.4px rgba(42, 32, 22, 0.2);
}
.tip .primary { text-shadow: none; }
.paper-wrap.still, .paper-wrap.still .tip-frame, .paper-wrap.still .paper { animation: none; }
.tip-lead { margin: 0 0 10px; font-style: italic; }
.tip h3 { margin: 14px 0 4px; font-size: 1rem; border-bottom: 1px dashed rgba(42, 36, 28, 0.6); }
.tip ul { margin: 0; padding-left: 1.2em; }
.tip li { margin: 2px 0; }
.tip-note { margin: 12px 0 0; font-size: 0.85rem; color: #4d4436; }
.paper .primary { text-shadow: none; }

/* 酒場の画面（設計書18.5）。店の絵の下半分を闇に沈め、その上に店の名前と情報屋の言葉を置く。走り書きは絵の下に出る */
.bar-wrap { flex-direction: column; align-items: center; gap: 18px; background: rgba(0, 0, 0, 0.86); }
.bar-room { position: relative; width: 100%; max-width: 46rem; margin: auto auto 0; background: #0b0a09; border: 1px solid var(--line); overflow: hidden; animation: rite-in 0.9s ease both; }
.bar-wrap .bar-room:only-child { margin-bottom: auto; }
.bar-art {
  aspect-ratio: 2 / 1;
  background: linear-gradient(to bottom, rgba(11, 10, 9, 0) 45%, rgba(11, 10, 9, 0.75) 78%, #0b0a09 100%), linear-gradient(to right, rgba(11, 10, 9, 0.5), rgba(11, 10, 9, 0) 18%, rgba(11, 10, 9, 0) 82%, rgba(11, 10, 9, 0.5)), var(--art) center / cover;
  animation: bar-light 2.4s ease both;
}
@keyframes bar-light { from { filter: brightness(0.35); } to { filter: none; } }
.bar-talk { position: relative; margin-top: -12%; padding: 0 clamp(18px, 5vw, 36px) clamp(18px, 4vw, 28px); font-family: var(--display); line-height: 1.95; }
.bar-place { margin: 0 0 4px; color: var(--accent); letter-spacing: 0.14em; font-size: 0.9rem; }
.bar-scene { margin: 0; color: var(--text-dim); }
.bar-greet { margin: 14px 0 0; text-wrap: balance; word-break: auto-phrase; font-size: clamp(1.05rem, 2.6vw, 1.2rem); }
.bar-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.bar-note { margin: 10px 0 0; color: var(--text-dim); font-size: 0.85rem; }
.bar-cut { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.bar-cut .bar-note { margin-top: 6px; }
/* 走り書きが画面より長くなっても（ひと晩の仕事の結果が加わったときなど）、店の絵と紙を縮めない。縮むと店の絵が欠け、紙の中身が紙からはみ出す */
.bar-wrap .bar-room, .bar-wrap .tip-frame { flex-shrink: 0; }
.bar-wrap .tip-frame { margin: 0 auto auto; }
.bar-wrap.still, .bar-wrap.still .bar-room, .bar-wrap.still .bar-art, .bar-wrap.still .tip-frame,
.bar-wrap.still-room, .bar-wrap.still-room .bar-room, .bar-wrap.still-room .bar-art { animation: none; }
@media (max-width: 520px) { .bar-talk { margin-top: -6%; } .bar-art { aspect-ratio: 16 / 10; } }

/* 出来事の挿絵（設計書18.9）。出来事欄の一番上に、欄の幅いっぱいに敷き、左右と下を欄の地の色へぼかす */
.event-art {
  height: clamp(90px, 24vw, 170px);
  margin: -14px -16px 12px;
  border-radius: 6px 6px 0 0;
  background:
    linear-gradient(to right, var(--surface) 0%, rgba(0, 0, 0, 0) 9%, rgba(0, 0, 0, 0) 91%, var(--surface) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 58%, var(--surface) 100%),
    var(--art) center var(--art-y, center) / cover no-repeat;
}

/* 場面の絵（葬儀・移住・密航。影絵の代わり。設計書18.9）。画面の中ほどに横長の帯で敷き、四方を黒へぼかして、ゆっくり寄る */
.scene-art {
  position: absolute; left: 0; right: 0; top: 56%;
  aspect-ratio: 3 / 1; max-height: 70vh;
  transform: translateY(-50%);
  background: var(--art) center / cover no-repeat;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 16%, #000 80%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 16%, #000 80%, transparent);
  mask-composite: intersect;
  transition: opacity 1.2s ease;
  animation: scene-art 9s ease-out both;
}
@keyframes scene-art { from { opacity: 0; transform: translateY(-50%) scale(1); } 15% { opacity: 1; } to { opacity: 1; transform: translateY(-50%) scale(1.06); } }
.voyage.voyage-out .scene-art { opacity: 0; }
/* 葬儀：知らせの文字のあいだは隠し、場面で見せ、遺言を読むあいだは薄く残す */
.rite .scene-art { opacity: 0; animation: none; }
.rite[data-step="scene"] .scene-art { opacity: 1; animation: scene-zoom 8s ease-out both; }
.rite[data-step="will"] .scene-art { opacity: 0.22; transform: translateY(-50%) scale(1.06); }
@keyframes scene-zoom { from { transform: translateY(-50%) scale(1); } to { transform: translateY(-50%) scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  .scene-art, .rite[data-step="scene"] .scene-art { animation: none; opacity: 1; }
  .rite .scene-art { opacity: 0; }
  .rite[data-step="scene"] .scene-art { opacity: 1; }
  .rite[data-step="will"] .scene-art { opacity: 0.22; }
}

/* 英語：ボタンの文は大文字で始める（文の途中にも使う言葉は、辞書では小文字で持っている） */
:lang(en) button::first-letter { text-transform: uppercase; }
/* 英語：字のあいだを広く取る見出しは、語が長いので少し詰める。新聞の本文は左ぞろえにする */
:lang(en) .title-sub { letter-spacing: 0.2em; padding-left: 0.2em; }
:lang(en) .caption-era { letter-spacing: 0.1em; }
:lang(en) .paper-name { font-size: clamp(1.5rem, 6.4vw, 2.8rem); letter-spacing: 0.02em; }
:lang(en) .paper-body { text-align: left; hyphens: auto; }
:lang(en) .paper-sub span { white-space: normal; }
/* 英語：続柄などの見出しの言葉も、大文字で始める */
:lang(en) .y::first-letter, :lang(en) h2::first-letter, :lang(en) h3::first-letter { text-transform: uppercase; }

/* 案内（最初の1年のチュートリアル。ui/guide.js）。遊びを止めずに、画面の上に短い語りを出す */
.guide { position: sticky; top: 8px; z-index: 5; margin: 12px 0; padding: 12px 14px; background: #201c14; border: 1px solid var(--accent); border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55); animation: rite-in 0.5s ease both; }
.guide-label { margin: 0 0 4px; font-size: 0.75rem; letter-spacing: 0.12em; color: var(--accent); }
.guide-text { margin: 0 0 6px; font-family: var(--serif); font-size: 0.95rem; line-height: 1.75; }
.guide-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.guide.long { position: static; }
/* 入口の「遊び方」と「プレイ前の注意」のボタンを並べる */
.title-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.manual-item { border-top: 1px solid var(--line); }
.manual-item:last-of-type { border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.manual-item > summary { padding: 12px 2px; cursor: pointer; color: var(--accent); font-weight: 600; font-size: 1rem; }
.manual-item[open] > summary { padding-bottom: 6px; }
.manual-item > p:last-child { margin-bottom: 14px; }
.chronicle-more { margin: 10px 0 0; text-align: center; }
/* 遊び方に添える、画面の切り取り。小さめに、枠をつけて置く */
.manual-shot { margin: 8px auto 10px; max-width: 320px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--bg); }
.manual-shot img { display: block; width: 100%; height: auto; }
/* 折りたためる見出し（収支）。見出しそのものがボタン */
h2.fold { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fold-button { background: none; border: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.fold-button:hover:not(:disabled) { color: var(--accent); }
.fold-mark { display: inline-block; width: 1.2em; font-size: 0.7em; color: var(--text-dim); }
.fold-total { font-family: var(--sans); font-size: 0.95rem; font-weight: 600; }
.report[hidden] { display: none; }
.guide.long { scroll-margin-top: 12px; }
