/* CORALS Project Planner（試作）— ライトグレーのミニマル。スマホが先 */
:root {
  color-scheme: light;
  --bg: #f2f2f0;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --ink: #171717;
  --ink-2: #55554f;
  --ink-3: #8a8a84;
  --line: #e3e3df;
  --line-2: #cfcfca;
  --accent: #171717;
  --accent-ink: #ffffff;
  --bar-corals: #2b2b29;
  --bar-other: #b9b9b3;
  --bar-search: #d8d4ca;
  --good: #2f6b4f;
  --good-bg: #e9f2ec;
  --warn: #8a5a12;
  --warn-bg: #f7efe0;
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 76px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* 試作の表示 */
.proto-banner {
  background: #e7e3d8;
  color: #5b5544;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-align: center;
  padding-block: 5px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* スマホの上の帯（ノッチ）の下に、スクロールした中身が透けないようにする */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }

/* 上：ロゴと進み具合 */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.top-inner {
  max-width: 600px; margin: 0 auto; padding-block: 14px 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 600; letter-spacing: 0.32em; font-size: 14px; }
.top-link {
  background: none; border: 0; padding: 6px 0; color: var(--ink-2); font-size: 14px;
  text-decoration: underline; text-underline-offset: 3px;
}
.progress { height: 3px; background: var(--line); }
.progress-fill { height: 100%; width: 0; background: var(--ink); transition: width 0.35s ease; }

/* 画面 */
.main {
  max-width: 600px; margin: 0 auto; padding-block: 28px calc(var(--nav-h) + 32px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.screen { min-height: 50vh; }
.screen.enter { animation: enter 0.24s ease both; }
.screen.enter-back { animation: enter-back 0.24s ease both; }
@keyframes enter { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen.enter, .screen.enter-back { animation: none; } .progress-fill { transition: none; } }

.eyebrow { font-size: 13px; color: var(--ink-3); margin: 0 0 8px; letter-spacing: 0.02em; }
.q-title { font-size: 26px; line-height: 1.22; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 8px; }
.q-title:focus { outline: none; }
.q-help { color: var(--ink-2); margin: 0 0 22px; font-size: 15px; }
.intro { color: var(--ink-2); margin: 0 0 22px; font-size: 15px; }

/* 選択肢 */
.options { display: grid; gap: 10px; margin: 0; padding: 0; }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 15px 16px; min-height: 56px;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
}
.option:hover { border-color: var(--line-2); }
.option:active { transform: scale(0.995); }
.option:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.option .radio {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2);
  display: grid; place-items: center; transition: border-color 0.15s;
}
.option .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: transparent; transition: background 0.15s; }
.option.selected { border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--ink) inset; }
.option.selected .radio { border-color: var(--ink); }
.option.selected .radio::after { background: var(--ink); }
.option .label { display: block; font-weight: 500; }
.option .sub { display: block; font-size: 13px; color: var(--ink-3); margin-top: 2px; }

.btn-secondary-wide {
  width: 100%; margin-top: 14px; background: transparent; border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm); padding: 14px 16px; color: var(--ink-2); text-align: center;
}
.btn-secondary-wide.selected { border-style: solid; border-color: var(--ink); color: var(--ink); }

/* 入力 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field .opt { color: var(--ink-3); font-weight: 400; }
.input {
  width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 14px 14px; font-size: 17px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
textarea.input { min-height: 96px; resize: vertical; font-size: 16px; }
.field-hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.field-error { font-size: 13px; color: #a3321f; margin-top: 6px; }

.suggest { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.suggest li + li { border-top: 1px solid var(--line); }
.suggest button { width: 100%; text-align: left; background: none; border: 0; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; }
.suggest button:hover, .suggest button.active { background: var(--surface-2); }
.suggest .s-sub { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.resolved { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 15px; color: var(--good); }
.resolved::before { content: "✓"; font-weight: 700; }

/* 月の選択 */
.year-label { font-size: 13px; color: var(--ink-3); margin: 18px 0 8px; }
.year-label:first-of-type { margin-top: 0; }
.months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.month {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 4px; text-align: center; font-size: 15px;
}
.month.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; font-weight: 600; }

/* 下：Back・Next */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(242, 242, 240, 0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-inner {
  max-width: 600px; margin: 0 auto; padding-block: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; justify-content: space-between; gap: 12px;
}
.btn { border-radius: 999px; padding: 13px 24px; font-weight: 500; border: 1px solid transparent; min-height: 48px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { background: var(--line-2); color: #fff; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:disabled { visibility: hidden; }
.btn-block { width: 100%; }
/* 送信中のボタン（メールのカード）。下の帯の Back とちがい、隠さずに薄くする */
.inline-form .btn:disabled { visibility: visible; opacity: 0.55; cursor: progress; }
/* ロボットよけの見えない欄 */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* 待ち画面 */
.building { display: grid; place-items: center; text-align: center; min-height: 55vh; }
.building .dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.building .dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); animation: dot 1s infinite ease-in-out; }
.building .dots span:nth-child(2) { animation-delay: 0.15s; }
.building .dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 1; transform: none; } }
.building p { font-size: 18px; margin: 0; }
.building small { color: var(--ink-3); display: block; margin-top: 6px; }

/* 結果 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
}
.chip::after { content: "✎"; font-size: 11px; color: var(--ink-3); }
.chip:hover { border-color: var(--line-2); color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px; }
.card h2 { font-size: 17px; margin: 0 0 4px; font-weight: 600; }
.card h3 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
.card .muted { color: var(--ink-2); font-size: 14px; margin: 0; }

.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.total-label { font-size: 13px; color: var(--ink-3); margin: 0 0 2px; }
.total-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 0; white-space: nowrap; }
@media (max-width: 480px) {
  .totals { grid-template-columns: 1fr; gap: 12px; }
  .totals > div + div { padding-top: 12px; border-top: 1px solid var(--line); }
}
.total-note { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }
.sample-tag { display: inline-block; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: #5b5544; background: #ece8dd; padding: 2px 8px; border-radius: 999px; margin-bottom: 12px; }

.timing { border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 16px; font-size: 14px; }
.timing.ok { background: var(--good-bg); color: var(--good); }
.timing.tight { background: var(--warn-bg); color: var(--warn); }
.timing strong { display: block; font-size: 15px; margin-bottom: 2px; }

.phases { list-style: none; margin: 14px 0 0; padding: 0; }
.phase { padding: 14px 0; border-top: 1px solid var(--line); }
.phase:first-child { border-top: 0; padding-top: 4px; }
.phase-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.phase-name { font-weight: 500; }
.phase-who { font-size: 12px; color: var(--ink-3); display: block; }
.phase-cost { font-weight: 600; white-space: nowrap; text-align: right; }
.phase-time { font-size: 13px; color: var(--ink-2); white-space: nowrap; text-align: right; display: block; font-weight: 400; }
.phase-note { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.phase.total-row { border-top: 1.5px solid var(--ink); }
.phase.total-row .phase-name, .phase.total-row .phase-cost { font-weight: 700; }

/* スケジュールの横棒 */
.gantt { margin-top: 6px; }
.g-row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; margin: 7px 0; font-size: 12px; color: var(--ink-2); }
.g-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 6px; }
.g-bar { position: absolute; top: 0; height: 100%; border-radius: 6px; background: var(--bar-other); }
.g-bar.corals { background: var(--bar-corals); }
.g-bar.search { background: var(--bar-search); }
.g-bar .range { position: absolute; top: 0; height: 100%; border-radius: 0 6px 6px 0; background: repeating-linear-gradient(45deg, transparent 0 3px, rgba(255,255,255,0.55) 3px 5px); }
.g-axis { display: grid; grid-template-columns: 112px 1fr; gap: 10px; font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.g-ticks { position: relative; height: 14px; }
.g-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.g-ticks span:first-child { transform: none; }
.g-ticks span.end { transform: translateX(-100%); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-3); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.compare-box { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }
.compare-box .k { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.compare-box .v { font-size: 15px; font-weight: 600; margin: 0; }
.compare-box .t { font-size: 13px; color: var(--ink-2); margin: 2px 0 0; }

.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.photo {
  aspect-ratio: 4 / 3; border-radius: var(--radius-sm); display: grid; place-items: center; text-align: center;
  background: repeating-linear-gradient(135deg, #ecece8 0 10px, #e5e5e0 10px 20px); color: var(--ink-3); font-size: 12px; padding: 8px;
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 9px 14px; font-size: 14px; }
.pill.selected { background: var(--ink); color: #fff; border-color: var(--ink); }

.inline-form { margin-top: 14px; }
.inline-form .row { display: grid; grid-template-columns: 1fr; gap: 0; }
.success { background: var(--good-bg); color: var(--good); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-top: 12px; }
.success small { display: block; color: var(--ink-2); margin-top: 4px; }

.disclaimer { font-size: 12px; color: var(--ink-3); margin: 18px 4px 0; }

.proto-panel { margin-top: 22px; border: 1px dashed #c9c2ad; border-radius: var(--radius-sm); background: #faf8f2; }
.proto-panel summary { cursor: pointer; padding: 12px 14px; font-size: 13px; color: #5b5544; }
.proto-panel pre { margin: 0; padding: 0 14px 14px; font-size: 11px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; color: #3d3a30; max-height: 420px; overflow: auto; }

.thanks { text-align: center; padding-top: 6vh; }
.thanks .check { width: 56px; height: 56px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; margin: 0 auto 18px; font-size: 26px; }

@media (min-width: 640px) {
  .main { padding-top: 44px; }
  .q-title { font-size: 30px; }
  .g-row, .g-axis { grid-template-columns: 150px 1fr; }
}
@media (max-width: 360px) {
  .months { grid-template-columns: repeat(3, 1fr); }
  .g-row, .g-axis { grid-template-columns: 92px 1fr; }
}
