/* === 基本設定 === */
:root {
    --brand-color: #007bff;
    --brand-color-dark: #0056b3;
    --brand-color-light: #e6f2ff;
    --bg-color: #f4f7f6;
    --section-bg: #ffffff;
    --card-bg: #ffffff;
    --text-color: #333;
    --text-heading-color: #111;
    --text-light: #555;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.05);

    /* ★アニメーション用 (ダークヘッダー) */
    --hero-bg-color: #2c3e50;
    --hero-text-color: #ffffff;
    --hero-subtext-color: #bdc3c7;
}

body {
    font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* ★アニメーションによる横スクロール防止 */
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === ヘッダー (トップページと共通) === */
.header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: relative;
    z-index: 10;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-heading-color);
    text-decoration: none;
}

.header-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 15px;
}

.header-nav ul li {
    width: 80px;
    text-align: center;
}

.header-nav a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}

.header-nav a:hover {
    color: var(--brand-color);
}

/* === ページ メインコンテンツ === */

/* ページヘッダー */
.page-header {
    background-color: var(--hero-bg-color);
    text-align: center;
    padding: 40px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* ★★★ ここから: セクション共通スタイル (お知らせページ等) ★★★ */

/* セクション共通 */
.section {
    padding: 60px 0;
    position: relative;
    z-index: 2;
    background-color: var(--section-bg);
    border-bottom: 1px solid #e0e0e0;
}

/* 下層ページ（お知らせページなど）用の背景色調整 */
main .section {
    background-color: var(--bg-color);
}

main .section:first-child {
    background-color: var(--section-bg);
}

/* セクション見出し (「お知らせ」など) */
.section-heading {
    text-align: center;
    font-size: clamp(26px, 5vw, 32px);
    font-weight: 700;
    color: var(--brand-color);
    margin-top: 0;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

.section-heading::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--brand-color);
    border-radius: 2px;
}

/* セクションのリード文 */
.section-lead {
    font-size: 16px;
    color: var(--text-light);
    text-align: center;
    max-width: 700px;
    margin: -20px auto 40px;
    line-height: 1.7;
}

/* ★★★ ここまで: セクション共通スタイル ★★★ */


/* アニメーションのCSS (page-header用) */
.math-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 0;
    }

    20% {
        opacity: 0.3;
    }

    80% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-200px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes floatSide {
    0% {
        transform: translateX(-50px) translateY(50px);
        opacity: 0;
    }

    20% {
        opacity: 0.2;
    }

    50% {
        transform: translateX(50px) translateY(-50px);
        opacity: 0.2;
    }

    80% {
        opacity: 0;
    }

    100% {
        transform: translateX(-50px) translateY(50px);
        opacity: 0;
    }
}

@keyframes scaleFade {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.2;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.math-animation span {
    position: absolute;
    top: 100%;
    font-size: 24px;
    font-weight: 700;
    color: var(--hero-text-color);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    opacity: 0;
    animation-fill-mode: both;
}

.math-animation span:nth-child(1) {
    left: 10%;
    animation: floatUp 15s infinite linear;
    font-size: 20px;
}

.math-animation span:nth-child(2) {
    left: 20%;
    animation: floatUp 18s infinite linear 3s;
    font-size: 30px;
}

.math-animation span:nth-child(3) {
    left: 30%;
    animation: floatSide 12s infinite ease-in-out 8s;
    font-size: 16px;
    top: 20%;
}

.math-animation span:nth-child(4) {
    left: 40%;
    animation: floatUp 16s infinite linear 5s;
    font-size: 24px;
}

.math-animation span:nth-child(5) {
    left: 50%;
    animation: scaleFade 10s infinite ease-out 11s;
    font-size: 20px;
    top: 50%;
}

.math-animation span:nth-child(6) {
    left: 60%;
    animation: floatUp 14s infinite linear 1s;
    font-size: 32px;
}

.math-animation span:nth-child(7) {
    left: 70%;
    animation: floatSide 13s infinite ease-in-out 6s;
    font-size: 18px;
    top: 10%;
}

.math-animation span:nth-child(8) {
    left: 80%;
    animation: floatUp 17s infinite linear 9s;
    font-size: 28px;
}

.math-animation span:nth-child(9) {
    left: 90%;
    animation: scaleFade 9s infinite ease-out 4s;
    font-size: 22px;
    top: 70%;
}

.math-animation span:nth-child(10) {
    left: 5%;
    animation: floatUp 20s infinite linear 2s;
    font-size: 25px;
}

.math-animation span:nth-child(11) {
    left: 15%;
    animation: scaleFade 11s infinite ease-out 7s;
    font-size: 19px;
    top: 30%;
}

.math-animation span:nth-child(12) {
    left: 25%;
    animation: floatSide 14s infinite ease-in-out 10s;
    font-size: 27px;
    top: 80%;
}

.math-animation span:nth-child(13) {
    left: 35%;
    animation: floatUp 19s infinite linear 4s;
    font-size: 21px;
}

.math-animation span:nth-child(14) {
    left: 45%;
    animation: floatSide 10s infinite ease-in-out 0s;
    font-size: 35px;
    top: 60%;
}

.math-animation span:nth-child(15) {
    left: 55%;
    animation: scaleFade 13s infinite ease-out 6s;
    font-size: 23px;
    top: 40%;
}

.math-animation span:nth-child(16) {
    left: 65%;
    animation: floatUp 21s infinite linear 8s;
    font-size: 29px;
}

.math-animation span:nth-child(17) {
    left: 75%;
    animation: floatSide 11s infinite ease-in-out 2s;
    font-size: 17px;
    top: 90%;
}

.math-animation span:nth-child(18) {
    left: 85%;
    animation: floatUp 15s infinite linear 12s;
    font-size: 31px;
}

.page-header .container {
    position: relative;
    z-index: 2;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--hero-text-color);
    margin-top: 0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header h1 i {
    font-size: 28px;
    margin-right: 15px;
    color: var(--hero-text-color);
}

.page-header p {
    font-size: 18px;
    color: var(--hero-subtext-color);
    margin-bottom: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ゲーム一覧セクション */
.game-section {
    padding: 60px 0;
}

/* 小見出し */
.content-subheading {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-heading-color);
    margin: 0 0 20px 0;
    padding-left: 10px;
    border-left: 4px solid var(--brand-color);
}

.content-subheading:not(:first-child) {
    margin-top: 40px;
}

/* ゲームグリッド (PC) */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    align-items: stretch;
}

@keyframes fadeInUps {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ゲームカード (PC) */
.game-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    box-sizing: border-box;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 1px 3px var(--shadow-color);
    animation: fadeInUps 0.5s ease-out backwards;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    position: relative;
    z-index: 2;
}

.game-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* カード本文エリア */
.game-card-body {
    padding: 24px 20px 20px 20px;
    text-align: center;
    flex-grow: 1;
}

.game-card-body img {
    display: block;
    width: 100%;
    margin-bottom: 1em;
    height: 320px;
    object-fit: cover;
}

.game-card h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-heading-color);
    margin: 0 0 10px 0;
    transition: color 0.3s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.game-card h2 i {
    font-size: 28px;
    margin-right: 0;
    margin-bottom: 10px;
    color: var(--brand-color);
    transition: transform 0.3s ease;
}

.game-card:hover h2 {
    color: var(--brand-color);
}

.game-card:hover h2 i {
    transform: scale(1.15);
}

.game-card p {
    font-size: 15px;
    color: var(--text-light);
    margin: 0;
}

/* カードフッターエリア (ボタン用) */
.game-card-footer {
    padding: 0 20px 20px 20px;
    text-align: right;
}

/* 「コードを見る」ボタン */
.code-link {
    display: inline-flex;
    /* display: none; */
    align-items: center;
    padding: 6px 10px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-light);
    font-size: 13px;
    transition: all 0.3s ease;
    text-decoration: none;
    z-index: 3;
    position: relative;
}

.code-link:hover {
    background-color: var(--brand-color-light);
    color: var(--brand-color);
    border-color: var(--brand-color);
}

.code-link i {
    margin-right: 6px;
    font-size: 14px;
}


/* ★★★ ここから: お知らせリスト (news.html と共通) ★★★ */
.news-list {
    max-width: 700px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    /* 角丸のため */
    background: var(--card-bg);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.news-list ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.news-list li {
    border-bottom: 1px solid var(--border-color);
}

.news-list li:last-child {
    border-bottom: none;
}

.news-list li a {
    display: flex;
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.3s;
    flex-wrap: nowrap;
    /* スマホで折り返す用 */
}

.news-list li a:hover {
    background-color: var(--brand-color-light);
}

.news-list li a .date {
    font-size: 15px;
    color: var(--text-light);
    margin-right: 20px;
    flex-shrink: 0;
    /* 縮まないように */
    font-weight: 500;
}

.news-list li a .title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-heading-color);
    flex-grow: 1;
    /* 残りの幅をすべて使う */
}

/* ★★★ ここまで: お知らせリスト ★★★ */


/* === フッター (トップページと共通) === */
.footer {
    padding: 40px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 0;
    position: relative;
    z-index: 2;
    background-color: var(--bg-color);
    border-top: 1px solid #e0e0e0;
}

/* === スマホ対応 (3列均一) === */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 26px;
    }

    .page-header p {
        font-size: 16px;
    }

    /* ★★★ ここから: セクション共通 (スマホ) ★★★ */
    .section {
        padding: 40px 0;
    }

    .section-heading {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .section-lead {
        font-size: 15px;
        margin-bottom: 30px;
    }

    /* ★★★ ここまで: セクション共通 (スマホ) ★★★ */

    .game-section {
        padding: 40px 0;
    }

    .game-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .game-card {
        padding: 10px;
        height: auto;
        box-sizing: border-box;
        justify-content: flex-start;
        /* 上から配置するように変更 */
        padding-bottom: 30px;
        /* ボタン用のスペースを確保 */
    }

    .game-card-body {
        padding: 0;
        flex-grow: 0;
    }

    /* ▼▼▼ 画像のサイズ調整スタイルを追加 ▼▼▼ */
    .game-card-body img {
        width: 100%;
        /* height: auto; */
        height: 60px;
        object-fit: cover;
        /* アスペクト比を維持 */
        margin-bottom: 8px;
        /* 画像とタイトルの間隔 */
    }

    .game-card h2 {
        font-size: 14px;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        margin: 0;
    }

    .game-card h2 i {
        font-size: 22px;
        margin-bottom: 5px;
    }

    .game-card p {
        display: none;
    }

    .game-card-footer {
        padding: 0;
        margin-top: 1em;
    }

    .code-link {
        position: absolute;
        bottom: 4px;
        right: 4px;
        padding: 3px 5px;
        font-size: 10px;
    }

    .code-link i {
        margin-right: 4px;
        font-size: 10px;
    }

    .header .container {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .game-grid {
        margin: 0 10px;
    }

    .game-card h2 {
        font-size: 12px;
    }

    .game-card h2 i {
        font-size: 20px;
    }

    /* ★★★ ここから: お知らせリスト (スマホ対応) ★★★ */
    .news-list li a {
        padding: 15px;
        /* flex-direction: column; */
        /* 縦積みに変更 */
    }

    .news-list li a .date {
        margin-right: 0;
        margin-bottom: 8px;
        /* 日付とタイトルの間隔 */
        font-size: 14px;
    }

    .news-list li a .title {
        font-size: 15px;
        line-height: 1.5;
        /* 読みやすさのため */
    }

    /* ★★★ ここまで: お知らせリスト (スマホ) ★★★ */
}