@charset "UTF-8";

/* =========================================
   基本リセット & フォント
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    /* Chrome等でのスワイプによる画面全体の揺れ・更新を防ぐ */
    overscroll-behavior: none;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Zen Maru Gothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
    background-color: #f0f5f0;
    overflow: hidden;       /* スクロール禁止 */
    touch-action: manipulation;

    /* 動的ビューポート（URLバーを計算した正確な高さ） */
    height: 100vh;          /* 古いブラウザ用予備 */
    height: 100dvh;         /* 最新ブラウザ用自動調整 */
}

/* =========================================
   PC閲覧時のレイアウト（中央にスマホサイズ固定）
   ========================================= */
.background-blur {
    position: fixed;
    inset: 0;
    background-color: #e6f0e6;
    z-index: -1;
}

.app-container {
    position: relative;
    width: 100vw;
    background-color: #ffffff;
    color: #333333;
    margin: 0 auto;

    /* 上から順にブロックを積み上げる強固なレイアウト */
    display: flex;
    flex-direction: column;
    overflow: hidden;

    height: 100vh;
    height: 100dvh;
}

/* PC画面（幅が広い場合）は中央にスマホ比率の枠を作る */
@media (min-width: 600px) {
    .app-container {
        width: 400px;
        height: 850px;
        max-height: 95vh;
        max-height: 95dvh;
        margin-top: 2.5vh;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }
}

/* =========================================
   プログレスバー (上部ブロック)
   ========================================= */
.progress-container {
    flex: 0 0 auto; /* 高さを固定し潰れないようにする */
    display: flex;
    gap: 4px;
    padding: 20px 15px 10px;
    z-index: 10;
}

.progress-segment {
    flex: 1;
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #32D74B;
    transition: width 0.3s ease;
}

/* =========================================
   スライドコンテンツエリア (中央ブロック)
   ========================================= */
.slide-container {
    flex: 1; /* 余った高さをすべて吸収する */
    min-height: 0; /* flexbox内で要素がはみ出さないための魔法のコード */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slide-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 15px 10px; /* 下部の余白を通常通りに */
}

/* タイトル（レッスンのテーマ） */
.slide-title {
    flex: 0 0 auto;
    font-size: 1.6rem;
    margin: 5px 0 15px;
    text-align: center;
    color: #147A33;   /* ★2026-08 白地に明るい緑は薄すぎて読めなかったため、濃い緑に */
    font-weight: bold;
}

/* メディア（画像・動画）枠：可能な限り拡大させる */
.media-wrapper {
    flex: 1; /* 余った空間をすべて画像枠に使う */
    width: 100%;
    min-height: 0; /* 縮小を許可 */
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.media-content {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 全体を表示する */
}

/* 説明文エリア（教室の様子）：サイズを固定しスクロールさせる */
.slide-description-area {
    flex: 0 0 120px; /* 縦幅を120pxに完全固定 */
    height: 120px;
    background: #f9f9f9;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    padding: 15px;
    overflow-y: auto; /* 文章が長い場合は縦スクロール */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* スクロールバーのデザイン（細く表示） */
.slide-description-area::-webkit-scrollbar {
    width: 4px;
}
.slide-description-area::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.slide-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #444444;
    white-space: pre-wrap;
    word-break: break-word;
}

.loading-text {
    text-align: center;
    margin-top: 50px;
    color: #666;
    font-weight: bold;
}

/* =========================================
   常時表示ナビゲーションボタン ＆ TOPに戻る (下部ブロック)
   ========================================= */
.nav-buttons {
    flex: 0 0 auto; /* 高さを固定。絶対配置(浮遊)をやめて確実に下部に置く */
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px 25px; /* 下部の安全な余白 */
    z-index: 20;
}

.nav-btn {
    background: #147A33;   /* ★白文字が読めるだけの濃さを確保 */
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(50, 215, 75, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.nav-btn:active {
    background: #0E5F26;
    transform: scale(0.95);
}

/* 中央の「TOPに戻る」ボタン */
.btn-back {
    color: #147A33;   /* ★2026-08 読みやすさのため濃い緑に */
    background: #ffffff;
    border: 2px solid #147A33;
    text-decoration: none;
    font-size: 1rem;
    font-weight: bold;
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:active {
    background: #f0f0f0;
}

/* =========================================
   アニメーション
   ========================================= */
.animate-fade {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   全画面画像拡大モーダル用
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cursor-zoom {
    cursor: zoom-in;
}

/* =========================================
   ★2026-08 リニューアルで追加した部分
   （見た目のベースは変えず、分かりやすさと読みやすさを足しています）
   ========================================= */

/* 上部バー：進み具合＋「いま何枚目か」 */
.topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 15px 8px;
    z-index: 10;
}
.topbar .progress-container {
    flex: 1 1 auto;
    padding: 0;
}
.slide-counter {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #EAF7EE;
    border: 2px solid #C6EBD2;
    border-radius: 999px;
    padding: 3px 10px 3px 4px;
}
.counter-kb {
    width: 22px;
    height: 22px;
    object-fit: contain;
}
.counter-text {
    font-family: "Fredoka", "Zen Maru Gothic", sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #147A33;      /* #EAF7EE の上で約 5.1:1 */
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* いま見ているところだけ色を濃くして、見終わった分と区別する */
.progress-fill.is-current {
    background-color: #147A33;
}

/* 読み込み中・エラー・データなし の共通表示（KB君に出てきてもらう） */
.state-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px;
    text-align: center;
}
.state-kb {
    width: 110px;
    max-width: 40%;
    object-fit: contain;
    opacity: 0.9;
}
.state-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #4A5A50;      /* 白地で約 7.4:1 */
    line-height: 1.7;
}
.state-retry {
    margin-top: 4px;
    background: #147A33;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    min-height: 48px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(20, 122, 51, 0.25);
}
.state-retry:active { transform: scale(0.97); }

/* 写真の拡大：ボタンとして扱い、キーボードでも開けるようにした */
.media-zoom-btn {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    display: block;
    font-family: inherit;
}
/* 画像は行の中の文字扱いだと下に数px余白ができてしまうので、ブロックとして置く */
.media-zoom-btn > img {
    display: block;
}
.zoom-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;       /* 黒地に白 = 約 13:1 */
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    pointer-events: none;
}

/* 拡大表示を閉じるボタン */
.modal-close {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.85);
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 画面には出さず、読み上げソフトにだけ伝える文言 */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* キーボード操作中の「いまここ」を必ず見えるようにする */
.nav-btn:focus-visible,
.btn-back:focus-visible,
.state-retry:focus-visible,
.media-zoom-btn:focus-visible,
.modal-close:focus-visible {
    outline: 3px solid #147A33;
    outline-offset: 3px;
}
.modal-close:focus-visible { outline-color: #ffffff; }

/* 動きが苦手な方の設定（OSの「視差効果を減らす」）を尊重する */
@media (prefers-reduced-motion: reduce) {
    .animate-fade { animation: none; }
    .progress-fill { transition: none; }
    * { scroll-behavior: auto; }
}


/* =========================================
   ★2026-08 日本語の改行の直し
   -----------------------------------------
   これまで、見出しが単語の途中で折り返していました。
       本格設備で「跳    ／    ぶ」楽しさを！
       地域唯一！「競技用トラン    ／    ポリン」
   端末のせいではなく、指定を足せば直せる問題です。

   ・word-break: auto-phrase … 単語のかたまりで折り返す
       ※Chrome と Edge で効きます。iPhoneのSafariでは
         今までどおりの折り返しになります（悪くはなりません）。
         特に目立つ見出しは、HTML側で「ここでは切らない」指定も入れてあります。
   ・line-break: strict … 小さい「っ」や長音「ー」が行頭に来ないようにする
   ・text-wrap: balance … 見出しの各行の長さをそろえる

   本文（p）には auto-phrase を入れていません。
   実際に試したところ、長い文章では行末がガタガタになって
   かえって読みにくくなったためです。
   ========================================= */
h1, h2, h3, h4, h5, h6,
.kb-phrase {
    word-break: auto-phrase;
    line-break: strict;
    text-wrap: balance;
}

p, li, dd, figcaption, label, button, .btn {
    line-break: strict;
    text-wrap: pretty;
}

/* HTMLの中で「ここでは切らないでほしい」ひとかたまりを囲むための印。
   Safariを含め、どの端末でも効きます。 */
.kb-nw {
    display: inline-block;
}
