/* --- Variables --- */
:root {
    --pop-yellow: #ffeb3b;
    --pop-pink: #ff4081;
    --pop-blue: #00e5ff;
    --pop-orange: #ff9800;
    --pop-green: #69f0ae;
    --paper-color: #fffdf7;
}

/* --- Base --- */
body, html {
    margin: 0; padding: 0; width: 100%; 
    /* height: 100%; を削除して、スクロール量(scrollHeight)が正常に計算されるように修正 */
    background-color: #fff;
    font-family: 'Zen Maru Gothic', sans-serif;
    cursor: none; /* デフォルトカーソル非表示 */
    overflow-x: hidden;
}

/* --- ローディング画面 --- */
#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: var(--paper-color);
    z-index: 9998; /* カーソルの直下 */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}
.loader {
    text-align: center;
    font-size: 1.5rem;
}
.corn-spinner {
    display: inline-block;
    width: 60px; /* 画像用の幅 */
    height: auto;
    animation: spin-bounce 1s infinite ease-in-out;
}
@keyframes spin-bounce {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

a, button, .scene {
    cursor: none;
}

/* --- カスタムカーソル --- */
#cursor {
    position: fixed;
    top: 0; left: 0;
    width: 60px;
    height: 60px;
    background-image: url('pointer.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 9999;
    /* 頭頂部（上部中央）をカーソル位置に合わせるための調整 */
    transform-origin: 50% 0; /* 上部中央を基準に回転・拡大 */
    transform: translate(-50%, 0) rotate(-15deg); /* 中央を合わせ、少し斜めに */
    transition: transform 0.1s, width 0.2s, height 0.2s;
}
#cursor.hovered {
    transform: translate(-50%, 0) rotate(-25deg) scale(1.3);
}

/* --- 背景動画とオーバーレイ --- */
#bg-video {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    object-fit: cover; z-index: 1;
    /* 明るく元気な色味にする */
    filter: brightness(1.1) contrast(1.05) saturate(1.2); 
}
#video-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(255, 255, 255, 0.4); /* 半透明の白で動画を薄くする */
    z-index: 2;
    pointer-events: none;
}

/* --- クレヨンの軌跡 --- */
#scroll-path-container {
    position: fixed;
    top: 0; right: 5vw; /* 画面右側に配置 */
    width: 60px; height: 100vh;
    z-index: 5;
    opacity: 0.8;
}
#crayon-path {
    width: 100%; height: 100%;
    /* クレヨンっぽい光沢やかすれ具合を表現 */
    filter: drop-shadow(0px 0px 5px rgba(255,202,40,0.8));
}

/* --- スクロールコンテナ --- */
#scroll-container {
    position: relative; z-index: 10; width: 100%;
}

.scene {
    min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
    padding: 100px 10vw; position: relative; /* 上下に見切れないようpaddingを確保 */
    opacity: 0;
    transform: scale(0.9) rotate(-5deg); /* スクラップブック風に少し傾ける */
    transition: opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 高さが低い画面用（PC・スマホ共通） */
@media (max-height: 800px) {
    .scene {
        justify-content: flex-start;
        padding-top: 100px;
        padding-bottom: 150px;
    }
}
/* スマホ表示時にコンテンツが縦長になりすぎるのを防ぐため、左右の余白を極限まで減らす */
@media (max-width: 768px) {
    .scene {
        justify-content: flex-start;
        padding: 80px 5px 120px 5px; /* 上下左右の余白を極力減らす */
    }
}

.scene.in-view {
    opacity: 1;
    transform: scale(1) rotate(0deg); /* 飛び出てきて真っ直ぐになる */
}

/* 各セクションの揺らぎ（手作り感のアシンメトリー） */
.scene:nth-child(even).in-view { transform: scale(1) rotate(2deg); }
.scene:nth-child(odd).in-view { transform: scale(1) rotate(-1deg); }

.left-align { align-items: flex-start; }
.right-align { align-items: flex-end; }
.center-align { align-items: center; }

/* --- スクラップブロック --- */
.scrap-block {
    position: relative;
    max-width: 800px;
    padding: 2rem;
}

/* マスキングテープのあしらい */
.tape {
    position: absolute;
    width: 140px; height: 40px;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 10;
}
/* テープのちぎれた端を表現 */
.tape::before, .tape::after {
    content: ''; position: absolute; top: 0; width: 10px; height: 100%;
    background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.7) 50%), linear-gradient(-45deg, transparent 50%, rgba(255,255,255,0.7) 50%);
    background-size: 10px 10px;
}
.tape::before { left: -10px; }
.tape::after { right: -10px; background-image: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.7) 50%), linear-gradient(-135deg, transparent 50%, rgba(255,255,255,0.7) 50%); }

.tape-top-left { top: -15px; left: -20px; transform: rotate(-15deg); }
.tape-top-right { top: -10px; right: -30px; transform: rotate(20deg); background-color: rgba(255, 235, 59, 0.7); }
.tape-top-center { top: -25px; left: 50%; transform: translateX(-50%) rotate(-5deg); background-color: rgba(255, 64, 129, 0.7); }

/* --- タイポグラフィとブレンド --- */
/* 画像タイトルのスタイル */
.title-image {
    max-width: 100%;
    margin: 0 auto; /* 中央揃え */
    height: auto;
    display: block;
    /* 白い光彩を追加して視認性を高める */
    filter: drop-shadow(0 0 8px #ffffff) drop-shadow(0 0 15px rgba(255,255,255,0.9)) drop-shadow(4px 4px 6px rgba(0,0,0,0.2));
    /* 1.5倍に拡大しつつ傾ける */
    transform: scale(1.5) rotate(-2deg);
}

/* 白フチとドロップシャドウで視認性を極限まで高める */
.huge-text {
    font-size: 11vw;
    line-height: 1.1;
    margin: 0;
    color: var(--pop-yellow);
    /* mix-blend-modeを廃止し、白い縁取りで背景から文字を浮き上がらせる */
    text-shadow: 
        -3px -3px 0 #fff,  
         3px -3px 0 #fff,
        -3px  3px 0 #fff,
         3px  3px 0 #fff,
         6px  6px 0px rgba(0,0,0,0.2);
    white-space: nowrap;
}
.blend-pink { color: var(--pop-pink); }
.blend-blue { color: var(--pop-blue); }
.blend-orange { color: var(--pop-orange); }
.blend-green { color: #2e7d32; }

/* 手書き風サブタイトル */
.hand-subtitle {
    font-family: 'Yusei Magic', sans-serif;
    font-size: 3rem;
    color: #fff;
    background: #333;
    display: inline-block;
    padding: 5px 25px;
    transform: rotate(-4deg);
    box-shadow: 6px 6px 0 var(--pop-pink);
    margin-top: -20px;
}

/* ちぎり紙風のテキスト背景 */
.paper-bg {
    position: relative;
    background-color: var(--paper-color);
    padding: 2.5rem;
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1.8;
    color: #444;
    /* 手作り感のある少し歪んだ形 */
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    border: 4px solid #444;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.1);
    margin-top: 1rem;
}
.paper-bg small { font-size: 1rem; color: #777; }

.paper-bg-round {
    background-color: var(--paper-color);
    padding: 3rem;
    font-size: 1.6rem;
    font-weight: 900;
    color: #444;
    border-radius: 50%; /* 丸いシール風 */
    border: 5px dashed var(--pop-orange);
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.warning-text {
    color: #ff4081;
    font-size: 1.1rem;
    margin-top: 1.5rem;
    background: #ffe0b2;
    padding: 8px 20px;
    border-radius: 30px;
    display: inline-block;
}

/* --- フォトフレーム（大人の背丈を超える…用） --- */
.photo-slideshow {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 2rem auto;
    aspect-ratio: 3 / 4; /* 縦長の比率 */
}

.photo-slideshow .photo-frame {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #fff;
    padding: 10px 10px 25px 10px; /* ポラロイド風（下が広い） */
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    box-sizing: border-box;
    opacity: 0; /* デフォルトは非表示 */
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
}

/* Javascriptで付与されるアクティブクラス */
.photo-slideshow .photo-frame.active {
    opacity: 1;
    visibility: visible;
    z-index: 5;
}

/* .tap-indicator is actually a sibling to .photo-frame, so :nth-child offsets might change.
   We should use nth-of-type for the photo-frames or just re-index.
   Wait, tap-indicator is the first child now. So photo-frame 1 is nth-child(2). */
.photo-slideshow .photo-frame:nth-child(2) { transform: rotate(-2deg); }
.photo-slideshow .photo-frame:nth-child(3) { transform: rotate(1deg); }
.photo-slideshow .photo-frame:nth-child(4) { transform: rotate(-1deg); }

.photo-slideshow .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #eee;
}

.tap-indicator {
    position: absolute;
    bottom: -15px;
    right: -15px;
    background-color: var(--pop-pink);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 10;
    pointer-events: none; /* クリックを下の画像に貫通させる */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    animation: tap-bounce 1.5s infinite;
}

@keyframes tap-bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-10px) rotate(-5deg); }
}

/* --- モードシール（遊び方） --- */
.mode-cards {
    display: flex; gap: 25px; margin-top: 2rem; flex-wrap: wrap;
}

.mode-sticker {
    width: 320px;
    height: auto;
    border-radius: 15px; /* 丸から長方形（角丸）に変更 */
    display: flex; flex-direction: column; justify-content: flex-start; align-items: center;
    text-align: center;
    padding: 20px;
    box-shadow: 0 15px 25px rgba(0,0,0,0.1);
    color: #333;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mode-sticker:hover { transform: scale(1.05) rotate(2deg); }

.yellow-sticker { background-color: var(--pop-yellow); border: 5px dotted #f57f17; transform: rotate(-3deg); }
.red-sticker { background-color: #ffcdd2; border: 5px dashed #f44336; transform: rotate(2deg); }
.green-sticker { background-color: var(--pop-green); border: 5px dashed #00c853; transform: rotate(-2deg); }

.mode-sticker h3 { font-size: 1.6rem; font-weight: 900; margin-bottom: 0.5rem; line-height: 1.3; }
.mode-sticker p { font-size: 1.1rem; font-weight: 700; margin: 0; }

.mode-sticker-img {
    width: 100%; /* 横幅いっぱい */
    height: 180px; /* 縦長・正方形ではなく横長の画像を想定 */
    border-radius: 10px; /* 丸から角丸に変更 */
    object-fit: cover;
    margin-bottom: 15px;
    border: 4px solid #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.mode-link-btn {
    display: inline-block;
    background: #ff4081;
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.8rem;
    margin-top: 10px;
    box-shadow: 0 2px 0 #c51162;
}

/* --- 開催概要（テーブル） --- */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 1.2rem;
    text-align: left;
}
.info-table th, .info-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
}
.info-table th {
    padding: 15px 5px 5px 5px;
    border-bottom: none;
    color: var(--pop-pink);
}
.info-table td {
    padding: 0 5px 15px 5px;
    border-bottom: 2px dashed #ccc;
    font-weight: 700;
}

/* --- アクセス情報詳細 --- */
.access-spot {
    background-color: #fff;
    border: 3px dashed var(--pop-orange);
    border-radius: 15px;
    padding: 20px;
    margin-top: 35px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.05);
    text-align: left;
}
.spot-title {
    font-size: 1.3rem;
    color: #fff;
    background-color: var(--pop-orange);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    margin-top: -35px;
    margin-bottom: 5px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.spot-name {
    font-size: 1.6rem;
    color: #333;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px dashed var(--pop-orange);
    display: block; /* 改行させる */
    font-weight: 900;
}
.spot-coord {
    font-family: monospace;
    font-size: 0.9rem;
    color: #666;
    background: #f9f9f9;
    border-left: 4px solid var(--pop-yellow);
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}
.google-map {
    width: 100%;
    height: 300px;
    border: none;
    border-radius: 10px;
    margin: 10px 0;
}
.video-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.video-btn {
    flex: 1;
    min-width: 120px;
    background: var(--pop-yellow);
    color: #333 !important;
    text-decoration: none !important;
    padding: 8px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
    border: 2px solid #f57f17;
    box-shadow: 0 3px 0 rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.video-btn:hover {
    transform: translateY(-2px);
}

.scroll-padding { height: 40vh; }

/* --- キャラクターの吹き出し --- */
.character-speech {
    display: flex;
    align-items: flex-start;
    margin-top: 40px;
    gap: 15px;
    z-index: 5;
    position: relative;
    align-self: center; /* セクションの中で中央寄りに配置 */
}
.character-speech.right {
    flex-direction: row-reverse;
}
.char-img {
    width: 240px; /* キャラクターを大きく */
    height: auto;
    flex-shrink: 0; /* 画面が狭くてもキャラクターを縮小しない */
    filter: drop-shadow(3px 3px 5px rgba(0,0,0,0.2));
    animation: bounce-slight 3s infinite ease-in-out;
}
@keyframes bounce-slight {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.speech-bubble {
    background-color: #fff;
    border: 4px solid var(--pop-pink);
    border-radius: 25px;
    padding: 15px 25px;
    font-size: 1.5rem; /* 吹き出しの文字も少し大きく */
    font-weight: 900;
    color: #333;
    position: relative;
    box-shadow: 4px 4px 0 rgba(255, 64, 129, 0.2);
    margin-top: 20px;
    word-break: keep-all; /* 文字が不自然な位置で改行されるのを防ぐ */
}
.speech-bubble::before, .speech-bubble::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
}
/* 左側キャラクター（吹き出しの左にツノ） */
.character-speech.left .speech-bubble::before {
    left: -18px;
    border-width: 12px 18px 12px 0;
    border-color: transparent var(--pop-pink) transparent transparent;
}
.character-speech.left .speech-bubble::after {
    left: -12px;
    border-width: 8px 14px 8px 0;
    border-color: transparent #fff transparent transparent;
}

/* 右側キャラクター（吹き出しの右にツノ） */
.character-speech.right .speech-bubble {
    border-color: var(--pop-orange);
    box-shadow: 4px 4px 0 rgba(255, 152, 0, 0.2);
}
.character-speech.right .speech-bubble::before {
    right: -18px;
    border-width: 12px 0 12px 18px;
    border-color: transparent transparent transparent var(--pop-orange);
}
.character-speech.right .speech-bubble::after {
    right: -12px;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #fff;
}

/* --- 左下のフワフワ浮くロゴ --- */
.floating-logo {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    animation: float-logo 3s ease-in-out infinite;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.logo-circle {
    background-color: #ffffff;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid var(--pop-orange);
    padding: 0; /* 丸の中いっぱいに広げるために0に変更 */
    box-sizing: border-box;
    transition: transform 0.3s;
    overflow: hidden; /* はみ出した部分を丸く切り取る */
}

.floating-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 画像の比率を保ちながら丸を埋める */
    display: block;
}

.logo-text {
    background-color: #ffffff;
    color: #444;
    font-size: 0.75rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 15px;
    text-align: center;
    line-height: 1.2;
    border: 2px solid var(--pop-orange);
}

.floating-logo:hover .logo-circle {
    transform: scale(1.15) rotate(-5deg);
}

@keyframes float-logo {
    0% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
    /* タイトルを画面いっぱいに広げる */
    .title-block { padding: 0; }
    .title-image { 
        width: 100vw; 
        max-width: none; 
        margin-left: -5px; /* sceneの左右padding(5px)を相殺 */
        transform: scale(1) rotate(-2deg); 
    }
    .huge-text { font-size: 16vw; }
    .hand-subtitle { font-size: 1.8rem; padding: 5px 15px; }
    
    /* 横幅を広げるため、右側のスクロールパス（黄色いリボン）を非表示に */
    #scroll-path-container { display: none !important; }
    
    /* コンテンツと枠の間にほどよいスペースを確保する */
    .paper-bg { font-size: 1rem; padding: 25px 20px; }
    .paper-bg-round { padding: 25px 20px; font-size: 1.05rem; }
    .mode-sticker { width: 100%; max-width: 340px; height: auto; }
    .mode-sticker h3 { font-size: 1.4rem; }
    .mode-sticker p { font-size: 1rem; }
    .mode-sticker-img { width: 100%; height: 150px; }
    .photo-slideshow { margin: 1rem auto; }
    .photo-slideshow .photo-frame { padding: 6px 6px 15px 6px; }
    .char-img { width: 160px; } /* スマホでもしっかり大きく */
    .speech-bubble { font-size: 1.15rem; padding: 10px 15px; }
    .spot-name { font-size: 1.3rem; }
    
    /* スマホでは角度をつけずに幅を有効活用する */
    .scene.in-view, 
    .scene:nth-child(even).in-view, 
    .scene:nth-child(odd).in-view {
        transform: scale(1) rotate(0deg) !important;
    }
    
    /* スマホではカスタムカーソル（とうもろこし）を無効化 */
    #cursor { display: none !important; }
    body, html, a, button, .scene { cursor: auto !important; }
}

/* --- PC向けレイアウト（横並び・ジグザグ配置） --- */
@media (min-width: 769px) {
    .floating-logo {
        bottom: 30px;
        left: 30px;
    }
    
    .logo-circle {
        width: 90px;
        height: 90px;
        padding: 0; /* PCでも丸の中いっぱいに */
    }
    
    .logo-text {
        font-size: 0.85rem;
    }

    /* PCではスマホ用の左右寄せを解除して中央配置 */
    .scene.left-align, .scene.right-align {
        justify-content: center;
    }

    .scrap-block {
        max-width: 1400px; /* PCでは幅をさらに広げる */
        width: 95%; /* 画面幅をいっぱいまで使う */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 30px;
    }
    
    .intro-block, .info-block {
        flex-direction: row; /* 横並びに戻す */
        align-items: flex-start;
        justify-content: space-between; /* 左右いっぱいに広げる */
        width: 100%;
        gap: 60px; /* テキストと背景の間に少し大きめの余白を持たせる */
    }

    .intro-block .huge-text, .info-block .huge-text {
        width: max-content; /* テキストの長さに枠幅を完全に合わせる */
        max-width: 50%; /* 大きくなりすぎ防止 */
        flex-shrink: 0;
        text-align: left;
        margin-top: 2rem;
        line-height: 1.1;
    }

    .intro-block .paper-bg, .info-block .paper-bg, .info-block .paper-bg-round {
        flex: 1; /* 残りの幅を綺麗に埋める */
        margin-left: 0;
        margin-top: 0;
        max-width: none;
        min-width: 0; /* flexの縮小を確実に許可 */
    }

    .paper-bg, .paper-bg-round {
        width: 100%;
        max-width: 900px;
        box-sizing: border-box;
    }

    .mode-cards {
        justify-content: center;
        max-width: 800px;
        margin: 0 auto 100px auto; /* 中央配置＆余白確保 */
    }

    /* タイトルは中央のまま（flex-direction: column を維持） */
    .title-block {
        flex-direction: column;
        align-items: center; /* タイトルは中央揃え */
        justify-content: center;
        max-width: 800px;
        margin: 0 auto 100px auto; /* 中央配置＆余白確保 */
    }

    .scrap-block .huge-text {
        font-size: clamp(4rem, 7vw, 7rem); /* PCで全見出しのサイズを統一しつつ、極端な巨大化を防ぐ */
        text-align: center;
    }

    .scrap-block .paper-bg {
        margin-top: 1rem;
    }

    /* 3つのあそびかたの中身を中央揃えで横並びに */
    .mode-cards {
        justify-content: center;
    }
}
