/* トップページ「つくる、あそぶ。」と同じトンマナ:
   生成り地（paper）に白カード、大きめの角丸、線は細く、影はほぼ無し。
   アクセントは黄・ミント・水色・ピンクのパステル。文字は Noto Sans JP、墨色。
   PL=ピンク / BS=水色 / CF=ミント で三表を色分けする。 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700;800;900&display=swap');

:root {
  --paper:#f6f4ef; --white:#fdfcf9; --ink:#252625; --muted:#626560; --line:#e4e3dc;
  --yellow:#ffe58d; --mint:#c9e7d8; --blue:#c2e3f4; --pink:#f6c6cb;
  --yellow-soft:#fff5cf; --mint-soft:#e6f4ec; --blue-soft:#e7f3fa; --pink-soft:#fbe6e8;
  --good:#3f7d5c; --bad:#c8553d; --focus:#366f88;
}
* { box-sizing:border-box; }
html { scroll-behavior:smooth; }
body { margin:0; color:var(--ink); background:var(--paper); font-family:'Noto Sans JP',sans-serif; font-size:14px; line-height:1.8; -webkit-font-smoothing:antialiased; }
a { color:inherit; text-decoration:none; }
button,a,summary { -webkit-tap-highlight-color:transparent; }
a:focus-visible,button:focus-visible,summary:focus-visible,input:focus-visible { outline:3px solid var(--focus); outline-offset:4px; }
::selection { background:var(--yellow); color:var(--ink); }

/* ---- サイト共通ヘッダー / フッター（トップと同じ） ---- */
.site-header { width:min(1280px,calc(100% - 64px)); margin:auto; min-height:110px; display:flex; align-items:center; justify-content:space-between; gap:20px; }
.brand { display:flex; align-items:center; gap:14px; }
.brand-symbol { display:grid; place-items:center; width:54px; height:48px; background:var(--ink); color:var(--white); border-radius:18px; font:900 21px/1 monospace; letter-spacing:-3px; padding-right:3px; transform:rotate(-7deg); }
.brand strong { display:block; font-size:19px; letter-spacing:.04em; font-weight:900; line-height:1.3; }
.brand small { display:block; margin-top:5px; font-size:12px; letter-spacing:.18em; font-weight:700; }
a.backlink { font-size:12px; font-weight:800; letter-spacing:.08em; padding:12px 0; }
a.backlink:hover { text-decoration:underline; text-underline-offset:5px; }
.site-footer { width:min(1280px,calc(100% - 64px)); margin:auto; display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:12px; padding:56px 8px 28px; border-top:1px solid #dddcd4; margin-top:60px; }
.footer-wordmark { font-size:19px; font-weight:900; letter-spacing:.025em; }
.site-footer span { font-size:12px; font-weight:600; letter-spacing:.08em; color:var(--muted); }

/* ---- 見出し・ラベル ---- */
.eyebrow { display:flex; align-items:center; gap:9px; font-size:12px; letter-spacing:.13em; font-weight:800; margin:0 0 14px; }
.tiny-star { font-size:23px; line-height:1; }
h1 { margin:0 0 20px; font-size:clamp(34px,4vw,54px); font-weight:900; line-height:1.4; letter-spacing:.01em; }
.hl { position:relative; z-index:0; white-space:nowrap; }
.hl::after { content:''; position:absolute; bottom:6px; height:14px; background:var(--yellow); left:0; right:0; border-radius:10px; z-index:-1; transform:rotate(-2deg); }
h2 { margin:6px 0; font-size:26px; font-weight:800; letter-spacing:.025em; line-height:1.6; }
h3 { margin:-18px -18px 14px; padding:12px 18px; font-size:14px; font-weight:800; letter-spacing:.04em; color:var(--ink); border-radius:22px 22px 0 0; }
h3 small { color:var(--muted); font-weight:600; margin-left:8px; font-size:12px; letter-spacing:0; }
.stmt.pl h3 { background:var(--pink); } .stmt.bs h3 { background:var(--blue); } .stmt.cf h3 { background:var(--mint); }
h4 { margin:0 0 10px; font-size:13px; font-weight:800; letter-spacing:.04em; display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
h4 .sub, .sub { color:var(--muted); font-weight:500; font-size:12px; letter-spacing:0; }
.tiny { font-size:12px; color:var(--muted); font-weight:600; letter-spacing:.04em; }
.who { display:inline-block; font-size:11px; font-weight:700; color:var(--ink); background:var(--blue); padding:2px 10px; margin-right:8px; border-radius:999px; vertical-align:1px; letter-spacing:.04em; }
.news .who { background:var(--yellow); }
.chara .who { background:var(--mint); }

/* ---- ボタン（トップのピル型に合わせる） ---- */
button { font:inherit; font-weight:700; cursor:pointer; border:1px solid var(--line); background:var(--white); color:var(--ink); border-radius:50px; padding:9px 18px; transition:transform .2s, background .2s, border-color .2s; }
button:hover { transform:translateY(-2px); border-color:var(--ink); }
button:active { transform:translateY(0); }
button.primary { background:var(--ink); color:var(--white); border-color:var(--ink); width:100%; min-height:52px; padding:12px 24px; font-size:14px; margin-top:16px; }
button.primary:hover { background:#000; }
button.ghost { border-color:transparent; background:transparent; color:var(--muted); font-size:12px; font-weight:600; padding:4px 8px; margin-top:6px; text-decoration:underline; text-underline-offset:4px; }
button.ghost:hover { transform:none; color:var(--ink); background:transparent; border-color:transparent; }
button:disabled { opacity:.35; cursor:not-allowed; transform:none; }

/* ---- スタート画面 ---- */
#start { width:min(1280px,calc(100% - 64px)); margin:0 auto; padding:32px 0 20px; }
.lead { color:var(--muted); max-width:720px; font-size:15px; line-height:2; letter-spacing:.03em; margin:0 0 24px; }
#industries { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:14px; margin:8px 0 12px; }
.ind { text-align:left; padding:22px 24px; background:var(--white); border:none; border-radius:24px; line-height:1.7; }
.ind:hover { transform:translateY(-3px); border:none; }
.ind:nth-child(1) { background:var(--yellow); } .ind:nth-child(2) { background:var(--blue); } .ind:nth-child(3) { background:var(--mint); }
.ind-name { font-weight:900; font-size:17px; letter-spacing:.02em; }
.lv { font-size:11px; font-weight:700; color:var(--white); background:var(--ink); border-radius:999px; padding:2px 10px; margin-left:8px; vertical-align:2px; }
.ind-tag { color:var(--muted); font-size:12px; margin-top:6px; font-weight:500; }
#badgecount { margin:4px 0 0 4px; }
.howto { margin-top:18px; background:var(--white); padding:6px 24px 10px; font-size:14px; border-radius:24px; }
.howto summary { cursor:pointer; font-weight:800; font-size:13px; letter-spacing:.04em; padding:12px 0; list-style:none; display:flex; justify-content:space-between; align-items:center; }
.howto summary::-webkit-details-marker { display:none; }
.howto summary::after { content:'+'; width:27px; height:27px; border-radius:50%; display:grid; place-items:center; background:var(--paper); font-size:18px; font-weight:400; transition:transform .2s; }
.howto[open] summary::after { transform:rotate(45deg); }
.howto ol { margin:0 0 8px; padding-left:22px; color:var(--muted); line-height:1.9; }

/* ---- ゲーム画面 ---- */
#game header { width:min(1280px,calc(100% - 64px)); margin:0 auto 16px; display:flex; justify-content:space-between; align-items:center; gap:16px; padding:14px 24px; background:var(--white); border-radius:50px; position:sticky; top:12px; z-index:2; font-weight:700; font-size:13px; letter-spacing:.04em; }
#game header .tiny { color:var(--muted); }
#hd-cash { font-size:22px; font-weight:900; font-variant-numeric:tabular-nums; padding:0 10px; border-radius:10px; background:var(--yellow); margin:0 2px; }
#hd-cash.danger { background:var(--pink); color:var(--bad); }
main { width:min(1280px,calc(100% - 64px)); margin:0 auto; display:grid; grid-template-columns:410px 1fr; gap:16px; }
aside#panel { background:var(--white); border-radius:28px; padding:22px 24px; align-self:start; }

.box { border-top:1px solid var(--line); padding:14px 0 6px; margin-top:8px; }
.box:first-child { border-top:none; padding-top:0; }
.news, .chara { padding:6px 0; font-size:13px; }
.fc { background:var(--yellow-soft); margin:8px -24px 0; padding:16px 24px; border-top:none; }
.fc dl { display:grid; grid-template-columns:auto 1fr; gap:6px 14px; margin:0; font-size:13px; }
.fc dt { color:var(--muted); white-space:nowrap; } .fc dd { margin:0; }
.card { border:1px solid var(--line); border-radius:20px; padding:14px 16px; margin:10px 0; background:var(--white); }
.card-head { font-size:14px; font-weight:800; }
.card-head .who { background:var(--pink); }
.card-text { color:var(--muted); font-size:13px; margin:4px 0 8px; }
.card-choice label { margin-right:16px; font-weight:600; }
.card-choice input { accent-color:var(--ink); }
.ctl { display:block; margin:12px 0; font-size:13px; }
.ctl > span { display:block; color:var(--muted); font-size:12px; font-weight:600; letter-spacing:.04em; }
.ctl b { font-size:16px; font-weight:900; font-variant-numeric:tabular-nums; }
.ctl input[type=range] { width:100%; accent-color:var(--ink); margin:2px 0; }
.ctl .note { display:block; font-size:12px; color:var(--muted); }
.predict { background:var(--blue-soft); border:none; border-radius:20px; padding:16px 18px; margin-top:14px; }
.predict .formula { font-size:12px; color:var(--muted); margin-bottom:6px; }
.predict label { display:block; margin-top:8px; font-size:13px; font-weight:600; }
.predict input { width:140px; padding:8px 12px; font:inherit; border:1px solid var(--line); border-radius:12px; margin-left:8px; background:var(--white); color:var(--ink); }
.predict input:focus { border-color:var(--ink); outline:none; }
details.dark { margin-top:14px; padding:12px 18px; background:var(--ink); color:#d9d8d2; font-size:13px; border-radius:20px; }
details.dark summary { cursor:pointer; font-weight:700; }
details.dark button { background:#3a3a3d; color:var(--white); border-color:#3a3a3d; margin:8px 6px 4px 0; }
details.dark button:hover { border-color:var(--yellow); }
details.dark .tiny { color:#a3a29b; }

/* ---- 三表 ---- */
#statements { display:grid; grid-template-columns:repeat(3, 1fr); gap:14px; align-self:start; }
.stmt { background:var(--white); border-radius:22px; padding:18px; }
table { width:100%; border-collapse:collapse; font-size:13px; }
td { padding:5px 4px; border-bottom:1px solid var(--line); }
td.num { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
td.dcol { width:64px; font-size:11px; }
tr.bold td { font-weight:800; border-bottom:1px solid var(--ink); background:var(--paper); }
tr.sect td { background:transparent; font-size:11px; color:var(--muted); font-weight:800; letter-spacing:.1em; padding:12px 4px 4px; border:none; }
tr.up .diff { color:var(--good); } tr.down .diff { color:var(--bad); }
tr.up td.num:first-of-type, tr.down td.num:first-of-type { animation:flash 1.2s ease-out; }
tr.culprit td { background:var(--yellow); }
@keyframes flash { from { background:var(--yellow); } to { background:transparent; } }

/* ---- 月末の結果 / 推理 ---- */
.result h3 { margin:0 0 10px; padding:0; background:none; color:var(--ink); font-size:17px; border-radius:0; }
table.pred th { text-align:right; font-weight:600; color:var(--muted); font-size:12px; }
table.pred td { text-align:right; } table.pred td:first-child, table.pred th:first-child { text-align:left; }
.quiz { margin:14px 0; padding:16px 18px; border:none; background:var(--blue-soft); border-radius:20px; }
.quiz.ok { background:var(--mint-soft); } .quiz.ng { background:var(--pink-soft); }
.suspects { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.suspects button { background:var(--white); }
.why { margin-top:8px; font-size:13px; }
ul.contrib { margin:6px 0 0; padding-left:18px; font-size:12px; color:var(--muted); }
.calm { margin:12px 0; color:var(--muted); }
.lessons { font-size:12px; color:var(--muted); } .lessons ul { padding-left:18px; margin:4px 0; }
.dead { background:var(--ink); color:var(--yellow); padding:14px 18px; margin-top:12px; border-radius:20px; font-weight:800; }

/* ---- エンディング ---- */
.ending { text-align:center; }
.end-kicker { font-size:12px; color:var(--muted); letter-spacing:.13em; font-weight:800; margin-top:8px; }
.ending h2 { position:relative; display:inline-block; z-index:0; }
.ending h2::after { content:''; position:absolute; bottom:8px; height:14px; background:var(--yellow); left:0; right:0; border-radius:10px; z-index:-1; transform:rotate(-2deg); }
.score { margin:10px 0; }
.chart { width:100%; height:auto; background:var(--white); border:1px solid var(--line); border-radius:18px; }
.chart .zero { stroke:#c9c8c1; stroke-dasharray:3 3; }
.chart .l-profit { fill:none; stroke:var(--bad); stroke-width:2.5; }
.chart .l-cash { fill:none; stroke:var(--good); stroke-width:2.5; }
.chart .tick { font-size:10px; fill:var(--muted); text-anchor:middle; }
.chart .lbl { font-size:11px; font-weight:bold; } .chart .lbl.profit { fill:var(--bad); } .chart .lbl.cash { fill:var(--good); }
.badges { margin:12px 0; text-align:left; }
.badge { display:inline-block; border:1px solid var(--line); border-radius:999px; padding:3px 12px; font-size:12px; font-weight:600; margin:3px; background:var(--white); }
.badge.fresh { background:var(--yellow); border-color:var(--yellow); }

/* ---- レスポンシブ ---- */
@media (max-width:1200px) { #statements { grid-template-columns:1fr; } }
@media (max-width:1000px) { .site-header,.site-footer,#start,#game header,main { width:calc(100% - 40px); } }
@media (max-width:960px) { main { grid-template-columns:1fr; } aside#panel { padding:20px; } .fc { margin:8px -20px 0; padding:14px 20px; } }
@media (max-width:700px) {
  .site-header,.site-footer,#start,#game header,main { width:calc(100% - 28px); }
  .site-header { min-height:88px; }
  .brand { gap:9px; } .brand-symbol { width:38px; height:37px; font-size:16px; border-radius:12px; } .brand strong { font-size:14px; } .brand small { display:none; }
  h1 { font-size:clamp(30px,8.5vw,44px); }
  #start { padding-top:20px; }
  #game header { border-radius:24px; padding:12px 18px; flex-wrap:wrap; gap:6px; top:8px; }
  #hd-cash { font-size:18px; }
  aside#panel { border-radius:22px; }
  .stmt { padding:16px; } h3 { margin:-16px -16px 12px; padding:10px 16px; border-radius:20px 20px 0 0; }
  .site-footer { padding:40px 6px 22px; }
}
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } * { transition:none!important; animation:none!important; } }

/* パネル内のチュートリアル: 白地に白が重ならないよう生成り地のインセットにする */
#panel .howto { margin:0 0 6px; background:var(--paper); padding:2px 18px 8px; border-radius:18px; }
#panel .howto summary { padding:10px 0; }
#panel .howto ol { font-size:13px; }
