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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eaed 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 80%, rgba(200, 210, 220, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(220, 220, 230, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(230, 235, 240, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.screen {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none;
}

/* ホーム画面 */
.logo h1 {
    text-align: center;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo p {
    text-align: center;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 48px;
    font-size: 1.25rem;
    font-weight: 400;
}

.difficulty-selection {
    text-align: center;
    margin-bottom: 40px;
}

.difficulty-selection h3 {
    color: rgba(0, 0, 0, 0.8);
    margin-bottom: 32px;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.difficulty-btn {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 16px auto;
    padding: 18px 32px;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #4b5563;
    border: none;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(209, 213, 219, 0.3);
    position: relative;
    overflow: hidden;
}

.difficulty-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.difficulty-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(209, 213, 219, 0.4);
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.difficulty-btn:hover::before {
    left: 100%;
}

.difficulty-btn:active {
    transform: translateY(-2px);
}

.game-info {
    background: rgba(248, 249, 250, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.game-info p {
    margin: 12px 0;
    color: rgba(0, 0, 0, 0.7);
    font-size: 1.1rem;
    font-weight: 500;
}

/* ゲーム画面 */
.game-header {
    margin-bottom: 30px;
}


.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(233, 236, 239, 0.6);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #d1d5db, #9ca3af, #d1d5db);
    background-size: 200% 100%;
    width: 10%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation: gradient 3s ease infinite;
}

@keyframes gradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(0, 0, 0, 0.8);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.timer-container {
    text-align: center;
    margin-bottom: 30px;
}

.timer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    color: white;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 20px;
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.3);
    position: relative;
    animation: pulse 1s infinite;
}

.timer::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.3;
    animation: ring 1s infinite;
}

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

@keyframes ring {
    0% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.1; }
    100% { transform: scale(1.2); opacity: 0; }
}

.timer-bar {
    width: 100%;
    height: 8px;
    background: rgba(233, 236, 239, 0.4);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-progress {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ffa500, #ff6b6b);
    background-size: 200% 100%;
    width: 100%;
    transition: width linear;
    animation: timerGradient 2s ease infinite;
    border-radius: 4px;
}

@keyframes timerGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.question-container {
    text-align: center;
}

.category {
    display: inline-block;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #4b5563;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 0.95rem;
    margin-bottom: 24px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(209, 213, 219, 0.25);
    letter-spacing: 0.5px;
}

#question-text {
    color: rgba(0, 0, 0, 0.9);
    margin-bottom: 36px;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.answers {
    margin-bottom: 30px;
}

.answer-btn {
    display: block;
    width: 100%;
    margin: 16px 0;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(233, 236, 239, 0.5);
    border-radius: 16px;
    text-align: left;
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(209, 213, 219, 0.15), transparent);
    transition: left 0.5s;
}

.answer-btn:hover {
    border-color: #d1d5db;
    background: rgba(249, 250, 251, 0.9);
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 8px 32px rgba(209, 213, 219, 0.2);
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn.correct {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(25, 135, 84, 0.1));
    border-color: #28a745;
    color: #155724;
    box-shadow: 0 8px 32px rgba(40, 167, 69, 0.2);
    transform: translateX(8px) scale(1.02);
}

.answer-btn.incorrect {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(183, 28, 28, 0.1));
    border-color: #dc3545;
    color: #721c24;
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.2);
}

.answer-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.skip-btn, .next-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.skip-btn {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #6b7280;
    box-shadow: 0 4px 16px rgba(209, 213, 219, 0.25);
}

.skip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(209, 213, 219, 0.35);
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.next-btn {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    box-shadow: 0 4px 16px rgba(167, 243, 208, 0.25);
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(167, 243, 208, 0.35);
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

/* 結果画面 */
.result-container {
    text-align: center;
}

.result-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.final-score {
    margin-bottom: 30px;
}

.score-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 180px;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #374151;
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 16px 48px rgba(209, 213, 219, 0.3);
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.2;
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    0% { transform: scale(1); opacity: 0.2; }
    100% { transform: scale(1.05); opacity: 0.3; }
}

.score-circle span:first-child {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.score-label {
    font-size: 1.3rem;
    font-weight: 500;
    opacity: 0.9;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

.wrong-answers {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.wrong-answers h4 {
    color: #856404;
    margin-bottom: 15px;
}

.wrong-answer-item {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.result-actions button {
    width: 100%;
    max-width: 280px;
    padding: 18px 32px;
    border: none;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#play-again-btn {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #4b5563;
    box-shadow: 0 8px 32px rgba(209, 213, 219, 0.25);
}

#share-btn {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    box-shadow: 0 8px 32px rgba(191, 219, 254, 0.25);
}

.result-actions button:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

#play-again-btn:hover {
    box-shadow: 0 16px 48px rgba(209, 213, 219, 0.35);
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

#share-btn:hover {
    box-shadow: 0 16px 48px rgba(191, 219, 254, 0.35);
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}


/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .screen {
        padding: 20px;
        border-radius: 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    #question-text {
        font-size: 1.2rem;
    }
    
    .timer {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
    }
    
    .score-circle span:first-child {
        font-size: 2.2rem;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
    
    .form-actions,
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .form-actions button,
    .skip-btn, .next-btn {
        width: 100%;
        max-width: 250px;
    }
    
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .screen {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    #question-text {
        font-size: 1.1rem;
    }
    
    .answer-btn {
        padding: 12px 15px;
        font-size: 1rem;
    }
}