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

/* タッチデバイス向けの最適化 */
@media (pointer: coarse) {
    .genre-card, .question-item, .btn, .lang-btn {
        touch-action: manipulation;
    }
}

body {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="white" fill-opacity="0.1"/><circle cx="80" cy="40" r="0.5" fill="white" fill-opacity="0.15"/><circle cx="40" cy="80" r="1.5" fill="white" fill-opacity="0.08"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: 0;
}

/* 言語別フォント設定 */
body.lang-ja {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo UI', 'MS UI Gothic', Tahoma, Geneva, Verdana, sans-serif;
}

body.lang-zh {
    font-family: 'Microsoft YaHei', '微软雅黑', 'SimSun', '宋体', 'Hiragino Sans GB', 'STHeiti', 'WenQuanYi Micro Hei', 'Segoe UI', Tahoma, sans-serif;
}

/* ボタンや他の要素にフォント継承を確実に適用（コード部分は除外） */
body.lang-ja *:not(code):not(pre):not([class*="language-"]):not(#output-input), 
body.lang-ja .btn, body.lang-ja button, body.lang-ja input:not(#output-input), body.lang-ja textarea:not(#output-input) {
    font-family: inherit !important;
}

body.lang-zh *:not(code):not(pre):not([class*="language-"]):not(#output-input), 
body.lang-zh .btn, body.lang-zh button, body.lang-zh input:not(#output-input), body.lang-zh textarea:not(#output-input) {
    font-family: inherit !important;
}

/* 特定のボタンクラスに明示的に適用 */
body.lang-ja .btn-info, body.lang-ja .btn-primary, body.lang-ja .btn-secondary, body.lang-ja .btn-danger, body.lang-ja .btn-back, body.lang-ja .lang-btn {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo UI', 'MS UI Gothic', Tahoma, Geneva, Verdana, sans-serif !important;
}

body.lang-zh .btn-info, body.lang-zh .btn-primary, body.lang-zh .btn-secondary, body.lang-zh .btn-danger, body.lang-zh .btn-back, body.lang-zh .lang-btn {
    font-family: 'Microsoft YaHei', '微软雅黑', 'SimSun', '宋体', 'Hiragino Sans GB', 'STHeiti', 'WenQuanYi Micro Hei', 'Segoe UI', Tahoma, sans-serif !important;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    width: 100%;
    max-width: 900px;
    padding: 48px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 36px;
}

h1 {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.score-board {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
    border-radius: 16px;
    font-size: 1.1em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.score-board span {
    color: #4b5563;
    font-weight: 500;
}

#question-section {
    margin-bottom: 30px;
}

#question-type {
    color: #667eea;
    font-size: 1.2em;
    margin-bottom: 15px;
}

#question-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    margin-bottom: 20px;
}

/* Prism.js のスタイルをオーバーライド */
pre[class*="language-"] {
    margin: 15px 0;
    border-radius: 8px;
    font-size: 14px;
}

code[class*="language-"] {
    font-family: 'Consolas', 'Monaco', 'Source Code Pro', 'Menlo', 'Roboto Mono', 'Ubuntu Mono', 'Courier New', Courier, monospace !important;
}

.answer-type {
    display: none;
    margin-bottom: 20px;
}

.answer-type.active {
    display: block;
}

#blank-input, #output-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

#blank-input:focus, #output-input:focus {
    outline: none;
    border-color: #667eea;
}

#output-input {
    min-height: 100px;
    font-family: 'Consolas', 'Monaco', 'Source Code Pro', 'Menlo', 'Roboto Mono', 'Ubuntu Mono', 'Courier New', Courier, monospace !important;
    resize: vertical;
}

.choice-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.3s;
}

.choice-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.choice-item.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 14px 32px;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #374151;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.3);
}

.btn-info:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 24px rgba(6, 182, 212, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.4);
}

#result-section {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#result-message {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 15px;
}

#result-message.correct {
    color: #48bb78;
}

#result-message.incorrect {
    color: #f56565;
}

#explanation {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    color: #4a5568;
    line-height: 1.6;
}

#final-result {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#final-result h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

#final-result p {
    font-size: 1.5em;
    margin-bottom: 20px;
}

#score-message {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 30px;
}

.highlight {
    background: #e6f3ff;
    color: #1a5490;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid #b3d9ff;
    font-weight: 600;
}

/* 戻るボタンのスタイル */
.btn-back {
    display: block;
    margin-left: auto;
    margin-bottom: 10px;
    padding: 8px 16px;
    font-size: 14px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    width: fit-content;
}

.btn-back:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(108, 117, 125, 0.4);
}

.container {
    position: relative;
}

/* 言語切り替えボタンのスタイル */
.language-toggle {
    display: flex;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    padding: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    width: fit-content;
}

.lang-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 64px;
}

.lang-btn:hover {
    color: #374151;
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.05);
}

.lang-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* ジャンル選択画面のスタイル */
#genre-selection {
    text-align: center;
    padding: 20px;
}

#genre-selection h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.genre-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #374151;
    padding: 32px 24px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

.genre-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.genre-card:hover::before {
    opacity: 1;
}

.genre-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    border-color: rgba(99, 102, 241, 0.3);
}

.genre-card h3 {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 12px;
    color: #1f2937;
    position: relative;
    z-index: 1;
}

.genre-card p {
    font-size: 1em;
    margin-bottom: 18px;
    color: #6b7280;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

.genre-card .question-count {
    display: inline-block;
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* ジャンル別カラー設定 */
.genre-card[data-genre="basics"]::before {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(67, 56, 202, 0.15));
}

.genre-card[data-genre="control"]::before {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.15));
}

.genre-card[data-genre="array"]::before {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(234, 88, 12, 0.15));
}

.genre-card[data-genre="function"]::before {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(147, 51, 234, 0.15));
}

.genre-card[data-genre="pointer"]::before {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(13, 148, 136, 0.15));
}

.genre-card[data-genre="all"]::before {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(219, 39, 119, 0.15));
}

.genre-card[data-genre="basics"] .question-count {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.genre-card[data-genre="control"] .question-count {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.genre-card[data-genre="array"] .question-count {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.genre-card[data-genre="function"] .question-count {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.genre-card[data-genre="pointer"] .question-count {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
}

.genre-card[data-genre="all"] .question-count {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

/* 進捗確認画面のスタイル */
.menu-buttons {
    text-align: center;
    margin-bottom: 30px;
}

#progress-view {
    padding: 20px;
    animation: fadeIn 0.5s ease;
    position: relative;
}

#progress-view h2 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.progress-summary {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border-left: 4px solid #667eea;
}

.total-progress h3 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.progress-bar {
    background: #e2e8f0;
    border-radius: 10px;
    height: 20px;
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    font-size: 1.1em;
    color: #4a5568;
    font-weight: 600;
}

.genre-progress-list {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.genre-progress-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.genre-info {
    flex: 1;
    margin-right: 20px;
}

.genre-info h4 {
    color: #333;
    margin-bottom: 5px;
    font-size: 1.2em;
}

.genre-info p {
    color: #666;
    font-size: 0.9em;
}

.progress-details {
    flex: 1;
    min-width: 200px;
}

.progress-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

/* 問題一覧画面のスタイル */
#question-list-view {
    padding: 20px;
    animation: fadeIn 0.5s ease;
    position: relative;
}

#question-list-view h2 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.genre-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 10px;
}

.genre-tab {
    padding: 12px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
}

.genre-tab:hover {
    background: rgba(102, 126, 234, 0.1);
}

.genre-tab.active {
    background: #667eea;
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.question-list-content {
    min-height: 400px;
}

.question-list {
    display: none;
}

.question-list.active {
    display: block;
}

.question-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 15px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.question-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.question-item.solved {
    border-left: 4px solid #48bb78;
    background: #f0fff4;
}

.question-item.solved::after {
    content: '✓';
    position: absolute;
    top: 15px;
    right: 15px;
    color: #48bb78;
    font-size: 18px;
    font-weight: bold;
}

.question-item.expanded {
    border-color: #6366f1;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

.question-detail {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.question-number {
    font-weight: bold;
    color: #667eea;
    font-size: 16px;
}

.question-type-badge {
    padding: 4px 8px;
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.question-type-badge.fill-blank {
    background: #e6fffa;
    color: #234e52;
}

.question-type-badge.output {
    background: #fffaf0;
    color: #744210;
}

.question-type-badge.multiple-choice {
    background: #f0f4ff;
    color: #3c4fe0;
}

.question-description {
    color: #4a5568;
    margin-bottom: 10px;
    line-height: 1.5;
}

.question-preview {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Source Code Pro', 'Menlo', 'Roboto Mono', 'Ubuntu Mono', 'Courier New', Courier, monospace !important;
    font-size: 13px;
    line-height: 1.4;
    color: #2d3748;
    white-space: pre-wrap;
    overflow-x: auto;
}

.question-list-buttons {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

/* スマホ対応メディアクエリ */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
        border-radius: 16px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.8em;
        margin-top: 10px;
    }
    
    header {
        margin-bottom: 24px;
    }
    
    .score-board {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 16px;
    }
    
    .genre-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .genre-card {
        padding: 24px 20px;
    }
    
    .language-toggle {
        position: relative;
        top: auto;
        left: auto;
        margin: 0 auto 20px auto;
        padding: 4px;
        display: flex;
        justify-content: center;
    }
    
    /* スマホで戻るボタンと言語切り替えボタンのサイズ調整 */
    .btn-back {
        padding: 6px 12px;
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .language-toggle {
        margin-bottom: 12px;
        padding: 4px;
    }
    
    .lang-btn {
        padding: 8px 14px;
        font-size: 13px;
        min-width: 56px;
    }
    
    /* モーダルのスマホ対応 */
    .modal-content {
        width: 95%;
        max-width: 100vw;
        max-height: 90vh;
        margin: 5vh auto;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 20px 24px 12px;
        flex-wrap: wrap;
    }
    
    .modal-header h3 {
        font-size: 1.3em;
        margin-right: 10px;
    }
    
    .modal-body {
        padding: 20px 24px 28px;
    }
    
    .modal-body .question-code {
        padding: 16px;
        font-size: 13px;
        overflow-x: auto;
    }
    
    .answer-section {
        grid-template-columns: 1fr;
    }
    
    .answer-box, .explanation-box {
        padding: 16px;
    }
    
    /* 右上戻るボタンのスマホ対応 */
    #back-to-menu-top,
    #back-to-menu-from-list-top {
        top: 16px;
        right: 16px;
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    /* ボタンのスマホ対応 */
    .btn {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    /* 問題一覧のスマホ対応 */
    .question-item {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .genre-tabs {
        flex-wrap: wrap;
        gap: 8px 4px;
    }
    
    .genre-tab {
        font-size: 13px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    h1 {
        font-size: 1.6em;
        margin-top: 8px;
    }
    
    header {
        margin-bottom: 20px;
    }
    
    .language-toggle {
        margin-bottom: 16px;
        padding: 3px;
    }
    
    /* 問題画面でのボタンサイズ調整 */
    .btn-back {
        padding: 5px 10px;
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .language-toggle {
        margin-bottom: 10px;
        padding: 3px;
    }
    
    .lang-btn {
        padding: 6px 12px;
        font-size: 12px;
        min-width: 50px;
    }
    
    /* 問題画面での更に細かい調整 */
    .lang-btn {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 45px;
    }
    
    .modal-content {
        width: 98%;
        margin: 1vh auto;
        max-height: 98vh;
    }
}

/* 更に小さい画面向け（320px以下） */
@media (max-width: 320px) {
    .btn-back {
        padding: 4px 8px;
        font-size: 11px;
        margin-bottom: 5px;
    }
    
    .language-toggle {
        margin-bottom: 8px;
        padding: 2px;
    }
    
    .lang-btn {
        padding: 3px 6px;
        font-size: 10px;
        min-width: 40px;
    }
    
    .modal-header {
        padding: 16px 20px 10px;
    }
    
    .modal-header h3 {
        font-size: 1.2em;
    }
    
    .modal-body {
        padding: 16px 20px 24px;
    }
    
    .modal-body .question-code {
        font-size: 12px;
        padding: 12px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .genre-card {
        padding: 20px 16px;
    }
    
    .question-item {
        padding: 14px;
    }
}

/* 右上戻るボタンのスタイル */
#back-to-menu-top,
#back-to-menu-from-list-top {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s, transform 0.2s;
    z-index: 10;
}

#back-to-menu-top:hover,
#back-to-menu-from-list-top:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

/* 問題詳細モーダルのスタイル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    /* タッチ操作向けの改善 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header h3 {
    color: #1f2937;
    font-size: 1.5em;
    font-weight: 700;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #374151;
}

.modal-body {
    padding: 24px 32px 32px;
}

.modal-body .question-type-badge {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-body .question-description {
    font-size: 1.1em;
    color: #374151;
    margin-bottom: 16px;
    line-height: 1.6;
}

.modal-body .question-code {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    white-space: pre-wrap;
    color: #1a365d;
}

.modal-body .question-text {
    font-size: 1.1em;
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 20px;
}

.choices-section {
    margin-bottom: 24px;
}

.choices-section h4 {
    color: #374151;
    margin-bottom: 12px;
    font-size: 1.1em;
}

#modal-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-choice {
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    color: #374151;
    font-weight: 500;
}

.modal-choice.correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

.answer-section {
    display: grid;
    gap: 20px;
}

.answer-box, .explanation-box {
    padding: 20px;
    border-radius: 12px;
}

.answer-box {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.explanation-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.answer-box h4, .explanation-box h4 {
    margin: 0 0 12px 0;
    font-size: 1.1em;
    color: #1f2937;
}

.correct-answer {
    font-weight: 600;
    color: #16a34a;
    font-size: 1.1em;
}

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

/* フッターのスタイル */
footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.copyright {
    text-align: center;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.6);
    opacity: 0.8;
}

.copyright a {
    color: rgba(0, 0, 0, 0.7);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.copyright a:hover {
    color: #6366f1;
    text-decoration: underline;
}

/* 進捗ページと問題一覧ページのh2見出し調整 */
#progress-view h2,
#question-list-view h2 {
    margin-top: 15px;
    margin-bottom: 20px;
}

/* 進捗ページと問題一覧ページでの戻るボタン調整 */
#progress-view .btn-back,
#question-list-view .btn-back {
    margin-bottom: 15px;
}

/* スマホでの見出し調整 */
@media (max-width: 768px) {
    #progress-view h2,
    #question-list-view h2 {
        margin-top: 10px;
        margin-bottom: 15px;
        font-size: 1.3em;
    }
    
    /* 進捗ページと問題一覧ページでの戻るボタン調整（スマホ） */
    #progress-view .btn-back,
    #question-list-view .btn-back {
        margin-bottom: 12px;
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* スマホでのフッター調整 */
@media (max-width: 768px) {
    footer {
        margin-top: 20px;
        padding-top: 15px;
    }
    
    .copyright {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    /* 進捗ページと問題一覧ページでの戻るボタン調整（小さいスマホ） */
    #progress-view .btn-back,
    #question-list-view .btn-back {
        margin-bottom: 10px;
        font-size: 12px;
        padding: 5px 10px;
    }
    
    #progress-view h2,
    #question-list-view h2 {
        margin-top: 8px;
        margin-bottom: 12px;
        font-size: 1.2em;
    }
    
    footer {
        margin-top: 15px;
        padding-top: 12px;
    }
    
    .copyright {
        font-size: 11px;
    }
}