/* CSS Document */
:root {
    /* 1. ここめE0pxに設宁E*/
    --manga-gap: 0px; 
    /* 2. 初期値をEれておき、後でJSが正確な値に上書きしまぁE*/
    --header-h: 0px; 
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* スクロールを完Eに禁止 */
    background: #000;
}
     .topimg{
         width: 100%;
         background-color: #fff;
         z-index: 999;
     }
/* 親要素の交通整琁E縦に並べめE*/
#page-2 {
    opacity: 0;
    flex-direction: column !important; /* 横並びを禁止して、縦に積み上げめE*/
    align-items: center !important;    /* 全てを中央に寁EめE*/
}
/* 中身の要素も、最初から透EにしておきまぁE*/
.js-panel, 
.story-text-content, 
.series-badge,
#story-controls {
    opacity: 0;
}
/* シリーズ名バチEのチEイン */
.series-badge {
    width: 100%;             /* 画面ぁEぱぁEE幁E使ぁE*/
    text-align: center;      /* 斁Eを真ん中に */
    white-space: nowrap;     /* 絶対に改行させなぁEE行防止EE*/
    
    /* ロゴEEチEーEとの隙間を調整 */
    margin-top: 10px;
    margin-bottom: 0px;

    background: rgba(0, 0, 0, 0.6); /* ガラスのような透過黁E*/
    backdrop-filter: blur(4px);    /* 背景を少しぼかす高級感 */
    color: #BF953F;               /* ゴールチE*/
    
    padding: 5px 15px;
    border-left: 3px solid #BF953F; /* 左側にゴールドE縦緁E*/
    
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    
    pointer-events: none; /* クリチEを阻害しなぁE*/
    opacity: 0;           /* 最初E隠す！ESでフェードインEE*/
    transition: opacity 1s ease;
}

/* ボタンの配置 */
.story-nav {
    /* 1. 位置を固定して最前面に */
    position: fixed; 
    bottom: 70px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999; /* 何よりも上に */

    /* 2. 最初E隠しておくEESで出します！E*/
    display: none; 
    opacity: 0;

    /* 3. 中身の並び方 */
    display: flex; /* ☁Eこを flex にしておき、JSでは display: flex に刁E替える */
    align-items: center;
    gap: 20px;
    
    /* 4. クリチEを絶対に送EなぁE*/
    pointer-events: auto !important;
}

.nav-btn {
    position: relative;  /* ☁Eれが忁Eです！z-indexを有効にするため */
    z-index: 10001;
    padding: 12px 25px;
    background: rgba(0,0,0,0.7);
    color: #FCF6BA;
    border: 1px solid #BF953F;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    letter-spacing: 1px;
    transition: 0.3s;
    z-index: 10001;
    
    /* ボタン自体EクリチEできるように戻ぁE*/
    pointer-events: auto;     
}
.speed-control, .nav-btn {
    pointer-events: auto !important; /* ボタンとスライダーだけE「触れる」よぁE強制 */
    cursor: pointer;
}
.home-nav {
    position: fixed;
    bottom: 20px; /* 一番下に配置 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
}

.btn-home {
    display: inline-block;
    padding: 10px 20px;
    background-color: #333; /* ボタンの色Eお好みの色にEE*/
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: background 0.3s;
    bottom: 20px;
}

.btn-home:hover {
    background-color: #555; /* ホバー時E色 */
    color: #fff;
}

.btn-home .icon {
    margin-right: 5px;
}
/* スライダーが反応してぁEか確認しめEくするため、少し大きくしまぁE*/
input[type="range"] {
    cursor: pointer;
    z-index: 10002;
    position: relative;
}
.nav-btn:disabled { opacity: 0.3; cursor: default; }
     
.fixed-brand-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* 高さは画像に合わせて自動で決まるよぁEしまぁE*/
    height: auto;
    
    z-index: 9999;
    pointer-events: none; /* ヘッダーの余白はスクロールを邪魔しなぁE*/
    
    /* 上部に少しだけ黒い影を置ぁE、画像を見えめEくしまぁE*/
    background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.manga-stage {
    display: flex;
    flex-direction: column;
    /* ☁Eこがポイント：中央寁E(center)を「上詰めEflex-start)」に変更 */
    justify-content: flex-start !important; 
    align-items: center;

    /* 上E余白をE体的に持E（好みで 5px、E5px 程度EE*/
    padding-top: 10px; 
    
    /* 画面の高さを確俁E*/
    min-height: 100vh;
    box-sizing: border-box;
}

/* 念のため、最初に来る吹きEしコンチEの margin もリセチE */
.ai-bubble-container {
    margin-top: 20px;
}

.brand-logo {
    /* 社長の設定通り */
    width: 100px;
    height: 0px;
    height: auto;
    display: block;
    /* ロゴも真ん中に寁EめE*/
    margin: 0 auto;
    margin-bottom: 0px;
}

/* 4コマが表示されるセクション */
/* セクションの高さを画面ぴったりに */
.manga-section {
    height: 100vh; 
    position: relative;
    /* 余計な余白めEE線を排除して寁EさせめE*/
    margin: 0;
    padding: 0;
    overflow: hidden;
}
/* --- 修正版：iOS Safari対応レイアウチE--- */

.manga-viewer {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    /* iOSの可変バーに対応しぁE100dvh を使用 */
    height: 100dvh; 
    
    display: flex;
    justify-content: center;
    /* --- 重要E真ん中寁Eをやめて、上詰めに固宁E--- */
    align-items: flex-start !important; 
    
    /* ロゴの高さ + 隙間30px を計箁E*/
/* --- 修正ポイント：padding-top を少し詰める --- */
    box-sizing: border-box;
    z-index: 10;
}


.manga-panel-container {
    width: 90vw;
    max-width: 600px;
    background: #111;
    border-radius: 12px;
    border: 2px solid #BF953F;
    overflow: hidden; /* 中身をEみ出させなぁE*/
    display: flex;
    flex-direction: column;
    /* overflow: hidden; は消すか、visibleにする */
    overflow: visible !important; /* 中身がEみ出してもクリチEをE断しなぁE*/
    position: relative;
}

/* アニメ部刁EE:3の比率を維持EE*/
.manga-panel {
    width: 100%;
    aspect-ratio: 6 / 4; /* 4:3を維持E*/
    
    background-size: 200% 200% !important; 
    background-repeat: no-repeat;
    background-position: 0% 0%;
    
    /* --- 復活E角丸と安定化 --- */
    border-radius: 12px; 
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    
    /* JSで制御するため、最初E0 */
    opacity: 0; 
    
    /* 丁E一、文字が重なっても後ろに回るように */
    position: relative;
    z-index: 1;
}

/* 追加するチEストエリア */
.story-text-content {
    /* 既存E設宁E.. */
    height: 150px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(191, 149, 63, 0.3); /* 画像との墁E */
    color: #FCF6BA;

    /* ☁Eこを追加E下E角をコンチEEE2pxEに合わせて丸める */
    /* 2pxの枠線Eを引いて 10px くらぁEすると冁EEに綺麗に収まりまぁE*/
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;

    /* 他E設宁E.. */
    position: relative;
    z-index: 5;
}
/* 1. ヘッダーEエピソードタイトル */
.story-header {
    color: #BF953F; /* ゴールチE*/
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.15em; /* 斁E間を庁Eて高級感をEぁE*/
    margin-bottom: 5px;
    text-transform: uppercase; /* 英語E常に大斁EE*/
    display: flex;
    align-items: center;
    gap: 10px;
}


/* 2. ボディE説明文 */
.story-body {
    color: #FCF6BA; /* シャンパンゴールチE*/
    font-size: 18px;
    line-height: 1.4;
    font-weight: 300;
    text-align: justify; /* 両端揁Eで綺麗に */
    opacity: 0.9;
    display: block;
    overflow-y: auto;
}
/* 一斁Eつのスタイル */
.sentence {
    opacity: 0;            /* 出番が来るまで透Eにしておく */
    margin-right: 5px;     /* 斁E斁EE自然な隙間 */
}
/* 3. おまけ：スクロールバEもゴールドで統一EE00pxなので重要EE*/
.story-text-content::-webkit-scrollbar {
    width: 3px;
}
.story-text-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}
.story-text-content::-webkit-scrollbar-thumb {
    background: #BF953F;
    border-radius: 10px;
}

/* キラキラした粒子感EESSで生EEE*/
.ai-glow-effect::after {
    content: "";
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    
    /* 粒子を少し大きくEEpx、EpxEし、数を増やしました */
    background-image: 
        radial-gradient(circle, #FCF6BA 1px, transparent 2px),
        radial-gradient(circle, #FFFFFF 2px, transparent 3px),
        radial-gradient(circle, #BF953F 3px, transparent 4px),
        radial-gradient(circle, #FCF6BA 1px, transparent 3px);
    
    /* 粒子を画面全体に散りEめる設宁E*/
    background-size: 400px 400px; /* こE数字で粒子E寁Eが変わりまぁE*/
    background-position: 0 0, 100px 150px, 250px 50px, 300px 300px;
    
    mix-blend-mode: screen; /* 黒背景の上で光らせる忁E設宁E*/
    animation: rotateGlow 30s linear infinite;
    opacity: 0.7;
}

/* 回転アニメーション */
@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* JSで制御するためのクラスE忁Eに応じてEE*/
.glow-active {
    opacity: 1 !important;
    transition: opacity 1s ease-in-out;
}
/* バブルを閉じ込める容器 */
.ai-bubble-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 5; /* 画僁E10)より後ろ、背景(0)より剁E*/
    overflow: hidden;
    pointer-events: none; /* 操作E邪魔をしなぁE*/
}

/* バブル本佁E*/
.ai-bubble {
    position: absolute;
    bottom: -20px;
    background: radial-gradient(circle, rgba(252, 246, 186, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(2px);
}

/* 泡が浮かんで消えるアニメーション */
@keyframes bubble-float {
    0% { transform: translateY(20px) scale(0.5); opacity: 0; }
    20% { opacity: 0.8; }
    80% { opacity: 0.4; }
    100% { transform: translateY(-100px) scale(1.5); opacity: 0; }
}     
.speed-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #FCF6BA;
    font-size: 10px;
    letter-spacing: 1px;
}

/* スライダー本佁E*/
input[type="range"] {
    -webkit-appearance: none; /* チEォルトEスタイルを解除 */
    width: 100px;
    background: transparent;
    cursor: pointer;
}

/* トラチEE線）E見た目 */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 2px; /* ☁EE高さ */
    background: #BF953F;
}

/* チEEミ（丸EE見た目 */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 15px; /* ☁Eマミの高さ */
    width: 15px;
    border-radius: 50%;
    background: #FCF6BA;
    box-shadow: 0 0 10px rgba(191, 149, 63, 0.8);

    /* --- 💡 ここが魔法E計算弁E--- */
    /* (線E高さ 2px / 2) - (チEEミE高さ 15px / 2) = 1 - 7.5 = -6.5px */
    margin-top: -6.5px; 
}
/* 1ペEジ目の専用スタイル */
.intro-screen {
    padding-top: env(safe-area-inset-top, 0px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #000;
    z-index: 20;
}

.story-title {
    color: #FCF6BA;
    font-family: "serif";
    font-size: 1.2rem;
    letter-spacing: 0.2em;
    margin-bottom: 20px;
    text-align: center;
}

.main-visual-container {
    width: 90vw;
    max-width: 700px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(191, 149, 63, 0.5);

}

.main-visual {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* スタートEタンを目立たせる鼓動EパルスE演E */
.gold-pulse {
    animation: pulse-gold 2s infinite;
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(252, 246, 186, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(252, 246, 186, 0); }
    100% { box-shadow: 0 0 0 0 rgba(252, 246, 186, 0); }
}    
