html {
    height: 100%;
    color: #00202b;
    background: linear-gradient(225deg, #0080aa 0%, #ffffff 100%) no-repeat;
    background-size: cover;
    overflow-y: scroll;
}

body {
    min-height: 100vh;
    animation: gradient-shift 4s 2 alternate cubic-bezier(0.65, 0, 0.35, 1);
    animation-delay: 2s;
    animation-fill-mode: both;
    background-size: cover;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-weight: 400;
    text-align: center;
    margin: 0;
    padding: 0 0 5rem;
    font-size: 16px;
    word-spacing: 0.5em;
    display: flex;
    flex-direction: column;
}

.logo-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1ch;
    white-space: nowrap;
    text-align: center;
    width: auto;
    margin: clamp(2rem, 4rem, 6rem) auto calc(0.5 * clamp(1rem, calc(80vw / 20), 4rem));
}

.logo-title img {
    height: calc(3 * clamp(1rem, calc(80vw / 20), 4rem));
    width: auto;
    margin: 0 clamp(0.5ch, 1ch, 2ch) 0 0;
    transform-origin: 50% 52%;
}

h1 {
    font-weight: 900;
    font-size: clamp(1rem, calc(70vw / 20), 4rem);
    letter-spacing: -0.1em;
    transform: scaleY(1.8);
    display: inline-block;
    line-height: 1;
    margin: 0 0.5ch 0 0;
}

.container {
    flex: 1;
    width: 70%;
    max-width: 1200px;
    margin: auto;
    padding: 0;
}

.menu-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin: 1.6rem 0 2rem;
    white-space: nowrap;
}

.menu-buttons button {
    background-color: #0080aa;
    color: #ffffff;
    border: none;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-weight: 800;
    text-rendering: optimizeLegibility;
    font-size: 1.3rem;
    padding: 0.4em 0.8em;
    border-radius: 2em;
    cursor: pointer;
    transition: background 0.3s ease-in-out, transform 0.2s ease-in-out;
}

.menu-buttons button:hover {
    background-color: #006080;
}

.menu-buttons button:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 32, 43, 0.3);
}

.menu-bigbuttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
    margin: 2.4rem 0 0;
    white-space: nowrap;
}

.menu-bigbuttons button {
    background-color: #ffffff;
    color: #0080aa;
    border: none;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-weight: 900;
    text-rendering: optimizeLegibility;
    font-size: 1.9rem;
    padding: 0.6em 0.8em;
    border-radius: 2em;
    cursor: pointer;
    transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
}

.menu-bigbuttons button:hover {
    background-color: #ffdf80;
    color: #006080;
}

.menu-bigbuttons button:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 32, 43, 0.3);
}

.menu-bigbuttons button.active, .menu-buttons button.active {
    opacity: 0.3;
    transition: opacity 0.3s ease-out;
    pointer-events: none;
}

.message-image {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 4rem 0;
    padding: 0;
}

.first-image {
    margin-top: 6rem;
}

.message-image img {
    width: 45%;
    max-width: 45%;
    height: auto;
    border-radius: 15%;
}

/* --- single-image のスタイル --- */
.message-image.single-image {
    justify-content: center;
    /* 画像を中央配置 */
    gap: 0;
    /* 余白をなくす */
    flex-direction: column;
    /* 画像を1枚だけ縦に配置 */
    align-items: center;
    /* 水平中央揃え */
}

.message-image.single-image img {
    width: 90%;
    max-width: 90%;
    height: auto;
    border-radius: calc(15% * 1024 / 1792) / 15%;
    /* 横の丸みを縦の15%と同じpxに */
}

.message-text {
    text-align: justify;
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 2rem 5%;
    padding: 0;
}

.rep {
    text-align: right;
    margin-bottom: 0;
}

section {
    visibility: hidden;
    text-align: justify;
    margin: 0;
    padding: 0;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease-in-out, height 0.3s ease-in-out;
}

#purpose {
    padding-top: 2.4rem;
}

footer {
    background: linear-gradient(to right, transparent 10%, #ffffff 30%, #ffffff 70%, transparent 90%);
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1;
    padding: 0.5rem;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
}

h2 {
    font-size: 2.4rem;
    font-weight: 900;
    margin: 2.4rem 0;
    padding: 0;
}

h3 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 2.4rem 2.4rem 2rem;
    padding: 0;
}

p, ul, ol {
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 2rem 2.4rem;
    padding: 0;
}

p img {
    margin: 0 1ch;
}

strong { font-weight: 800; }

em {
    font-style: italic;
    font-weight: 700;
}

.l { text-align: left; }

.c { text-align: center; }

.r { text-align: right; }

.theme-color-text { color: #00202b; }

.theme-color-bg1 { color: #0080aa; }

.theme-color-bg2 { color: #ffffff; }

a {
    color: #550040;
    text-decoration: underline;
    font-weight: 900;
    transition: color 0.3s, text-decoration 0.3s;
}

a:hover {
    color: #800060;
    text-decoration: underline;
}

ul {
    list-style: none;
    margin-left: 3.4rem;
}

ul li {
    position: relative;
    margin-bottom: 0.5em;
    padding-left: 0.5em;
}

ul li:before {
    content: "";
    position: absolute;
    top: 0.5em;
    left: -1em;
    width: 0.8em;
    height: 0.8em;
    background-color: #00202b;
    border-radius: 50%;
}

ol {
    list-style-type: decimal;
    margin-left: 4.4rem;
}

ol li {
    margin-bottom: 0.5em;
    padding-left: 0;
}

ol li::marker {
    font-weight: 800;
}

dl {
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 2rem 2.4rem -1rem;
}

dt {
    font-weight: 800;
    white-space: nowrap;
    margin: 0;
    display: inline-block;
    vertical-align: baseline;
}

dd {
    margin: 0 0 1em 5em;
    position: relative;
    top: -1.6em;
}

.logos {
    text-align: center;
}

.logos img {
    width: 200px;
    height: auto;
    margin: 0 1ch;
}

.members {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    padding-top: 0;
}

.member {
    border: 4px solid #0080aa;
    padding: 1rem;
    border-radius: 2rem;
    background: #fff4d5;
    text-align: center;
    box-shadow: none;
    transition: transform 0.2s ease-in-out;
}

.member img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 1.2rem;
}

.member h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 1rem 0 0;
}

.member p {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.6;
    margin: 0;
}

.text-container {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    margin: 1rem 1rem 1.5rem;
    text-align: center; /* デフォルトは中央寄せ */
    display: block;
    white-space: nowrap; /* 一時的に折り返しを防ぐ（JavaScriptで判定しやすくするため） */
}

.text-container.wrap {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    margin: 1rem 1rem 1.5rem;
    text-align: left; /* 折り返しが発生したら左寄せ */
    white-space: normal; /* 折り返しを許可 */
}

.dummy {
    opacity: 0.5;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.buttons a {
    display: inline-block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 2em;
    font-size: 1.4rem;
    font-weight: 800;
    transition: background 0.3s, transform 0.2s;
}

/* ボタン0 */
.buttons .button0 {
    background-color: #0080aa;
    color: #ffffff;
}

.buttons .button0:hover {
    background-color: #006080;
}

.buttons .button0:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 32, 43, 0.3);
}

/* ボタン1 */
.buttons .button1 {
    background-color: #aa2b00;
    color: #ffffff;
}

.buttons .button1:hover {
    background-color: #802000;
}

.buttons .button1:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 32, 43, 0.3);
}

/* ボタン2 */
.buttons .button2 {
    background-color: #aa8000;
    color: #ffffff;
}

.buttons .button2:hover {
    background-color: #806000;
}

.buttons .button2:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 32, 43, 0.3);
}

/* ボタン3 */
.buttons .button3 {
    background-color: #80aa00;
    color: #ffffff;
}

.buttons .button3:hover {
    background-color: #608000;
}

.buttons .button3:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 32, 43, 0.3);
}

.buttons span {
    display: inline-block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 2em;
    font-size: 1.4rem;
    font-weight: 800;
}

/* ボタン4 */
.buttons .button4 {
    background-color: #555555;
    color: #ffffff;
}

.history dd {
    margin: 0 0 0 10em;
}

.history dd.br {
    margin: -1.6em 0 0 10em;
}

/* ハンバーガーメニューのボタン */
.hamburger-menu {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 200;
}

/* 3本線のデザイン（☰） */
.hamburger-menu span {
    display: block;
    width: 80%;
    height: 4px;
    background: #00202b;
    /* 色を固定 */
    transition: all 0.3s ease-in-out;
    position: absolute;
}

.hamburger-menu span:nth-child(1) {
    top: 8px;
}

.hamburger-menu span:nth-child(2) {
    top: 20px;
}

.hamburger-menu span:nth-child(3) {
    top: 32px;
}

/* メニューが開いた時のクロスアニメーション（✖） */
.hamburger-menu.active span:nth-child(1) {
    transform: translateY(12px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-12px) rotate(-45deg);
}

/* スマホ用のメニュー */
.mobile-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 250px;
    height: auto;
    max-height: 90vh;
    /* 画面の90%までの高さに制限 */
    overflow-y: auto;
    /* 必要に応じてスクロール */
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    box-shadow: -4px 0px 10px rgba(0, 0, 0, 0.1);

    /* 初期状態では完全に画面外に隠す */
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 150;
}

/* メニュー表示時 */
.mobile-menu.active {
    transform: translateX(0);
}

/* メニューのボタン */
.mobile-menu button {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 1.2rem;
    /* 少し小さくしてコンパクトに */
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-weight: 800;
    text-rendering: optimizeLegibility;
    padding: 0.4rem;
    margin: 0.4rem 0;
    border: none;
    background: #0080aa;
    color: #ffffff;
    border-radius: 2em;
    transition: background 0.3s ease-in-out, transform 0.2s ease-in-out;
}

.mobile-menu button:hover {
    background: #006080;
    transform: scale(0.95);
    transition: all 0.3s ease-in-out;
}

.mobile-menu button:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 32, 43, 0.3);
}

/* スマホメニューのボタンの通常色 */
.mobile-menu button {
    background-color: #0080aa;
    /* PCメニューと統一 */
    color: #ffffff;
    border-radius: 2em;
    transition: background 0.3s ease-in-out;
}

/* アクティブ（選択中）のボタンを薄い色にする */
.mobile-menu button.active {
    background-color: #006080;
    /* PCのアクティブ状態と統一 */
    opacity: 0.5;
}

/* hoverやactiveの効果を無効化 */
.mobile-menu button:hover,
.mobile-menu button:active {
    background-color: #0080aa;
    opacity: 1;
}

/* --- --- --- タブレット対応 --- --- --- */
@media screen and (max-width: 768px) {
    .container {
        width: 75%;
    }
}

/* --- --- --- スマホ対応 --- --- --- */
@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
        padding: 0;
    }

    .logo-title {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin: clamp(2rem, 2.5rem, 3rem) auto calc(1.2 * clamp(1rem, calc(90vw / 20), 2rem));
    }

    .logo-title img {
        width: auto;
        height: calc(10 * clamp(1rem, calc(90vw / 20), 2rem));
        margin: 1.5rem 0;
    }

    h1 {
        font-size: clamp(1rem, calc(90vw / 20), 2rem);
        text-align: center;
        margin: 0.5rem 0 0;
    }

    .container {
        width: 80%;
        padding: 0 0 5rem;
    }

    .hamburger-menu {
        display: block;
    }

    .menu-buttons {
        display: none;
    }

    .menu-bigbuttons {
        display: flex;
        justify-content: center;
        gap: 0.8em;
        flex-wrap: wrap;
        margin-bottom: 2rem;
    }

    .menu-bigbuttons button {
        font-size: 1.4rem;
        padding: 0.6em;
        border-radius: 2em;
        text-align: center;
        flex-grow: 1;
        /* ボタンサイズを均等に */
    }

    /* 1行目の「正会員と教材集」を中央配置 */
    .menu-bigbuttons button:first-child {
        flex-basis: 100%;
        /* 幅を100%にして1行占有 */
        text-align: center;
    }

    /* 2行目の「利用会員」と「活動実績」は左右に並べる */
    .menu-bigbuttons button:nth-child(2),
    .menu-bigbuttons button:nth-child(3) {
        flex-basis: calc(50% - 0.8em);
        /* 50%にして2つ横並び */
        text-align: center;
    }

    .message-image {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 4rem 0;
    }

    .first-image {
        flex-direction: column-reverse;
    }

    .message-image img {
        width: 90%;
        max-width: 90%;
    }

    .message-image.single-image img {
        width: 100%;
        max-width: 100%;
    }

    .message-text {
        margin: 2rem 0;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .message-text.rep {
        margin-bottom: -1rem;
        padding-bottom: 0;
    }

    .message-text.rep + * {
        margin-top: 0 !important;
    }

    footer {
        font-size: 0.9rem;
        background: #ffffff;
        padding: 0.5ch 1.5ch 0.5ch 0;
        box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    h2 {
        font-size: 1.6rem;
        margin: 0 0 2rem;
    }

    h3 {
        font-size: 1.2rem;
        margin: 2rem 0;
    }

    p, ul, ol {
        margin: 2rem 0;
    }

    ul {
        margin-left: 1.4rem;
    }

    ol {
        margin-left: 2.4rem;
    }

    dl {
        margin: 2rem 0;
    }

    dt {
        white-space: normal;
        display: block;
        text-align: left;
        margin: 2rem 0 1rem;
    }

    dd {
        position: static;
        text-align: left;
        margin: 1rem 0;
    }

    .history dd {
        margin-left: 0;
    }
}
