/* タイトル画面スタイル */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: linear-gradient(135deg, #0a1929, #1a3a5a, #2c5364);
    z-index: 1000;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* タイトル画面 */
.title-container {
    text-align: center;
    position: relative;
    z-index: 1002;
    max-width: 90%;
    padding: 20px;
    margin: 0 auto;
    box-sizing: border-box;
}

.game-title {
    font-size: clamp(2.5rem, 8vw, 4rem); /* レスポンシブフォントサイズ */
    margin-bottom: 10px;
    text-shadow: 0 0 20px #00ffff, 0 0 30px #00ffff, 0 0 40px #00ffff;
    background: linear-gradient(45deg, #00ffff, #0088ff);
    -webkit-background-clip: text;
    background-clip: text; /* 標準プロパティを追加 */
    -webkit-text-fill-color: transparent;
    animation: titleGlow 3s ease-in-out infinite alternate;
    word-wrap: break-word; /* 長い単語の折り返し */
    line-height: 1.2;
}

.game-subtitle {
    font-size: clamp(1.2rem, 4vw, 1.8rem); /* レスポンシブフォントサイズ */
    margin-bottom: 30px;
    color: #88ddff;
    text-shadow: 0 0 10px #0088ff;
    word-wrap: break-word;
    line-height: 1.3;
    padding: 0 10px;
}

@keyframes titleGlow {
    from {
        text-shadow: 0 0 20px #00ffff, 0 0 30px #00ffff;
    }
    to {
        text-shadow: 0 0 30px #00ffff, 0 0 40px #00ffff, 0 0 50px #0088ff;
    }
}

/* タイトル背景アニメーション */
.title-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001; /* 背景はボタンの背後に */
    pointer-events: none; /* 背景がクリックを邪魔しないように */
}

.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #eee, transparent),
        radial-gradient(2px 2px at 40px 70px, #fff, transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, #fff, transparent),
        radial-gradient(2px 2px at 160px 30px, #eee, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: starsMove 50s linear infinite;
}

@keyframes starsMove {
    from { background-position: 0 0; }
    to { background-position: 0 1000px; }
}

.meteors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.meteors::before,
.meteors::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, #fff, transparent);
    animation: meteorFall 8s linear infinite;
}

.meteors::before {
    left: 25%;
    animation-delay: 0s;
}

.meteors::after {
    left: 75%;
    animation-delay: 4s;
}

@keyframes meteorFall {
    0% {
        top: -50px;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

/* メニューボタン */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
    position: relative;
    z-index: 1003;
    max-width: 100%;
}

.menu-btn {
    padding: 15px 30px;
    font-size: clamp(1rem, 4vw, 1.3rem); /* レスポンシブフォントサイズ */
    background: linear-gradient(135deg, rgba(0, 180, 219, 0.8), rgba(0, 131, 176, 0.8));
    color: white;
    border: 2px solid #00ffff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 180, 219, 0.4);
    position: relative;
    z-index: 1004;
    pointer-events: auto !important;
    max-width: 100%;
    box-sizing: border-box;
}

.menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 180, 219, 0.6);
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.9), rgba(0, 150, 200, 0.9));
}

.start-btn {
    background: linear-gradient(135deg, rgba(0, 200, 83, 0.8), rgba(0, 150, 36, 0.8));
    border-color: #00ff88;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.4);
}

.start-btn:hover {
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.9), rgba(0, 180, 60, 0.9));
    box-shadow: 0 8px 25px rgba(0, 230, 118, 0.6);
}

.quick-instruction {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #00ffff;
    backdrop-filter: blur(5px);
}

.quick-instruction p {
    margin: 10px 0;
    font-size: 1.1rem;
    color: #88ddff;
}

/* 画面コンテナ */
.screen-container {
    max-width: 95%;
    max-height: 90vh;
    padding: 20px;
    background: rgba(0, 20, 40, 0.9);
    border-radius: 20px;
    border: 2px solid #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    margin: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.screen-container h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 20px;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    flex-shrink: 0;
}

/* 実績画面専用のスタイル */
#achievementsScreen .screen-container {
    max-width: 1200px;
    width: 95%;
}

#achievementsScreen .achievements-content {
    flex: 1;
    min-height: 0; /* フレックスボックス内でのスクロールを可能に */
}

/* 遊び方画面 */
.instruction-content {
    text-align: left;
}

.instruction-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 40, 80, 0.5);
    border-radius: 10px;
    border-left: 4px solid #00ffff;
}

.instruction-section h3 {
    color: #00ffff;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.item-example {
    display: flex;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
}

.shield-icon {
    background: linear-gradient(135deg, #00ffff, #0088ff);
    border: 2px solid #ffffff;
}

.wormhole-icon {
    background: linear-gradient(135deg, #8a2be2, #4b0082);
    border: 2px solid #00ffff;
}

.item-description {
    flex: 1;
}

/* 設定画面 */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0, 40, 80, 0.5);
    border-radius: 10px;
}

.setting-item label {
    font-size: 1.1rem;
    color: #88ddff;
    min-width: 100px;
}

.setting-item select {
    padding: 8px 15px;
    border: 1px solid #00ffff;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    min-width: 120px;
}

.setting-item input[type="range"] {
    min-width: 250px;
}

/* 実績画面 */
.achievements-content {
    margin-bottom: 30px;
}

.achievement {
    display: flex;
    align-items: center;
    margin: 15px 0;
    padding: 20px;
    background: rgba(0, 40, 80, 0.5);
    border-radius: 10px;
    border-left: 4px solid #00ffff;
}

.achievement.locked {
    opacity: 0.6;
    border-left-color: #666;
}

.achievement-icon {
    font-size: 2rem;
    margin-right: 20px;
    width: 60px;
    text-align: center;
}

.achievement-info h3 {
    color: #00ffff;
    margin-bottom: 5px;
}

.achievement.locked .achievement-info h3 {
    color: #888;
}

.achievement-info p {
    color: #88ddff;
    margin: 0;
}

.achievement.locked .achievement-info p {
    color: #666;
}

/* 戻るボタン */
.back-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.back-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.6);
}

/* ゲームオーバー画面の戻るボタン */
.game-over-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 5px;
}

/* 統計画面スタイル */
.stats-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 20px;
}

.stats-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 40, 80, 0.5);
    border-radius: 10px;
    border-left: 4px solid #00ffff;
}

.stats-section h3 {
    color: #00ffff;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-shadow: 0 0 10px #00ffff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.stat-label {
    color: #88ddff;
    font-size: 1rem;
}

.stat-value {
    color: #ffffff;
    font-weight: bold;
    font-size: 1.1rem;
}

.stat-highlight {
    color: #ffff00;
    font-size: 1.2rem;
    text-shadow: 0 0 10px #ffff00;
}

/* スクロールバーのスタイリング */
.stats-content::-webkit-scrollbar {
    width: 8px;
}

.stats-content::-webkit-scrollbar-track {
    background: rgba(0, 20, 40, 0.5);
    border-radius: 4px;
}

.stats-content::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 4px;
}

.stats-content::-webkit-scrollbar-thumb:hover {
    background: #00aaff;
}