/* 全体のリセット */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
}

/* ページ全体のスタイル */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f4f4f4;
    font-family: "yomogi", cursive;
    overflow: hidden;
}

/* コンテナのスタイル */
.container {
    text-align: center;
    padding: 20px;
    width: 100%;
    height: 80%;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: visible; /* はみ出しを隠す */
}

#titleText {
    margin-bottom: 0px;
}

/* タイトル画面の画像スタイル */
#titleImage {
    max-width: 60%;
    height: auto;
    display: block;
    margin-top: 20px;
    border-radius: 8px;
    margin-left: auto;
    margin-right: auto;
}

/* ガチャ画面のコンテナスタイル */
#imageContainer {
    position: relative;
    width: 100%;
    height: 50%;
    margin-top: 10pt;
    overflow: visible; /* はみ出しを隠す */
}

/* カードパックのスタイル */
#cardPack {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px; /* サイズを調整 */
    height: 300px; /* サイズを調整 */
    background: url('images/card-pack.png') no-repeat center center;
    background-size: contain; /* 画像サイズ調整 */
    opacity: 0;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: none;
    animation: none;
}

/* 青色のカードのスタイル */
#blueCard {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px; /* サイズを調整 */
    height: 375px; /* サイズを調整 */
    /* background-color: rgba(0, 0, 255, 0.5);*/
    opacity: 0;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: none;
    animation: none;
    border-radius: 15px; /* 角を丸くする */
}

/* ガチャ結果の画像 */
#resultImage {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: 80%; /* サイズを調整 */
    max-height: 80%; /* サイズを調整 */
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 3;
    border-radius: 15px; /* 角を丸くする */
}

/* アニメーションの定義 */
@keyframes showPack {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(0px);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(50px);
    }
}

@keyframes showBlueCard {
    0% {
        opacity: 0;
        box-shadow: 0 0 0 rgba(0, 0, 255, 0);
    }
    50% {
        opacity: 1;
        /* 初期のボックスシャドウの色（これをJavaScriptで変える） */
        box-shadow: var(--blue-card-shadow, 0 0 20px rgba(0, 0, 255, 0.8));
    }
    100% {
        opacity: 0;
        box-shadow: 0 0 0 rgba(0, 0, 255, 0);
    }
}

@keyframes showResultImage {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* アニメーションを適用するクラス */
.show-card-pack {
    display: block;
    animation: showPack 4s forwards;
}

.show-blue-card {
    display: block;
    animation: showBlueCard 4s forwards 1.5s; /* 遅延を追加 */
}

.show-result-image {
    display: block;
    animation: showResultImage 2s forwards;
}

/* ボタンスタイル */
button {
    background-color: #28a745;
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease, opacity 1s ease-in-out; /* 背景色と透明度のトランジション */
    margin-top: 20px;
    width: 45%;
    max-width: 300px;
    opacity: 1; /* 初期は表示 */
    font-family: "yomogi", cursive;
}

/* 各ボタンの色を設定 */
.retry-button {
    background-color: #28a745; /* 緑色 */
    width: 60%;
}

.share-button {
    background-color: #4ca3ff; /* 青色 */
}

.title-button {
    background-color: #434340; /* 黄色 */
}

/* ボタンを非表示にするためのクラス */
.button-hidden {
    opacity: 0; /* 非表示 */
}

/* ボタンのスタイル (ホバーとアクティブ) */
button:hover {
    background-color: #218838;
}

button:active {
    transform: scale(0.95);
}

/* メディアクエリ: スマホ向けのスタイル */
@media screen and (max-width: 600px) {
    .container {
        padding: 10px;
    }

    #titleImage {
        max-width: 100%;
        max-height: 400px;
    }

    #imageContainer {
        height: 60%;
    }

    #cardPack {
        width: 250px; /* サイズを調整 */
        height: 3750px; /* サイズを調整 */
    }

    #blueCard {
        width: 180px; /* サイズを調整 */
        height: 270px; /* サイズを調整 */
    }

    button {
        padding: 15px;
        font-size: 18px;
        max-width: 100%;
    }
    #actionButtons {
        margin-top: 10px; /* 余白を詰める */
    }
}

/* 初期状態で非表示にするクラス */
.hidden {
    display: none;
}

/* 初期状態で非表示にするクラス */
.vishidden {
    visibility: hidden;
}

/* ボタンを非表示にするためのクラス（瞬時に非表示） */
.fading-hidden {
    opacity: 0; /* 非表示 */
    transition: none; /* トランジションなし */
}

/* ボタンを表示するためのクラス（スムーズに表示） */
.fading-visible {
    opacity: 1; /* 表示 */
    transition: opacity 1s ease-in-out; /* 透明度のトランジション */
}

/* キラキラエフェクトのスタイル */
.sparkle-effect {
    position: absolute;
    top: 30%;

    width: 100%;
    height: 100%; /* サイズは調整可能 */
    width: height;
    background: radial-gradient(circle, rgba(234, 255, 3, 0.7) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none; /* エフェクトがクリックできないように */
}

/* キャプションのスタイル */
#captionText {
    font-size: 16px; /* フォントサイズ */
    color: #333; /* テキストの色 */
    font-weight: normal; /* フォントの太さ */
    margin-top: 0; /* キャプションの上部余白を削除 */
    margin-bottom: 40px; /* キャプションの下部余白を追加 */
}

/* 画像表示ページの中央揃え */
#imageDisplay {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    width: 100%;
    text-align: center;
    padding: 10px;
    overflow-y: auto;
    box-sizing: border-box;
}

#imageDisplay h2 {
    margin: 5px 0;
    font-size: 18px;
}

#imageDisplay p {
    margin: 5px 0;
}

/* 画像のスタイル */
#displayImage {
    display: block;
    max-width: 90%;
    max-height: 45vh;
    margin-left: auto;
    margin-right: auto;
    height: auto;
    margin-bottom: 10px;
    border-radius: 15px;
}

/* ボタンのスタイル */
#returnToTitle {
    background-color: #434340;
    color: #ffffff;
    padding: 8px 15px;
    font-size: 14px;
    text-align: center;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: inline-block;
    width: auto;
    min-width: 150px;
    margin-top: 5px;
}

#returnToTenDrawResult {
    margin-top: 5px;
}

#shareMessage {
    text-align: center;
    font-size: 12px;  /* 小さめのフォントサイズ */
    color: #666;  /* 少し控えめな色 */
    margin: 5px 0; /* 余白を小さくする */
}

/* ボタンのホバー状態 */
#returnToTitle:hover {
    background-color: #333; /* ホバー時の背景色 */
}

.blueCardTSUZU {
    background-color: rgb(255, 0, 0, 0.5); /* 例: 黄色 */
}

.blueCardBR, .blueCardUR {
    background-color: rgba(190, 12, 255, 0.5); /* 例: 青 */
}

.blueCardSR {
    background-color: rgb(255, 255, 0, 0.5); /* 例: 赤 */
}

.blueCardN {
    background-color: rgba(50, 80, 255, 0.5); /* 例: 緑 */
}

/* 10連ガチャボタン */
.ten-draw-button {
    background-color: #ff6b35;
    margin-top: 10px;
}

.ten-draw-button:hover {
    background-color: #e55a2b;
}

/* 10連ガチャ演出グリッド */
.ten-draw-animation-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    width: 100%;
    max-height: 60%;
}

.ten-draw-animation-cell {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.ten-draw-animation-cell .cell-card-pack {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    background: url('../images/card-pack.png') no-repeat center center;
    background-size: contain;
    opacity: 0;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.ten-draw-animation-cell .cell-blue-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70%;
    height: 70%;
    opacity: 0;
    transform: translate(-50%, -50%);
    z-index: 2;
    border-radius: 6px;
}

.ten-draw-animation-cell .cell-result-image {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 3;
    border-radius: 6px;
}

/* セル用アニメーション */
@keyframes cellShowPack {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

@keyframes cellShowBlueCard {
    0% { opacity: 0; box-shadow: none; }
    50% { opacity: 1; box-shadow: var(--blue-card-shadow, 0 0 15px rgba(0, 0, 255, 0.8)); }
    100% { opacity: 0; box-shadow: none; }
}

@keyframes cellShowResult {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#tenDrawProgress {
    font-size: 18px;
    color: #666;
    margin-top: 10px;
}

/* 10連ガチャ結果グリッド */
.ten-draw-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    max-height: 60%;
    overflow-y: auto;
}

.ten-draw-card {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s ease;
    aspect-ratio: 1/1;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ten-draw-card:hover {
    transform: scale(1.05);
}

.ten-draw-card img {
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
}

.ten-draw-card .rarity-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    color: white;
}

.rarity-TR { background-color: rgba(255, 0, 0, 0.9); }
.rarity-BR, .rarity-UR { background-color: rgba(190, 12, 255, 0.9); }
.rarity-SR { background-color: rgba(255, 200, 0, 0.9); }
.rarity-R, .rarity-N { background-color: rgba(50, 80, 255, 0.9); }

.ten-draw-hint {
    font-size: 14px;
    color: #888;
    margin: 0 0 8px 0;
}

.share-message-text {
    text-align: center;
    font-size: 11px;
    color: #666;
    margin: 5px 0 3px 0;
}

#tenDrawShareSection {
    margin-top: 5px;
}

#tenDrawShareSection button {
    padding: 8px 15px;
    font-size: 14px;
}

#tenDrawActions {
    margin-top: 15px;
}

#tenDrawActions button {
    margin: 5px;
}

/* スマホ向け9連ガチャ調整 */
@media screen and (max-width: 600px) {
    /* 演出グリッド - スマホでは3列3行 */
    .ten-draw-animation-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        padding: 5px;
        max-height: 55%;
    }

    .ten-draw-animation-cell {
        aspect-ratio: 1/1;
        max-height: 90px;
    }

    .ten-draw-animation-cell .cell-result-image {
        max-width: 90%;
        max-height: 90%;
    }

    /* 結果グリッド - スマホでは3列3行 */
    .ten-draw-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        padding: 5px;
        max-height: 55%;
    }

    .ten-draw-card {
        aspect-ratio: 1/1;
        max-height: 90px;
    }

    .ten-draw-card img {
        max-width: 90%;
        max-height: 90%;
    }

    .ten-draw-card .rarity-badge {
        font-size: 9px;
        padding: 2px 4px;
    }

    /* 詳細画面のスマホ対応 */
    #imageDisplay {
        padding: 8px;
    }

    #imageDisplay h2 {
        font-size: 16px;
    }

    #displayImage {
        max-height: 40vh;
    }

    #imageDisplay button {
        padding: 8px 15px;
        font-size: 14px;
        margin: 3px;
    }
}