/* プレイヤー画面。古代エジプトの砂色とナイルの青を基調にした、落ち着いた画面。PC のブラウザ向け。 */
@font-face {
  font-family: "MPLUS1p";
  src: url("/fonts/m-plus-1p/MPLUS1p-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "MPLUS1p";
  src: url("/fonts/m-plus-1p/MPLUS1p-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "DelaGothicOne";
  src: url("/fonts/dela-gothic-one/DelaGothicOne-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "NotoSansJPFallback";
  src: url("/fonts/noto-sans-jp/NotoSansJP-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --sand-50: #fbf5e6;
  --sand-100: #f4e8cb;
  --sand-200: #e8d4a2;
  --sand-300: #d9b878;
  --sand-500: #b99555;
  --sand-700: #7a5a2a;
  --ink: #2a2118;
  --ink-soft: #5d4d3a;
  --nile-800: #163f52;
  --nile-700: #1b4f66;
  --nile-600: #1f5f7a;
  --nile-500: #2a7a96;
  --nile-100: #dbeaf0;
  --gold: #b8862b;
  --clay: #a4452c;
  --clay-bg: #f8e4dc;
  --ok: #2f6b45;
  --ok-bg: #e3f0e6;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(80, 56, 20, 0.14);
  --font-body: "MPLUS1p", "NotoSansJPFallback", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-title: "DelaGothicOne", "MPLUS1p", "NotoSansJPFallback", sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-width: 1100px;
  min-height: 100vh;
  background: var(--sand-50) linear-gradient(180deg, #f8ecd0 0, var(--sand-50) 240px) no-repeat;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

:focus-visible { outline: 3px solid var(--nile-500); outline-offset: 2px; }

.loading { padding: 80px 24px; text-align: center; color: var(--ink-soft); }

/* ---------- 共通部品 ---------- */
.screen { max-width: 1040px; margin: 0 auto; padding: 36px 24px 64px; }
.screen.narrow { max-width: 680px; }

.card {
  background: #fffdf7;
  border: 1px solid var(--sand-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }

.display-title {
  font-family: var(--font-title);
  font-size: 1.9rem;
  line-height: 1.4;
  color: var(--nile-700);
  font-weight: 400;
}
.screen-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  line-height: 1.5;
  color: var(--nile-700);
  font-weight: 400;
  margin-bottom: 8px;
}
.panel-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--nile-700);
  font-weight: 400;
  margin-bottom: 6px;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--nile-800);
  margin: 22px 0 8px;
  padding-left: 10px;
  border-left: 4px solid var(--gold);
  line-height: 1.5;
}
.section-title.small { font-size: 0.95rem; margin-top: 14px; border-left-width: 3px; }
.lead { color: var(--ink-soft); margin-bottom: 14px; }
.hint { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.7; margin: 4px 0 8px; }
.count { font-size: 0.9rem; font-weight: 400; color: var(--ink-soft); }
.unit { font-size: 0.9rem; color: var(--ink-soft); margin-left: 4px; }

.btn {
  min-height: 44px;
  padding: 8px 18px;
  border: 2px solid var(--nile-600);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--nile-700);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, transform 0.05s;
  line-height: 1.4;
}
.btn:hover:not(:disabled) { background: var(--nile-100); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--nile-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--nile-700); }
.btn-wide { width: 100%; }
.btn-small { min-height: 36px; padding: 4px 12px; font-size: 0.9rem; }
.btn.is-active { background: var(--nile-100); border-color: var(--nile-800); }
.btn.is-confirming { background: var(--gold); border-color: var(--sand-700); color: #fff; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.link-btn {
  background: none; border: 0; padding: 4px 0; color: var(--nile-600);
  text-decoration: underline; cursor: pointer; font-size: 0.9rem;
}

.row-end { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.phase-end { margin-top: 26px; padding-top: 16px; border-top: 1px dashed var(--sand-300); }

.field-label { display: block; font-weight: 700; margin-bottom: 4px; }
.field-label.big { font-size: 1.05rem; line-height: 1.6; margin-bottom: 8px; }
.text-input, .select, .free-input, .num {
  width: 100%;
  border: 2px solid var(--sand-300);
  border-radius: 8px;
  background: #fff;
  padding: 8px 12px;
  line-height: 1.6;
}
.text-input:focus, .select:focus, .free-input:focus, .num:focus { border-color: var(--nile-500); outline: none; box-shadow: 0 0 0 3px rgba(42, 122, 150, 0.25); }
.free-input { resize: vertical; min-height: 76px; }
.free-input.tall { min-height: 130px; }
.num { width: 96px; text-align: right; flex: none; }
.num.is-invalid { border-color: var(--clay); background: var(--clay-bg); }
.form-error, .field-error { color: var(--clay); font-size: 0.9rem; min-height: 1.4em; font-weight: 700; }
.thinking { color: var(--nile-700); font-weight: 700; margin-top: 8px; }
.thinking::after { content: ""; display: inline-block; width: 1.2em; animation: dots 1.2s steps(4, end) infinite; overflow: hidden; vertical-align: bottom; white-space: nowrap; }
@keyframes dots { 0% { width: 0; } 100% { width: 1.2em; } }

.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; position: relative; font-size: 0.95rem; line-height: 1.7; }
.notice-soft { background: var(--sand-100); border: 1px solid var(--sand-200); color: var(--ink-soft); }
.notice-info { background: var(--nile-100); border: 1px solid #b6d3df; color: var(--nile-800); padding-right: 40px; }
.notice-error { background: var(--clay-bg); border: 1px solid #e3b8a8; color: var(--clay); font-weight: 700; }
.notice-x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: inherit; }

.toast-box { position: fixed; right: 16px; top: 16px; z-index: 50; display: grid; gap: 8px; }
.toast { background: var(--nile-800); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); }
.toast-error { background: var(--clay); }

.badge { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: var(--sand-200); color: var(--sand-700); font-size: 0.8rem; font-weight: 700; }

/* 選択肢のカード（チェック・ラジオ） */
.option-list, .radio-list { display: grid; gap: 8px; }
.option, .radio {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--sand-200); border-radius: 8px; background: #fff;
  padding: 10px 14px; cursor: pointer; line-height: 1.6;
}
.option:hover, .radio:hover { border-color: var(--nile-500); }
.option.is-on, .radio.is-on { border-color: var(--nile-600); background: var(--nile-100); }
.option input, .radio input { width: 20px; height: 20px; accent-color: var(--nile-600); flex: none; }
.option input:disabled ~ .option-text { opacity: 0.5; }
.option-text { flex: 1; }
.option-kind { font-size: 0.8rem; color: var(--ink-soft); border: 1px solid var(--sand-300); border-radius: 999px; padding: 0 8px; }
.choice-group { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
.choice-group legend { padding: 0; }

/* ---------- ログイン・ホーム・属性 ---------- */
.login { padding-top: 12vh; }
.login-card { text-align: center; padding: 36px 36px 32px; }
.login-card .field-label, .login-card .form-error { text-align: left; }
.login-mark {
  width: 64px; height: 56px; margin: 0 auto 14px;
  background: var(--sand-300);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 3px var(--sand-700);
}
.login-card .display-title { margin-bottom: 10px; }
.login-card .lead { text-align: left; }
.login-card .btn { margin-top: 8px; }

.home-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.home-side { display: grid; gap: 6px; justify-items: end; min-width: 240px; }
.attr-card { padding: 14px 16px; width: 100%; }
.attr-title { font-weight: 700; font-size: 0.9rem; color: var(--ink-soft); }
.attr-line { display: flex; gap: 12px; line-height: 1.7; }
.attr-line span { color: var(--ink-soft); min-width: 5em; }
.attr-card .btn { margin-top: 8px; }
.resume-card { border-color: var(--gold); background: #fff8e4; }
.resume-card p { margin-bottom: 4px; }
.scenario { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--sand-200); }
.scenario:last-of-type { border-bottom: 0; }
.scenario-title { font-size: 1.1rem; font-weight: 700; }
.scenario .btn { min-width: 140px; }
.play-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--sand-200); }
.play-item:last-child { border-bottom: 0; }
.play-info { display: grid; }
.play-title { font-weight: 700; }
.play-meta { font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- ゲーム画面 ---------- */
.game-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px;
  background: var(--nile-800);
  color: #fdf6e3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 22px; height: 20px; background: var(--sand-300); clip-path: polygon(50% 0, 100% 100%, 0 100%); flex: none; }
.brand-name { font-family: var(--font-title); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22em; }
.steps { display: flex; gap: 6px; margin-left: auto; }
.step { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; color: #b9d3de; border: 1px solid rgba(255, 255, 255, 0.2); }
.step-no { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); font-size: 0.75rem; font-weight: 700; }
.step.is-done { color: #fdf6e3; }
.step.is-done .step-no { background: var(--sand-300); color: var(--nile-800); }
.step.is-current { background: var(--sand-300); color: var(--nile-800); border-color: var(--sand-300); font-weight: 700; }
.step.is-current .step-no { background: var(--nile-800); color: var(--sand-100); }
.gauges { display: flex; gap: 18px; padding-left: 20px; border-left: 1px solid rgba(255, 255, 255, 0.25); }
.gauge { display: grid; line-height: 1.3; }
.gauge-label { font-size: 0.72rem; color: #b9d3de; }
.gauge-value { font-weight: 700; white-space: nowrap; }
.head-link { color: #fdf6e3; font-size: 0.85rem; white-space: nowrap; }
.test-badge { background: var(--gold); color: #fff; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }

.game-body {
  display: grid;
  grid-template-columns: minmax(440px, 1fr) minmax(500px, 1fr);
  gap: 20px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 24px 40px;
  align-items: start;
}
.left {
  position: sticky; top: 74px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 92px);
  min-height: 0;
}
.stage-wrap { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--sand-500); box-shadow: var(--shadow); background: var(--sand-100); flex: none; }
.stage-svg { display: block; width: 100%; height: 100%; }
.stage-boat { animation: drift 9s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(150px); } }
.stage-layer { transition: height 0.9s ease, y 0.9s ease; }
.stage-portrait.is-in { animation: appear 0.35s ease-out; }
@keyframes appear { from { opacity: 0; transform: translate(96px, 160px); } to { opacity: 1; transform: translate(96px, 150px); } }
@media (prefers-reduced-motion: reduce) {
  .stage-boat, .stage-portrait.is-in, .thinking::after { animation: none; }
  .stage-layer { transition: none; }
}

.dialogue {
  flex: none; max-height: 168px; overflow: auto;
  background: #fffdf7; border: 2px solid var(--sand-500); border-radius: var(--radius);
  padding: 10px 16px 12px; box-shadow: var(--shadow);
}
.dialogue.is-empty { display: none; }
.dialogue-empty { color: var(--ink-soft); font-size: 0.9rem; }
.dialogue-name { font-weight: 700; color: var(--nile-700); display: flex; align-items: center; gap: 10px; line-height: 1.6; }
.dialogue-tag { font-size: 0.8rem; font-weight: 400; background: var(--sand-200); color: var(--sand-700); padding: 0 10px; border-radius: 999px; }
.dialogue-text { font-size: 1.05rem; line-height: 1.85; }

.logbox { flex: 1 1 auto; min-height: 120px; display: flex; flex-direction: column; background: #fffdf7; border: 1px solid var(--sand-200); border-radius: var(--radius); overflow: hidden; }
.log-tabs { display: flex; background: var(--sand-100); border-bottom: 1px solid var(--sand-200); }
.log-tab { flex: 1; border: 0; background: none; padding: 6px 8px; cursor: pointer; font-size: 0.88rem; color: var(--ink-soft); border-bottom: 3px solid transparent; }
.log-tab.is-active { color: var(--nile-700); font-weight: 700; border-bottom-color: var(--nile-600); background: #fffdf7; }
.log-body { flex: 1; overflow: auto; padding: 8px 14px 10px; font-size: 0.92rem; line-height: 1.75; }
.log-entry { padding: 6px 0; border-bottom: 1px dotted var(--sand-200); }
.log-entry:last-child { border-bottom: 0; }
.log-q { font-weight: 700; }
.log-mark { display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 4px; background: var(--nile-100); color: var(--nile-700); font-size: 0.78rem; font-weight: 700; }
.log-a { color: var(--ink-soft); padding-left: 2px; }
.log-who, .log-who-inline { font-weight: 700; color: var(--nile-700); }
.log-who-inline { margin-right: 8px; }
.log-kind { font-size: 0.78rem; font-weight: 700; color: var(--sand-700); }
.log-event .log-kind { color: var(--clay); }
.log-response .log-kind { color: var(--nile-600); }

.right { min-width: 0; background: #fffdf7; border: 1px solid var(--sand-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px 0; }
.panel-body { padding-bottom: 18px; }

/* ヒアリング */
.stat-row { display: flex; gap: 28px; }
.stat { display: grid; line-height: 1.5; }
.stat-label { font-size: 0.82rem; color: var(--ink-soft); }
.stat-value { font-size: 1.15rem; font-weight: 700; color: var(--nile-700); }
.hearing-status { padding: 12px 16px; background: var(--sand-100); box-shadow: none; }
.meter { height: 8px; background: #fff; border-radius: 999px; margin-top: 8px; border: 1px solid var(--sand-300); overflow: hidden; }
.meter-fill { height: 100%; background: var(--gold); transition: width 0.4s; }
.char-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.char-tab {
  display: grid; text-align: left; gap: 0; line-height: 1.5;
  border: 2px solid var(--sand-200); border-radius: 8px; background: #fff; padding: 8px 12px; cursor: pointer;
}
.char-tab:hover { border-color: var(--nile-500); }
.char-tab.is-active { border-color: var(--nile-600); background: var(--nile-100); }
.char-tab-name { font-weight: 700; }
.char-tab-title { font-size: 0.8rem; color: var(--ink-soft); }
.char-tab-count { font-size: 0.78rem; color: var(--nile-700); }
.question-list { display: grid; gap: 8px; }
.question {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  border: 2px solid var(--sand-200); border-radius: 8px; background: #fff; padding: 10px 14px; cursor: pointer; line-height: 1.65;
}
.question:hover:not(:disabled) { border-color: var(--nile-600); background: var(--nile-100); }
.question:disabled { cursor: not-allowed; }
.question.is-asked { background: var(--sand-100); color: var(--ink-soft); border-style: dashed; }
.question:disabled:not(.is-asked) { opacity: 0.5; }
.question-badge { font-size: 0.78rem; background: var(--sand-200); color: var(--sand-700); border-radius: 999px; padding: 0 10px; white-space: nowrap; }
.free-box { margin-top: 4px; }
.card.free-box { background: var(--sand-100); box-shadow: none; }

/* 計画 */
.field { margin-bottom: 14px; }
.field-controls { display: flex; align-items: center; gap: 12px; }
.field-controls input[type="range"] { flex: 1; accent-color: var(--nile-600); min-width: 0; }
.field-controls .text-input { flex: 1; }
.worker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.worker-field .field-controls { gap: 6px; }
.sum-line { margin-top: 10px; padding: 8px 14px; border-radius: 8px; font-weight: 700; }
.sum-line.is-ok { background: var(--ok-bg); color: var(--ok); }
.sum-line.is-ng { background: var(--clay-bg); color: var(--clay); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--nile-100); border: 1px solid #b6d3df; border-radius: 999px; padding: 2px 6px 2px 14px; }
.chip-x { border: 0; background: none; cursor: pointer; font-size: 1.1rem; color: var(--nile-700); line-height: 1; padding: 2px 6px; }
.custom-assume { margin-top: 14px; }

/* 実行 */
.event-card { border-color: var(--gold); background: #fffaf0; }
.event-card + .event-card, .reason-card + .event-card { margin-top: 14px; }
.event-head { display: flex; gap: 10px; align-items: center; }
.event-tag { background: var(--clay); color: #fff; font-size: 0.78rem; font-weight: 700; border-radius: 4px; padding: 0 8px; }
.event-who { font-size: 0.9rem; color: var(--ink-soft); }
.event-title { font-size: 1.15rem; font-weight: 700; margin: 4px 0; line-height: 1.55; }
.event-text { line-height: 1.85; }
.choice-list { display: grid; gap: 8px; }
.choice {
  text-align: left; width: 100%; border: 2px solid var(--nile-500); border-radius: 8px; background: #fff;
  padding: 10px 14px; cursor: pointer; line-height: 1.65;
}
.choice:hover:not(:disabled) { background: var(--nile-100); }
.choice:disabled { opacity: 0.5; cursor: not-allowed; }
.reason-card { background: #f0f7fa; border-color: var(--nile-500); margin-bottom: 14px; }
.reports { margin-top: 8px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
.report { border: 2px solid var(--sand-200); border-radius: 8px; background: #fff; overflow: hidden; }
.report.is-open { border-color: var(--nile-600); }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 10px 12px; cursor: pointer; text-align: left; line-height: 1.5; }
.report-head:hover { background: var(--sand-100); }
.report-label { font-weight: 700; }
.report-toggle { font-size: 0.82rem; color: var(--nile-600); white-space: nowrap; }
.report-body { padding: 2px 12px 10px; border-top: 1px dotted var(--sand-300); }
.report-value { font-size: 1.5rem; font-weight: 700; color: var(--nile-700); line-height: 1.5; margin-top: 4px; }
.report-message { margin-top: 6px; line-height: 1.75; }
.report-meta { font-size: 0.82rem; color: var(--ink-soft); }
.report-note { font-size: 0.88rem; color: var(--ink-soft); margin-top: 2px; }
.side-panel { margin-top: 14px; background: var(--sand-100); box-shadow: none; }
.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-head .section-title { margin-top: 0; }
.topic-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.reply-box { margin-top: 12px; padding: 10px 14px; background: #fff; border-radius: 8px; border: 1px solid var(--sand-300); }
.reply-who { font-size: 0.85rem; color: var(--ink-soft); }
.reply-text { margin: 2px 0; }
.reply-granted { font-weight: 700; color: var(--nile-700); font-size: 0.92rem; }
.action-bar {
  position: sticky; bottom: 0; z-index: 5;
  margin: 18px -22px 0; padding: 12px 22px 14px;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.9), #fffdf7 30%);
  border-top: 2px solid var(--sand-200);
}
.action-hint { font-size: 0.88rem; color: var(--clay); margin-bottom: 6px; font-weight: 700; }
.action-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }

/* 結果 */
.result-list { display: grid; gap: 4px; }
.result-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 0; border-bottom: 1px dotted var(--sand-200); }
.result-row:last-child { border-bottom: 0; }
.result-row dt { color: var(--ink-soft); }
.result-row dd { font-weight: 700; font-size: 1.1rem; text-align: right; }
.facts { list-style: disc; padding-left: 1.4em; display: grid; gap: 4px; }
.result-actions { display: grid; gap: 10px; }

/* 振り返り */
.reflect .confidential {
  position: sticky; top: 0; z-index: 6;
  background: #fff3d6; border: 2px solid var(--gold); border-radius: var(--radius);
  padding: 10px 16px; margin: 6px 0 16px; box-shadow: var(--shadow); line-height: 1.75;
}
.confidential-title { font-weight: 700; color: var(--sand-700); }
.question-card { margin-top: 14px; }
.event-link { margin-bottom: 8px; }
.select { width: 100%; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(251, 245, 230, 0), var(--sand-50) 40%); padding: 18px 0 8px; margin-top: 8px; }
.save-status { margin-right: auto; font-weight: 700; color: var(--ok); }
.save-status.is-error { color: var(--clay); }

.card > .section-title:first-child, .card > .section-title:first-of-type:first-child { margin-top: 0; }
.right > .panel-body > .panel-title { margin-top: 0; }

.plan-hints { background: var(--sand-100); border: 1px solid var(--sand-200); border-radius: 8px; padding: 10px 16px; margin-bottom: 8px; }
.plan-hints-title { font-weight: 700; font-size: 0.9rem; color: var(--sand-700); }
.plan-hints ul { list-style: disc; padding-left: 1.3em; font-size: 0.92rem; line-height: 1.75; }

/* シナリオ選択 */
.scenarios-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 20px; }
.scenario-card + .scenario-card { margin-top: 16px; }
.scenario-card.is-playing { border-color: var(--gold); background: #fff8e4; }
.scenario-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.scenario-state { font-size: 0.82rem; font-weight: 700; padding: 0 12px; border-radius: 999px; background: var(--sand-200); color: var(--sand-700); white-space: nowrap; }
.scenario-state.state-playing { background: var(--gold); color: #fff; }
.scenario-state.state-played { background: var(--nile-100); color: var(--nile-700); }
.scenario-brief { margin: 8px 0; line-height: 1.85; }
.scenario-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 8px; }
.scenario-foot .hint { margin: 0; }
.scenario-foot .btn { min-width: 160px; }

/* ---------- 生成画像（読めなかったときは JS が従来の表示に戻す） ---------- */
.login-hero {
  display: block; width: calc(100% + 72px); height: 220px; margin: -36px -36px 20px;
  object-fit: cover; border-radius: var(--radius) var(--radius) 0 0;
}
.home-banner {
  display: block; width: 100%; height: 160px; object-fit: cover; margin-bottom: 20px;
  border: 2px solid var(--sand-500); border-radius: var(--radius); box-shadow: var(--shadow);
}
.scenario-card:has(.scenario-thumb) { display: grid; grid-template-columns: 256px 1fr; column-gap: 20px; align-content: start; }
.scenario-card:has(.scenario-thumb) > * { grid-column: 2; }
.scenario-card:has(.scenario-thumb) > .scenario-thumb { grid-column: 1; }
.scenario-thumb {
  display: block; width: 256px; height: 144px; object-fit: cover; grid-row: 1 / span 4;
  border-radius: 8px; border: 1px solid var(--sand-200);
}

/* ---------- 工程表（WBS とガントチャート） ---------- */
.gantt {
  --tree-w: 190px;
  --row-h: 28px;
  margin-top: 20px;
  padding: 12px 14px 14px;
  background: var(--sand-50);
  border: 1px solid var(--sand-200);
  border-radius: var(--radius);
}
.gantt-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gantt-title { font-size: 1.05rem; font-weight: 700; color: var(--nile-800); padding-left: 10px; border-left: 4px solid var(--gold); line-height: 1.5; }
.gantt-body-wrap[hidden] { display: none; }
.gantt-lead { margin: 6px 0 4px; }
.gantt-draft { display: inline-block; margin: 2px 0 4px; padding: 0 10px; border-radius: 999px; background: var(--gold); color: #fff; font-size: 0.82rem; font-weight: 700; }
.gantt-summary { display: grid; gap: 0; margin: 6px 0 10px; font-size: 0.93rem; line-height: 1.75; }
.gantt-summary .is-ok { color: var(--ok); }
.gantt-summary .is-late { color: var(--clay); }

.gantt-chart { background: #fffdf7; border: 1px solid var(--sand-200); border-radius: 8px; padding: 0 10px 4px; }
.gantt-row { display: grid; grid-template-columns: var(--tree-w) minmax(0, 1fr); height: var(--row-h); border-bottom: 1px dotted var(--sand-200); }
.gantt-rows { position: relative; }
.gantt-row.is-layer { background: var(--sand-100); }
.gantt-headrow { height: 42px; border-bottom: 2px solid var(--sand-200); }
.gantt-headrow.has-now { height: 60px; }
.gantt-tree { display: flex; align-items: center; gap: 6px; min-width: 0; padding-right: 10px; font-size: 0.88rem; line-height: 1.3; }
.gantt-row.is-task > .gantt-tree { padding-left: 24px; }
.gantt-layer-btn { border: 0; background: none; text-align: left; cursor: pointer; font-weight: 700; color: var(--nile-800); padding-left: 2px; }
.gantt-layer-btn:hover { background: var(--nile-100); }
.gantt-caret { width: 1em; color: var(--nile-600); font-size: 0.8rem; flex: none; }
.gantt-label { white-space: nowrap; }
.gantt-amount { margin-left: auto; font-size: 0.78rem; font-weight: 400; color: var(--ink-soft); white-space: nowrap; }
.gantt-colhead { align-self: end; padding-bottom: 4px; font-size: 0.78rem; color: var(--ink-soft); font-weight: 700; }
.gantt-badge { padding: 0 8px; border-radius: 999px; background: var(--gold); color: #fff; font-size: 0.7rem; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.gantt-row.is-bottleneck > .gantt-tree .gantt-label { color: var(--sand-700); font-weight: 700; }

.gantt-cell { position: relative; min-width: 0; }
.gantt-cell-text { position: absolute; left: 6px; top: 0; bottom: 0; right: 0; display: flex; align-items: center; font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-cell-text.is-late { color: var(--clay); font-weight: 700; }
.gantt-bar { position: absolute; top: 9px; height: 10px; border-radius: 3px; background: var(--nile-500); z-index: 1; }
.gantt-rows.has-actual .gantt-bar { top: 4px; }
.gantt-bar.is-layer { background: var(--nile-700); }
.gantt-bar.is-bottleneck { background: var(--gold); }
.gantt-bar.is-late { background: var(--clay); }
.gantt-bar.is-bottleneck.is-late { box-shadow: 0 0 0 2px var(--gold); }
.gantt-bar.is-clipped { border-top-right-radius: 0; border-bottom-right-radius: 0; background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0 3px, transparent 3px 6px); }
.gantt-actual { position: absolute; top: 17px; height: 7px; border-radius: 3px; background: var(--nile-800); z-index: 1; }
.gantt-actual.status-done { background: var(--ok); }
.gantt-actual.status-ahead { background: var(--ok); }
.gantt-actual.status-behind { background: var(--clay); }
.gantt-actual.is-ongoing { background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0 3px, transparent 3px 6px); }

.gantt-overlay { position: absolute; top: 0; bottom: 0; left: var(--tree-w); right: 0; pointer-events: none; }
.gantt-overlay.is-lines { z-index: 2; }
.gantt-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--sand-200); }
.gantt-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--clay); margin-left: -1px; }
.gantt-line.is-now { border-left: 2px solid var(--nile-800); }
.gantt-tick-label { position: absolute; bottom: 3px; transform: translateX(-50%); font-size: 0.72rem; color: var(--ink-soft); line-height: 1.2; }
.gantt-line-label { position: absolute; top: 0; padding: 0 6px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; line-height: 1.6; white-space: nowrap; color: #fff; }
.gantt-line-label.is-deadline { background: var(--clay); }
.gantt-line-label.is-now { top: 18px; background: var(--nile-800); }
.gantt-line-label.is-right { transform: translateX(-100%); }

.gantt-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 2px; font-size: 0.8rem; color: var(--ink-soft); }
.gantt-legend li { display: flex; align-items: center; gap: 6px; }
.gantt-swatch { display: inline-block; width: 22px; height: 8px; border-radius: 3px; }
.gantt-swatch.is-plan { background: var(--nile-500); }
.gantt-swatch.is-late { background: var(--clay); }
.gantt-swatch.is-bottleneck { background: var(--gold); }
.gantt-swatch.is-actual { background: var(--nile-800); }
.gantt-swatch.is-deadline { height: 0; width: 22px; border-top: 2px dashed var(--clay); border-radius: 0; }
.gantt-swatch.is-now { height: 0; width: 22px; border-top: 2px solid var(--nile-800); border-radius: 0; }

.gantt-status { margin-top: 8px; }
.gantt-status-title { font-size: 0.85rem; font-weight: 700; color: var(--sand-700); }
.gantt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.gantt-chip { padding: 0 10px; border-radius: 999px; font-size: 0.8rem; background: var(--nile-100); color: var(--nile-800); border: 1px solid var(--sand-300); }
.gantt-chip.status-done, .gantt-chip.status-ahead { background: var(--ok-bg); color: var(--ok); }
.gantt-chip.status-behind { background: var(--clay-bg); color: var(--clay); font-weight: 700; }
.gantt-chip.status-notStarted, .gantt-chip.status-noEstimate { background: var(--sand-100); color: var(--ink-soft); }

.gantt-axis-note { margin: 8px 0 2px; }
.gantt-basis { margin-top: 4px; font-size: 0.85rem; line-height: 1.7; color: var(--ink-soft); }
.gantt-basis.is-basis { padding: 6px 12px; background: #fff3d6; border: 1px solid var(--sand-300); border-left: 4px solid var(--gold); border-radius: 6px; color: var(--ink); }
.gantt-basis.is-warn { color: var(--clay); font-weight: 700; }
