@import url('https://fonts.googleapis.com/css2?family=Darumadrop+One&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-image: url('wall.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}

/* 基本レイアウト */
.screen {
    width: 100%;
    max-width: 400px;
    min-height: 600px;
    background: #FFF0F5; /* Very light pink */
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 30px;
    position: relative;
}

.screen.hidden {
    display: none;
}

/* ローディング画面 */
.loading-content {
    text-align: center;
    width: 100%;
}

.loading-text {
    font-size: 2rem;
    color: #FF69B4; /* Pink */
    margin-bottom: 40px;
    font-weight: 600;
}

.loading-bar-container {
    width: 100%;
    height: 8px;
    background: #F8E0E6; /* Lighter pink */
    border-radius: 4px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #FFC0CB, #FF69B4); /* Pink gradient */
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 4px;
}

/* スタート画面 */
.start-content {
    text-align: center;
    width: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-title {
    font-family: 'Darumadrop One', cursive; /* Apply the new font */
    font-size: 2.5rem;
    color: red;
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 0px;
}

/* ボタン */
.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px; /* ボタンの最小幅を調整 */
}

.btn.primary {
    background: red;
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 105, 180, 0.3);
}

.btn.primary:active {
    transform: translateY(0);
}

/* ゲーム画面 */
.game-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.progress-container {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #F8E0E6; /* Lighter pink */
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFC0CB, #FF69B4); /* Pink gradient */
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
    min-width: 40px;
}

.question-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 40px;
    line-height: 1.5;
    text-align: left;
    font-weight: 600;
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.answer-btn {
    padding: 20px 24px;
    border: 2px solid #87CEEB; /* SkyBlue */
    border-radius: 12px;
    background: white;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    /* transitionの対象を限定する */
    transition: background-color 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    text-align: left;
    line-height: 1.4;
}

/* ホバーエフェクトは、ホバーが可能なデバイスでのみ適用 */
@media (hover: hover) {
    .answer-btn:hover {
        border-color: #FF69B4; /* Pink border on hover */
        background: #FFF0F5; /* Very light pink background on hover */
        transform: translateY(-1px);
    }
}

.answer-btn:active {
    transform: translateY(0);
}



/* ゲームオーバー画面 */
.gameover-content {
    text-align: center;
    width: 100%;
    position: relative;
    z-index: 1;
}

.result-title {
    font-size: 2rem;
    color: red; /* Darker pink */
    margin-bottom: 10px;
    font-weight: 700;
    text-align: center;
}

.mbti-result {
    background: transparent;
    border-radius: 16px;
    padding: 30px 20px;
    margin-bottom: 20px; /* ボタンとの間隔を調整 */
}

.mbti-type {
    font-size: 3rem;
    color: #FF69B4; /* Pink */
    margin-bottom: 10px;
    font-weight: 800;
}

.mbti-name {
    font-size: 1.5rem;
    color: red; /* Darker pink */
    margin-bottom: 20px;
    font-weight: 600;
}

.mbti-description {
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
    text-align: left;
    background-color: white; /* 背景を白に */
    border-radius: 10px; /* 角丸に */
    padding: 15px; /* 見た目を整えるためにパディングを追加 */
    margin-top: 15px; /* 上の要素との間隔 */
}

#details-btn {
    width: 100%;
    margin-top: 20px;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .screen {
        min-height: 70vh;
        padding: 30px 20px;
        border-radius: 15px;
    }
    
    .game-title {
        font-size: 2rem;
    }

    .question {
        font-size: 1.2rem;
    }
    
    .answer-btn {
        padding: 16px 20px;
        font-size: 0.95rem;
    }
    
    .mbti-type {
        font-size: 2.5rem;
    }
}

@media (max-width: 360px) {
    .game-title {
        font-size: 1.8rem;
    }
    
    .question {
        font-size: 1.1rem;
    }
}

/* タッチデバイス対応 */
@media (hover: none) and (pointer: coarse) {
    .answer-btn:hover {
        border-color: #F8E0E6; /* Lighter pink border */
        background: white;
        transform: none;
    }
    
    .answer-btn:active {
        /* Removed border-color and background to prevent persistent active state styling on touch devices */
    }
    
    .btn.primary:hover {
        transform: none;
        box-shadow: 0 20px 40px rgba(255, 105, 180, 0.1);
    }
}

.atsuo-character {
    display: block;
    margin: 0 auto 20px auto;
    max-width: 100px;
    height: auto;
}

.main-image {
    display: block;
    margin: 5px auto 10px auto;
    max-width: 90%;
    height: auto;
    position: relative;
    z-index: 2;
}

.age-input-container p {
    font-size: 1.8rem; /* フォントサイズを調整 */
    color: black; /* 色を黒に変更 */
    margin: 10px 0;
    font-weight: bold;
}

.age-input-container input {
    padding: 15px 20px; /* Increased padding */
    font-size: 2rem; /* Larger font size */
    border: 2px solid #FFC0CB; /* Light pink border */
    border-radius: 15px; /* Slightly more rounded */
    width: 150px; /* Increased width */
    height: 60px; /* Increased height */
    text-align: center;
    display: block; /* Make it a block element */
    margin: 20px auto; /* Center horizontally and add vertical margin */
    color: black; /* 黒に変更 */
}

.age-input-container input::placeholder {
    color: #F8E0E6; /* Lighter pink for placeholder */
}

.age-input-container input:focus {
    outline: none;
    border-color: #FF69B4; /* Pink border on focus */
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.3); /* Subtle glow */
}

.age-input-content {
    text-align: center;
    width: 100%;
}

#age-input-screen {
    justify-content: center;
}

#confirm-age-btn {
    margin-top: 20px;
}

/* 詳細画面のスタイル */
.details-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.details-scroll-area {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    text-align: left;
    padding-right: 15px; /* スクロールバーのスペース */
    margin-bottom: 20px;
}

.detail-item {
    background-color: white; /* 背景を白に */
    border-radius: 10px; /* 角丸に */
    padding: 15px; /* パディングを追加 */
    margin-bottom: 15px; /* 下のマージンは維持 */
    margin-top: 15px; /* 上のマージンを追加 */
    /* border-bottomとpadding-bottomは新しいスタイルで不要になるため削除 */
}

.detail-item:last-child {
    /* border-bottom: none; は不要 */
}

.detail-item h3 {
    color: red;
    margin-bottom: 8px;
    text-align: center;
}

.detail-item ul {
    list-style-position: inside;
    padding-left: 0;
}

.detail-item li {
    margin-bottom: 5px;
}

#detail-compatibility h4 {
    font-size: 1rem;
    color: #333;
    margin-top: 10px;
    margin-bottom: 5px;
}

#detail-compatibility a {
    color: #87CEEB; /* 水色 */
    text-decoration: none; /* 下線を削除 */
}

#detail-compatibility a:hover {
    text-decoration: underline; /* ホバーで下線を表示 */
}

.result-mbti-image {
    width: 200px;
    height: 200px;
    margin: 10px auto 20px;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    border: 8px solid #FFC0CB; /* Light pink border - 太くしました */
}

/* シェアボタン */
.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.share-btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.share-btn:hover {
    opacity: 0.85;
}

.share-x {
    background-color: #1DA1F2; /* Twitter Blue */
}

.share-line {
    background-color: #06C755; /* LINE Green */
}

.stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    background: transparent;
    z-index: 0;
}

.stars-container::before,
.stars-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(0);
    animation: falling-star-field linear infinite;
}

.stars-container::before {
    animation: falling-star-field linear infinite;
}

.stars-container::after {
    animation: falling-star-field linear infinite;
}

/* Define individual star styling */
.star {
    position: absolute;
    opacity: 0; /* Start invisible */
    animation: falling-star linear infinite;
}

/* Keyframes for falling star animation */
@keyframes falling-star {
    0% {
        transform: translateY(-10vh) rotate(0deg); /* Start above the screen */
        opacity: 0;
    }
    10% {
        opacity: 1; /* Fade in */
    }
    90% {
        opacity: 1; /* Stay visible */
    }
    100% {
        transform: translateY(110vh) rotate(720deg); /* Fall below the screen, rotate 720deg */
        opacity: 0; /* Fade out */
    }
}

/* Apply varying animations to individual stars */
.star:nth-child(1) {
    left: 10%;
    width: 15px;
    height: 15px;
    animation-duration: 8s;
    animation-delay: 0s;
}
.star:nth-child(2) {
    left: 25%;
    width: 20px;
    height: 20px;
    animation-duration: 10s;
    animation-delay: 2s;
}
.star:nth-child(3) {
    left: 40%;
    width: 18px;
    height: 18px;
    animation-duration: 7s;
    animation-delay: 4s;
}
.star:nth-child(4) {
    left: 60%;
    width: 25px;
    height: 25px;
    animation-duration: 9s;
    animation-delay: 1s;
}
.star:nth-child(5) {
    left: 80%;
    width: 15px;
    height: 15px;
    animation-duration: 6s;
    animation-delay: 3s;
}


@keyframes falling-star-field {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%); /* Move stars down by 100% of container height */
    }
}

.answer-btn:focus,
.answer-btn:active {
    outline: none !important;
    box-shadow: none !important;
}