.kg-step-flow {
  --kg-step-flow-color-primary: var(--kgt-color-primary, #38b266);
  --kg-step-flow-color-primary-soft: #76c692;
  --kg-step-flow-color-secondary: var(--kgt-color-secondary, #506352);
  --kg-step-flow-color-surface: var(--kgt-color-secondary-bg, #d2e8d3);
  --kg-step-flow-color-surface-alt: #f7fbf8;
  --kg-step-flow-color-border: var(--kgt-color-border, #c7d8c8);
  --kg-step-flow-color-muted: var(--kgt-color-muted, #5f6b5f);
  --kg-step-flow-color-text: var(--kgt-color-black, #191c19);
  width: min(100%, var(--kgt-container-lg, 99rem));
  max-width: var(--kgt-container-lg, 99rem);
  margin-inline: auto;
  margin-block: 3rem;
  color: var(--kg-step-flow-color-text);
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
}

.kg-step-flow__section-title {
  margin: 0 0 1.3rem;
  padding: 0.9rem 1.4rem;
  border-radius: 0.2rem;
  background: linear-gradient(
    135deg,
    var(--kg-step-flow-color-primary) 0%,
    var(--kg-step-flow-color-primary-soft) 100%
  );
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.4;
}

.kg-step-flow__lead {
  margin: 0 0 1.4rem;
  color: var(--kg-step-flow-color-muted);
  font-size: 1.4rem;
  line-height: 1.8;
}

.kg-step-flow__list {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.kg-step-flow__item {
  position: relative;
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  gap: 1.4rem;
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0 2rem;
}

.kg-step-flow__item:last-child {
  padding-bottom: 0;
}

.kg-step-flow__item:not(:last-child)::after {
  content: "↓";
  position: absolute;
  left: 0.85rem;
  bottom: 0.1rem;
  color: var(--kg-step-flow-color-primary);
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1;
}

.kg-step-flow__number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.2rem;
  margin-top: 0.2rem;
  padding: 0.4rem;
  background: var(--kg-step-flow-color-primary);
  color: #fff;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.kg-step-flow__content {
  min-width: 0;
  padding: 1.6rem 1.8rem;
  background: linear-gradient(
    180deg,
    var(--kg-step-flow-color-surface-alt) 0%,
    var(--kg-step-flow-color-surface) 100%
  );
  border: 0.1rem solid rgb(80 99 82 / 10%);
}

.kg-step-flow__item-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.kg-step-flow__item-title {
  margin: 0;
  color: var(--kg-step-flow-color-primary);
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.45;
}

.kg-step-flow__item-note {
  color: var(--kg-step-flow-color-secondary);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
}

.kg-step-flow__item-body {
  margin: 0;
  color: var(--kg-step-flow-color-secondary);
  font-size: 1.45rem;
  line-height: 1.85;
}

.kg-step-flow__callout {
  margin-top: 1.4rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.7rem;
  background: #fff;
  box-shadow: inset 0 0 0 0.1rem var(--kg-step-flow-color-border);
}

.kg-step-flow__callout::before {
  content: "";
  display: block;
  height: 0.2rem;
  margin: -1.25rem -1.5rem 1.1rem;
  background: linear-gradient(
    90deg,
    var(--kg-step-flow-color-primary) 0%,
    var(--kg-step-flow-color-primary-soft) 100%
  );
}

.kg-step-flow__callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
  color: var(--kg-step-flow-color-primary);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.5;
}

.kg-step-flow__callout-title::after {
  content: "▼";
  font-size: 1rem;
  line-height: 1;
}

.kg-step-flow__callout-body {
  margin: 0;
  color: var(--kg-step-flow-color-muted);
  font-size: 1.4rem;
  line-height: 1.9;
}

.kg-step-flow__editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 0.1rem dashed var(--kg-step-flow-color-border);
}

.kg-step-flow__editor-add {
  margin-top: 1.4rem;
}

.editor-styles-wrapper .kg-step-flow__editor-actions .components-button {
  min-height: 3rem;
  padding-inline: 0.9rem;
  font-size: 1.25rem;
}

.editor-styles-wrapper .kg-step-flow__content {
  padding: 1.6rem;
}

.editor-styles-wrapper .kg-step-flow__list {
  display: flex;
  flex-direction: column;
}

.editor-styles-wrapper .kg-step-flow__item {
  width: 100%;
  max-width: 100%;
}

.editor-styles-wrapper .kg-step-flow__item-title,
.editor-styles-wrapper .kg-step-flow__item-note,
.editor-styles-wrapper .kg-step-flow__item-body,
.editor-styles-wrapper .kg-step-flow__section-title,
.editor-styles-wrapper .kg-step-flow__lead,
.editor-styles-wrapper .kg-step-flow__callout-title,
.editor-styles-wrapper .kg-step-flow__callout-body {
  outline-offset: 0.2rem;
}

.editor-styles-wrapper
  .kg-step-flow
  .block-editor-rich-text__editable[data-is-placeholder-visible="true"]::before {
  color: var(--kg-step-flow-color-muted);
  opacity: 0.8;
}

@media (max-width: 767px) {
  .kg-step-flow__item {
    grid-template-columns: 3.6rem minmax(0, 1fr);
    gap: 1rem;
    padding-bottom: 2rem;
  }

  .kg-step-flow__item:not(:last-child)::after {
    left: 0.55rem;
    bottom: 0.2rem;
  }

  .kg-step-flow__number {
    min-height: 3.6rem;
    font-size: 2rem;
  }

  .kg-step-flow__content {
    padding: 1.4rem;
  }

  .kg-step-flow__item-title {
    font-size: 1.7rem;
  }
}

/* Safety override: force a single-column stack even if theme/global styles mutate list layouts. */
.wp-block-kgt-step-flow.kg-step-flow > .kg-step-flow__list,
.kg-step-flow > .kg-step-flow__list,
ol.kg-step-flow__list {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.wp-block-kgt-step-flow.kg-step-flow
  > .kg-step-flow__list
  > .kg-step-flow__item,
.kg-step-flow > .kg-step-flow__list > .kg-step-flow__item,
ol.kg-step-flow__list > li.kg-step-flow__item {
  display: grid !important;
  grid-template-columns: 4.2rem minmax(0, 1fr) !important;
  gap: 1.4rem !important;
  align-items: start !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 0 2rem !important;
  float: none !important;
  clear: both !important;
}

.wp-block-kgt-step-flow.kg-step-flow
  > .kg-step-flow__list
  > .kg-step-flow__item:last-child,
.kg-step-flow > .kg-step-flow__list > .kg-step-flow__item:last-child,
ol.kg-step-flow__list > li.kg-step-flow__item:last-child {
  margin-bottom: 0 !important;
}

@media (max-width: 767px) {
  .wp-block-kgt-step-flow.kg-step-flow
    > .kg-step-flow__list
    > .kg-step-flow__item,
  .kg-step-flow > .kg-step-flow__list > .kg-step-flow__item,
  ol.kg-step-flow__list > li.kg-step-flow__item {
    grid-template-columns: 3.6rem minmax(0, 1fr) !important;
    gap: 1rem !important;
  }
}
