/* =========================================================
   Sugar Blocks — 共通スタイル（フロント / エディター共用）
   すべてのブロックは max-width:100% でスマホ表示でも崩れません
   ========================================================= */

:root {
  --sgb-accent: #e8618c;
  --sgb-ink: #33323d;
  --sgb-paper: #ffffff;
  --sgb-muted: #8a8794;
  --sgb-line: #e9e5ee;
  --sgb-radius: 12px;
  --sgb-shadow: 0 4px 16px rgba(51, 50, 61, 0.08);
}

[class^="sgb-"], [class*=" sgb-"] {
  box-sizing: border-box;
}
[class^="sgb-"] *, [class*=" sgb-"] * {
  box-sizing: border-box;
}
[class^="sgb-"] img {
  max-width: 100%;
  height: auto;
}

/* ---------- 1) 文字枠（ボックス） ---------- */
.sgb-box {
  position: relative;
  margin: 1.5em 0;
  padding: 1.25em 1.25em;
  border-radius: var(--sgb-radius);
  background: var(--sgb-box-bg, #fff);
  border: 2px solid var(--sgb-box-border, var(--sgb-accent));
  color: var(--sgb-box-color, var(--sgb-ink));
  max-width: 100%;
  overflow-wrap: break-word;
}
.sgb-box__title {
  position: absolute;
  top: 0;
  left: 1em;
  transform: translateY(-55%);
  display: inline-block;
  padding: 0.15em 0.9em;
  font-size: 0.85em;
  font-weight: 700;
  border-radius: 999px;
  background: var(--sgb-box-border, var(--sgb-accent));
  color: #fff;
  line-height: 1.6;
  white-space: nowrap;
  max-width: calc(100% - 2em);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sgb-box.has-title {
  margin-top: 2.2em;
  padding-top: 1.5em;
}
.sgb-box--dashed { border-style: dashed; }
.sgb-box--double { border-style: double; border-width: 4px; }
.sgb-box--stitch {
  border-style: dashed;
  box-shadow: 0 0 0 6px var(--sgb-box-bg, #fff), 0 0 0 8px var(--sgb-box-border, var(--sgb-accent));
  margin: 2em 0.6em;
}
.sgb-box--flag {
  border: none;
  border-left: 6px solid var(--sgb-box-border, var(--sgb-accent));
  border-radius: 4px;
  background: var(--sgb-box-bg, #faf7fb);
}
.sgb-box--shadow {
  border: 1px solid var(--sgb-line);
  box-shadow: var(--sgb-shadow);
}
.sgb-box p {
  margin: 0 !important; /* テーマの段落余白を打ち消し、Shift+Enter改行と同じ間隔に */
  line-height: 1.9;
}
.sgb-box p:first-child { margin-top: 0; }
.sgb-box p:last-child { margin-bottom: 0; }

/* ---------- マーカー（リッチテキスト書式） ---------- */
.sgb-marker-yellow {
  background: linear-gradient(transparent 55%, #ffe76a 55%);
  font-weight: inherit;
}
.sgb-marker-pink {
  background: linear-gradient(transparent 55%, #ffc2d4 55%);
}
.sgb-marker-blue {
  background: linear-gradient(transparent 55%, #b5e3ff 55%);
}

/* ---------- 2) 画像スライダー ---------- */
.sgb-slider {
  position: relative;
  margin: 1.8em 0;
  max-width: 100%;
}
.sgb-slider__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: var(--sgb-radius);
  gap: 0;
}
.sgb-slider__track::-webkit-scrollbar { display: none; }
.sgb-slider__slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  position: relative;
}
.sgb-slider__slide img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.sgb-slider__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.6em 1em;
  font-size: 0.85em;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}
.sgb-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--sgb-ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--sgb-shadow);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sgb-slider__arrow:hover { background: #fff; }
.sgb-slider__arrow--prev { left: 10px; }
.sgb-slider__arrow--next { right: 10px; }
.sgb-slider__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.sgb-slider__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--sgb-line);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.sgb-slider__dot.is-active {
  background: var(--sgb-accent);
  transform: scale(1.4);
}

/* ---------- 3) タブ切り替え ---------- */
.sgb-tabs {
  margin: 1.8em 0;
  max-width: 100%;
}
.sgb-tabs__nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sgb-tabs__nav::-webkit-scrollbar { display: none; }
.sgb-tabs__btn {
  flex: 1 0 auto;
  min-width: 90px;
  padding: 0.65em 1em;
  border: 1px solid var(--sgb-line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: #f5f3f8;
  color: var(--sgb-muted);
  font-weight: 700;
  font-size: 0.92em;
  cursor: pointer;
  white-space: nowrap;
}
.sgb-tabs__btn.is-active {
  background: var(--sgb-tabs-accent, var(--sgb-accent));
  border-color: var(--sgb-tabs-accent, var(--sgb-accent));
  color: #fff;
}
.sgb-tabs__panel {
  display: none;
  padding: 1.2em;
  border: 1px solid var(--sgb-line);
  border-top: 3px solid var(--sgb-tabs-accent, var(--sgb-accent));
  border-radius: 0 0 var(--sgb-radius) var(--sgb-radius);
  background: #fff;
  overflow-wrap: break-word;
}
.sgb-tabs__panel.is-active { display: block; }

/* ---------- 4) タイムライン ---------- */
.sgb-timeline {
  margin: 1.8em 0;
  padding: 0;
  list-style: none;
  max-width: 100%;
}
.sgb-timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 1em;
  padding-bottom: 1.6em;
}
.sgb-timeline__item::before {
  content: "";
  position: absolute;
  left: calc(6.5em + 0.5em + 6px);
  top: 14px;
  bottom: -4px;
  width: 2px;
  background: var(--sgb-line);
}
.sgb-timeline__item:last-child::before { display: none; }
.sgb-timeline__item::after {
  content: "";
  position: absolute;
  left: calc(6.5em + 0.5em);
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sgb-tl-accent, var(--sgb-accent));
  box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--sgb-line);
}
.sgb-timeline__date {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--sgb-tl-accent, var(--sgb-accent));
  text-align: right;
  padding-top: 2px;
  overflow-wrap: break-word;
}
.sgb-timeline__body { padding-left: 1.6em; min-width: 0; }
.sgb-timeline__title {
  font-weight: 700;
  color: var(--sgb-ink);
  margin: 0 0 0.25em;
}
.sgb-timeline__text {
  margin: 0;
  color: var(--sgb-muted);
  font-size: 0.95em;
  overflow-wrap: break-word;
}
@media (max-width: 480px) {
  .sgb-timeline__item { grid-template-columns: 4.6em 1fr; }
  .sgb-timeline__item::before { left: calc(4.6em + 0.5em + 6px); }
  .sgb-timeline__item::after { left: calc(4.6em + 0.5em); }
}

/* ---------- 5) 料金表テーブル ---------- */
.sgb-pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 1.8em 0;
  max-width: 100%;
}
.sgb-pricing__col {
  border: 1px solid var(--sgb-line);
  border-radius: var(--sgb-radius);
  background: #fff;
  padding: 1.4em 1.2em;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sgb-shadow);
  min-width: 0;
}
.sgb-pricing__col.is-featured {
  border: 2px solid var(--sgb-pricing-accent, var(--sgb-accent));
}
.sgb-pricing__badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sgb-pricing-accent, var(--sgb-accent));
  color: #fff;
  font-size: 0.75em;
  font-weight: 700;
  padding: 0.2em 1em;
  border-radius: 999px;
  white-space: nowrap;
}
.sgb-pricing__plan {
  font-weight: 700;
  font-size: 1.05em;
  color: var(--sgb-ink);
  margin: 0 0 0.3em;
}
.sgb-pricing__price {
  font-size: 1.9em;
  font-weight: 800;
  color: var(--sgb-pricing-accent, var(--sgb-accent));
  line-height: 1.2;
  margin: 0.1em 0;
  overflow-wrap: break-word;
}
.sgb-pricing__unit {
  font-size: 0.8em;
  color: var(--sgb-muted);
  margin: 0 0 0.8em;
}
.sgb-pricing__features {
  list-style: none;
  margin: 0 0 1.2em;
  padding: 0;
  text-align: left;
  flex: 1;
}
.sgb-pricing__features li {
  padding: 0.5em 0 0.5em 1.6em;
  border-bottom: 1px dashed var(--sgb-line);
  position: relative;
  font-size: 0.92em;
  overflow-wrap: break-word;
}
.sgb-pricing__features li::before {
  content: "✓";
  position: absolute;
  left: 0.2em;
  color: var(--sgb-pricing-accent, var(--sgb-accent));
  font-weight: 700;
}
.sgb-pricing__btn {
  display: inline-block;
  padding: 0.7em 1em;
  border-radius: 999px;
  background: var(--sgb-pricing-accent, var(--sgb-accent));
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s;
}
.sgb-pricing__btn:hover { opacity: 0.85; }

/* ---------- 6) カウントダウン ---------- */
.sgb-countdown {
  margin: 1.8em 0;
  padding: 1.4em 1em;
  border-radius: var(--sgb-radius);
  background: var(--sgb-cd-bg, #33323d);
  color: #fff;
  text-align: center;
  max-width: 100%;
}
.sgb-countdown__title {
  font-weight: 700;
  margin: 0 0 0.7em;
  font-size: 1em;
  overflow-wrap: break-word;
}
.sgb-countdown__units {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sgb-countdown__unit {
  min-width: 64px;
  padding: 0.5em 0.4em;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
}
.sgb-countdown__num {
  display: block;
  font-size: 1.7em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--sgb-cd-accent, #ffd166);
  line-height: 1.2;
}
.sgb-countdown__label {
  display: block;
  font-size: 0.7em;
  opacity: 0.8;
  margin-top: 2px;
}
.sgb-countdown__done {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--sgb-cd-accent, #ffd166);
}
@media (max-width: 400px) {
  .sgb-countdown__unit { min-width: 56px; }
  .sgb-countdown__num { font-size: 1.4em; }
}

/* ---------- 7) 著者プロフィール ---------- */
.sgb-author {
  display: flex;
  gap: 1.1em;
  margin: 1.8em 0;
  padding: 1.3em;
  border: 1px solid var(--sgb-line);
  border-top: 4px solid var(--sgb-author-accent, var(--sgb-accent));
  border-radius: var(--sgb-radius);
  background: #fff;
  box-shadow: var(--sgb-shadow);
  max-width: 100%;
}
.sgb-author__avatar {
  flex: 0 0 84px;
}
.sgb-author__avatar img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--sgb-author-accent, var(--sgb-accent));
}
.sgb-author__body { min-width: 0; flex: 1; }
.sgb-author__role {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 700;
  color: var(--sgb-author-accent, var(--sgb-accent));
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.1em 0.8em;
  margin-bottom: 0.3em;
}
.sgb-author__name {
  font-weight: 800;
  font-size: 1.1em;
  color: var(--sgb-ink);
  margin: 0 0 0.35em;
}
.sgb-author__bio {
  margin: 0 0 0.6em;
  font-size: 0.92em;
  color: var(--sgb-muted);
  overflow-wrap: break-word;
}
.sgb-author__links {
  display: flex;
  gap: 0.8em;
  flex-wrap: wrap;
}
.sgb-author__links a {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--sgb-author-accent, var(--sgb-accent));
  text-decoration: none;
}
.sgb-author__links a:hover { text-decoration: underline; }
@media (max-width: 480px) {
  .sgb-author { flex-direction: column; align-items: center; text-align: center; }
  .sgb-author__links { justify-content: center; }
}

/* ---------- 8) 関連記事カード ---------- */
.sgb-related {
  position: relative;
  margin: 2em 0 1.8em;
  border: 2px solid var(--sgb-accent);
  border-radius: var(--sgb-radius);
  background: #fff;
  max-width: 100%;
}
.sgb-related__label {
  position: absolute;
  top: 0;
  left: 1em;
  transform: translateY(-55%);
  background: var(--sgb-accent);
  color: #fff;
  font-size: 0.8em;
  font-weight: 700;
  padding: 0.15em 1em;
  border-radius: 999px;
  white-space: nowrap;
}
.sgb-related__link {
  display: flex;
  gap: 1em;
  padding: 1.2em;
  text-decoration: none;
  color: inherit;
}
.sgb-related__thumb {
  flex: 0 0 140px;
}
.sgb-related__thumb img,
.sgb-related__img {
  width: 140px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.sgb-related__body { min-width: 0; }
.sgb-related__title {
  display: block;
  font-weight: 700;
  color: var(--sgb-ink);
  margin-bottom: 0.3em;
  overflow-wrap: break-word;
}
.sgb-related__link:hover .sgb-related__title { color: var(--sgb-accent); }
.sgb-related__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.88em;
  color: var(--sgb-muted);
}
.sgb-related__date {
  display: block;
  margin-top: 0.4em;
  font-size: 0.78em;
  color: var(--sgb-muted);
}
@media (max-width: 480px) {
  .sgb-related__link { flex-direction: column; }
  .sgb-related__thumb { flex-basis: auto; }
  .sgb-related__thumb img, .sgb-related__img { width: 100%; height: 160px; }
}

/* ---------- 9) YouTube装飾埋め込み ---------- */
.sgb-youtube {
  margin: 1.8em 0;
  max-width: 100%;
}
.sgb-youtube__frame {
  position: relative;
  border-radius: var(--sgb-radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  border: 4px solid var(--sgb-yt-accent, var(--sgb-accent));
}
.sgb-youtube__frame::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}
.sgb-youtube__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.sgb-youtube__caption {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 0.6em;
  font-size: 0.88em;
  font-weight: 700;
  color: var(--sgb-ink);
}
.sgb-youtube__caption::before {
  content: "▶";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 6px;
  background: var(--sgb-yt-accent, var(--sgb-accent));
  color: #fff;
  font-size: 10px;
}

/* ---------- 10) Googleマップ ---------- */
.sgb-map {
  margin: 1.8em 0;
  max-width: 100%;
}
.sgb-map__frame {
  position: relative;
  border-radius: var(--sgb-radius);
  overflow: hidden;
  border: 1px solid var(--sgb-line);
  box-shadow: var(--sgb-shadow);
}
.sgb-map__frame::before {
  content: "";
  display: block;
  padding-top: var(--sgb-map-ratio, 62%);
}
.sgb-map__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.sgb-map__caption {
  margin-top: 0.5em;
  font-size: 0.85em;
  color: var(--sgb-muted);
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.sgb-map__caption::before { content: "📍"; }

/* ---------- 11) 吹き出し会話（LINE風） ---------- */
.sgb-chat {
  margin: 1.8em 0;
  padding: 1.2em 1em;
  border-radius: var(--sgb-radius);
  background: var(--sgb-chat-bg, #7494c0);
  max-width: 100%;
}
.sgb-chat__row {
  display: flex;
  gap: 0.7em;
  margin-bottom: 1em;
  align-items: flex-start;
}
.sgb-chat__row:last-child { margin-bottom: 0; }
.sgb-chat__row--right { flex-direction: row-reverse; }
.sgb-chat__avatar {
  flex: 0 0 44px;
  text-align: center;
}
.sgb-chat__avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  display: block;
}
.sgb-chat__avatar--placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid #fff;
}
.sgb-chat__name {
  display: block;
  font-size: 0.68em;
  color: #fff;
  margin-top: 3px;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sgb-chat__bubble {
  position: relative;
  max-width: min(72%, 480px);
  padding: 0.7em 1em;
  border-radius: 16px;
  background: #fff;
  color: var(--sgb-ink);
  font-size: 0.95em;
  line-height: 1.65;
  overflow-wrap: break-word;
}
.sgb-chat__row--left .sgb-chat__bubble {
  border-top-left-radius: 4px;
}
.sgb-chat__row--left .sgb-chat__bubble::before {
  content: "";
  position: absolute;
  top: 8px;
  left: -8px;
  border: 6px solid transparent;
  border-right-color: #fff;
  border-left: 0;
}
.sgb-chat__row--right .sgb-chat__bubble {
  background: var(--sgb-chat-me, #8de055);
  border-top-right-radius: 4px;
}
.sgb-chat__row--right .sgb-chat__bubble::before {
  content: "";
  position: absolute;
  top: 8px;
  right: -8px;
  border: 6px solid transparent;
  border-left-color: var(--sgb-chat-me, #8de055);
  border-right: 0;
}
.sgb-chat__bubble p { margin: 0; }
@media (max-width: 480px) {
  .sgb-chat__bubble { max-width: 78%; }
}

/* ---------- 汎用：スマホ調整 ---------- */
@media (max-width: 600px) {
  .sgb-pricing { grid-template-columns: 1fr; }
}

/* ---------- 赤字太字（リッチテキスト書式） ---------- */
.sgb-red-bold {
  color: #e0245e;
  font-weight: 800;
}

/* =========================================================
   整列（左寄せ・中央寄せ・右寄せ）
   ブロックツールバーの整列ボタンで切り替え
   ========================================================= */
.sgb-align--left { text-align: left; }
.sgb-align--center { text-align: center; }
.sgb-align--right { text-align: right; }

/* --- flexレイアウトのブロックは中身も追従させる --- */

/* カウントダウン：数字ユニットの寄せ */
.sgb-countdown.sgb-align--left .sgb-countdown__units { justify-content: flex-start; }
.sgb-countdown.sgb-align--right .sgb-countdown__units { justify-content: flex-end; }

/* スライダー：ドットの寄せ */
.sgb-slider.sgb-align--left .sgb-slider__dots { justify-content: flex-start; }
.sgb-slider.sgb-align--right .sgb-slider__dots { justify-content: flex-end; }

/* タブ：整列指定時はタブ幅を内容に合わせ、指定方向へ寄せる */
.sgb-tabs.sgb-align--left .sgb-tabs__btn,
.sgb-tabs.sgb-align--center .sgb-tabs__btn,
.sgb-tabs.sgb-align--right .sgb-tabs__btn { flex: 0 0 auto; }
.sgb-tabs.sgb-align--left .sgb-tabs__nav { justify-content: flex-start; }
.sgb-tabs.sgb-align--center .sgb-tabs__nav { justify-content: center; }
.sgb-tabs.sgb-align--right .sgb-tabs__nav { justify-content: flex-end; }

/* 料金表：列内テキストの寄せを上書き（既定は中央） */
.sgb-pricing.sgb-align--left .sgb-pricing__col { text-align: left; }
.sgb-pricing.sgb-align--right .sgb-pricing__col { text-align: right; }
.sgb-pricing.sgb-align--right .sgb-pricing__features li {
  padding: 0.5em 1.6em 0.5em 0;
  text-align: right;
}
.sgb-pricing.sgb-align--right .sgb-pricing__features li::before {
  left: auto;
  right: 0.2em;
}

/* 著者プロフィール：中央/右指定時のリンク位置 */
.sgb-author.sgb-align--center .sgb-author__links { justify-content: center; }
.sgb-author.sgb-align--right .sgb-author__links { justify-content: flex-end; }

/* YouTube/マップ：キャプションの寄せ */
.sgb-youtube.sgb-align--center .sgb-youtube__caption,
.sgb-map.sgb-align--center .sgb-map__caption { justify-content: center; }
.sgb-youtube.sgb-align--right .sgb-youtube__caption,
.sgb-map.sgb-align--right .sgb-map__caption { justify-content: flex-end; }

/* タイムライン：日付列は右揃えを維持しつつ本文のみ追従 */
.sgb-timeline.sgb-align--center .sgb-timeline__date,
.sgb-timeline.sgb-align--right .sgb-timeline__date { text-align: right; }
