/* アカツキちゃんストーリーページ専用CSS */
:root {
    --story-primary: #667eea;
    --story-secondary: #f093fb;
    --story-accent: #764ba2;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --warm-white: #fefefe;
}

/* このページ専用：標準フッターを非表示 */
footer {
    display: none !important;
}

/* メインコンテナ */
.akatsuki-story-container {
    position: relative;
    height: 600vh; /* 6シーン分 */
}

/* 固定キャンバス */
.story-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
}

/* 背景 */
.story-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/assets/img/aktk-chan-bg/dawn-sky.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: all 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0.9;
}

/* マンガ風フレーム */
.manga-frame {
    position: absolute;
    border: 3px solid var(--text-primary);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 6px 6px 0px rgba(45, 55, 72, 0.3);
    z-index: 3;
    opacity: 0;
    transform: scale(0.8) rotate(2deg);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.manga-frame.active {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* メインフレーム */
.main-frame {
    width: 380px;
    height: 450px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.8) rotate(2deg);
    border-radius: 20px;
}

/* サブフレーム */
.sub-frame {
    width: 140px;
    height: 90px;
    border-radius: 12px;
}

.sub-frame-1 {
    top: 8%;
    left: 8%;
    transform: rotate(-3deg);
}

.sub-frame-2 {
    top: 12%;
    right: 12%;
    transform: rotate(4deg);
}

.sub-frame-3 {
    bottom: 15%;
    left: 6%;
    transform: rotate(2deg);
}

/* アカツキちゃんキャラクター */
.akatsuki-character {
    position: absolute;
    width: 320px;
    height: 380px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 4;
    opacity: 1;
}

.akatsuki-character img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.2));
}

/* キャラクター画像の基本スタイル */
.akatsuki-character-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.1s ease-out, opacity 0.2s ease, filter 0.3s ease;
    will-change: transform;
    transform: rotate(0deg);
}

/* フォールバックキャラクタースタイル */
.fallback-character {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #fce4ec, #e3f2fd);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #667eea;
    border: 3px solid rgba(102, 126, 234, 0.2);
    text-align: center;
}

.fallback-character .character-emoji {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.fallback-character .character-name {
    font-size: 1.2rem;
    font-weight: 600;
}

/* マンガエフェクト */
.manga-effects {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* 集中線 */
.focus-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    background: radial-gradient(
        circle at center,
        transparent 35%,
        rgba(45, 55, 72, 0.08) 36%,
        transparent 37%,
        rgba(45, 55, 72, 0.08) 38%,
        transparent 39%
    );
    animation: focusRotate 12s linear infinite;
}

/* スピードライン */
.speed-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    background: repeating-linear-gradient(
        35deg,
        transparent,
        transparent 8px,
        rgba(102, 126, 234, 0.12) 9px,
        rgba(102, 126, 234, 0.12) 11px
    );
    animation: speedMove 2.5s ease-in-out infinite;
}

/* トーン効果 */
.manga-tone {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, rgba(240, 147, 251, 0.1) 1px, transparent 1px);
    background-size: 24px 24px, 30px 30px;
    animation: toneShift 5s ease-in-out infinite;
}

/* 吹き出し風テキストエリア */
.story-bubble {
    position: absolute;
    bottom: 5%;
    left: 0;
    right: 0;
    width: 80%;
    max-width: 1100px;
    min-width: 400px;
    margin: 0 auto;
    height: auto;
    min-height: 120px;
    max-height: 300px;
    background: var(--warm-white);
    border: 3px solid var(--text-primary);
    border-radius: 25px 25px 25px 8px;
    padding: 1.8rem;
    text-align: center;
    transform: translateY(100%) scale(0.8);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 8px 8px 0px rgba(45, 55, 72, 0.25);
    z-index: 10;
    opacity: 0;
    overflow: hidden;
}

/* 吹き出しのしっぽ */
.story-bubble::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 35px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--warm-white);
    filter: drop-shadow(2px 2px 0px rgba(45, 55, 72, 0.25));
}

.story-bubble * {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.story-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 32px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid var(--text-primary);
}

.story-bubble p,
.story-bubble h2 {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* テキストスタイル */
.bubble-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    text-shadow: 2px 2px 0px rgba(102, 126, 234, 0.2);
}

.bubble-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.bubble-subtitle {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
    font-style: italic;
}

/* シーン別スタイル */
.scene-intro .akatsuki-character {
    transform: translate(-50%, -50%) scale(1);
}

.scene-intro .story-bubble {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.scene-intro .manga-tone {
    opacity: 0.4;
}

/* キャラクター設定シーン */
.scene-character .akatsuki-character {
    transform: translate(-35%, -50%) scale(1.05) rotate(-2deg);
}

.scene-character .story-bubble {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.scene-character .speed-lines {
    opacity: 0.3;
}

/* 技術シーン */
.scene-technology .akatsuki-character {
    transform: translate(-60%, -45%) scale(0.95) rotate(1deg);
}

.scene-technology .story-bubble {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.scene-technology .focus-lines {
    opacity: 0.25;
}

/* 使命シーン */
.scene-mission .akatsuki-character {
    transform: translate(-50%, -60%) scale(1.1);
}

.scene-mission .story-bubble {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.scene-mission .focus-lines {
    opacity: 0.4;
}

.scene-mission .manga-tone {
    opacity: 0.3;
}

/* お問い合わせシーン */
.scene-contact .akatsuki-character {
    transform: translate(-45%, -50%) scale(1.05) rotate(-1deg);
}

.scene-contact .story-bubble {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.scene-contact .speed-lines {
    opacity: 0.2;
}

/* CTAボタン */
.story-cta-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--story-primary), var(--story-secondary));
    color: white;
    padding: 0.8rem 2rem;
    border: 2px solid rgba(45, 55, 72, 0.1);
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.3);
    font-size: 0.95rem;
}

.story-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    color: white;
}

/* アニメーション */
@keyframes focusRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes speedMove {
    0%, 100% { transform: translateX(0px); }
    50% { transform: translateX(15px); }
}

@keyframes toneShift {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.5; }
}

/* スクロール進行バー */
.story-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--story-primary), var(--story-secondary));
    z-index: 1000;
    transition: width 0.1s ease;
}

/* ローディング画面（このページ専用） */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: url('/assets/img/aktk-chan-bg/dawn-sky.webp') center/cover no-repeat;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.2s;
}

.akatsuki-loading {
    animation: akatsukiFloat 2s ease-in-out infinite;
}

@keyframes akatsukiFloat {
    0%, 100% { transform: translateY(0px) rotate(-1deg); }
    25% { transform: translateY(-15px) rotate(1deg); }
    50% { transform: translateY(-8px) rotate(-0.5deg); }
    75% { transform: translateY(-18px) rotate(0.8deg); }
}

/* 星エフェクトコンテナ */
.star-effects-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* 星パーティクル */
.star-particle {
    position: absolute;
    pointer-events: none;
    z-index: 6;
}

/* ローディング画面の星エフェクト用スタイル */
.loading-star-particle {
    position: absolute;
    pointer-events: none;
    z-index: 6;
}

.loading-star-particle.star-type {
    width: 24px;
    height: 24px;
}

.loading-star-particle.sparkle-type {
    width: 20px;
    height: 20px;
}

.loading-star-particle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* CSS フォールバック：星 */
.star-fallback {
    position: relative;
    width: 100%;
    height: 100%;
}

.star-fallback .star-vertical {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 24px;
    background: linear-gradient(to bottom, #ffeaa7, #fab1a0);
    transform: translateX(-50%);
    border-radius: 1px;
}

.star-fallback .star-horizontal {
    position: absolute;
    top: 50%;
    left: 0;
    width: 24px;
    height: 2px;
    background: linear-gradient(to right, #ffeaa7, #fab1a0);
    transform: translateY(-50%);
    border-radius: 1px;
}

/* CSS フォールバック：スパークル */
.sparkle-fallback {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #fd79a8, #e17055);
    border-radius: 50%;
    position: relative;
}

.sparkle-fallback .sparkle-vertical {
    position: absolute;
    top: -2px;
    left: 50%;
    width: 1px;
    height: 24px;
    background: linear-gradient(to bottom, #fd79a8, transparent);
    transform: translateX(-50%);
}

.sparkle-fallback .sparkle-horizontal {
    position: absolute;
    top: 50%;
    left: -2px;
    width: 24px;
    height: 1px;
    background: linear-gradient(to right, #fd79a8, transparent);
    transform: translateY(-50%);
}

/* 星の噴出アニメーション */
@keyframes starErupt {
    0% {
        transform: translateY(0px) scale(0) rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 0.9;
        transform: translateY(-70vh) scale(1) rotate(90deg);
    }
    85% {
        opacity: 0.9;
        transform: translateY(-120vh) scale(1.2) rotate(270deg);
    }
    100% {
        transform: translateY(-140vh) scale(0.6) rotate(360deg);
        opacity: 0;
    }
}

/* スパークルの噴出アニメーション */
@keyframes sparkleErupt {
    0% {
        transform: translateY(0px) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        opacity: 0.8;
        transform: translateY(-60vh) scale(1) rotate(120deg);
    }
    80% {
        opacity: 0.8;
        transform: translateY(-115vh) scale(1.1) rotate(300deg);
    }
    100% {
        transform: translateY(-135vh) scale(0.4) rotate(480deg);
        opacity: 0;
    }
}

/* 最終セクションのスタイル */
.akatsuki-final-section {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 4rem 2rem 6rem 2rem;
    text-align: center;
    margin-top: 100vh;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.akatsuki-final-content {
    max-width: 800px;
    margin: 0 auto;
}

.akatsuki-final-title {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 2rem;
    text-shadow: 3px 3px 0px rgba(102, 126, 234, 0.2);
    font-weight: 700;
}

.akatsuki-final-description {
    font-size: 1.2rem;
    color: #4a5568;
    line-height: 1.8;
    margin-bottom: 3rem;
}

.akatsuki-cta-button {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #f093fb);
    color: white;
    padding: 1.2rem 3rem;
    border: 3px solid #2d3748;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 6px 6px 0px rgba(45, 55, 72, 0.3);
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.akatsuki-cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 9px 9px 0px rgba(45, 55, 72, 0.3);
    color: white;
    text-decoration: none;
}

/* アカツキちゃん専用のミニフッター */
.akatsuki-mini-footer {
    background: rgba(45, 55, 72, 0.1);
    padding: 2rem 0;
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
    border-top: 1px solid rgba(45, 55, 72, 0.1);
}

.akatsuki-mini-footer p {
    margin: 0.5rem 0;
}

.akatsuki-mini-footer .company-name {
    font-weight: 600;
    color: #4a5568;
}

.akatsuki-mini-footer .credit {
    margin-top: 1rem;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .main-frame {
        width: 300px;
        height: 350px;
    }

    .akatsuki-character {
        width: 250px;
        height: 300px;
    }

    .bubble-title {
        font-size: 1.3rem;
    }

    .bubble-description {
        font-size: 0.9rem;
    }

    .story-bubble {
        padding: 1.4rem;
        min-height: 100px;
    }

    .sub-frame {
        width: 100px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .akatsuki-story-container {
        /* height: auto; を削除し、PCと同じ高さに */
        height: 600vh;
        min-height: 100vh;
    }
    
    .story-canvas {
        /* position: relative; を削除し、PCと同じく固定 */
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        min-height: 100vh;
        display: block;
        padding: 0;
        z-index: 1;
    }
    
    /* モバイルでは背景を確実に表示 */
    .story-background {
        min-height: 100vh;
    }

    .manga-frame {
        display: none;
    }
    
    .manga-effects {
        display: none;
    }
    
    .akatsuki-character {
        position: relative;
        width: 280px;
        height: 320px;
        left: auto;
        top: auto;
        transform: none;
        margin-bottom: 2rem;
        margin-top: 84px;
        margin-left: auto;
        margin-right: auto;
        z-index: 4;
    }
    
    .akatsuki-character img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
    }

    .story-bubble {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        margin: 0 auto;
        width: auto;
        max-width: 90%;
        min-width: 320px;
        height: auto;
        min-height: auto;
        max-height: none;
        background: var(--warm-white);
        border: 3px solid var(--text-primary);
        border-radius: 25px;
        padding: 2rem 1.8rem;
        text-align: center;
        transform: none;
        transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 4px 4px 0px rgba(45, 55, 72, 0.25);
        z-index: 10;
        opacity: 1;
        overflow: hidden;
    }

    /* 吹き出しの矢印をキャラクター側に向ける */
    .story-bubble::before {
        bottom: auto;
        top: -12px;
        left: 50%;
        transform: translateX(-50%);
        border-left: 12px solid transparent;
        border-right: 12px solid transparent;
        border-top: none;
        border-bottom: 12px solid var(--warm-white);
    }
    
    .story-bubble::after {
        bottom: auto;
        top: -15px;
        left: 50%;
        transform: translateX(-50%);
        border-left: 15px solid transparent;
        border-right: 15px solid transparent;
        border-top: none;
        border-bottom: 15px solid var(--text-primary);
    }

    .bubble-title {
        font-size: 1.4rem;
        margin-bottom: 1.2rem;
    }

    .bubble-description {
        font-size: 1.1rem;
        line-height: 1.7;
        margin-bottom: 1rem;
    }

    .bubble-subtitle {
        font-size: 0.9rem;
        margin-top: 1.2rem;
    }
    
    /* モバイルでは全シーンで同じスタイル */
    .story-canvas[class*="scene-"] .akatsuki-character {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
    }
    
    .story-canvas[class*="scene-"] .story-bubble {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
        opacity: 1;
    }
}

/* 極小画面（iPhone SE等）対応 */
@media (max-width: 375px) {
    .story-bubble {
        max-width: 95%;
        min-width: 300px;
        padding: 1.8rem 1.5rem;
    }
    
    .bubble-title {
        font-size: 1.2rem;
    }
    
    .bubble-description {
        font-size: 1rem;
    }
    
    .bubble-subtitle {
        font-size: 0.85rem;
    }
    
    .akatsuki-character {
        width: 250px;
        height: 280px;
    }
}