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

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Yu Gothic', sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.screen {
    display: none;
    animation: fadeIn 0.5s;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* タイトル画面 */
.game-title {
    text-align: center;
    margin-bottom: 20px;
}

.title-main {
    display: block;
    font-size: 48px;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5),
                 0 0 40px rgba(44, 83, 100, 0.5);
    letter-spacing: 4px;
}

.title-sub {
    display: block;
    font-size: 16px;
    letter-spacing: 8px;
    margin-top: 10px;
    opacity: 0.8;
}

.game-description {
    text-align: center;
    margin-bottom: 40px;
    font-size: 18px;
    opacity: 0.9;
}

.mode-selection h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.mode-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: #fff;
    text-align: left;
}

.mode-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.mode-name {
    display: block;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.mode-desc {
    display: block;
    font-size: 14px;
    opacity: 0.8;
}

.controls-info {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.controls-info h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.controls-info p {
    font-size: 16px;
    opacity: 0.9;
}

/* ゲーム画面 */
.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}

.stat {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
}

.game-board {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.5);
    max-width: 100%;
    height: auto;
}

.game-status {
    text-align: center;
}

.game-message {
    font-size: 18px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 結果画面 */
.result-title {
    text-align: center;
    font-size: 36px;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.result-stats {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.result-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-stat:last-child {
    border-bottom: none;
}

.result-label {
    font-size: 18px;
    opacity: 0.8;
}

.result-value {
    font-size: 24px;
    font-weight: bold;
}

.result-rank {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.rank-label {
    display: block;
    font-size: 18px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.rank-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

.retry-btn,
.back-btn {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.retry-btn {
    background: linear-gradient(135deg, #0f2027 0%, #2c5364 100%);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.retry-btn:hover,
.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .title-main {
        font-size: 36px;
    }

    #game-canvas {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 15px;
    }

    .game-header {
        flex-wrap: wrap;
    }

    .stat {
        min-width: 100px;
    }
}
