/* --- 共通・ベーススタイル --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: #f0f0f0;
    color: #333;
    font-family: 'Noto Sans JP', sans-serif;
    margin: 0;
    padding: 0;
    text-align: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    /* PCではコンテンツを中央に配置 */
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* --- ヘッダー --- */
.dopa-header {
    background-color: #fff;
    color: #ff3860;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #eee;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

.header-logo {
    font-size: 1.5rem;
    color: #ff3860;
}

/* --- メインコンテンツ --- */
.dopa-main {
    flex-grow: 1;
    padding: 1rem;
}

.ad-banner {
    width: 100%;
    background: linear-gradient(45deg, #ff3860, #ff6b6b);
    color: white;
    padding: 2rem 0;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

/* ガチャカードのコンテナ (PC向け) */
.gacha-list-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.gacha-card {
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    border: 2px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gacha-image {
    width: 100%;
    height: 180px;
    background-color: #eee;
    overflow: hidden;
}

.gacha-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gacha-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.gacha-card-title {
    font-family: 'Orbitron', sans-serif;
    color: #ff3860;
    margin-top: 0;
    font-size: 1.2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.gacha-description {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
}

.gacha-button {
    width: 100%;
    padding: 1rem;
    background-color: #ff3860;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #d1224a;
    transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

.gacha-button:hover {
    background-color: #ff577b;
}

.gacha-button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #d1224a;
}

/* --- フッター --- */
.dopa-footer {
    background-color: #333;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid #444;
}

.footer-nav a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-nav a:hover {
    opacity: 1;
}

/* --- モーダルのスタイル (全画面表示) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 12px;
    position: relative; /* スキップボタン用 */
    text-align: center;
}

/* 広告モーダル（画面全体表示） */
#ad-space {
    display: none; /* デフォルトで非表示にする */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 9999;
    /* display: flex; は削除する */
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    flex-direction: column; /* 縦方向に要素を並べる */
}

/* 広告モーダルのコンテンツ */
#ad-space .modal-content {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 2rem;
    max-width: 80%;
}

/* 計算問題部分のスタイル */
#calculation-task {
    margin-top: 2rem;
}

#calculation-task h4, #calculation-task p {
    color: white;
}

#answer {
    padding: 0.5rem;
    font-size: 1.2rem;
    width: 100px;
    margin: 1rem 0;
    text-align: center;
    border-radius: 8px;
    border: 2px solid #ccc;
}

#submit-answer {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 3px 0 #3e8e41;
}

#submit-answer:active {
    transform: translateY(3px);
    box-shadow: none;
}

/* --- ガチャ演出関連のスタイル --- */
#gacha-animation {
    background-color: #1a1a1a;
    z-index: 10000;
}

#gacha-animation .modal-content {
    background-color: #1a1a1a;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#gacha-animation h3 {
    color: white;
    font-family: 'Orbitron', sans-serif;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.2);
}

#pack-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 2rem;
}

.pack, .card {
    width: 120px;
    height: 180px;
    border-radius: 10px;
    background-color: #333;
    border: 3px solid #555;
    cursor: pointer;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    transition: all 0.5s ease-in-out;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.pack.visible {
    opacity: 1;
}

.pack.opened {
    transform: rotateY(180deg);
}

.card.visible {
    opacity: 1;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
}

.card-back {
    background-color: #555;
    background-image: url('images/card-back.png');
    background-size: cover;
    background-position: center;
}

.card-front {
    transform: rotateY(180deg);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 1rem;
    font-weight: bold;
    font-size: 1.2rem;
}

.rarity-win {
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    border: 3px solid #ffd700;
}
.rarity-lose-a {
    background: linear-gradient(45deg, #00c6ff, #0072ff);
    border: 3px solid #00c6ff;
}
.rarity-lose-b {
    background: linear-gradient(45deg, #a0a0a0, #707070);
    border: 3px solid #a0a0a0;
}

.win-card {
    animation: win-effect 1s infinite alternate;
}

@keyframes win-effect {
    from {
        transform: scale(1);
        box-shadow: 0 0 15px #ffd700, 0 0 25px #ff8c00;
    }
    to {
        transform: scale(1.05);
        box-shadow: 0 0 20px #ffd700, 0 0 40px #ff8c00;
    }
}

.skip-button {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    z-index: 10001;
}

/* --- 当選者フォームの追加 --- */
.winner-form-section {
    padding: 2rem 1rem;
}

.form-card {
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
}

.form-title {
    font-family: 'Orbitron', sans-serif;
    color: #ff3860;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.form-description {
    color: #666;
    margin-bottom: 2rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.submit-button {
    width: 100%;
    padding: 1rem;
    background-color: #ff3860;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #d1224a;
    transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

.submit-button:hover {
    background-color: #ff577b;
}

.submit-button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #d1224a;
}

/* --- レスポンシブ対応 (スマホ向け) --- */
@media (max-width: 600px) {
    .app-container {
        width: 100%;
        max-width: none;
        box-shadow: none;
    }
    
    .dopa-header, .dopa-footer {
        position: sticky;
        top: 0;
        bottom: 0;
    }

    .dopa-main {
        padding: 0.5rem;
    }

    .gacha-list-container {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }

    .gacha-card {
        width: 90%;
        margin-bottom: 20px;
    }
    
    .form-card {
        padding: 1.5rem;
        border-radius: 0;
        box-shadow: none;
    }
}