/* リセット & ベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* 横スクロール禁止 */
    overflow-y: auto; /* 縦スクロール許可 */
    background: transparent;
    /* 1画面完結のための最適化 */
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* スマートフォン時はスクロール許可 */
@media screen and (max-width: 768px) {
    html, body {
        overflow-x: hidden !important; /* 横スクロール禁止 */
        overflow-y: auto !important; /* 縦スクロール許可 */
        height: auto !important;
    }
}

body {
    height: auto; /* 高さを自動に */
    min-height: 100vh;
    min-height: 100svh; /* モバイルブラウザ対応 */
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* 横スクロール禁止 */
    overflow-y: auto; /* 縦スクロール許可 */
    font-family: 'Noto Serif JP', serif;
    color: #ffffff;
    background: #000; /* スライドショーの背景として黒を設定 */
    /* スクロール対応 */
    position: static;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: none;
    /* セーフエリア対応 */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* メインコンテナ - 天地中央配置 */
.container {
    position: relative;
    width: 100%;
    max-width: 100vw; /* 最大幅を制限 */
    max-width: 100svw; /* モバイルブラウザ対応 */
    height: auto; /* 高さを自動に */
    min-height: 100vh;
    min-height: 100svh; /* モバイルブラウザ対応 */
    overflow: visible; /* スクロール許可 */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* 下寄せ配置 */
    align-items: center;
    padding: 40px 20px; /* 上下左右に余白 */
    box-sizing: border-box; /* paddingを含めた幅計算 */
}

/* 背景画像はbodyで設定、JavaScriptで切り替え */

/* PC版ロゴ - 左上配置 */
.logo-wrapper {
    position: absolute;
    top: 30px;
    left: 30px;
    width: 200px;
    z-index: 4;
    display: block;
}

.logo {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* スマホ版用のオーバーレイ（PC版では非表示） */
.overlay {
    display: none;
}

/* メインコンテンツ - flexboxでコンテンツを下寄せ配置 */
.main-content {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* 下寄せ配置 */
    align-items: center;
    gap: 60px; /* コンテンツ間の間隔 */
    flex: 1; /* 残りの高さを全て使用 */
}

/* 縦書きテキスト（PC版 - ブロック要素として中央配置） */
.vertical-text-wrapper {
    position: static; /* position解除 */
    transform: none;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: auto;
    background: transparent;
    padding: 0;
    margin: 0 auto; /* 中央配置 */
}

.vertical-text {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: transparent;
}

.tagline {
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    font-size: clamp(32px, 4vw, 60px); /* vwベースの相対サイズ */
    line-height: 1em;
    color: #ffffff;
    text-align: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    width: auto; /* 自動幅調整 */
    height: auto;
    letter-spacing: 0.1em;
    background: transparent;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8); /* 視認性向上 */
}

/* アナウンスメント（PC版 - ブロック要素として配置） */
.announcement-wrapper {
    position: static; /* position解除 */
    transform: none;
    width: 80vw;
    max-width: 1090px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: auto;
    margin: 0 auto; /* 中央配置 */
}

.announcement {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.announcement-text {
    font-family: 'Noto Serif JP', serif;
    color: #ffffff;
    text-align: center;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.05em;
    padding: 20px;
    gap: 35px; /* 余白を調整 */
}

.title-section {
    font-weight: 500;
    font-size: clamp(28px, 4.5vw, 55px); /* より柔軟な相対サイズ */
    line-height: 1.2em; /* 行間を小さく */
    letter-spacing: 0.05em;
    margin-bottom: 1.5vh; /* vh単位で相対的な余白 */
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8); /* 視認性向上 */
}

.details-section {
    font-weight: 400;
    font-size: clamp(12px, 1.8vw, 20px); /* 全体的に小さく */
    line-height: 1.5em; /* 行間も調整 */
    letter-spacing: 0.02em;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8); /* 視認性向上 */
}

/* PC版では最初の行のみ改行、残りは1行表示 */
.detail-line {
    display: inline;
}

.detail-line:first-child {
    display: block;
    margin-bottom: 0.5em;
    /* PC版では他の詳細情報と同じサイズに統一 */
}

.detail-line:not(:first-child):not(:last-child)::after {
    content: "／";
    margin: 0 0.2em;
}

/* レスポンシブ対応 - タブレット（900px以下で切り替え） - ブロック配置 */
@media screen and (max-width: 900px) {
    .container {
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100svh !important;
        overflow: visible !important;
        padding: 30px 20px !important;
        justify-content: flex-end !important; /* 下寄せ配置 */
        align-items: center !important;
    }
    
    .logo-wrapper {
        position: absolute !important; /* ロゴは左上維持 */
        top: 30px !important;
        left: 30px !important;
        width: 180px !important;
    }
    
    .vertical-text-wrapper {
        position: static !important; /* ブロック配置 */
        margin: 0 auto !important;
        transform: none !important;
        padding: 0;
    }
    
    .tagline {
        font-size: clamp(28px, 5vw, 40px); /* vwベース相対サイズ */
        margin-top: 0; /* 余白削除 */
        text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.9);
    }
    
    .announcement-wrapper {
        position: static !important; /* ブロック配置 */
        width: 90vw; /* より広い幅で余裕を持たせる */
        margin: 0 auto !important;
        transform: none !important;
    }
    
    .announcement-text {
        gap: 2vh; /* より小さな余白 */
        margin-top: 0; /* 余白削除 */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .title-section {
        font-size: clamp(24px, 4.8vw, 42px); /* vwベース相対サイズ */
        line-height: 1.2em; /* 行間を小さく */
        margin-bottom: 2vh; /* vh単位で相対的な余白 */
        margin-top: 0; /* 余白削除 */
        text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.9);
        text-align: center !important;
    }
    
    .details-section {
        font-size: clamp(11px, 2.5vw, 16px); /* より小さく */
        margin-top: 0; /* 余白削除 */
        text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.9);
        line-height: 1.4em; /* 行間調整 */
        text-align: center !important;
    }
}

/* レスポンシブ対応 - スマートフォン (縦向き) - シンプルなブロック配置 */
@media screen and (max-width: 768px) {
    /* 全てのPC版スタイルをリセット */
    .container {
        position: relative !important;
        width: 100vw !important;
        width: 100svw !important; /* モバイルブラウザ対応 */
        height: auto !important; /* 高さを自動に */
        min-height: 100vh !important;
        min-height: 100svh !important; /* モバイルブラウザ対応 */
        overflow: visible !important; /* スクロール許可 */
        margin: 0 !important;
        padding: 20px 20px 40px 20px !important; /* 上部の余白を小さく */
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important; /* 下寄せ配置 */
        align-items: center !important;
    }
    
    /* メインコンテンツ */
    .main-content {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        z-index: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important; /* 下寄せ配置 */
        align-items: center !important;
        gap: 60px !important; /* コンテンツ間の間隔 */
        flex: 1 !important; /* 残りの高さを全て使用 */
    }
    
    /* オーバーレイ完全非表示 */
    .overlay {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* ロゴ - ブロック要素として配置 */
    .logo-wrapper {
        position: static !important; /* position解除 */
        width: 200px !important;
        height: auto !important;
        z-index: auto !important;
        display: block !important;
        margin: 0 auto !important; /* 中央配置 */
        transform: none !important;
    }
    
    .logo {
        width: 100% !important;
        height: auto !important;
        display: block !important;
    }
    
    /* 縦書きテキスト - ブロック要素として中央配置 */
    .vertical-text-wrapper {
        position: static !important; /* position解除 */
        width: auto !important;
        height: auto !important;
        z-index: auto !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        flex-direction: unset !important;
        padding: 0 !important;
        margin: 0 auto !important; /* 中央配置 */
        transform: none !important;
    }
    
    .vertical-text {
        width: auto !important;
        height: auto !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0 !important;
        margin: 0 !important;
        flex-direction: unset !important;
    }
    
    .tagline {
        font-family: 'Noto Serif JP', serif !important;
        font-weight: 500 !important;
        font-size: clamp(20px, 6vw, 32px) !important; /* vwベース相対サイズ */
        line-height: 1em !important;
        color: #ffffff !important;
        writing-mode: vertical-rl !important;
        text-orientation: upright !important;
        text-align: center !important;
        letter-spacing: 0.05em !important;
        text-shadow: 3px 3px 15px rgba(0, 0, 0, 0.95) !important; /* 視認性向上 */
        width: auto !important;
        height: auto !important;
        display: block !important;
        margin: 0 !important;
        margin-top: 0 !important; /* 余白削除 */
        padding: 0 !important;
        transform: none !important;
        position: static !important;
    }
    
    /* お知らせテキスト - ブロック要素として配置 */
    .announcement-wrapper {
        position: static !important; /* position解除 */
        width: 100% !important;
        max-width: 90vw !important;
        height: auto !important;
        z-index: auto !important;
        display: block !important;
        justify-content: unset !important;
        align-items: unset !important;
        flex-direction: unset !important;
        gap: unset !important;
        margin: 0 auto !important; /* 中央配置 */
        transform: none !important;
    }
    
    .announcement {
        width: 100% !important;
        height: auto !important;
        display: block !important;
        text-align: center !important; /* 中央配置 */
        justify-content: unset !important;
        align-items: unset !important;
        flex-direction: unset !important;
    }
    
    .announcement-text {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        text-align: center !important; /* 中央配置 */
        justify-content: center !important;
        align-items: center !important;
        gap: 15px !important; /* 余白を小さく */
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* 疑似要素を完全に無効化 */
    .announcement-text::before {
        display: none !important;
        content: none !important;
        visibility: hidden !important;
    }
    
    /* HTMLの実際の要素を表示 */
    .title-section {
        display: block !important;
        visibility: visible !important;
        font-family: 'Noto Serif JP', serif !important;
        font-weight: 500 !important;
        font-size: clamp(18px, 5.5vw, 28px) !important; /* vwベース相対サイズ */
        line-height: 1.1em !important; /* 行間をより小さく */
        color: #ffffff !important;
        text-align: center !important; /* 中央配置 */
        margin: 0 !important; /* マージンなし */
        padding: 0 !important;
        text-shadow: 3px 3px 15px rgba(0, 0, 0, 0.95) !important; /* 視認性向上 */
        letter-spacing: 0.02em !important;
        width: auto !important;
        height: auto !important;
    }
    
    .details-section {
        display: block !important;
        visibility: visible !important;
        font-family: 'Noto Serif JP', serif !important;
        font-weight: 400 !important;
        font-size: clamp(10px, 3vw, 14px) !important; /* 全体的に小さく */
        line-height: 1.5em !important; /* 行間も調整 */
        color: #ffffff !important;
        text-align: center !important; /* 中央配置 */
        margin: 0 !important;
        margin-top: 0 !important; /* 余白削除 */
        padding: 0 !important;
        text-shadow: 3px 3px 15px rgba(0, 0, 0, 0.95) !important; /* 視認性向上 */
        letter-spacing: 0.02em !important;
        width: auto !important;
        height: auto !important;
    }
    
    /* スマートフォン版では改行表示 */
    .detail-line {
        display: block !important; /* ブロック要素で改行 */
        margin-bottom: 0.15em !important; /* 行間を小さく */
    }
    
    .detail-line:last-child {
        margin-bottom: 0 !important;
    }
    
    /* PC版の区切り文字を無効化 */
    .detail-line::after,
    .detail-line::before {
        display: none !important;
        content: none !important;
    }
    
    /* 全ての行を統一して小さく */
    .detail-line {
        font-size: clamp(10px, 3vw, 14px) !important; /* 全体的に小さく統一 */
    }
    
    /* 最初の行（ホームページをリニューアル）をさらに小さく */
    .detail-line:first-child {
        font-size: clamp(9px, 2.5vw, 12px) !important; /* より小さく */
        opacity: 0.9 !important; /* 少し薄く */
    }
}

/* レスポンシブ対応 - 小さなスマートフォン（シンプルなブロック配置） */
@media screen and (max-width: 480px) {
    .container {
        padding: 15px 15px 30px 15px !important; /* より小さな上部余白 */
    }
    
    .logo-wrapper {
        width: 160px !important; /* より小さなロゴサイズ */
    }
    
    .main-content {
        gap: 10vw !important; /* より小さな画面用のgap調整 */
    }
    
    .tagline {
        font-size: clamp(18px, 6vw, 26px) !important; /* より小さなフォントサイズ */
    }
    
    .announcement-text {
        gap: 12px !important; /* より小さなgap */
    }
    
    /* 詳細情報全体を小さく */
    .details-section {
        font-size: clamp(9px, 2.8vw, 12px) !important; /* 全体的に小さく */
    }
    
    /* 全ての行を小さく */
    .detail-line {
        font-size: clamp(9px, 2.8vw, 12px) !important;
    }
    
    /* 最初の行をさらに小さく */
    .detail-line:first-child {
        font-size: clamp(8px, 2.3vw, 10px) !important;
    }
    
    .title-section {
        font-size: clamp(16px, 5.5vw, 22px) !important;
        line-height: 1.1em !important; /* 行間をより小さく */
    }
}

/* 横向きスマートフォン - スクロール対応（突き破り防止） */
@media screen and (max-height: 600px) and (orientation: landscape) {
    /* bodyとhtmlのスクロール許可 */
    html, body {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100svh !important; /* モバイルブラウザ対応 */
        padding-top: 0 !important;
    }
    
    .container {
        height: auto !important;
        min-height: 120vh !important; /* スクロール領域を確保 */
        min-height: 120svh !important; /* モバイルブラウザ対応 */
        overflow: visible !important;
        position: relative !important;
        padding-top: 20px !important; /* 上部に安全な余白 */
        padding-bottom: 40px !important; /* 下部に安全な余白 */
    }
    
    /* 縦書きテキスト - 安全な上部配置 */
    .vertical-text-wrapper {
        position: absolute !important;
        top: max(80px, 15vh) !important; /* 最小80pxを確保して突き破り防止 */
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 10 !important;
        width: auto !important;
        height: auto !important;
    }
    
    .tagline {
        font-size: clamp(16px, 4vh, 22px) !important; /* vhベース相対サイズ */
        font-weight: 500 !important;
        text-shadow: 3px 3px 12px rgba(0, 0, 0, 0.95) !important;
    }
    
    /* アナウンスメント - 縦書きテキストの下に配置 */
    .announcement-wrapper {
        position: absolute !important;
        top: max(200px, 35vh) !important; /* 縦書きテキストの下に配置 */
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 80vw !important;
        max-width: none !important;
        z-index: 10 !important;
    }
    
    .announcement {
        text-align: center !important;
    }
    
    .announcement-text {
        font-size: clamp(12px, 2.8vh, 16px) !important; /* vhベース相対サイズ */
        text-align: center !important;
        font-weight: 500 !important;
        gap: 2vh !important;
    }
    
    .title-section {
        font-size: clamp(14px, 3.2vh, 20px) !important;
        line-height: 1.1em !important; /* 行間をより小さく */
        margin-bottom: 1.5vh !important;
        text-align: center !important;
    }
    
    .details-section {
        font-size: clamp(10px, 2.5vh, 14px) !important;
        text-align: center !important;
    }
}

/* 非常に高さが小さい画面用（突き破り完全防止） */
@media screen and (max-height: 400px) {
    html, body {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100svh !important; /* モバイルブラウザ対応 */
    }
    
    .container {
        height: auto !important;
        min-height: 150vh !important; /* より大きなスクロール領域 */
        min-height: 150svh !important; /* モバイルブラウザ対応 */
        overflow: visible !important;
        position: relative !important;
        padding-top: 30px !important;
        padding-bottom: 50px !important;
    }
    
    .vertical-text-wrapper {
        position: absolute !important;
        top: 60px !important; /* 固定値で安全確保 */
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 100 !important;
    }
    
    .tagline {
        font-size: clamp(14px, 5vw, 20px) !important;
        text-shadow: 3px 3px 15px rgba(0, 0, 0, 0.95) !important;
    }
    
    .announcement-wrapper {
        position: absolute !important;
        top: 180px !important; /* 固定値で安全な間隔 */
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 85vw !important;
        z-index: 100 !important;
    }
    
    .announcement-text {
        gap: 15px !important;
    }
    
    .title-section {
        font-size: clamp(12px, 4vw, 18px) !important;
        line-height: 1.1em !important; /* 行間をより小さく */
        margin-bottom: 10px !important;
        text-align: center !important;
    }
    
    .details-section {
        font-size: clamp(10px, 3.5vw, 14px) !important;
        text-align: center !important;
    }
}

/* アニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.announcement-text {
    animation: fadeInUp 1.2s ease-out 0.5s both;
}

.tagline {
    animation: fadeInRight 1.2s ease-out 0.8s both;
}

.logo {
    animation: fadeInUp 1.0s ease-out 0.2s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 参考サイト風スライドショー用スタイル */
.slideshow-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: -10 !important;
    overflow: hidden !important;
}

.slide {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    transform-origin: center center !important;
    will-change: opacity, transform !important;
    backface-visibility: hidden !important;
}

/* モバイル専用の最適化 - ズーム効果対応 */
@media screen and (max-width: 768px) {
    .slide {
        background-attachment: scroll !important;
        transition: opacity 1s ease-in-out, transform 8s ease-out !important; /* ズーム効果追加 */
        will-change: opacity, transform !important;
    }
}

/* PC版での最適化 */
@media screen and (min-width: 769px) {
    .slide {
        background-attachment: fixed;
        transition: opacity 1s ease-in-out, transform 10s ease-out !important;
    }
}

/* スムーズなアニメーション用のベースクラス */
.smooth-transition {
    transition-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* パフォーマンス最適化のための設定 */
body {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.container {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* JavaScriptからのスケール変更を無効化 */
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
}
