* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    background: radial-gradient(ellipse at bottom, #0d1b2a 0%, #1b263b 50%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    color: #f1f5f9;
    position: relative;
}

/* Background stars animation */
body::before {
    content: '';
    position: fixed;
    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, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,0.4), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: twinkle 3s infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

/* ヘッダースタイル */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.header-link:hover {
    color: #60a5fa;
}

.header-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#titleScreen, #gameScreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 80px 20px 20px;
}

h1 {
    margin-bottom: 20px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
    font-size: 36px;
    color: #f1f5f9;
}

/* タイトル画面 */
#titleScreen {
    justify-content: center;
    min-height: 100vh;
    animation: fadeIn 0.8s;
}

.title-logo {
    font-size: 56px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out;
    color: #f1f5f9;
}

.title-description {
    font-size: 20px;
    text-align: center;
    margin-bottom: 50px;
    line-height: 1.6;
    color: #cbd5e1;
}

.mode-selection {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.start-btn {
    padding: 30px 50px;
    font-size: 28px;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    min-width: 200px;
    margin-top: 0;
}

.start-btn.normal {
    background: linear-gradient(135deg, #10b981, #059669);
}

.start-btn.hard {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.start-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

.start-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.mode-desc {
    font-size: 16px;
    font-weight: normal;
    opacity: 0.95;
    display: block;
    margin-top: 5px;
}

.highscores {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    justify-content: center;
}

.highscore-column {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    min-width: 200px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.highscore-column h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    text-align: center;
    color: #f1f5f9;
}

.highscore-column ol {
    list-style-position: inside;
    padding: 0;
    margin: 0;
    font-size: 16px;
    line-height: 1.8;
    color: #cbd5e1;
}

.highscore-column li {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(51, 65, 85, 0.5);
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.highscore-column li:hover {
    background: rgba(71, 85, 105, 0.6);
    transform: translateX(5px);
}

.new-record {
    font-size: 20px;
    font-weight: bold;
    color: #fbbf24;
    margin: 15px 0;
    animation: pulse 1s infinite;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* ゲーム画面 */
#gameScreen {
    animation: fadeIn 0.5s;
}

#modeDisplay {
    margin-bottom: 15px;
    padding: 10px 24px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    color: #f1f5f9;
}

.game-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

button {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}

.back-btn {
    background: linear-gradient(135deg, #64748b, #475569) !important;
}

.back-btn:hover {
    background: linear-gradient(135deg, #475569, #334155) !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    text-align: center;
    animation: slideIn 0.4s;
}

.modal-content h2 {
    color: #f1f5f9;
    margin-bottom: 20px;
    font-size: 32px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.result-mode-display {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    color: #10b981;
    margin-bottom: 10px;
    display: inline-block;
}

.result-mode-display.hard {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

#resultCanvas {
    border: 3px solid #10b981;
    border-radius: 10px;
    margin: 20px auto;
    display: block;
    background: #fef9e7;
    transition: border-color 0.3s;
}

#resultCanvas.hard {
    border-color: #ef4444;
}

.result-score {
    font-size: 36px;
    font-weight: bold;
    color: #10b981;
    margin: 15px 0;
    transition: color 0.3s;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.result-score.hard {
    color: #ef4444;
}

.result-message {
    font-size: 18px;
    color: #cbd5e1;
    margin: 15px 0;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.modal-btn {
    padding: 12px 30px;
    font-size: 16px;
    margin-top: 0;
    transition: all 0.3s;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

#modalResetBtn.hard {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

#modalResetBtn.hard:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#gameCanvas {
    background: #fef9e7;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    cursor: pointer;
}

#info {
    margin-top: 20px;
    text-align: center;
    font-size: 18px;
    background: rgba(255,255,255,0.2);
    padding: 15px 30px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

#score {
    font-size: 24px;
    font-weight: bold;
    margin-top: 10px;
    color: #ffeb3b;
}

button {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

button:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

button:active {
    transform: translateY(0);
}
