/* 基本的なスタイル */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #fce4ec; /* ポップな背景色 */
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    text-align: center;
    overflow-x: hidden; /* 横スクロール防止 */
}

#app {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 480px; /* スマホでの見やすさを考慮 */
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden; /* アニメーションはみ出し防止 */
}

/* 画面共通スタイル */
.screen {
    display: none; /* 初期状態では非表示 */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px; /* ある程度の高さを確保 */
}

.screen.active {
    display: flex; /* アクティブな画面のみ表示 */
}

h1 {
    color: #d84315; /* ブランドカラー */
    font-size: 2.2em;
    margin-bottom: 20px;
}

h1 img {
    max-width: 90%; /* 新しいロゴ画像に合わせて調整 */
    height: auto;
    margin-bottom: 10px; /* キャッチコピーとの間隔 */
}

h2 {
    color: #e65100;
    font-size: 1.6em;
    margin-bottom: 25px;
}

p {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* ボタン共通スタイル */
.start-button, .answer-button, .return-to-start-button {
    background-color: #ff7043; /* ボタン色 */
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 1.4em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 112, 67, 0.4);
    transition: transform 0.2s, background-color 0.2s;
    margin-top: 20px;
    min-width: 200px;
    width: fit-content; /* ボタンの幅を内容に合わせる */
}

.start-button:hover, .answer-button:hover, .return-to-start-button:hover {
    background-color: #f4511e;
    transform: translateY(-3px);
}

/* スタート画面 */
#start-screen .catchphrase {
    font-size: 1.3em;
    font-weight: bold;
    color: #e65100;
    margin-bottom: 30px;
}

/* 質問画面 */
#question-screen #answer-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px; /* ボタン間のスペース */
    width: 100%;
    max-width: 350px; /* ボタンの最大幅 */
    margin-top: 20px;
}
#question-screen .answer-button {
    width: 100%; /* 回答ボタンは横幅いっぱいに */
}
#question-screen .question-count {
    font-size: 0.9em;
    color: #999;
    margin-top: 15px;
}


/* 診断中アニメーション画面 */
#animation-screen img {
    max-width: 90%;
    height: auto;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite alternate; /* 心臓の鼓動のようなアニメーション */
}

@keyframes pulse {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
    }
}

#animation-screen p {
    font-size: 1.2em;
    font-weight: bold;
    color: #d84315;
}

/* 結果画面 */
#result-screen #result-image {
    max-width: 80%;
    height: auto;
    margin-bottom: 20px;
    animation: bounceIn 0.8s forwards; /* 結果がポンと現れるアニメーション */
    transform-origin: bottom; /* 揺れる基点を下に */
}

@keyframes bounceIn {
    0% {
        transform: scale(0.1);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

#result-screen #result-image.shaking {
    animation: shake 0.5s infinite alternate; /* 小刻みに揺れるアニメーション */
}

@keyframes shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(1deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-1deg); }
    100% { transform: rotate(0deg); }
}

#result-screen #result-text {
    font-size: 1.5em;
    font-weight: bold;
    color: #d84315;
    margin-bottom: 10px;
    animation: fadeIn 1s forwards; /* フェードイン */
    animation-delay: 0.2s;
    opacity: 0;
}

#result-screen #flavor-description {
    font-size: 1em;
    color: #666;
    margin-bottom: 25px;
    animation: fadeIn 1s forwards; /* フェードイン */
    animation-delay: 0.4s;
    opacity: 0;
}

.share-text {
    font-size: 1.1em;
    font-weight: bold;
    color: #e65100;
    background-color: #fff9c4;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    line-height: 1.5;
    animation: fadeIn 1s forwards; /* フェードイン */
    animation-delay: 0.6s;
    opacity: 0;
}

/* X投稿ボタンのスタイル */
.share-x-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1DA1F2; /* Xのブランドカラー */
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(29, 161, 242, 0.4);
    transition: transform 0.2s, background-color 0.2s;
    margin-top: 30px; /* 他の要素との間隔 */
    text-decoration: none; /* aタグのスタイルをリセット */
    animation: fadeIn 1s forwards; /* フェードイン */
    animation-delay: 0.8s;
    opacity: 0;
    gap: 8px; /* アイコンとテキストの間隔 */
    max-width: 300px; /* ボタンの最大幅 */
    width: 100%;
}

.share-x-button:hover {
    background-color: #0c85d0;
    transform: translateY(-3px);
}

.share-x-button svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* 最初に戻るボタンのスタイル */
.return-to-start-button {
    background-color: #66bb6a; /* 少し落ち着いた色 */
    margin-top: 15px; /* Xボタンとの間隔 */
    animation: fadeIn 1s forwards; /* フェードイン */
    animation-delay: 1s; /* Xボタンより少し遅らせる */
    opacity: 0;
    font-size: 1.2em;
    padding: 12px 25px;
    max-width: 300px; /* Xボタンに合わせる */
    width: 100%;
}
.return-to-start-button:hover {
    background-color: #43a047;
}


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

/* レスポンシブデザイン */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    #app {
        padding: 20px;
        border-radius: 15px;
    }
    h1 {
        font-size: 1.8em;
    }
    h1 img {
        max-width: 100%; /* 小さい画面でより大きく表示 */
    }
    h2 {
        font-size: 1.4em;
    }
    p {
        font-size: 1em;
    }
    .start-button, .answer-button, .return-to-start-button {
        font-size: 1.2em;
        padding: 12px 25px;
    }
    #start-screen .catchphrase {
        font-size: 1.1em;
    }
    #result-screen #result-text {
        font-size: 1.3em;
    }
    .share-text {
        font-size: 0.95em;
        padding: 10px;
    }
    .share-x-button, .return-to-start-button {
        font-size: 1.1em;
        padding: 10px 20px;
    }
    .share-x-button svg {
        width: 20px;
        height: 20px;
    }
    .screen {
        min-height: 350px;
    }
}