.ggb-stats {
  /* ---- 色の変数まとめ。ここだけ変えれば全体の配色を調整できる ---- */
  --ggb-green: #00871e;   /* 背景・ラベル文字のグリーン */
  --ggb-orange: #FF5A00;  /* 数字のオレンジ */
  --ggb-gray: #C1C8CE;    /* アイコンのグレー */
  --ggb-white: #FFFFFF;

  background-color: var(--ggb-green);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  box-sizing: border-box;
}
.ggb-stats *,
.ggb-stats *::before,
.ggb-stats *::after {
  box-sizing: inherit;
  font-family: "Noto Sans JP", sans-serif;
}

/* ---- コンテンツ幅1000pxで中央寄せ ---- */
.ggb-stats__inner {
  max-width: 870px;
  margin: 0 auto;
  padding: 48px 24px;
}

.ggb-stats__title {
  color: var(--ggb-white);
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 32px;
  line-height: 1.4;
}
.ggb-stats__date {
  font-size: 18px;
  font-weight: 500;
  margin-left: 4px;
}

/* ---- グリッド本体 ----
   6列を基準に、幅広カード(上段2枚)は span 3、通常カードは span 2 にすることで
   「上段2カラム / 下段3カラム」を1つのgridで再現している。 */
.ggb-stats__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.ggb-card--wide   { grid-column: span 3; }
.ggb-card--normal { grid-column: span 2; }

/* ---- モバイル(640px以下): 全カード2列固定 ----
   9枚(通常カード)は3の倍数なので2列だと最後の1枚だけ余るが、
   ご指定どおり「気にせず自然に折り返す」実装。 */
@media (max-width: 640px) {
  .ggb-stats__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .ggb-card--wide,
  .ggb-card--normal {
    grid-column: span 1;
  }
  .ggb-stats__title { font-size: 22px; }
  .ggb-stats__inner { padding: 32px 16px; }
}

/* ---- カード共通スタイル ---- */
.ggb-card {
    background-color: var(--ggb-white);
    border-radius: 4px;
    padding: 24px 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 120px;
}
/* アイコンは元SVGの縦横比がバラバラ(横長〜縦長)なので、
   「高さを固定して幅は自動」にすることでアイコンごとに歪まないようにしている。
   横に並べたときの見え方を揃えたいだけなら、この height の値だけ調整すればOK。 */
.ggb-card__icon {
  height: 40px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-end; /* アイコンの高さが違っても、下端(ベースライン)を揃えて並べる */
  justify-content: center;
}
.ggb-card__icon img {
  height: 100%;
  width: auto;
  max-width: 100%; /* 極端に横長のアイコンがカードからはみ出さないための保険 */
  display: block;
}

.ggb-card__label {
  color: var(--ggb-green);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.ggb-card__label.lefts{
text-align: left;
margin: 0 1em 6px 0;
}

.ggb-card__num-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  margin: 0;
}
.ggb-card__num-wrap--ratio {
  gap: 4px;
}

.ggb-num {
    color: var(--ggb-orange);
    font-weight: 700;
    font-size: 58px;
    font-variant-numeric: tabular-nums;
    line-height: 0.8em;
}
.ggb-card__unit {
  color: var(--ggb-green);
  font-weight: 700;
  font-size: 16px;
  margin-left: 2px;
}
.ggb-card__colon {
  color: var(--ggb-green);
  font-weight: 700;
  font-size: 28px;
}

/* 幅広カード(創業年数)の数字は少し大きめに */
.ggb-card--wide .ggb-num { font-size: 64px; }

/* ---- 円グラフカード ---- */
.ggb-card--pie {
  padding: 20px 16px;
}
.ggb-card__pie-title {
    color: var(--ggb-green);
    font-weight: 700;
    font-size: 18px;
    margin: 12px 0 0px;
}
.ggb-pie-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* ラベルが円の外側にはみ出すので、はみ出し分の余白を確保しておく */
  padding: 12px;
}
.ggb-pie {
  width: 190px;
  height: 190px;
  flex-shrink: 0;
}
.ggb-pie svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible; /* viewBoxの外(=円の外側)にラベルが出ても隠れないようにする */
}

/* ---- 円グラフの外側に出るラベル(「20代」「60%」など) ----
   SVGの<text>要素に対して、通常のHTML要素と同じようにopacityで
   フェードインアニメーションをかけている(対応ブラウザは十分広い) */
.ggb-pie-label {
  font-family: inherit;
  font-weight: 700;
  opacity: 0;
  transition: opacity .5s ease;
}
.ggb-pie-label.is-visible {
  opacity: 1;
}
.ggb-pie-label__name {
  font-size: 11px;
  fill: #ffffff;
}
.ggb-pie-label__num {
  font-size: 15px;
  fill: #ffffff;
}



.ggb-stats__grid .ggb-card:nth-of-type(1) .ggb-card__icon {
    max-height: 100px;
    height: 100%;
    max-width: 130px;
    width: 100%;
}

.ggb-stats__grid .ggb-card:nth-of-type(2) {position: relative;align-items: flex-start;}
.ggb-stats__grid .ggb-card:nth-of-type(2) .ggb-pie-wrap {
    position: absolute;
    z-index: 99;
    top: -80px;
    right: 0%;
    width: fit-content;
}
.ggb-stats__grid .ggb-card:nth-of-type(2) .ggb-pie {
    width: 280px;
    height: 280px;
    flex-shrink: 0;
}

.ggb-stats__grid .ggb-card:nth-of-type(2) .ggb-card__icon{}
.ggb-stats__grid .ggb-card:nth-of-type(3) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(4) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(5) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(6) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(7) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(8) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(9) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(10) .ggb-card__icon{height: auto;}
.ggb-stats__grid .ggb-card:nth-of-type(11) .ggb-card__icon{height: auto;}



.ggb-stats__grid .ggb-card:nth-of-type(1) .ggb-card__label {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
}
.ggb-stats__grid .ggb-card:nth-of-type(2) .cad_label_box{}
.ggb-stats__grid .ggb-card:nth-of-type(3) .cad_label_box {
    display: flex;
    align-items: flex-end;
}
.ggb-stats__grid .ggb-card:nth-of-type(4) .cad_label_box{}
.ggb-stats__grid .ggb-card:nth-of-type(5) .cad_label_box {
    display: flex;
    align-items: flex-end;
}
.ggb-stats__grid .ggb-card:nth-of-type(6) .cad_label_box{}
.ggb-stats__grid .ggb-card:nth-of-type(7) .cad_label_box{}
.ggb-stats__grid .ggb-card:nth-of-type(8) .cad_label_box {
    display: flex;
    align-items: flex-end;
}
.ggb-stats__grid .ggb-card:nth-of-type(9) .cad_label_box {
    display: flex;
    align-items: flex-end;
}
.ggb-stats__grid .ggb-card:nth-of-type(10) .cad_label_box {
    display: flex;
    align-items: flex-end;
}
.ggb-stats__grid .ggb-card:nth-of-type(11) .cad_label_box {
    display: flex;
    align-items: flex-end;
}


@media (max-width: 880px) {
 .ggb-stats__grid .ggb-card:nth-of-type(2){
    justify-content: flex-end;
 }

}



@media (max-width: 720px) {

.ggb-stats__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.ggb-card--wide {
    grid-column: span 4;
}

.ggb-stats__grid .ggb-card:nth-of-type(2) {
    justify-content: flex-end;
    flex-direction: column-reverse;
}

.ggb-stats__grid .ggb-card:nth-of-type(2) .ggb-pie-wrap {
    position: relative;
    z-index: auto;
    /* top: auto; */
    /* right: auto; */
    width: 100%;
    /* bottom: 0; */
    max-width: 360px; 
    margin: 40px auto -120px;
}

.ggb-stats__grid .ggb-card:nth-of-type(2) .ggb-pie {
    width: 100%;
    height: auto;
    flex-shrink: 0;
}

.ggb-stats__grid .ggb-card:nth-of-type(2) .ggb-card__pie-title {
    width: 100%;
    font-size: 18px;
}


}



@media (max-width: 640px) {
  .ggb-pie { width: 160px; height: 160px; }
  .ggb-pie-label__name { font-size: 10px; }
  .ggb-pie-label__num { font-size: 13px; }

.ggb-stats__grid {
    grid-template-columns: repeat(2, 1fr);
}

.ggb-card--wide {
    grid-column: span 2;
}

}



@media (max-width: 520px){
    .ggb-stats__grid {
        grid-template-columns: repeat(1, 1fr);
    }

}


@media (max-width: 480px) {

.ggb-card--wide {
    grid-column: span 1;
}

}






/* ---- アニメーションを減らす設定の人向け ----
   カウントアップや円グラフの動きが不要な場合はここで無効化 */
@media (prefers-reduced-motion: reduce) {
  .ggb-pie-label {
    transition: none;
  }
}