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

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Yu Gothic', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    overflow: hidden;
}

.game-container {
    width: 98%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 10px;
    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: 15px;
}

.title-main {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
}

.title-sub {
    display: block;
    font-size: 1em;
    opacity: 0.9;
    margin-top: 5px;
}

.game-description {
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 25px;
    opacity: 0.95;
}

.mode-selection h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.3em;
}

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

.mode-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px;
    padding: 18px;
    color: #fff;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.mode-btn:hover, .mode-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.03);
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.3);
}

.mode-name {
    font-weight: bold;
    font-size: 1.2em;
}

.mode-desc {
    font-size: 0.9em;
    opacity: 0.9;
}

.high-scores {
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
}

.high-scores h3 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.high-score-list {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 10px;
}

.high-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    min-width: 80px;
}

.high-score-item span:first-child {
    font-size: 0.9em;
    opacity: 0.9;
}

.high-score-item span:last-child {
    font-size: 1.3em;
    font-weight: bold;
}

.instructions {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
}

.instructions h3 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 8px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    text-align: center;
}

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

.stat {
    flex: 1;
    min-width: 22%;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 5px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7em;
    opacity: 0.9;
    margin-bottom: 3px;
}

.stat-value {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
}

.stat-value.combo-low {
    color: #4AFF4A;
}

.stat-value.combo-medium {
    color: #FFD700;
    text-shadow: 0 0 10px #FFD700;
}

.stat-value.combo-high {
    color: #FF4444;
    text-shadow: 0 0 15px #FF4444;
    animation: pulse 0.5s infinite;
}

.panic-mode-banner {
    background: linear-gradient(90deg, #FF4444, #FF8800, #FF4444);
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    margin-bottom: 8px;
    display: none;
    animation: pulse 0.5s infinite;
}

.panic-mode-banner.active {
    display: block;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.game-area {
    position: relative;
    width: 100%;
    height: 550px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.game-area.panic {
    animation: shake 0.2s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.target {
    position: absolute;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    animation: appear 0.3s;
    transition: transform 0.1s;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.target:active {
    transform: scale(0.9);
}

.flower-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* 花の色ごとのアニメーション */
.target-red:hover,
.target-blue:hover,
.target-yellow:hover,
.target-pink:hover,
.target-purple:hover {
    animation: flowerBounce 0.3s ease-in-out;
}

@keyframes flowerBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.target-bad {
    filter: drop-shadow(0 4px 8px rgba(139, 69, 19, 0.6));
}

.target-bad:hover {
    animation: shakeTarget 0.3s;
}

@keyframes shakeTarget {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes appear {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.feedback {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    height: 40px;
    opacity: 0;
    transition: opacity 0.3s;
}

.feedback.show {
    opacity: 1;
}

.feedback.correct {
    color: #4AFF4A;
    text-shadow: 0 0 10px #4AFF4A;
}

.feedback.wrong {
    color: #FF4A4A;
    text-shadow: 0 0 10px #FF4A4A;
}

/* 結果画面 */
.result-title {
    text-align: center;
    font-size: 2em;
    margin-bottom: 20px;
}

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

.result-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.result-label {
    font-size: 1.1em;
}

.result-value {
    font-size: 1.3em;
    font-weight: bold;
}

.result-stat.high-score {
    background: rgba(255, 215, 0, 0.3);
}

.result-rank {
    text-align: center;
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.rank-label {
    display: block;
    font-size: 1em;
    margin-bottom: 5px;
}

.rank-value {
    display: block;
    font-size: 3em;
    font-weight: bold;
    text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
}

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

.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.retry-btn:hover, .retry-btn:active {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

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

.back-btn:hover, .back-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

/* スマホ対応 */
@media (max-width: 600px) {
    .game-container {
        padding: 8px;
    }

    .title-main {
        font-size: 2em;
    }

    .game-area {
        height: calc(100vh - 200px);
        min-height: 450px;
        max-height: 600px;
    }

    .stat-label {
        font-size: 0.65em;
    }

    .stat-value {
        font-size: 1em;
    }
}

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

    .game-header {
        margin-bottom: 5px;
        gap: 3px;
    }

    .stat {
        min-width: 22%;
        padding: 5px 3px;
    }

    .game-area {
        height: calc(100vh - 180px);
        min-height: 400px;
        max-height: 550px;
    }

    .panic-mode-banner {
        font-size: 0.9em;
        padding: 6px;
        margin-bottom: 5px;
    }

    .feedback {
        font-size: 1.2em;
        height: 30px;
    }
}

/* タッチデバイス用 */
@media (hover: none) {
    .mode-btn:hover, .retry-btn:hover, .back-btn:hover {
        transform: none;
    }

    .mode-btn:active {
        transform: scale(0.98);
    }

    .target:hover {
        transform: none;
    }
}
