/* コンテナ設定 */
.mb-wizard-container {
  max-width: 1400px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  font-family: "Helvetica Neue", Arial, sans-serif;
  min-height: 550px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 利用回数バッジ */
.mb-usage-badge {
  position: absolute;
  top: 20px;
  left: 15px;
  background: #f0f0f0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: #666;
  font-weight: 600;
  z-index: 10;
}

.mb-usage-badge strong {
  color: #9b2222;
  font-size: 1.1em;
}

/* プログレスバー */
.mb-progress-bar {
  height: 6px;
  background: #eee;
  width: 100%;
  margin-top: 0;
}

.mb-progress-fill {
  height: 100%;
  background: #9b2222;
  width: 0%;
  transition: width 0.3s ease;
}

.mb-step-content,
.mb-result-wrapper,
#mb-loading {
  padding: 40px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.mb-step-content {
  justify-content: flex-start;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 質問・選択肢 */
.mb-question-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
  text-align: center;
  margin-top: 20px;
  line-height: 1.25em;
}

.mb-question-desc {
  text-align: center;
  color: #666;
  margin-bottom: 40px;
  font-size: 16px;
}

.mb-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
}

@media(min-width: 600px) {
  .mb-options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media(min-width: 960px) {
  .mb-options-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

.mb-option-card {
  border: 2px solid #eee;
  border-radius: 10px;
  padding: 30px 20px;
  cursor: pointer;
  transition: 0.2s;
  text-align: center;
  font-weight: 600;
  color: #555;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.mb-option-card:hover {
  border-color: #9b2222;
  color: #9b2222;
  background: #fff5f6;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(155, 34, 34, 0.1);
}

.mb-option-card.selected {
  background: #9b2222;
  color: #fff;
  border-color: #9b2222;
}

/* 自由記述エリア */
.mb-textarea {
  width: 100%;
  padding: 20px;
  border: 2px solid #eee;
  border-radius: 8px;
  font-size: 16px;
  min-height: 200px;
  resize: vertical;
  box-sizing: border-box;
}

.mb-other-input {
  width: 100%;
  padding: 15px;
  border: 2px solid #eee;
  border-radius: 8px;
  font-size: 16px;
  margin-top: 15px;
  box-sizing: border-box;
  resize: vertical;
  min-height: 30px;
  height: calc(1em + 34px);
  background: #fafafa;
}

.mb-other-input:focus {
  border-color: #9b2222;
  background: #fff;
  outline: none;
}

/* ボタン類 */
.mb-nav-buttons {
  padding: 30px 50px;
  background: #f9f9f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.mb-btn-back {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 15px;
  text-decoration: underline;
}

.mb-btn-next {
  background: #9b2222;
  color: #fff;
  border: none;
  padding: 15px 40px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-left: auto;
}

.mb-btn-next:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.mb-btn-next:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ローディング */
#mb-loading {
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 400px;
}

.mb-loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid #f3f3f3;
  border-top: 6px solid #9b2222;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 30px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#mb-loading-text {
  font-weight: 600;
  font-size: 20px;
  color: #333;
  margin-bottom: 15px;
  min-height: 1.5em;
}

/* 結果エリア */
.mb-result-wrapper {
  display: none;
}

.mb-retry-header {
  text-align: right;
  margin-bottom: 20px;
}

.mb-retry-btn {
  background: #fff;
  border: 1px solid #ccc;
  color: #555;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mb-retry-btn:hover {
  background: #f0f0f0;
  border-color: #bbb;
}

.mb-scenario-output {
  background: #fdfdfd;
  padding: 40px;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 30px;
  line-height: 1.8;
  text-align: left;
  max-width: auto;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

.mb-scenario-output h2 {
  color: #9b2222;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
  margin-top: 40px;
  font-size: 1.6em;
  font-weight: 600;
}

.mb-scenario-output h3 {
  color: #9b2222;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
  margin-top: 40px;
  font-size: 1.4em;
}

.mb-scenario-output h3:first-child {
  margin-top: 0;
}

.mb-scenario-output h4 {
  color: #9b2222;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
  margin-top: 40px;
  font-size: 1.2em;
}

.mb-scenario-output ul {
  padding-left: 20px;
}

.mb-scenario-output strong {
  background: linear-gradient(transparent 60%, #fff176 60%);
}

.mb-scenario-output table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 25px 0;
  font-size: 14px;
  background-color: #fff;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mb-scenario-output th,
.mb-scenario-output td {
  padding: 12px 15px;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}

.mb-scenario-output th {
  background-color: #f8f8f8;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #9b2222;
  white-space: nowrap;
  min-width: 120px;
}

.mb-scenario-output tr:nth-child(even) {
  background-color: #fcfcfc;
}

.mb-scenario-output tr:hover {
  background-color: #fff0f0;
}

/* 修正指示エリア */
.mb-refine-box {
  background: #f0f8ff;
  border: 2px solid #cce4ff;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 30px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.mb-refine-title {
  font-weight: 600;
  color: #0056b3;
  margin-bottom: 10px;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
}

.mb-refine-textarea {
  width: 100%;
  border: 1px solid #cce4ff;
  border-radius: 4px;
  padding: 10px;
  min-height: 80px;
  font-size: 14px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.mb-refine-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.mb-refine-counter {
  font-size: 12px;
  color: #666;
}

.mb-refine-submit-btn {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: 0.2s;
}

.mb-refine-submit-btn:hover {
  background: #0056b3;
}

.mb-refine-submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* CTAエリア（修正後） */
.mb-cta-box {
  background: #fff;
  border: 2px solid #9b2222;
  border-radius: 12px;
  padding: 40px 30px;
  margin-top: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* デバッグ */
.mb-debug-box {
  margin-top: 30px;
  border-top: 1px dashed #ccc;
  padding-top: 20px;
  text-align: left;
}

.mb-debug-content {
  margin-top: 10px;
  background: #333;
  color: #0f0;
  padding: 15px;
  border-radius: 5px;
  font-family: monospace;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

.mb-info {
  padding: 10px;
  background-color: #eee;
  color: #333;
  font-size: 12px;
}

.mb-info li {
  list-style-type: disc;
  list-style-position: inside;
  line-height: 1.5em;
  margin-left: 1em;
}

.mb-info a {
  text-decoration: underline;
}


@media all and (max-width: 1024px) { /* SP */

  .mb-step-content, .mb-result-wrapper, #mb-loading {
    padding: 40px 20px;
  }

  .mb-nav-buttons {
    padding: 20px 30px;
    flex-wrap: wrap;
    flex-flow: column-reverse;
    gap: 20px;
  }

  .mb-btn-back {
    width: 100%;
  }

  .mb-btn-next {
    margin-right: auto;
  }
}