/* =================================================================
   サンプル制作 電話ヒアリングシート（1画面で見渡せるレイアウト）
   ================================================================= */

:root {
  --paper: #F1F2EF;
  --surface: #FFFFFF;
  --ink: #1A1F3A;
  --ink-2: #444A66;
  --muted: #767B91;
  --line: #DCDFE5;
  --line-2: #C3C8D3;
  --tint: #E6E9F2;
  --lapis: #2D45D8;
  --lapis-soft: rgba(45, 69, 216, .14);
  --danger: #C2362B;

  --display: "Zen Old Mincho", "Shippori Mincho", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;

  --ease: cubic-bezier(.2, .7, .1, 1);
  --top-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  line-break: strict;
}
p { text-wrap: pretty; }
h1, h2, h3, .q-label { word-break: auto-phrase; text-wrap: balance; }
.sheet-note, .sec-lead, .q-help, .done-lead { word-break: auto-phrase; }
button, label, select, input[type="color"] { touch-action: manipulation; }
.q, .f-input { scroll-margin-top: calc(var(--top-h) + 20px); scroll-margin-bottom: 96px; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--lapis); outline-offset: 3px; border-radius: 6px; }

/* ---------- ヘッダー ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: var(--top-h); padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { margin: 0; min-width: 0; font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { flex: 1; margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; flex: none; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 700; font-size: 15px; letter-spacing: .06em;
  transition: transform .2s var(--ease), background .3s, border-color .3s;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: #2A3058; }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover { background: var(--surface); border-color: var(--ink); }
.btn--sm { min-height: 44px; padding: 0 22px; font-size: 15px; }
.top-actions .btn--primary { padding: 0 32px; background: var(--lapis); }
.top-actions .btn--primary:hover { background: #2338B8; }
.btn.is-busy { pointer-events: none; opacity: .6; }
.link { padding: 0; border: 0; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

/* ---------- 紙面：セクションを並べて一望できるように ---------- */
.sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 20px 24px;
  max-width: 1400px; margin-inline: auto;
  padding: 20px max(28px, env(safe-area-inset-right)) 48px max(28px, env(safe-area-inset-left));
}
/* セクションの id は questions.php の id と対応 */
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sheet-note { grid-column: 1 / -1; margin: 0; font-size: 15px; color: var(--ink-2); }
.sheet-note .req { margin: 0 2px; vertical-align: 1px; }
.submit-error { grid-column: 1 / -1; margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.sec { min-width: 0; padding: 20px 24px 10px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 55%, var(--paper)); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sec-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.5; }
.sec-lead { margin: 2px 0 0; font-size: 14px; line-height: 1.7; color: var(--muted); }

.omakase-all {
  flex: none; padding: 6px 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .25s, border-color .25s, color .25s;
}
.omakase-all:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.omakase-all[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- 質問 ---------- */
.q { padding: 16px 0 18px; border-top: 1px solid var(--line); }
.sec-head + .qs .q:first-child, .sec-lead + .qs .q:first-child { margin-top: 12px; }
.sec[data-id="basic"] .q:nth-child(2) { margin-top: 12px; }
.q-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.q-title { min-width: 0; }
.q-label { display: block; margin: 0; font-weight: 700; font-size: 17px; line-height: 1.6; }
.req {
  display: inline-block; margin-left: 8px; padding: 0 6px;
  border-radius: 4px; background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-size: 12px; font-weight: 700; line-height: 1.7; vertical-align: 2px; letter-spacing: .08em;
}
.q-help { margin: 2px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); }

/* おまかせボタン（チェックボックスのように使う） */
.omakase {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font-size: 14px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
  transition: background .25s, border-color .25s, color .25s;
}
.omakase:hover { border-color: var(--ink); color: var(--ink); }
.omakase-box { position: relative; width: 15px; height: 15px; border: 1.5px solid var(--line-2); border-radius: 3px; transition: border-color .25s, background .25s; }
.omakase:hover .omakase-box { border-color: var(--ink); }
.omakase[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.omakase[aria-pressed="true"] .omakase-box { background: var(--paper); border-color: var(--paper); }
.omakase[aria-pressed="true"] .omakase-box::after {
  content: ""; position: absolute; left: 4px; top: 0; width: 4px; height: 8px;
  border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.q.is-omakase .q-body { display: none; }
.q.is-omakase .q-help { display: none; }
.q.is-omakase .q-head { margin-bottom: 4px; }
.q-omakase { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 10px; background: var(--tint); }
.q-omakase-title { margin: 0; min-width: 0; font-weight: 700; font-size: 15px; line-height: 1.6; }
.q-omakase-note { margin-left: 8px; font-weight: 400; color: var(--ink-2); }
.q-omakase-undo { flex: none; padding: 0; border: 0; background: none; color: var(--ink); font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; }

/* 入力欄 */
.f-input {
  display: block; width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
  font-size: 17px; line-height: 1.6;
  transition: border-color .25s, box-shadow .25s;
}
.f-input::placeholder { color: #A7ABB9; }
.f-input:hover { border-color: var(--line-2); }
.f-input:focus { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 3px var(--lapis-soft); }
.f-textarea { min-height: 96px; height: 96px; resize: vertical; }
.f-input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(194, 54, 43, .12); }
.f-error { margin: 6px 0 0; color: var(--danger); font-size: 14.5px; font-weight: 500; }
select.f-input {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}

/* 基本情報：短い欄は2列に */
.sec[data-id="basic"] .qs, .sec[data-id="access"] .qs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
.sec[data-id="access"] .q[data-q="address"],
.sec[data-id="access"] .q[data-q="map_url"] { grid-column: 1 / -1; }
.sec[data-id="basic"] .q-help { display: none; }

/* チップ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input, .card input, .taste input, .swatch input[type="radio"] {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.chip span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 16px; cursor: pointer; user-select: none;
  transition: background .2s, color .2s, border-color .2s;
}
.chip span:hover { border-color: var(--line-2); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip input:focus-visible + span { outline: 2px solid var(--lapis); outline-offset: 3px; }
.opt-other { margin-top: 10px; }

/* カード選択：電話中はチップのように小さく並べる */
.cards { display: flex; flex-wrap: wrap; gap: 8px; }
.card {
  position: relative; display: inline-flex; align-items: center;
  min-height: 42px; padding: 0 18px 0 40px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  cursor: pointer; transition: border-color .2s;
}
.card:hover { border-color: var(--line-2); }
.card-mark { position: absolute; left: 14px; top: 50%; width: 17px; height: 17px; margin-top: -8.5px; border-radius: 50%; border: 1.5px solid var(--line-2); transition: border .2s var(--ease); }
.card-title { font-weight: 500; font-size: 16px; line-height: 1.5; }
.card-desc { display: none; }
.card:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.card input:checked ~ .card-mark { border: 5px solid var(--ink); }
.card:has(input:focus-visible) { outline: 2px solid var(--lapis); outline-offset: 3px; }

/* テイスト */
.tastes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.taste {
  position: relative; display: flex; flex-direction: column;
  padding: 8px 8px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  cursor: pointer; transition: border-color .2s;
}
.taste:hover { border-color: var(--line-2); }
.taste:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.taste:has(input:focus-visible) { outline: 2px solid var(--lapis); outline-offset: 3px; }
.taste-specimen { position: relative; display: block; aspect-ratio: 4 / 3; margin-bottom: 10px; border-radius: 8px; overflow: hidden; background: var(--t-bg); color: var(--t-ink); }
.taste-glyph { position: absolute; left: 12%; top: 12%; font-family: var(--t-font); font-weight: var(--t-weight, 600); font-size: clamp(32px, 3vw, 44px); line-height: 1; }
.taste-line { position: absolute; left: 12%; bottom: 30%; width: 56%; height: 4px; border-radius: 2px; background: currentColor; opacity: .55; }
.taste-line--s { bottom: 20%; width: 36%; opacity: .3; }
.taste-dot { position: absolute; right: 12%; bottom: 14%; width: 28%; aspect-ratio: 1; border-radius: var(--t-shape, 50%); background: var(--t-accent); }
.taste-name { padding: 0 4px; font-weight: 700; font-size: 16px; line-height: 1.5; }
.taste-desc { padding: 0 4px; font-size: 13px; line-height: 1.6; color: var(--muted); }

.taste--minimal  { --t-bg: #FFFFFF; --t-ink: #141414; --t-accent: #141414; --t-font: "Zen Kaku Gothic New"; --t-weight: 500; --t-shape: 0; }
.taste--minimal .taste-specimen { box-shadow: inset 0 0 0 1px #E6E6E6; }
.taste--luxury   { --t-bg: #12110E; --t-ink: #E9E1CD; --t-accent: #C5A467; --t-font: "Shippori Mincho"; --t-weight: 400; --t-shape: 0; }
.taste--natural  { --t-bg: #EFEBDF; --t-ink: #46442F; --t-accent: #8A9B6E; --t-font: "Zen Maru Gothic"; --t-weight: 700; --t-shape: 40% 60% 55% 45%; }
.taste--pop      { --t-bg: #FFE9A8; --t-ink: #2B2340; --t-accent: #FF5D73; --t-font: "Zen Maru Gothic"; --t-weight: 900; --t-shape: 50%; }
.taste--tech     { --t-bg: #0B1022; --t-ink: #DCE4FF; --t-accent: #4F7CFF; --t-font: "Zen Kaku Gothic New"; --t-weight: 700; --t-shape: 4px; }
.taste--tech .taste-specimen { background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 8px 8px; }
.taste--wamodern { --t-bg: #F1ECE0; --t-ink: #1E1D1A; --t-accent: #A3392C; --t-font: "Zen Old Mincho"; --t-weight: 700; --t-shape: 50%; }
.taste--elegant  { --t-bg: #F8F1EF; --t-ink: #5A4651; --t-accent: #C9A2AE; --t-font: "Shippori Mincho"; --t-weight: 400; --t-shape: 999px 999px 0 0; }
.taste--bold     { --t-bg: #FF4E1A; --t-ink: #FFFFFF; --t-accent: #111111; --t-font: "Dela Gothic One"; --t-weight: 400; --t-shape: 0; }

/* カラー */
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.swatch { position: relative; display: block; width: 40px; height: 40px; cursor: pointer; }
.swatch > span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: box-shadow .2s, transform .2s var(--ease); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); transform: scale(.9); }
.swatch input:focus-visible + span { outline: 2px solid var(--lapis); outline-offset: 5px; }
.swatch--custom > span { background: conic-gradient(from 0deg, #E35D5D, #E8C547, #5DB37A, #4C86D9, #9567D1, #E35D5D); }
.swatch--custom.has-color > span { background: var(--sw); }
.swatch-picker { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.swatch-value { margin-left: 4px; font-size: 14px; color: var(--muted); font-feature-settings: "tnum"; }

/* ドメイン候補（questions.php で使う場合） */
.domains { display: grid; gap: 8px; }
.domain-row { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); align-items: center; column-gap: 10px; }
.domain-rank { font-weight: 700; font-size: 13px; color: var(--ink-2); }
.domain-fields { display: flex; gap: 6px; min-width: 0; }
.domain-name { flex: 1 1 auto; min-width: 0; font-feature-settings: "tnum"; }
.domain-tld { flex: 0 0 auto; width: 10em; }
.domain-out { grid-column: 2; margin: 2px 0 0; font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; }
.domain-out span { display: block; }
.domain-out .domain-sub { font-size: 12px; color: var(--muted); }
.domain-out:empty { display: none; }
.domain-out.is-error { color: var(--danger); }

/* アップロード（questions.php で使う場合） */
.drop { position: relative; border: 1.5px dashed var(--line-2); border-radius: 12px; background: color-mix(in srgb, var(--surface) 60%, transparent); transition: border-color .2s, background .2s; }
.drop:hover, .drop.is-over { border-color: var(--ink); background: var(--surface); }
.drop.is-over { border-style: solid; }
.drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-input:focus-visible + .drop-face { outline: 2px solid var(--lapis); outline-offset: 4px; border-radius: 10px; }
.drop-face { display: grid; justify-items: center; padding: 14px 12px; text-align: center; pointer-events: none; }
.drop-ico { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.drop-main { margin: 0; font-weight: 500; font-size: 13.5px; }
.drop-main span { text-decoration: underline; text-underline-offset: 3px; }
.drop-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.thumbs:empty { display: none; }
.thumb { position: relative; }
.thumb-media { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.thumb-media img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ext { font-weight: 700; font-size: 14px; color: var(--ink-2); }
.thumb-name { display: block; margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-main { position: absolute; left: 4px; top: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(26, 31, 58, .82); color: #fff; font-size: 10px; }
.thumb-del { position: absolute; right: 4px; top: 4px; padding: 1px 7px; border: 0; border-radius: 999px; background: rgba(26, 31, 58, .82); color: #fff; font-size: 10.5px; line-height: 1.6; }
.thumb-del:hover { background: var(--danger); }

/* ---------- スマホ用の送信ボタン ---------- */
.mobile-send { display: none; }

/* ---------- 送信中・送信完了 ---------- */
.sending, .done { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(241, 242, 239, .9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sending-card { width: min(360px, 100%); text-align: center; }
.sending-bar { height: 2px; background: var(--line); overflow: hidden; }
.sending-bar span { display: block; height: 100%; width: 0; background: var(--ink); transition: width .3s linear; }
.sending-text { margin: 18px 0 0; font-weight: 700; }
.sending-pct { margin: 0; font-family: var(--display); color: var(--muted); font-feature-settings: "tnum"; }

.done-card { width: min(460px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 20px 60px rgba(26, 31, 58, .12); animation: pop .4s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.done-title { margin: 0 0 8px; outline: none; font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1.5; }
.done-lead { margin: 0; font-size: 14px; color: var(--ink-2); }
.done-receipt { display: flex; align-items: baseline; gap: 16px; margin: 20px 0 24px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.done-receipt dt { font-size: 12.5px; color: var(--muted); }
.done-receipt dd { margin: 0; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: .06em; font-feature-settings: "tnum"; }
.done-card .btn { width: 100%; }

/* =================================================================
   レスポンシブ
   ================================================================= */
@media (max-width: 1080px) {
  .sheet {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
  }
}

@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .brand { font-size: 13px; letter-spacing: .04em; }
  .save-state { display: none; }
  .top-actions [data-send] { display: none; }
  .sheet { padding: 14px max(12px, env(safe-area-inset-right)) 110px max(12px, env(safe-area-inset-left)); }
  .sec { padding: 16px 16px 6px; }
  .sec-title { font-size: 20px; }
  .tastes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sec[data-id="basic"] .qs, .sec[data-id="access"] .qs { grid-template-columns: minmax(0, 1fr); }
  .mobile-send {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: linear-gradient(to top, var(--paper) 70%, transparent);
  }
  .mobile-send .btn { width: 100%; background: var(--lapis); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
