/* ===== ベース（背景なし） ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP",
               "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: #0b1026;
  background: #f5f7fb;   /* 背景なしでも読みやすい薄グレー */
  overflow-x: clip;
}

/* ===== 変数（幅はここで集中管理） ===== */
:root{
  --space-ink:#0b1026;
  --space-accent1:#7bd3ff;
  --space-accent2:#b7a8ff;

  --section-gap: clamp(40px, 8vh, 120px);
  --section-pad: clamp(16px, 3.8vw, 44px);

  /* 幅プリセット */
  --w-xs: 560px;
  --w-sm: 720px;
  --w-md: 860px;
  --w-lg: 1000px;
  --w-xl: 1140px;

  /* 既定の最大幅（モバイル〜タブレットは数値、PCは下の@mediaで90vwに） */
  --section-max: var(--w-md);

  /* カードの透明度（背景なし前提で濃いめ） */
  --panel-alpha: .94;
}

/* 画面幅ごとの既定最大幅（PCは90%に広げる） */
@media (max-width: 480px){
  :root{ --section-max: 92vw; --section-pad: clamp(16px, 4.5vw, 28px); }
}
@media (min-width: 481px) and (max-width: 767px){
  :root{ --section-max: 92vw; }
}
@media (min-width: 768px) and (max-width: 1023px){
  :root{ --section-max: var(--w-sm); }
}
/* ★ PC幅では最大幅＝画面の90%（90vw） */
@media (min-width: 1024px){
  :root{ --section-max: 90vw; }
}

/* ===== セクション単位の幅指定（任意） ===== */
.cosmic-section.w-xs{ --section-max: var(--w-xs); }
.cosmic-section.w-sm{ --section-max: var(--w-sm); }
.cosmic-section.w-md{ --section-max: var(--w-md); }
.cosmic-section.w-lg{ --section-max: var(--w-lg); }
.cosmic-section.w-xl{ --section-max: var(--w-xl); }

/* ★ このクラスを付けたセクションは常に最大幅90% */
.cosmic-section.w-90{ --section-max: 90vw; }

/* ===== セクション（中央寄せ＋カード） ===== */
.cosmic-section{
  /* 幅：画面から安全余白を引きつつ、最大幅は --section-max */
  width: min(100% - 3rem, var(--section-max));
  margin-inline: auto;                  /* 中央寄せ */
  margin-block: var(--section-gap);     /* セクション間隔 */
  padding: var(--section-pad);
  position: relative;
  z-index: 0;

  background: rgba(255,255,255,var(--panel-alpha));
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border-radius: 22px;
  border: 1px solid rgba(0,0,0,.05);
  box-shadow:
    0 18px 40px rgba(6,12,38,.10),
    inset 0 1px 0 rgba(255,255,255,.65);
  color: var(--space-ink);
}
@supports not (backdrop-filter: blur(10px)){
  .cosmic-section{ background:#ffffff; }
}

/* ほのかな縁取り（宇宙っぽさを少しだけ） */
.cosmic-section::before{
  content:"";
  position:absolute; inset:-2px; border-radius:inherit; z-index:-1;
  background: conic-gradient(from 180deg at 50% 50%,
    rgba(123,211,255,.12),
    rgba(183,168,255,.10),
    rgba(123,211,255,.12));
  filter: blur(14px);
  opacity:.75;
}

/* 見出し */
.cosmic-section h2{
  margin: 0 0 .7em;
  font-size: clamp(1.8rem, 4.8vw, 2.6rem);
  line-height: 1.22;
  text-align: center;
  letter-spacing: .02em;
  color: var(--space-ink);
}

/* 見出し下の点線（星っぽいアクセント） */
.cosmic-section h2::after{
  content:"";
  display:block;
  height: 12px;
  margin: .6em auto 0;
  width: min(92%, 760px);
  background:
    radial-gradient(circle at 8px 50%, var(--space-accent1) 3px, transparent 4px) 0 0 / 26px 12px repeat-x,
    radial-gradient(circle at 22px 50%, var(--space-accent2) 2px, transparent 3px) 0 0 / 26px 12px repeat-x,
    linear-gradient(to right, transparent, rgba(0,0,0,.08), transparent) 0 100% / 100% 2px no-repeat;
}

/* 本文（左寄せ＋行長制御） */
.cosmic-section p{
  margin: .25em auto 0;
  /*max-width: 68ch;*/
  font-size: clamp(1.02rem, 2.2vw, 1.28rem);
  line-height: 1.95;
  letter-spacing: .03em;
  text-align: left;
  text-justify: inter-ideograph;
}

/* 連続セクションの間隔を揃える */
.cosmic-section + .cosmic-section{
  margin-top: var(--section-gap);
}








/* ===== ベース（背景なし） ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP",
               "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: #0b1026;
  background: #f5f7fb;   /* 背景なしでも読みやすい薄グレー */
  overflow-x: clip;
}

/* ===== 変数（幅はここで集中管理） ===== */
:root{
  --space-ink:#0b1026;
  --space-accent1:#7bd3ff;
  --space-accent2:#b7a8ff;

  --section-gap: clamp(40px, 8vh, 120px);
  --section-pad: clamp(16px, 3.8vw, 44px);

  /* 幅プリセット */
  --w-xs: 560px;
  --w-sm: 720px;
  --w-md: 860px;
  --w-lg: 1000px;
  --w-xl: 1140px;

  /* 既定の最大幅（モバイル〜タブレットは数値、PCは下の@mediaで90vwに） */
  --section-max: var(--w-md);

  /* カードの透明度（背景なし前提で濃いめ） */
  --panel-alpha: .94;
}

/* 画面幅ごとの既定最大幅（PCは90%に広げる） */
@media (max-width: 480px){
  :root{
    --section-max: 92vw;
    --section-pad: clamp(14px, 4.8vw, 24px); /* モバイルは少しコンパクト */
    --section-gap: clamp(24px, 6vh, 64px);
  }
}
@media (min-width: 481px) and (max-width: 767px){
  :root{ --section-max: 92vw; --section-gap: clamp(28px, 7vh, 80px); }
}
@media (min-width: 768px) and (max-width: 1023px){
  :root{ --section-max: var(--w-sm); }
}
/* ★ PC幅では最大幅＝画面の90%（90vw） */
@media (min-width: 1024px){
  :root{ --section-max: 90vw; }
}

/* ===== セクション単位の幅指定（任意） ===== */
.cosmic-section.w-xs{ --section-max: var(--w-xs); }
.cosmic-section.w-sm{ --section-max: var(--w-sm); }
.cosmic-section.w-md{ --section-max: var(--w-md); }
.cosmic-section.w-lg{ --section-max: var(--w-lg); }
.cosmic-section.w-xl{ --section-max: var(--w-xl); }

/* ★ このクラスを付けたセクションは常に最大幅90% */
.cosmic-section.w-90{ --section-max: 90vw; }

/* ===== セクション（中央寄せ＋カード） ===== */
.cosmic-section{
  /* 幅：画面から安全余白を引きつつ、最大幅は --section-max */
  width: min(100% - 3rem, var(--section-max));
  margin-inline: auto;                  /* 中央寄せ */
  margin-block: var(--section-gap);     /* セクション間隔 */
  padding: var(--section-pad);
  position: relative;
  z-index: 0;

  background: rgba(255,255,255,var(--panel-alpha));
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border-radius: 22px;
  border: 1px solid rgba(0,0,0,.05);
  box-shadow:
    0 18px 40px rgba(6,12,38,.10),
    inset 0 1px 0 rgba(255,255,255,.65);
  color: var(--space-ink);
}

/* ガラス未対応のフォールバック */
@supports not (backdrop-filter: blur(10px)){
  .cosmic-section{ background:#ffffff; }
}

/* ほのかな縁取り（宇宙っぽさを少しだけ） */
.cosmic-section::before{
  content:"";
  position:absolute; inset:-2px; border-radius:inherit; z-index:-1;
  background: conic-gradient(from 180deg at 50% 50%,
    rgba(123,211,255,.12),
    rgba(183,168,255,.10),
    rgba(123,211,255,.12));
  filter: blur(14px);
  opacity:.75;
}

/* 見出し */
.cosmic-section h2{
  margin: 0 0 .7em;
  font-size: clamp(1.6rem, 5.5vw, 2.4rem); /* ほんの少し下限↓でスマホ収まり良く */
  line-height: 1.22;
  text-align: center;
  letter-spacing: .02em;
  color: var(--space-ink);
}

/* 見出し下の点線（星っぽいアクセント） */
.cosmic-section h2::after{
  content:"";
  display:block;
  height: 12px;
  margin: .6em auto 0;
  width: min(92%, 760px);
  background:
    radial-gradient(circle at 8px 50%, var(--space-accent1) 3px, transparent 4px) 0 0 / 26px 12px repeat-x,
    radial-gradient(circle at 22px 50%, var(--space-accent2) 2px, transparent 3px) 0 0 / 26px 12px repeat-x,
    linear-gradient(to right, transparent, rgba(0,0,0,.08), transparent) 0 100% / 100% 2px no-repeat;
}

/* 本文（左寄せ＋行長制御） */
.cosmic-section p{
  margin: .25em auto 0;
  /* max-width はPC/タブレットでは適用、スマホは解除気味に */
  max-width: 68ch;
  font-size: clamp(1rem, 4.2vw, 1.24rem); /* スマホで少し大きめに見えるよう調整 */
  line-height: 1.95;
  letter-spacing: .03em;
  text-align: left;
  text-justify: inter-ideograph;
  overflow-wrap: anywhere; /* 狭小端末でのはみ出し防止 */
}

/* 連続セクションの間隔を揃える */
.cosmic-section + .cosmic-section{
  margin-top: var(--section-gap);
}

/* ===== スマホ最適化（～640px） ===== */
@media (max-width: 640px){
  .cosmic-section{
    width: min(96vw, var(--section-max)); /* 端の余白をやや広めに確保 */
    border-radius: 16px;
    box-shadow:
      0 12px 26px rgba(6,12,38,.10),
      inset 0 1px 0 rgba(255,255,255,.65);
    /* モバイルは描画負荷を下げる（ガラス効果OFF） */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #fff;
    /* iOSのノッチ安全領域 */
    padding-left: max(var(--section-pad), env(safe-area-inset-left));
    padding-right: max(var(--section-pad), env(safe-area-inset-right));
  }

  .cosmic-section::before{
    filter: blur(12px);
    opacity:.6; /* 縁どり控えめ */
  }

  .cosmic-section h2{
    font-size: clamp(1.4rem, 6vw, 1.9rem);
    margin-bottom: .6em;
  }

  .cosmic-section h2::after{
    height: 10px;
    background:
      radial-gradient(circle at 8px 50%, var(--space-accent1) 2.5px, transparent 3.5px) 0 0 / 22px 10px repeat-x,
      radial-gradient(circle at 20px 50%, var(--space-accent2) 2px, transparent 3px) 0 0 / 22px 10px repeat-x,
      linear-gradient(to right, transparent, rgba(0,0,0,.08), transparent) 0 100% / 100% 2px no-repeat;
  }

  .cosmic-section p{
    max-width: none;                 /* 画面幅いっぱいで読みやすく */
    font-size: clamp(0.98rem, 4.4vw, 1.12rem);
    line-height: 1.9;
  }
}

/* 動きを抑えたいユーザー設定に配慮 */
@media (prefers-reduced-motion: reduce){
  .cosmic-section::before{ filter: none; }
}
