/* お直しのご相談｜田谷漆器店
   Figma「お直しサイト」改善版（モノクロ・ゴシック）SP 375 に準拠 */

:root {
  --ink: #111111;    /* 文字・ボタン */
  --gray: #616161;   /* 本文 */
  --light: #9a9a9a;  /* 補足・プレースホルダー */
  --line: #dbdbdb;   /* 線・枠 */
  --soft: #e9e9e9;   /* 写真枠・アイコン地 */
  --bg: #f4f4f4;     /* 画面の背景 */
  --white: #ffffff;  /* カード */
  --error: #b52929;  /* 入力エラーのみ */
  --photo: #c4c4c4;
  --maxw: 480px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  word-break: break-word;
}
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
p { margin: 0; }
h1, h2 { margin: 0; font-size: inherit; }
img { display: block; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- 全体の枠 ---------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.inner { width: 100%; max-width: var(--maxw); margin: 0 auto; }

/* ---------- 上部：トップバー＋進捗 ---------- */
.head {
  position: sticky; top: 0; z-index: 20;
  background: var(--white);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
}
.tb-side { width: 40px; height: 26px; display: flex; align-items: center; }
.tb-back { font-size: 22px; line-height: 26px; color: var(--ink); width: 40px; height: 26px; text-align: left; }
.tb-quit { font-size: 12px; color: var(--light); width: 40px; height: 18px; text-align: right; margin-left: auto; }
.tb-back[hidden], .tb-quit[hidden] { display: none; }
.logo { position: relative; width: 71.3px; height: 22px; overflow: hidden; flex-shrink: 0; }
.logo img {
  position: absolute;
  top: 16.53%; right: 8.21%; bottom: 18.07%; left: 9.68%;
  width: auto; height: auto;
  transform: scaleY(-1); /* Figmaの書き出しは上下反転で保存されているため */
}
.head-divider { height: 1px; background: var(--line); }
.progress { padding: 4px 20px 14px; display: flex; flex-direction: column; gap: 8px; }
.progress[hidden], .head-divider[hidden] { display: none; }
.segments { display: flex; gap: 4px; }
.segments span { flex: 1 0 0; height: 3px; border-radius: 2px; background: var(--soft); transition: background .2s; }
.segments span.on { background: var(--ink); }
.plabel { display: flex; justify-content: space-between; font-size: 11px; line-height: normal; white-space: nowrap; }
.plabel b { font-weight: 700; letter-spacing: .06em; }
.plabel span { color: var(--light); }

/* ---------- 本文 ---------- */
main { flex: 1 0 auto; }
.screen { display: none; padding: 24px 20px 28px; flex-direction: column; gap: 18px; }
.screen.is-active { display: flex; }
.screen:focus { outline: none; }

.h1 { font-size: 22px; font-weight: 700; line-height: 1.45; }
.lead { font-size: 13px; line-height: 1.7; color: var(--gray); margin-top: 6px; }
.hint { font-size: 12px; color: var(--light); text-align: center; }
.caption { font-size: 11.5px; color: var(--light); }
.card { background: var(--white); border-radius: 14px; padding: 18px; }
.card-title { font-size: 13px; font-weight: 700; }

/* 0 はじめに */
.hero { padding: 20px 0 4px; display: flex; flex-direction: column; gap: 14px; }
.hero-kicker { font-size: 12px; font-weight: 500; color: var(--light); letter-spacing: .06em; }
.hero-title { font-size: 24px; font-weight: 700; line-height: 1.45; }
.hero-text { font-size: 13.5px; line-height: 1.8; color: var(--gray); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  padding: 6px 12px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: normal;
}
.flow { display: flex; flex-direction: column; gap: 16px; }
.flow-item { display: flex; align-items: center; gap: 14px; }
.flow-no {
  background: var(--ink); color: var(--white); border-radius: 14px;
  padding: 5px 10px; font-size: 12px; font-weight: 700; line-height: normal; flex-shrink: 0;
}
.flow-t { display: flex; flex-direction: column; gap: 2px; line-height: normal; }
.flow-t b { font-size: 14.5px; font-weight: 700; }
.flow-t span { font-size: 12px; color: var(--light); }

/* 1 器の種類（選択カード） */
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; line-height: normal; transition: border-color .15s, box-shadow .15s;
}
.option .t { flex: 1 0 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.option .t b { font-size: 15.5px; font-weight: 700; }
.option .t span { font-size: 12px; color: var(--light); }
.option .chev { font-size: 22px; color: var(--light); flex-shrink: 0; }
.option.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.option.is-selected .chev { color: var(--ink); }

/* 2 かたち（タイル）・点数 */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 6px 14px; color: var(--ink); transition: background .15s, color .15s;
}
.tile svg { width: 40px; height: 40px; flex-shrink: 0; }
.tile span { font-size: 12.5px; font-weight: 500; line-height: 1.4; text-align: center; }
.tile.is-selected { background: var(--ink); border-color: var(--ink); color: var(--white); }
.qty { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.qty .t { display: flex; flex-direction: column; gap: 2px; line-height: normal; white-space: nowrap; }
.qty .t b { font-size: 14.5px; font-weight: 700; }
.qty .t span { font-size: 11.5px; color: var(--light); }
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button {
  min-width: 35px; height: 31px; padding: 0 12px; border-radius: 18px;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.stepper .minus { background: var(--white); border: 1px solid var(--line); color: var(--ink); }
.stepper .plus { background: var(--ink); color: var(--white); min-width: 40px; }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { font-size: 18px; font-weight: 700; min-width: 11px; text-align: center; }

/* 3 気になるところ（チップ） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 6px; white-space: nowrap; line-height: normal;
  background: var(--white); border: 1px solid var(--line); border-radius: 22px;
  padding: 11px 16px; font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.chip .ck { display: none; font-size: 12px; font-weight: 700; }
.chip.is-selected { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chip.is-selected .ck { display: inline; }
.count { font-size: 12px; font-weight: 500; }
.count.is-empty { color: var(--light); font-weight: 400; }
.note-card { display: flex; flex-direction: column; gap: 8px; }
.textarea {
  width: 100%; height: 76px; resize: none; border: 0; border-radius: 10px;
  background: var(--bg); padding: 12px 14px; font-size: 13.5px; line-height: 1.6; color: var(--ink);
}
.textarea::placeholder, .input::placeholder { color: var(--light); }
.textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink); background: var(--white); }

/* 4 写真 */
.tips {
  display: flex; align-items: center; gap: 10px; background: var(--white);
  border-radius: 12px; padding: 12px 14px; color: var(--gray);
}
.tips .i { font-size: 14px; }
.tips p { flex: 1 0 0; font-size: 12px; line-height: 1.65; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--soft); color: var(--light); font-size: 12px;
}
.slot.add { background: var(--white); border: 1px dashed var(--ink); color: var(--ink); gap: 4px; }
.slot.add .plus { font-size: 22px; line-height: normal; }
.slot.add .lbl { font-size: 11px; font-weight: 500; }
.slot.filled { background: var(--photo); justify-content: flex-end; padding: 0 6px 6px; }
.slot.filled img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.filled .raw { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--gray); }
.slot .no {
  position: absolute; top: 6px; left: 6px; background: var(--ink); color: var(--white);
  border-radius: 10px; padding: 2px 7px; font-size: 10px; font-weight: 700; line-height: normal;
}
.slot .ctag {
  position: relative; background: var(--white); color: var(--ink); border-radius: 10px;
  padding: 3px 8px; font-size: 10.5px; font-weight: 500; line-height: normal; white-space: nowrap;
}
.slot.loading::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6); border-top-color: var(--ink); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pcount { font-size: 12px; color: var(--gray); }
.pformat { font-size: 11px; color: var(--light); }
.msg-error { font-size: 12px; color: var(--error); line-height: 1.6; }
.msg-error:empty { display: none; }

/* 5 ご連絡先 */
.fields { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 500; line-height: normal; }
.field .row { display: flex; gap: 8px; }
.input {
  flex: 1 0 0; min-width: 0; width: 100%; border: 0; border-radius: 10px; background: var(--bg);
  padding: 14px; font-size: 14.5px; line-height: normal; color: var(--ink); -webkit-appearance: none; appearance: none;
}
/* iPhoneは16px未満の入力欄をタップすると画面が拡大されるため、iPhone/iPadだけ16pxにする */
@supports (-webkit-touch-callout: none) { .input, .textarea { font-size: 16px; } }
.input:focus { outline: none; background: var(--white); box-shadow: inset 0 0 0 1.5px var(--ink); }
.field.has-error .input { background: var(--white); box-shadow: inset 0 0 0 1.5px var(--error); }
.field .help { font-size: 11.5px; color: var(--light); line-height: normal; }
.field .err { font-size: 12px; color: var(--error); line-height: normal; display: none; }
.field.has-error .err { display: block; }
.btn-zip {
  flex-shrink: 0; border: 1px solid var(--ink); border-radius: 10px; padding: 14px 15px;
  font-size: 12.5px; font-weight: 500; line-height: normal; white-space: nowrap; background: var(--white);
}
.btn-zip:disabled { opacity: .5; }

/* 6 確認 */
.sum { padding: 4px 18px; display: flex; flex-direction: column; gap: 12px; }
.sum-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; line-height: normal; }
.sum-h b { font-size: 13px; font-weight: 700; }
.sum-h button, .ph-h button { font-size: 12.5px; font-weight: 500; }
.sum-row { display: flex; gap: 12px; padding: 8px 0; line-height: normal; }
.sum-row:last-child { padding-bottom: 14px; }
.sum-row dt { width: 92px; flex-shrink: 0; font-size: 12.5px; color: var(--light); }
.sum-row dd { margin: 0; flex: 1 0 0; min-width: 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.ph-card { display: flex; flex-direction: column; gap: 10px; }
.ph-h { display: flex; justify-content: space-between; line-height: normal; }
.ph-h b { font-size: 13px; font-weight: 700; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs .th { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--photo); position: relative; }
.thumbs .th img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .th .raw { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--gray); }
.th-comments { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--gray); line-height: 1.5; }
.th-comments:empty { display: none; }
.consent { display: flex; align-items: center; gap: 10px; padding-top: 4px; font-size: 13px; line-height: normal; }
.consent input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.consent .box {
  width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--white);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: transparent; font-size: 11px; font-weight: 700; line-height: 1;
}
.consent input:checked + .box { background: var(--ink); color: var(--white); }
.consent input:focus-visible + .box { outline: 2px solid var(--ink); outline-offset: 2px; }
.consent .lnk { text-decoration: underline; text-underline-offset: 2px; }

/* 7 完了 */
.done-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 8px; text-align: center; }
.done-check {
  background: var(--ink); color: var(--white); border-radius: 30px; padding: 14px 18px;
  font-size: 24px; font-weight: 700; line-height: normal;
}
.done-hero h1 { font-size: 21px; font-weight: 700; line-height: normal; }
.done-hero p { font-size: 13.5px; color: var(--gray); }
.receipt {
  display: flex; align-items: center; justify-content: space-between; background: var(--white);
  border-radius: 12px; padding: 14px 18px; line-height: normal; white-space: nowrap;
}
.receipt span { font-size: 12.5px; color: var(--light); }
.receipt b { font-size: 15px; font-weight: 700; letter-spacing: .04em; }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl { display: flex; gap: 12px; align-items: flex-start; padding-top: 14px; }
.tl img { width: 12px; height: 50px; flex-shrink: 0; }
.tl.last img { height: 12px; }
.tl .t { flex: 1 0 0; display: flex; flex-direction: column; gap: 2px; line-height: normal; }
.tl .h { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tl .h b { font-size: 14px; font-weight: 700; }
.tl .h span { font-size: 11.5px; font-weight: 500; color: var(--gray); }
.tl .d { font-size: 12px; }
.tl .d.mute { color: var(--light); }
.done-note { font-size: 11.5px; line-height: 1.7; color: var(--light); text-align: center; }
.done-contact { font-size: 12px; color: var(--gray); text-align: center; }
.done-contact a { color: inherit; }

/* ---------- 下部ボタン ---------- */
.bottom {
  position: sticky; bottom: 0; z-index: 20;
  background: var(--white); border-top: 1px solid var(--line);
}
.bottom[hidden] { display: none; }
.bottom .inner {
  padding: 12px 20px 28px;
  padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 12px));
  display: flex; flex-direction: column; gap: 10px;
}
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  border-radius: 28px; padding: 17px 20px; background: var(--ink); color: var(--white);
  font-size: 15px; font-weight: 700; letter-spacing: .04em; line-height: normal; text-decoration: none;
  transition: background .15s;
}
.btn:disabled { background: var(--line); cursor: default; }
.btn.secondary { background: var(--white); color: var(--ink); border: 1px solid var(--ink); }
.btn .spin {
  width: 16px; height: 16px; margin-right: 8px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: var(--white); animation: spin .8s linear infinite;
}
.bottom-note { font-size: 11.5px; color: var(--light); text-align: center; line-height: normal; }
.bottom-note:empty { display: none; }
.bottom-error { font-size: 12px; color: var(--error); text-align: center; line-height: 1.6; }
.bottom-error:empty { display: none; }

/* ---------- シート ---------- */
.dim {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .4);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.dim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  background: var(--white); border-radius: 20px 20px 0 0;
  padding: 10px 20px 32px; padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 16px));
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  transform: translateY(105%); transition: transform .25s ease; visibility: hidden;
  max-height: 92vh; max-height: 92dvh; overflow-y: auto;
}
.sheet.is-open { transform: translateY(0); visibility: visible; }
.sheet .grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); flex-shrink: 0; }
.sheet-title { font-size: 15px; font-weight: 700; text-align: center; width: 100%; line-height: normal; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; width: 100%; line-height: normal; }
.sheet-head b { font-size: 15px; font-weight: 700; }
.sheet-head .del { font-size: 13px; color: var(--error); }
.action {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--bg); border-radius: 12px; padding: 16px 18px; line-height: normal; white-space: nowrap;
}
.action .i { font-size: 16px; color: var(--gray); }
.action b { font-size: 15px; font-weight: 500; }
.cancel { padding-top: 14px; font-size: 14px; color: var(--gray); }
.preview { width: 100%; height: 200px; border-radius: 12px; background: var(--photo); overflow: hidden; flex-shrink: 0; position: relative; }
.preview img { width: 100%; height: 100%; object-fit: contain; background: var(--bg); }
.preview .raw { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--gray); }
.comment {
  width: 100%; height: 84px; resize: none; border: 1.5px solid var(--ink); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; line-height: 1.6; background: var(--white);
}
.comment:focus { outline: none; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.examples button {
  border: 1px solid var(--line); border-radius: 14px; padding: 6px 12px;
  font-size: 12px; color: var(--gray); line-height: normal; white-space: nowrap;
}
.sheet .btn { flex-shrink: 0; }
.sheet .txt { width: 100%; font-size: 13px; line-height: 1.8; color: var(--gray); }
.sheet .txt h3 { font-size: 13px; color: var(--ink); margin: 14px 0 4px; }
.sheet .txt h3:first-child { margin-top: 0; }
.sheet .txt ul { margin: 0; padding-left: 1.2em; }
.sheet .btns { display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* ---------- 広い画面 ---------- */
@media (min-width: 600px) {
  .screen { padding-left: 20px; padding-right: 20px; }
}
