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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
}

.container {
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* 初期画面 */
.initial-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.logo {
    width: 160px;
    height: 160px;
    margin-bottom: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.initial-content h1 {
    color: #333;
    margin-bottom: 40px;
    font-weight: 700;
    line-height: 1.2;
}

.main-title {
    font-size: 2rem;
    display: inline-block;
}

.sub-title {
    font-size: 3rem;
    display: inline-block;
    font-weight: 900;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.mode-btn, .settings-btn {
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.normal-mode {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.amadare-mode {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.settings-btn {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.normal-mode:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.amadare-mode:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
}

.settings-btn:hover {
    transform: translateY(-2px);
    background: #e9ecef;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.mode-btn:active, .settings-btn:active {
    transform: translateY(0);
}

/* カウントダウン画面 */
.countdown-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 80px 60px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    min-width: 400px;
}

.countdown-number {
    font-size: 10rem;
    font-weight: 900;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.countdown-message {
    font-size: 1.5rem;
    color: #666;
    font-weight: 600;
}

/* フラッシュ画面 */
.flash-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 80px 60px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    min-width: 400px;
}

.flash-number {
    font-size: 8rem;
    font-weight: 900;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.progress {
    font-size: 1.2rem;
    color: #666;
    font-weight: 500;
}

#current-number {
    color: #667eea;
    font-weight: 700;
}

/* あまだれモード画面 */
.amadare-content {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.falling-area {
    position: relative;
    width: 100%;
    height: calc(100vh - 100px);
    background: linear-gradient(180deg, rgba(135, 206, 250, 0.1) 0%, rgba(173, 216, 230, 0.2) 100%);
}

.falling-number {
    position: absolute;
    font-size: 4rem;
    font-weight: 900;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.falling-number.landed {
    opacity: 0;
}

#amadare-progress {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 30px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

#fallen-count {
    color: #ff6b6b;
    font-weight: 700;
}

/* 入力画面 */
.input-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    min-width: 400px;
}

.input-content h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 40px;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

#answer-input {
    padding: 20px 25px;
    font-size: 1.5rem;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    width: 250px;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 600;
}

#answer-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.submit-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 20px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* 結果画面 */
.result-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    min-width: 500px;
}

.result-message {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    padding: 20px;
    border-radius: 15px;
}

.result-message.correct {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.result-message.incorrect {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.score-details {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    font-size: 1.2rem;
}

.label {
    font-weight: 600;
    color: #666;
}

.value {
    font-weight: 700;
    color: #333;
    font-size: 1.4rem;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.play-again-btn, .back-btn, .confirm-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-again-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.back-btn {
    background: #6c757d;
    color: white;
}

.confirm-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.play-again-btn:hover, .back-btn:hover, .confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 設定画面 */
.settings-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    min-width: 500px;
}

.settings-content h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 40px;
    font-weight: 600;
}

.setting-item {
    margin-bottom: 40px;
    text-align: left;
}

.setting-label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.setting-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.interval-slider {
    flex: 1;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

.interval-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.interval-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.slider-value {
    min-width: 80px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
}

.settings-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .initial-content, .countdown-content, .flash-content, .input-content, .result-content, .settings-content {
        margin: 20px;
        padding: 40px 20px;
        min-width: auto;
        max-width: 90vw;
    }
    
    .button-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .mode-btn, .settings-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .falling-number {
        font-size: 3rem;
    }
    
    .countdown-number {
        font-size: 8rem;
        min-height: 120px;
    }
    
    .flash-number {
        font-size: 6rem;
        min-height: 120px;
    }
    
    .main-title {
        font-size: 1.5rem;
    }
    
    .sub-title {
        font-size: 2.2rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 20px;
    }
    
    #answer-input {
        width: 100%;
        max-width: 300px;
    }
    
    .result-actions {
        flex-direction: column;
    }
}

/* アニメーション */
@keyframes flash-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.flash-number.flash-animation {
    animation: flash-in 0.2s ease-out;
}