/* クリスマスケーキ予約 LIFF
 * スマホ幅前提。タップ領域44px以上、入力欄は16px以上（iOSの自動ズーム防止）。
 * 色を変えるときは :root の変数だけ触ればよい。
 */
:root {
  --green: #1f4d3a;
  --green-light: #e8f1ec;
  --red: #b3262e;
  --red-light: #fbeaea;
  --gold: #c9a227;
  --bg: #fbf7f0;
  --card: #ffffff;
  --text: #2a2a2a;
  --muted: #6b6b6b;
  --border: #e3ddd2;
  --radius: 12px;
  --tap: 48px;
  --footer-h: 132px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; }

.page { padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom)); }

/* ---- ヘッダー ---- */
.app-header {
  background: var(--green);
  color: #fff;
  padding: 14px 16px 12px;
  background-image:
    radial-gradient(circle at 12% 30%, rgba(255,255,255,.25) 1.5px, transparent 2px),
    radial-gradient(circle at 78% 20%, rgba(255,255,255,.2) 1.5px, transparent 2px),
    radial-gradient(circle at 55% 75%, rgba(255,255,255,.18) 1px, transparent 1.5px),
    radial-gradient(circle at 90% 70%, rgba(255,255,255,.22) 1.5px, transparent 2px);
}
.shop-name { font-size: 13px; opacity: .85; letter-spacing: .05em; }
.app-title { margin: 2px 0 0; font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.app-title::after { content: " 🎄"; }

/* ---- ステップ ---- */
.steps {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 12px 8px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); position: relative; }
.step + .step::before {
  content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0;
}
.step.is-done + .step::before, .step.is-done + .step.is-current::before { background: var(--green); }
.step-num {
  position: relative; z-index: 1;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; border: 2px solid var(--border);
  font-weight: 700; font-size: 13px;
}
.step.is-current { color: var(--green); font-weight: 700; }
.step.is-current .step-num { background: var(--green); border-color: var(--green); color: #fff; }
.step.is-done .step-num { background: var(--green-light); border-color: var(--green); color: var(--green); }

/* ---- コンテンツ ---- */
.content { padding: 16px; }
.section-title { font-size: 18px; margin: 4px 0 14px; }
.sub-title { font-size: 16px; margin: 20px 0 10px; color: var(--green); }
.sub-title:first-child { margin-top: 0; }
.hint { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.center { text-align: center; }
.empty { padding: 24px 0; text-align: center; color: var(--muted); }

.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.notice-error { background: var(--red-light); color: var(--red); border: 1px solid #f0c4c6; }
.notice-info { background: var(--green-light); color: var(--green); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* ---- 商品 ---- */
.cards { display: flex; flex-direction: column; gap: 12px; }
.product { display: flex; align-items: center; gap: 12px; padding: 14px; transition: border-color .15s, box-shadow .15s; }
.product.is-selected { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.product.is-soldout { opacity: .6; background: #f4f2ee; }
.product { align-items: flex-start; }
.product-img { width: 88px; height: 88px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.product-body { flex: 1; min-width: 0; }
.product-name { font-weight: 700; font-size: 16px; }
.product-meta { font-size: 15px; color: var(--text); }
.stock { font-size: 14px; color: var(--muted); }
.stock.is-low { color: var(--red); font-weight: 700; }
.badge-soldout {
  flex-shrink: 0; padding: 6px 12px; border-radius: 999px;
  background: #8a8a8a; color: #fff; font-size: 14px; font-weight: 700;
}
.qty-stepper { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.qty-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 1.5px solid var(--green); background: #fff; color: var(--green);
  font-size: 22px; font-weight: 700; line-height: 1;
}
.qty-btn:disabled { border-color: var(--border); color: #c4c4c4; }
.qty-btn:not(:disabled):active { background: var(--green-light); }
.qty-value { min-width: 28px; text-align: center; font-size: 18px; font-weight: 700; }

/* ---- 日付・時間帯 ---- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.choice, .slot {
  min-height: 56px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: #fff;
  font-size: 16px;
}
.choice { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; }
.choice-main { font-weight: 700; }
.choice-sub { font-size: 13px; color: var(--muted); }
.choice.is-selected, .slot.is-selected { border-color: var(--green); background: var(--green-light); box-shadow: 0 0 0 1px var(--green); }
.choice:disabled, .slot:disabled { background: #f0eeea; color: #a5a5a5; border-color: var(--border); }

.slot-list { display: flex; flex-direction: column; gap: 10px; }
.slot { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; text-align: left; }
.slot-label { font-weight: 700; }
.slot-remaining { font-size: 14px; color: var(--muted); }
.slot-remaining.is-low { color: var(--red); font-weight: 700; }

/* ---- フォーム ---- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; padding: 0; }
.req { font-size: 12px; background: var(--red); color: #fff; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 10px; background: #fff;
  font-size: 16px; /* 16px未満だとiOSで自動ズームされる */
}
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,77,58,.15); }
.has-error .input { border-color: var(--red); background: #fffafa; }
.field-error { color: var(--red); font-size: 14px; margin: 6px 0 0; font-weight: 700; }
.input-with-counter { position: relative; }
.input-with-counter .input { padding-right: 96px; }
.counter { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); }
.counter.is-over { color: var(--red); font-weight: 700; }

.radio-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.radio {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: 10px; background: #fff;
}
.radio.is-selected { border-color: var(--green); background: var(--green-light); }
.radio input, .agree input { width: 22px; height: 22px; accent-color: var(--green); margin: 0; flex-shrink: 0; }

.info-box { background: #fff8e6; border: 1px solid #f0dfb0; border-radius: var(--radius); padding: 12px 14px; font-size: 15px; }
.info-box p { margin: 0; }
.info-title { font-weight: 700; margin-bottom: 4px; color: #7a5b00; }
.notes { margin: 0; padding-left: 1.2em; }
.notes li + li { margin-top: 4px; }

/* ---- 確認・完了 ---- */
.summary { margin: 0 0 16px; padding: 4px 16px; }
.summary-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.summary-row dt { width: 6em; flex-shrink: 0; color: var(--muted); font-size: 15px; }
.summary-row dd { margin: 0; flex: 1; min-width: 0; word-break: break-all; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; justify-content: space-between; gap: 8px; }
.item-list .price { white-space: nowrap; }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; }
.summary-total strong { font-size: 22px; color: var(--red); }

.agree {
  display: flex; align-items: center; gap: 12px; margin-top: 16px;
  min-height: 56px; padding: 0 16px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: #fff; font-weight: 700;
}
.agree.is-checked { border-color: var(--green); background: var(--green-light); }

.done { text-align: center; }
.done .summary { text-align: left; }
.done-icon {
  width: 64px; height: 64px; margin: 16px auto 8px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 34px; display: grid; place-items: center;
}
.closed-icon { font-size: 48px; margin: 24px 0 8px; }
.done-title { font-size: 20px; margin: 0 0 16px; }
.resno-box { background: #fff; border: 2px dashed var(--gold); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }
.resno-label { font-size: 14px; color: var(--muted); }
.resno { font-size: 32px; font-weight: 800; letter-spacing: .08em; color: var(--green); }
.done-text { margin: 0 0 20px; }

/* ---- ボタン ---- */
.btn {
  min-height: var(--tap); padding: 0 20px; border-radius: 999px; border: 0;
  font-size: 16px; font-weight: 700;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 2px 0 #7f1a20; }
.btn-primary:disabled { background: #cfc9c0; box-shadow: none; color: #fff; }
.btn-primary:not(:disabled):active { transform: translateY(1px); box-shadow: 0 1px 0 #7f1a20; }
.btn-secondary { background: #fff; color: var(--green); border: 1.5px solid var(--green); }
.btn-block { display: block; width: 100%; margin-top: 12px; }

.footer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--border);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 12px rgba(0,0,0,.05);
}
.footer-bar > * { max-width: 488px; margin-left: auto; margin-right: auto; }
.footer-summary { font-size: 15px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.footer-buttons { display: flex; gap: 10px; }
.footer-buttons .btn-secondary { flex: 0 0 96px; }
.footer-buttons .btn-primary { flex: 1; }

/* ---- 読み込み ---- */
.screen-center { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 4px; }
.screen-center .btn-block { max-width: 320px; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 4px solid var(--green-light); border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.35); display: grid; place-items: center; }
.overlay[hidden] { display: none; }
.overlay-box { background: #fff; border-radius: var(--radius); padding: 24px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 220px; }
.overlay-box p { margin: 0; font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
