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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #fef3f3 0%, #f3e7ff 100%);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.header p {
    color: #666;
}

/* 統計カード */
.stats-card {
    background: linear-gradient(135deg, #e9d5ff 0%, #fce7f3 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.stats-card h2 {
    text-align: center;
    margin-bottom: 1rem;
    color: #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.stat-item {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #7c3aed;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

/* メニューグリッド */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.menu-btn {
    padding: 2rem 1rem;
    border: none;
    border-radius: 1rem;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.menu-btn small {
    display: block;
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.btn-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.btn-red {
    background: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
}

.btn-purple {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
}

.btn-green {
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
}

.btn-red:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* 記事バナー */
.article-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    border: 2px solid #fbbf24;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.banner-header h2 {
    font-size: 1.25rem;
    color: #333;
}

.banner-header button {
    background: none;
    border: none;
    color: #ea580c;
    font-weight: bold;
    cursor: pointer;
}

.article-banner p {
    color: #666;
    margin-bottom: 1rem;
}

/* ボタン */
.btn-primary {
    background: linear-gradient(135deg, #f97316 0%, #eab308 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-back {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.btn-back:hover {
    color: #333;
}

/* 画面切り替え */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* カテゴリー選択 */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: white;
    border: none;
    border-radius: 1rem;
    font-size: 1.125rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-btn:hover {
    transform: scale(1.03);
}

.badge {
    background: rgba(255,255,255,0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
}

/* 問題画面 */
.quiz-header {
    margin-bottom: 2rem;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.category-badge {
    background: #ede9fe;
    color: #7c3aed;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: bold;
}

.btn-favorite {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.btn-favorite.active {
    filter: brightness(1.2);
}

#timer {
    color: #dc2626;
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7 0%, #ec4899 100%);
    transition: width 0.3s;
}

.question-content h3 {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 2rem;
}

#options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.option-btn {
    padding: 1rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.option-btn:hover:not(:disabled) {
    border-color: #a855f7;
    background: #faf5ff;
}

.option-btn.correct {
    border-color: #10b981;
    background: #d1fae5;
}

.option-btn.incorrect {
    border-color: #ef4444;
    background: #fee2e2;
}

.option-btn:disabled {
    cursor: not-allowed;
}

.explanation {
    background: #dbeafe;
    border: 2px solid #3b82f6;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.explanation h4 {
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.explanation p {
    color: #374151;
    line-height: 1.6;
}

.quiz-actions {
    display: flex;
    gap: 1rem;
}

.quiz-actions button {
    flex: 1;
}

/* 統計画面 */
#stats-chart {
    margin: 2rem 0;
    max-width: 100%;
}

#category-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-stat {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
}

.category-stat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.category-stat-bar {
    width: 100%;
    height: 0.75rem;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.category-stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7 0%, #ec4899 100%);
    transition: width 0.3s;
}

.category-stat-text {
    text-align: right;
    font-size: 0.875rem;
    font-weight: bold;
    color: #7c3aed;
    margin-top: 0.25rem;
}

/* 記事 */
.article-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #d1d5db;
}

.filter-btn.active {
    background: #7c3aed;
    color: white;
}

#articles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.article-card {
    background: linear-gradient(135deg, #faf5ff 0%, #fce7f3 100%);
    padding: 1.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.article-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.article-category {
    background: #ede9fe;
    color: #7c3aed;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: bold;
}

.article-date {
    color: #9ca3af;
    font-size: 0.75rem;
}

.article-title {
    font-size: 1.125rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.article-excerpt {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.article-link {
    color: #7c3aed;
    font-size: 0.875rem;
    font-weight: 600;
}

/* 記事詳細 */
#article-content {
    line-height: 1.8;
}

#article-content h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 1rem;
}

#article-content h2 {
    font-size: 1.5rem;
    color: #333;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

#article-content p {
    color: #666;
    margin-bottom: 1rem;
}

/* フッター */
footer {
    background: #1f2937;
    color: white;
    padding: 2rem 1rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
}

.footer-section a {
    display: block;
    color: #d1d5db;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.footer-section a:hover {
    color: #a855f7;
}

.footer-bottom {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
    font-size: 0.875rem;
}

.footer-text {
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* レスポンシブ */
@media (max-width: 640px) {
    .menu-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quiz-actions {
        flex-direction: column;
    }

    #articles-list {
        grid-template-columns: 1fr;
    }
}