:root {
  --os-text: #1d1d1f;
  --os-text-sub: #3a3a3c;
  --os-border: #c7c7cc;
  --os-bg-soft: #f5f5f7;
  --os-accent: #d22630;
  --os-accent-dark: #aa1e27;
  --os-accent-bg: #fdeced;
  --os-line: #06c755;
  --os-line-dark: #05a847;
  --os-w: 560px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: var(--os-text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  /* 下部固定バーの分の余白（JSで実測値に上書き） */
  padding-bottom: calc(200px + env(safe-area-inset-bottom));
}

button { font-family: inherit; }

.os-header { border-bottom: 1px solid #e5e5ea; }
.os-header-inner { max-width: var(--os-w); margin: 0 auto; padding: 12px 18px; }
.os-logo { font-weight: 800; font-size: 1rem; color: var(--os-text); text-decoration: none; }
.os-logo span { color: var(--os-accent); }

.os-noscript { max-width: var(--os-w); margin: 24px auto; padding: 20px; background: var(--os-accent-bg); border-radius: 16px; }

.os-screen {
  max-width: var(--os-w);
  margin: 0 auto;
  padding: 8px 18px 24px;
}

/* ---------- 進捗・戻る ---------- */
.os-back {
  background: none;
  border: 2px solid var(--os-border);
  border-radius: 999px;
  padding: 8px 18px;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--os-text);
  cursor: pointer;
}
.os-top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
}
.os-progress-text {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 12px;
}
.os-progress { grid-column: 1 / -1; margin-top: 10px; }
.os-progress-step { font-size: 1.15rem; font-weight: 800; }
.os-progress-left { font-size: 1.05rem; font-weight: 700; color: var(--os-accent); }
.os-progress {
  height: 14px;
  background: #e5e5ea;
  border-radius: 999px;
  overflow: hidden;
}
.os-progress-fill { height: 100%; background: var(--os-accent); border-radius: 999px; transition: width 0.25s; }

.os-q {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 12px 0 12px;
}

/* ---------- 選択カード ---------- */
.os-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.os-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 144px;
  padding: 10px 8px;
  background: #fff;
  border: 3px solid var(--os-border);
  border-radius: 18px;
  color: var(--os-text);
  cursor: pointer;
  text-align: center;
}
.os-card:focus-visible { outline: 4px solid var(--os-accent-dark); outline-offset: 2px; }
.os-card-img { width: 80px; height: 80px; object-fit: contain; }
.os-card-label { font-size: 1.1rem; font-weight: 800; line-height: 1.35; }
.os-card-sub { font-size: 0.9rem; font-weight: 600; color: var(--os-text-sub); }
.os-card.is-selected {
  border-color: var(--os-accent);
  background: var(--os-accent-bg);
  box-shadow: 0 0 0 3px var(--os-accent) inset;
}
.os-card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--os-accent);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 下部固定「次へ」 ---------- */
.os-nextbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: #fff;
  border-top: 1px solid #e5e5ea;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
}
.os-next {
  display: block;
  width: 100%;
  max-width: calc(var(--os-w) - 36px);
  margin: 0 auto;
  min-height: 64px;
  border: none;
  border-radius: 16px;
  background: var(--os-accent);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
}
.os-next:hover { background: var(--os-accent-dark); }
.os-next:disabled { background: #d1d1d6; color: #3a3a3c; cursor: not-allowed; }

/* ---------- 開始画面 ---------- */
.os-start { text-align: center; padding-top: 36px; }
.os-start-img { width: 140px; height: 140px; object-fit: contain; }
.os-start-title { font-size: 2rem; font-weight: 800; line-height: 1.35; margin: 14px 0 18px; }
.os-start-lead { font-size: 1.15rem; font-weight: 600; color: var(--os-text-sub); margin: 4px 0; }
.os-start-btn { margin-top: 32px; min-height: 72px; font-size: 1.45rem; }

/* ---------- 本数 ---------- */
.os-qty-media {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 18px;
}
.os-qty-media img { width: 56px; height: 56px; object-fit: contain; }
.os-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 22px;
}
.os-qty-btn {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  border-radius: 50%;
  border: 3px solid var(--os-text);
  background: #fff;
  color: var(--os-text);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.os-qty-btn:disabled { border-color: #d1d1d6; color: #aeaeb2; cursor: not-allowed; }
.os-qty-value { display: flex; align-items: baseline; gap: 4px; cursor: text; }
.os-qty-input {
  width: 3.2ch;
  font-size: 3.2rem;
  font-weight: 800;
  text-align: center;
  border: none;
  border-bottom: 3px solid var(--os-border);
  background: transparent;
  color: var(--os-text);
  padding: 0;
  border-radius: 0;
  cursor: text;
}
.os-qty-input:focus { outline: none; border-bottom-color: var(--os-accent); background: var(--os-accent-bg); }
.os-qty-unit { font-size: 1.5rem; font-weight: 800; }

.os-qty-over {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 2px solid var(--os-accent);
  border-radius: 12px;
  background: var(--os-accent-bg);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}
.os-qty-over[hidden] { display: none; }
.os-hint { text-align: center; font-size: 1.05rem; font-weight: 600; color: var(--os-text-sub); margin: 4px 0; }
.os-hint-strong { margin-top: 18px; color: var(--os-text); background: var(--os-bg-soft); border-radius: 12px; padding: 12px 14px; }

/* ---------- 確認 ---------- */
.os-linebar .os-line-btn { max-width: calc(var(--os-w) - 36px); margin: 0 auto; }
.os-linebar-howto {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}
.os-linebar-howto img { width: 32px; height: 32px; object-fit: contain; }
.os-linebar-howto strong { color: var(--os-line-dark); }
.os-sum { border: 3px solid var(--os-border); border-radius: 18px; padding: 4px 18px; }
.os-sum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #e5e5ea;
}
.os-sum-row:last-child { border-bottom: none; }
.os-sum-text { display: flex; flex-direction: column; }
.os-sum-label { font-size: 0.95rem; font-weight: 700; color: var(--os-text-sub); }
.os-sum-value { font-size: 1.4rem; font-weight: 800; line-height: 1.35; }
.os-sum-edit {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 6px 14px;
  border: 2px solid var(--os-border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--os-text);
  cursor: pointer;
}

.os-price { text-align: center; background: var(--os-bg-soft); border-radius: 18px; padding: 16px; margin: 16px 0 10px; }
.os-price-label { margin: 0; font-size: 1rem; font-weight: 700; }
.os-price-value { margin: 2px 0 4px; font-size: 2.2rem; font-weight: 800; color: var(--os-accent); }
.os-price-value.is-text { font-size: 1.3rem; }
.os-price-note { margin: 2px 0; font-size: 0.95rem; font-weight: 600; color: var(--os-text-sub); }

.os-howto {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eafaf0;
}
.os-howto img { width: 56px; height: 56px; object-fit: contain; flex: 0 0 56px; }
.os-howto p { margin: 0; font-size: 1.1rem; font-weight: 700; line-height: 1.5; }
.os-howto strong { color: var(--os-line-dark); }

.os-line-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 72px;
  border-radius: 18px;
  background: var(--os-line);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--os-line-dark);
}
.os-line-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--os-line-dark); }

.os-pc { margin-top: 24px; text-align: center; border: 3px solid var(--os-line); border-radius: 20px; padding: 20px; }
.os-pc-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 12px; }
.os-qr { width: 260px; height: 260px; margin: 0 auto; }
.os-qr svg, .os-qr img { width: 100%; height: 100%; display: block; }
.os-pc .os-howto { text-align: left; }

.os-fallback { text-align: center; margin-top: 26px; }
.os-fallback-toggle {
  background: none;
  border: none;
  padding: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--os-text-sub);
  text-decoration: underline;
  cursor: pointer;
}
.os-fallback-body { background: var(--os-bg-soft); border-radius: 14px; padding: 14px 16px; margin-top: 8px; font-size: 1rem; }
.os-fallback-body p { margin: 0 0 10px; }
.os-fallback-link {
  display: inline-block;
  padding: 10px 20px;
  border: 2px solid var(--os-line);
  border-radius: 999px;
  color: var(--os-line-dark);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 360px) {
  .os-card { min-height: 136px; }
  .os-card-img { width: 68px; height: 68px; }
  .os-qty-btn { width: 72px; height: 72px; flex-basis: 72px; }
}

.os-footer {
  max-width: var(--os-w);
  margin: 0 auto;
  padding: 24px 18px 8px;
  border-top: 1px solid #e5e5ea;
  text-align: center;
  font-size: 0.85rem;
  color: var(--os-text-sub);
}
.os-footer a { color: var(--os-text-sub); }
