/* エムズクラフト AI相談窓口 */
:root {
  --brand: #1ab39b;          /* ブランドカラー（面・線に使う） */
  --brand-ink: #0d7e6c;      /* 白地の文字に使う濃いめの緑（読みやすさ確保） */
  --brand-tint: #e8f6f3;
  --ink: #1a2a3a;
  --text: #33404d;
  --text-soft: #6b6b6b;
  --line: #e5e5e5;
  --bg: #fafaf8;
  --paper: #ffffff;
  --danger: #b4372f;
  --font-jp: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --font-serif: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  --font-en: "Cormorant Garamond", Georgia, serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: .02em;
}
a { color: var(--brand-ink); }
[hidden] { display: none !important; }

/* ヘッダー・フッター */
.site-head {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 760px; margin: 0 auto; padding: 18px 16px;
}
.site-head__brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); line-height: 1.2; }
.site-head__logo { display: block; height: 34px; width: auto; }
@media (max-width: 560px) { .site-head__logo { height: 28px; } }
.site-head__en { font-family: var(--font-en); font-size: 13px; letter-spacing: .12em; color: var(--text-soft); }
.site-head__jp { font-family: var(--font-serif); font-size: 18px; font-weight: 700; }
.site-head__label {
  font-size: 12px; font-weight: 500; color: var(--brand-ink);
  border: 1px solid var(--brand); border-radius: 999px; padding: 3px 12px;
}
.site-foot { text-align: center; font-size: 12px; color: var(--text-soft); padding: 32px 16px 40px; }

.view { display: block; max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* 共通パーツ */
.eyebrow, .section-title span {
  font-family: var(--font-en); font-size: 14px; letter-spacing: .2em; color: var(--brand-ink); margin: 0;
}
.section-title {
  display: flex; flex-direction: column; gap: 2px;
  border-left: 3px solid var(--brand); padding-left: 14px;
  font-family: var(--font-serif); font-size: 22px; color: var(--ink); margin: 0 0 20px; line-height: 1.5;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  font: 500 15px/1 var(--font-jp); letter-spacing: .06em;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .15s, opacity .15s;
}
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #0e1823; }
.btn--ghost { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { background: var(--brand-tint); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.form-error { color: var(--danger); font-size: 14px; margin: 12px 0 0; min-height: 1em; }

.check, .radio { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 16px 0; }
.check input, .radio input { width: 20px; height: 20px; accent-color: var(--brand-ink); margin: 0; flex: none; }

/* ① 入口 */
.hero { padding: 40px 0 32px; }
.hero__title {
  font-family: var(--font-serif); font-weight: 700; color: var(--ink);
  font-size: clamp(34px, 9vw, 52px); line-height: 1.35; margin: 8px 0 20px; letter-spacing: .06em;
}
.hero__lede { margin: 0 0 24px; }
.hero__facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.hero__facts li {
  font-size: 13px; font-weight: 500; background: var(--brand-tint); color: var(--brand-ink);
  padding: 4px 12px; border-radius: 4px;
}

.roles { margin: 8px 0 48px; }
.roles__row { display: grid; grid-template-columns: 1fr 32px 1fr; align-items: stretch; }
.roles__card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.roles__card--human { border-color: var(--ink); }
.roles__tag { font-size: 12px; color: var(--text-soft); margin: 0; }
.roles__head { font-family: var(--font-serif); font-size: 24px; font-weight: 700; color: var(--ink); margin: 2px 0 8px; }
.roles__card--ai .roles__head { color: var(--brand-ink); }
.roles__body { font-size: 14px; margin: 0; line-height: 1.7; }
.roles__arrow { position: relative; }
.roles__arrow::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 10px; height: 10px;
  border-top: 2px solid var(--ink); border-right: 2px solid var(--ink);
  transform: translate(-70%, -50%) rotate(45deg);
}

.rooms { margin-bottom: 48px; }
.rooms__list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rooms__list li {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; line-height: 1.6;
}
.rooms__list b { color: var(--ink); font-size: 15px; }
.rooms__list span { font-size: 13px; color: var(--text-soft); }
.rooms__note { font-size: 13px; color: var(--text-soft); margin: 14px 0 0; }

.consent { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px; margin-bottom: 24px; }
.consent__list { padding-left: 1.2em; margin: 0 0 12px; font-size: 14px; }
.consent__list li { margin-bottom: 6px; }
.consent__link { font-size: 14px; margin: 0; }

/* ② チャット */
#view-chat { display: flex; flex-direction: column; min-height: calc(100dvh - 80px); }
#view-chat[hidden] { display: none !important; }
.chat-rooms {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 12px; scrollbar-width: none;
}
.chat-rooms::-webkit-scrollbar { display: none; }
.chat-rooms span {
  flex: none; font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-soft); background: var(--paper);
  transition: all .2s;
}
.chat-rooms span.is-on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }

.chat-log { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.75; }
.msg--ai { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg--user { align-self: flex-end; background: var(--ink); color: #fff; border-top-right-radius: 4px; }
.msg__room { display: block; font-size: 12px; font-weight: 700; color: var(--brand-ink); margin-bottom: 2px; }
.msg--system { align-self: center; font-size: 13px; color: var(--text-soft); background: none; padding: 4px; text-align: center; }
.msg--error { align-self: center; font-size: 14px; color: var(--danger); background: #fdf1f0; }
.msg--typing { color: var(--text-soft); }
.msg--typing i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite both; }
.msg--typing i:nth-child(2) { animation-delay: .2s; }
.msg--typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

.chat-karte-cta { margin-bottom: 12px; }

.chat-input {
  position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end;
  border-top: 1px solid var(--line);
}
.chat-input textarea {
  width: 100%; resize: none; font: 16px/1.6 var(--font-jp); color: var(--ink);
  border: 1px solid #cfcfcf; border-radius: 12px; padding: 10px 12px; background: var(--paper);
  max-height: 40vh;
}
.chat-input__send { min-height: 46px; padding: 0 18px; }
.chat-input__meta { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--text-soft); }
.chat-input__meta.is-over { color: var(--danger); }

/* ③ カルテ */
.karte {
  background: var(--paper); border: 1px solid var(--line); border-top: 6px solid var(--brand);
  border-radius: var(--radius); padding: 28px 22px; margin: 16px 0 16px;
}
.karte__head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 8px; }
.karte__en { font-family: var(--font-en); letter-spacing: .2em; font-size: 13px; color: var(--brand-ink); margin: 0; }
.karte__title { font-family: var(--font-serif); font-size: 26px; color: var(--ink); margin: 0; }
.karte__date { font-size: 13px; color: var(--text-soft); margin: 4px 0 0; }
.karte__sec { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.karte__sec:last-child { border-bottom: 0; }
.karte__sec h2 { font-size: 15px; color: var(--ink); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.karte__sec h2::before { content: ""; width: 8px; height: 8px; background: var(--brand); border-radius: 2px; flex: none; }
.karte__sec p { margin: 0; white-space: pre-wrap; font-size: 15px; }
.karte__sec--handover { background: var(--brand-tint); border-radius: 10px; padding: 14px 16px; border-bottom: 0; margin-top: 8px; }
.karte__foot { margin-top: 16px; font-size: 12px; color: var(--text-soft); text-align: right; }
.karte-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 40px; }
.karte-actions .btn { flex: 1 1 140px; padding: 0 12px; white-space: nowrap; }
body.is-chat .site-foot { display: none; }

/* ④ 申込 */
.apply { background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius); padding: 24px 20px; margin-bottom: 24px; }
.apply__lede { margin: 0 0 16px; }
.apply__type { border: 0; padding: 0; margin: 0 0 8px; }
.apply__type legend { font-weight: 700; color: var(--ink); font-size: 14px; }
.apply__type .radio { margin: 8px 0; }
.field { display: block; margin: 14px 0; }
.field__label { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.field__label em { font-style: normal; font-size: 11px; color: #fff; background: var(--danger); border-radius: 3px; padding: 1px 6px; margin-left: 8px; vertical-align: 2px; }
.field input {
  width: 100%; font: 16px var(--font-jp); padding: 12px; border: 1px solid #cfcfcf; border-radius: 10px; background: var(--paper); color: var(--ink);
}
.apply__privacy { font-size: 13px; color: var(--text-soft); margin: 18px 0 0; }

/* ⑤ 完了 */
.done { text-align: center; padding: 64px 0; }
.done__title { font-family: var(--font-serif); color: var(--ink); font-size: 26px; margin: 8px 0 16px; }
.done p { margin: 0 0 28px; }

@media (max-width: 560px) {
  .roles__row { grid-template-columns: 1fr; }
  .roles__arrow { height: 28px; }
  .roles__arrow::after { transform: translate(-50%, -70%) rotate(135deg); }
  .rooms__list { grid-template-columns: 1fr; }
  .msg { max-width: 94%; }
}

/* 印刷：カルテだけを出す */
@media print {
  body { background: #fff; }
  .site-head, .site-foot, .karte-actions, .apply, #view-intro, #view-chat, #view-done { display: none !important; }
  #view-karte { display: block !important; max-width: none; padding: 0; }
  .karte { border: 0; border-top: 6px solid var(--brand); margin: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 入口の短縮（2026-10-10）：開始ボタンをヒーロー直下へ */
.hero { padding: 24px 0 20px; }
.hero__title { margin: 4px 0 14px; font-size: clamp(30px, 8vw, 46px); }
.hero__lede { margin: 0 0 16px; }
.start { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 48px; }
.start__points { margin: 0 0 8px; padding-left: 1.2em; font-size: 14px; line-height: 1.7; }
.start__points li { margin-bottom: 4px; }
.start__more { font-size: 13px; color: var(--text-soft); margin: 4px 0 0; }
.start__more summary { cursor: pointer; color: var(--brand-ink); width: fit-content; }
.start__more .consent__list { margin-top: 8px; font-size: 13px; }
.start .check { margin: 14px 0 12px; font-size: 14px; }
.about { margin-bottom: 24px; }
.about .roles { margin: 0 0 32px; }
.about .rooms { margin: 0; }
.about__sub { font-family: var(--font-serif); font-size: 18px; color: var(--ink); margin: 0 0 14px; }

/* ===== 入口リニューアル（2026-10-10c）：開いたら会話が始まっている ===== */
.open { padding: 8px 0 28px; }
.open__badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  font-size: 12px; font-weight: 500; color: var(--brand-ink);
  background: var(--brand-tint); border-radius: 999px; padding: 5px 12px 5px 10px;
}
.open__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); position: relative; }
.open__dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--brand);
  opacity: 0; animation: mzc-ping 1.8s ease-out infinite;
}
@keyframes mzc-ping { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.4); opacity: 0; } }

.open__talk { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.open__avatar { flex: none; width: 44px; height: 44px; }
.open__avatar svg { width: 100%; height: 100%; display: block; }
.open__bubbles { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.open__name { margin: 0; font-size: 12px; color: var(--text-soft); }
.bubble {
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px;
  padding: 12px 16px; font-size: 16px; line-height: 1.7; color: var(--ink); width: fit-content; max-width: 100%;
  box-shadow: 0 2px 10px rgba(26, 42, 58, .05);
  opacity: 0; transform: translateY(8px); animation: mzc-pop .45s ease-out forwards;
}
.bubble--1 { animation-delay: .25s; }
.bubble--2 { animation-delay: 1.1s; font-weight: 700; }
@keyframes mzc-pop { to { opacity: 1; transform: none; } }

.topics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px;
  opacity: 0; animation: mzc-pop .5s ease-out 1.7s forwards;
}
.topic {
  display: flex; align-items: center; gap: 8px; text-align: left;
  min-height: 56px; padding: 10px 12px; border-radius: 14px;
  background: var(--paper); border: 1.5px solid var(--line); color: var(--ink);
  font: 500 14px/1.4 var(--font-jp); cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.topic:hover { border-color: var(--brand); background: var(--brand-tint); }
.topic:active { transform: scale(.97); }
.topic:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.topic__ico { font-size: 20px; line-height: 1; flex: none; }

.open__free {
  display: flex; gap: 8px; margin: 0 0 14px;
  opacity: 0; animation: mzc-pop .5s ease-out 1.9s forwards;
}
.open__free input {
  flex: 1; min-width: 0; font: 16px var(--font-jp); color: var(--ink);
  padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper);
}
.open__free input:focus { outline: none; border-color: var(--brand); }
.open__send {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; display: grid; place-items: center;
}
.open__send svg { width: 22px; height: 22px; }

.open__consent {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  font-size: 13px; color: var(--text-soft); line-height: 1.6;
  padding: 10px 12px; border-radius: 10px; border: 1px dashed transparent;
}
.open__consent input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--brand-ink); }
.open__consent.is-need { border-color: var(--danger); background: #fdf1f0; color: var(--ink); }
.open__consent.is-shake { animation: mzc-shake .4s; }
@keyframes mzc-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.open .form-error { margin: 4px 0 0; }

body.is-starting .topics, body.is-starting .open__free { opacity: .4 !important; pointer-events: none; }

.crew { border-top: 1px solid var(--line); padding: 22px 0 8px; text-align: center; }
.crew__lead { margin: 0 0 14px; font-size: 13px; color: var(--text-soft); }
.crew__list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.crew__list li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--ink); }
.crew__ico {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: var(--paper); border: 1px solid var(--line);
}
.crew__flow { margin: 0; font-size: 12px; color: var(--text-soft); display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; }
.crew__flow b { font-weight: 500; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

.about-privacy { margin: 20px 0 8px; font-size: 13px; color: var(--text-soft); }
.about-privacy summary { cursor: pointer; color: var(--brand-ink); }
.about-privacy .consent__list { margin-top: 10px; }

@media (min-width: 720px) {
  .topics { grid-template-columns: repeat(3, 1fr); }
  .bubble { font-size: 17px; }
}
@media (max-width: 480px) {
  .crew__list { grid-template-columns: repeat(3, 1fr); row-gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble, .topics, .open__free { animation: none; opacity: 1; transform: none; }
  .open__dot::after { animation: none; }
}

.open__consent { margin: 0 0 12px; background: var(--paper); border: 1px solid var(--line); }
.open__consent.is-need { border-style: dashed; }
.topic { font-size: 14px; letter-spacing: 0; padding: 10px; gap: 6px; }
