/* ===================================================================
   MenuFresh - Customize Wizard
   Mode A (画面遷移型) と Mode B (アコーディオン型) 両対応
   =================================================================== */

/* ===== Container ===== */
.wizard {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-divider);
  overflow: hidden;
}

/* ===== Step Block ===== */
.wiz-step {
  border-bottom: 1px solid var(--color-divider);
}

.wiz-step:last-of-type {
  border-bottom: none;
}

.wiz-step__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  color: var(--color-text-primary);
  transition: background var(--duration-fast);
}

.wiz-step__header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.wiz-step__num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-number);
  font-size: 1.15rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--duration-normal) var(--ease-bounce);
}

.wiz-step.is-completed .wiz-step__num {
  background: var(--color-success, #4ade80);
  color: var(--color-bg-base);
}

.wiz-step.is-active .wiz-step__num {
  background: var(--color-accent-primary);
  color: var(--color-bg-base);
  box-shadow: 0 0 0 4px rgba(232, 155, 59, 0.2);
}

.wiz-step__title-block {
  flex: 1;
  min-width: 0;
}

.wiz-step__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-primary);
}

.wiz-step__selection {
  font-size: 0.85rem;
  color: var(--color-accent-secondary);
  margin: 4px 0 0;
  font-weight: 600;
}

.wiz-step__chevron {
  width: 24px;
  height: 24px;
  color: var(--color-text-tertiary);
  transition: transform var(--duration-normal) var(--ease-out);
}

.wiz-step.is-open .wiz-step__chevron {
  transform: rotate(180deg);
  color: var(--color-accent-primary);
}

.wiz-step__chevron svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

/* Body (collapsed/expanded) */
.wiz-step__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.wiz-step.is-open .wiz-step__body {
  max-height: 6000px;  /* enough for 17 toppings on mobile single column */
}

.wiz-step__body-inner {
  padding: 0 28px 28px;
}

/* ===== Selection Cards (universal) ===== */
.opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.opt-grid--mains {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.opt-grid--sizes {
  grid-template-columns: repeat(4, 1fr);
  max-width: 600px;
}

.opt-grid--toppings {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.opt-grid--spice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 700px;
}

/* Option Card */
.opt-card {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid transparent;
  border-radius: var(--radius-card);
  padding: 0;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--color-text-primary);
}

.opt-card:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.opt-card.is-selected {
  border-color: var(--color-accent-primary);
  background: rgba(232, 155, 59, 0.1);
  box-shadow: 0 6px 20px rgba(232, 155, 59, 0.2);
}

.opt-card__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent-primary);
  color: var(--color-bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.95rem;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration-fast) var(--ease-bounce);
  z-index: 2;
}

.opt-card.is-selected .opt-card__check {
  opacity: 1;
  transform: scale(1);
}

/* Brief tap-confirmation pulse — fires for ~400ms after tap, before
   the wizard auto-advances to the next step */
.opt-card.is-just-tapped {
  animation: optTapPulse 0.5s var(--ease-bounce);
}

@keyframes optTapPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 155, 59, 0.6); }
  40% { transform: scale(1.04); box-shadow: 0 0 0 10px rgba(232, 155, 59, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 155, 59, 0); }
}

.opt-card.is-just-tapped .opt-card__check {
  animation: checkBouncePop 0.5s var(--ease-bounce);
}

@keyframes checkBouncePop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.opt-card__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.opt-card__body {
  padding: 12px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.opt-card__name {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 4px;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.opt-card__sub {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  margin: 0;
  line-height: 1.4;
}

.opt-card__price {
  display: flex;
  align-items: baseline;
  gap: 0.2em;
  margin-top: 8px;
  font-family: var(--font-number);
  color: var(--color-accent-secondary);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.opt-card__price-cur {
  font-size: 0.6em;
  opacity: 0.7;
}

/* Size variant: simpler cards */
.opt-card--size {
  padding: 16px 12px;
  align-items: center;
  text-align: center;
  aspect-ratio: 1;
  justify-content: center;
}

.opt-card--size .opt-card__name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.opt-card--size .opt-card__sub {
  font-size: 0.7rem;
}

.opt-card--size .opt-card__price-modifier {
  font-family: var(--font-number);
  font-size: 0.95rem;
  margin-top: 6px;
  color: var(--color-accent-secondary);
}

/* Topping variant: card with main area + quantity bar */
.opt-card--topping {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  min-height: 80px;
  gap: 0;
}

.opt-card--topping__main {
  display: flex;
  align-items: stretch;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  color: inherit;
  flex: 1;
}

.opt-card--topping .opt-card__image {
  width: 88px;
  aspect-ratio: 1;
  flex-shrink: 0;
}

.opt-card--topping .opt-card__body {
  padding: 10px 12px;
  justify-content: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.opt-card--topping .opt-card__name {
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.3;
  /* Allow up to 2 lines, then ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.opt-card--topping .opt-card__price {
  font-size: 0.95rem;
  margin-top: 4px;
  display: inline-flex;
  align-items: baseline;
  /* Price always below name; doesn't need right padding to avoid icon */
}

.opt-card__price-multiplier {
  font-size: 0.75em;
  color: var(--color-accent-primary);
  margin-left: 0.3em;
  font-weight: 700;
}

/* Quantity Control */
.qty-control {
  display: flex;
  align-items: stretch;
  height: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

.qty-control--hint {
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  color: inherit;
  transition: background var(--duration-fast);
}

.qty-control--hint:hover {
  background: rgba(232, 155, 59, 0.12);
}

.qty-control--hint:active {
  background: rgba(232, 155, 59, 0.2);
}

.qty-hint {
  font-size: 0.75rem;
  color: var(--color-accent-secondary);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.opt-card--topping.is-selected .qty-control {
  background: rgba(232, 155, 59, 0.15);
}

.qty-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-accent-secondary);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  user-select: none;
  -webkit-user-select: none;
}

.qty-btn:hover {
  background: rgba(232, 155, 59, 0.25);
  color: var(--color-text-primary);
}

.qty-btn:active {
  transform: scale(0.92);
  background: rgba(232, 155, 59, 0.4);
}

.qty-btn--minus {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.qty-btn--plus {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.qty-display {
  flex: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-number);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
  min-width: 40px;
  user-select: none;
  -webkit-user-select: none;
}

/* Selected card visual: hide check (replaced by qty) */
.opt-card--topping.is-selected .opt-card__check {
  display: none;
}

/* Info icon (ⓘ) for toppings — positioned over the IMAGE area's top-right
   (image is 88px wide, so we use left positioning to anchor to image's
   right edge rather than the entire card's right edge). This keeps the
   body area unobstructed for the topping name and price. */
.opt-card__info {
  position: absolute;
  top: 6px;
  /* image_width(88) - icon_width(28) - small_inset(6) = 54px */
  left: 54px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(20, 17, 13, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--color-text-primary);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  font-family: 'Georgia', 'Times New Roman', serif;
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.opt-card__info:hover {
  background: var(--color-accent-primary);
  color: var(--color-bg-base);
  border-color: var(--color-accent-primary);
  transform: scale(1.15);
}

.opt-card__info:active {
  transform: scale(0.95);
}

.opt-card--topping.is-selected .opt-card__info {
  background: var(--color-accent-primary);
  color: var(--color-bg-base);
  border-color: var(--color-accent-primary);
}

/* Spice level variant — vertical layout (icons above text) */
.opt-grid--spice {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-width: none;
}

.opt-card--spice {
  flex-direction: column;
  align-items: center;
  padding: 18px 12px 14px;
  gap: 8px;
  text-align: center;
  min-height: 140px;
  justify-content: flex-start;
}

.opt-card__spice-icons {
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  line-height: 1;
  margin-bottom: 4px;
}

.opt-card__spice-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  color: var(--color-text-primary);
}

.opt-card__spice-note {
  font-size: 0.7rem;
  color: var(--color-text-tertiary);
  margin: 0;
  line-height: 1.4;
}

.opt-card__spice-extra {
  font-family: var(--font-number);
  font-size: 0.9rem;
  color: var(--color-accent-secondary);
  font-weight: 700;
  margin-top: auto;
  padding: 4px 10px;
  background: rgba(232, 155, 59, 0.12);
  border-radius: 100px;
}

/* Help text */
.wiz-help {
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
  margin: 0 0 16px;
}

/* ===== Sticky Bottom Bar (running total) ===== */
.wiz-bottom {
  position: sticky;
  bottom: 0;
  /* Solid background — previously a transparent-top gradient was eating
     clicks meant for option cards (mains/sizes) directly above the bar */
  background: rgba(20, 17, 13, 0.96);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--color-divider);
  z-index: 5;
}

/* Soft fade just ABOVE the bar (visual continuity), no click capture */
.wiz-bottom::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(180deg, transparent, rgba(20, 17, 13, 0.55));
  pointer-events: none;
}

.wiz-bottom__total-label {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--color-text-tertiary);
  margin: 0;
  font-weight: 700;
}

.wiz-bottom__total-value {
  font-family: var(--font-number);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-accent-secondary);
  letter-spacing: 0.02em;
  line-height: 1;
}

.wiz-bottom__cur {
  font-size: 0.55em;
  opacity: 0.8;
  margin-right: 4px;
}

.wiz-bottom__suffix {
  font-size: 0.45em;
  color: var(--color-text-tertiary);
  font-family: var(--font-body);
  font-weight: 400;
  margin-left: 8px;
}

.wiz-bottom__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wiz-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.wiz-btn--primary {
  background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-warm));
  color: var(--color-bg-base);
  box-shadow: 0 4px 14px rgba(232, 155, 59, 0.4);
}

.wiz-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(232, 155, 59, 0.5);
}

.wiz-btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-secondary);
}

.wiz-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-primary);
}

/* ===== Mode A (Screen-flow) Specific ===== */
.wizard.is-mode-a .wiz-step {
  display: none;
}

.wizard.is-mode-a .wiz-step.is-active {
  display: block;
}

.wizard.is-mode-a .wiz-step__header {
  pointer-events: none;
}

.wizard.is-mode-a .wiz-step__chevron {
  display: none;
}

.wizard.is-mode-a .wiz-step__body {
  max-height: none !important;
  overflow: visible !important;
}

/* Progress bar (Mode A) */
.wiz-progress {
  display: none;
  padding: 22px 28px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--color-divider);
}

.wizard.is-mode-a .wiz-progress {
  display: block;
}

.wiz-progress__bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 8px;
}

.wiz-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-warm));
  border-radius: 100px;
  transition: width 0.5s var(--ease-out);
}

.wiz-progress__text {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  letter-spacing: 0.1em;
  font-weight: 600;
  margin: 0;
}

.wiz-progress__text strong {
  color: var(--color-accent-secondary);
  font-family: var(--font-number);
  font-size: 1.1em;
}

/* ===== Order Summary Modal ===== */
.wiz-summary {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.wiz-summary.is-open {
  display: flex;
}

.wiz-summary__card {
  width: 100%;
  max-width: 540px;
  background: linear-gradient(180deg, var(--color-bg-elevated), var(--color-bg-surface));
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow-elevated);
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn var(--duration-normal) var(--ease-bounce);
}

.wiz-summary__title-block {
  text-align: center;
  margin-bottom: 24px;
}

.wiz-summary__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-warm));
  color: var(--color-bg-base);
  font-size: 1.6rem;
  margin-bottom: 12px;
  animation: scaleIn 0.5s var(--ease-bounce);
}

.wiz-summary__eyebrow {
  display: block;
  color: var(--color-accent-secondary);
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.wiz-summary__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
}

.wiz-summary__rows {
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
  padding: 16px 0;
  margin-bottom: 20px;
}

.wiz-summary__row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 0.95rem;
  align-items: baseline;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}

.wiz-summary__row:last-child {
  border-bottom: none;
}

.wiz-summary__row-label {
  color: var(--color-text-secondary);
}

.wiz-summary__row-value {
  color: var(--color-text-primary);
  font-weight: 600;
  text-align: right;
}

.wiz-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.wiz-summary__total-label {
  font-size: 1rem;
  color: var(--color-text-secondary);
  font-weight: 700;
}

.wiz-summary__total-value {
  font-family: var(--font-number);
  font-size: 2.4rem;
  color: var(--color-accent-secondary);
  font-weight: 700;
}

.wiz-summary__hint {
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
  text-align: center;
  margin: 0 0 20px;
  padding: 14px;
  background: rgba(232, 155, 59, 0.08);
  border: 1px solid rgba(232, 155, 59, 0.2);
  border-radius: 12px;
}

.wiz-summary__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Mobile responsive ===== */
@media (max-width: 640px) {
  .wiz-step__header {
    padding: 18px 16px;
  }
  .wiz-step__body-inner {
    padding: 0 16px 20px;
  }
  .opt-grid--sizes {
    grid-template-columns: repeat(2, 1fr);
  }
  .opt-grid--toppings {
    grid-template-columns: 1fr;
  }
  .wiz-bottom {
    padding: 16px 18px;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .wiz-bottom__total-value {
    font-size: 1.8rem;
  }
}

/* Mode toggle indicator (subtle) */
.wiz-mode-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: var(--color-accent-secondary);
  color: var(--color-bg-base);
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}
