/* ========================================
   知育ゲームランド ホームページ
   手描きレイアウトを元にした共通デザイン
======================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        "Zen Maru Gothic",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        Meiryo,
        sans-serif;
    color: #333;
    background: #fffdf8;
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- ヘッダー：カテゴリページと同型 ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}

.header-inner {
    width: min(1200px, 94%);
    height: 80px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.header-logo {
    width: 90px;
    height: auto;
}

/* ---------- 大きめロゴ ---------- */

.home-hero {
    width: min(900px, 94%);
    margin: 0 auto;
    padding: 38px 0 24px;
    text-align: center;
}

.main-logo {
    width: min(260px, 62vw);
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0 auto;
}

.hero-copy {
    margin-top: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #706235;
}

/* ---------- 共通 ---------- */

.home-section {
    padding: 24px 0 44px;
}

.section-inner {
    width: min(1100px, 94%);
    margin: 0 auto;
}

.section-title-row {
    margin-bottom: 18px;
}

.section-kicker {
    margin-bottom: 2px;
    color: #8a7a46;
    font-size: .84rem;
    font-weight: 700;
}

.section-title-row h2 {
    font-size: 1.55rem;
    line-height: 1.35;
}

/* ---------- おすすめゲーム ---------- */

.recommend-scroller {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.recommend-card {
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 2px solid #ffe28a;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
    transition: transform .2s, box-shadow .2s;
}

.recommend-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}

.recommend-icon {
    aspect-ratio: 4 / 3;
    margin: 8px 8px 0;
    border-radius: 13px;
    background: #fff4c7;
    display: grid;
    place-items: center;
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 900;
}

.recommend-body {
    padding: 12px 13px 15px;
}

.recommend-body h3 {
    font-size: 1rem;
    line-height: 1.45;
    margin-bottom: 3px;
}

.recommend-body p {
    color: #777;
    font-size: .8rem;
}

/* ---------- 年齢・学年 ---------- */

.age-section {
    background: #fff9e9;
}

.age-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.age-card,
.school-card {
    min-height: 92px;
    padding: 12px 8px;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .07);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform .2s, box-shadow .2s;
}

.age-card:hover,
.school-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(0, 0, 0, .11);
}

.age-card {
    gap: 3px;
}

.age-main {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.age-sub {
    padding-top: 9px;
    font-weight: 800;
}

.school-card {
    gap: 2px;
    flex-direction: column;
    line-height: 1.05;
    font-weight: 800;
}

.school-card strong {
    font-size: 1.75rem;
}

/* ---------- ジャンル ---------- */

.genre-section {
    padding-top: 42px;
}

.genre-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.genre-card {
    min-height: 150px;
    padding: 18px 12px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .07);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
    transition: transform .2s, box-shadow .2s;
}

.genre-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}

.genre-icon {
    min-height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 7px;
    font-size: 2.2rem;
    font-weight: 900;
}

.genre-abc {
    font-size: 1.6rem;
}

.genre-123 {
    font-size: 1.55rem;
    letter-spacing: -0.03em;
}

.genre-svg {
    width: 44px;
    height: 44px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.genre-svg--star {
    stroke-width: 2.7;
}

.genre-name {
    font-size: 1.1rem;
    font-weight: 900;
}

.genre-desc {
    margin-top: 4px;
    color: #777;
    font-size: .8rem;
}

/* ---------- サイト説明 ---------- */

.about-section {
    padding: 10px 0 56px;
}

.about-card {
    width: min(900px, 94%);
    margin: 0 auto;
    padding: 28px 32px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .07);
}

.about-card h2 {
    margin-bottom: 16px;
    padding-bottom: 10px;
    font-size: 1.4rem;
    border-bottom: 3px solid #ffe28a;
}

/* ---------- フッター ---------- */

.site-footer {
    padding: 30px 15px;
    background: #f2f2f2;
    color: #555;
    text-align: center;
}

.site-footer nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 10px;
}

/* ---------- TOPボタン ---------- */

.top-button {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 900;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: #ffe28a;
    font-size: 21px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
    display: none;
}

.top-button.is-visible {
    display: grid;
    place-items: center;
}

/* ---------- タブレット ---------- */

@media (max-width: 900px) {
    .recommend-scroller {
        grid-template-columns: repeat(3, 1fr);
    }

    .age-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ---------- スマホ ---------- */

@media (max-width: 650px) {
    .header-inner {
        height: 72px;
    }

    .header-logo {
        width: 105px;
    }

    .home-hero {
        padding: 30px 0 18px;
    }

    .main-logo {
        width: min(220px, 64vw);
    }

    .hero-copy {
        font-size: .92rem;
    }

    .home-section {
        padding: 22px 0 36px;
    }

    /* 手描き画像の横に続くおすすめカード感を再現 */
    .recommend-scroller {
        display: flex;
        gap: 11px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding: 2px 2px 12px;
        scrollbar-width: none;
    }

    .recommend-scroller::-webkit-scrollbar {
        display: none;
    }

    .recommend-card {
        flex: 0 0 72%;
        scroll-snap-align: start;
    }

    .age-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .age-card,
    .school-card {
        min-height: 76px;
        border-radius: 14px;
    }

    .age-main {
        font-size: 1.65rem;
    }

    .school-card strong {
        font-size: 1.45rem;
    }

    .genre-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 11px;
    }

    .genre-card {
        min-height: 132px;
        padding: 14px 8px;
        border-radius: 15px;
    }

    .genre-icon {
        font-size: 1.8rem;
    }

    .genre-abc {
        font-size: 1.35rem;
    }

    .genre-123 {
        font-size: 1.3rem;
    }

    .genre-svg {
        width: 38px;
        height: 38px;
    }

    .genre-name {
        font-size: .95rem;
    }

    .genre-desc {
        font-size: .72rem;
    }

    .about-card {
        padding: 22px 18px;
    }

    .about-card h2 {
        font-size: 1.25rem;
    }
}

/* ===== ホーム：おすすめ / 人気 / 新作 タブ ===== */

.game-tab-buttons {
    display: flex;
    gap: 10px;
    margin: 0 0 20px;
}

.game-tab-button {
    min-width: 108px;
    padding: 11px 18px;
    border: 2px solid #ffe28a;
    border-radius: 999px;
    background: #fff;
    color: #555;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s, background .2s, box-shadow .2s;
}

.game-tab-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
}

.game-tab-button.is-active {
    background: #ffe28a;
    color: #333;
}

.game-tab-button:focus-visible {
    outline: 3px solid #333;
    outline-offset: 2px;
}

.game-tab-panel[hidden] {
    display: none;
}

@media (max-width: 650px) {
    .game-tab-buttons {
        gap: 7px;
        margin-bottom: 16px;
    }

    .game-tab-button {
        flex: 1;
        min-width: 0;
        padding: 10px 6px;
        font-size: .9rem;
    }
}

.recommend-icon.has-game-image{padding:0;overflow:hidden;background:#eef3f7}.recommend-icon.has-game-image img{width:100%;height:100%;display:block;object-fit:cover}


/* ===== Step5: responsive / viewport hardening ===== */
html, body { max-width: 100%; overflow-x: clip; }
body { min-width: 0; }
.header-inner, .section-inner, .home-hero, .about-card { min-width: 0; }
.recommend-scroller, .age-grid, .genre-grid { min-width: 0; }
.recommend-card, .age-card, .school-card, .genre-card { min-width: 0; }
.recommend-body h3, .recommend-body p, .genre-name, .genre-desc, .about-card, .site-footer { overflow-wrap: anywhere; }
.site-footer nav { row-gap: 8px; }
.top-button { bottom: max(18px, env(safe-area-inset-bottom)); right: max(18px, env(safe-area-inset-right)); }
@media (max-width: 650px) {
  .header-inner { height: 64px; }
  .header-logo { width: 78px; }
  .home-hero { padding-top: 24px; }
  .section-inner { width: min(100% - 24px, 1100px); }
  .recommend-card { flex-basis: min(78vw, 290px); }
  .site-footer { padding: 24px 12px; }
  .site-footer nav { gap: 8px 14px; font-size: .86rem; }
}
@media (max-width: 420px) {
  .age-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .genre-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .game-tab-button { font-size: .84rem; }
}
@media (max-width: 340px) {
  .genre-grid { grid-template-columns: 1fr; }
  .recommend-card { flex-basis: 86vw; }
}
@media (hover: none) {
  .recommend-card:hover, .age-card:hover, .school-card:hover, .genre-card:hover, .game-tab-button:hover { transform: none; box-shadow: inherit; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}


/* STEP8 performance: skip layout/paint work for off-screen heavy sections. */
@supports (content-visibility: auto) {
  .game-list-section,
  .description-section,
  .related-section,
  .section-block.games-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 720px;
  }
}


/* ===== Step6: トップページの案内コンテンツ ===== */
.home-info-section {
    padding: 18px 0 64px;
}

.home-info-shell {
    width: min(1000px, 94%);
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

.home-info-shell .about-card {
    width: 100%;
    margin: 0;
}

.home-info-intro p + p,
.home-guide-card p + p {
    margin-top: 12px;
}

.home-info-block {
    padding: 4px 0;
}

.home-info-heading {
    margin-bottom: 14px;
}

.home-info-heading h2,
.home-guide-card h2,
.home-parent-card h2 {
    font-size: 1.35rem;
    line-height: 1.4;
}

.home-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.home-feature-card,
.home-guide-card,
.home-parent-card {
    background: #fff;
    border: 1px solid #f2e7bd;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
}

.home-feature-card {
    padding: 20px;
}

.home-feature-card h3 {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.home-feature-card p,
.home-guide-card p,
.home-parent-card p,
.home-info-intro p {
    color: #555;
}

.home-guide-card {
    padding: 24px 26px;
}

.home-guide-card h2 {
    margin-bottom: 10px;
}

.home-guide-card a {
    color: #67591f;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.home-parent-card {
    padding: 24px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    background: #fff9e9;
}

.home-parent-card > div {
    min-width: 0;
}

.home-parent-card h2 {
    margin-bottom: 8px;
}

.home-parent-link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 18px;
    border: 2px solid #ffe28a;
    border-radius: 999px;
    background: #fff;
    font-weight: 800;
    white-space: nowrap;
    transition: transform .2s, box-shadow .2s;
}

.home-parent-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
}

.home-parent-link:focus-visible,
.home-guide-card a:focus-visible {
    outline: 3px solid #333;
    outline-offset: 3px;
}

@media (max-width: 800px) {
    .home-feature-grid {
        grid-template-columns: 1fr;
    }

    .home-parent-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 650px) {
    .home-info-section {
        padding-bottom: 46px;
    }

    .home-info-shell {
        width: min(100% - 24px, 1000px);
        gap: 18px;
    }

    .home-feature-card,
    .home-guide-card,
    .home-parent-card {
        padding: 19px 18px;
        border-radius: 15px;
    }

    .home-info-heading h2,
    .home-guide-card h2,
    .home-parent-card h2 {
        font-size: 1.2rem;
    }

    .home-parent-link {
        width: 100%;
    }
}

@media (hover: none) {
    .home-parent-link:hover {
        transform: none;
        box-shadow: none;
    }
}
