/* ===== CSS変数 ===== */
:root {
    --main-color: #0097d3;
    --main-color-dark: #007ab3;
    --main-color-light: #33a9dd;
    --main-color-ultra-light: #e6f7ff;
    --accent-color: #ff6b35;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
}

/* ===== 基本設定 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', 'BIZ UDPGothic', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, var(--main-color-ultra-light) 0%, #ffffff 100%);
    min-height: 100vh;
}

/* ===== ヘッダー ===== */
header, .lesson-header {
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color-dark) 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
}

/* 目次ページ - 中央寄せ */
header:not(.lesson-header) .header-content {
    max-width: 1200px;
    padding: 1rem 20px 0;
    justify-content: space-between;
    text-align: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.index-hero h1 {
    font-family: 'Noto Sans JP', 'M PLUS Rounded 1c', sans-serif;
    font-weight: 700;
}

/* レッスンページタイトル */
.lesson-title, h1.lesson-title {
    font-size: 2.3rem;
    font-weight: bold;
    margin: 0;
}

/* デスクトップでレッスンページを左寄せ */
@media (min-width: 769px) {
    .lesson-header .header-content {
        justify-content: flex-start;
    }
    
    .lesson-header .lesson-title {
        text-align: left;
        flex: 1;
    }
    
    .lesson-header .lesson-nav {
        margin-left: auto;
    }
}

/* ナビゲーション */
.lesson-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 100px;
    max-width: 120px;
    text-align: center;
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-button:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* 目次ページ専用ナビ */
.index-progress-summary {
    display: flex;
    align-items: center;
    gap: 20px;
}

.index-total-points {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}

.dev-reset-all, .dev-reset-button {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.dev-reset-all:hover, .dev-reset-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* 進行バー */
.progress-container {
    max-width: 1400px;
    margin: 10px auto 0;
    padding: 0 20px;
}

.progress-bar-wrapper {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    background: var(--accent-color);
    height: 100%;
    width: 25%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-text {
    margin-top: 5px;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* パンくずリスト */
.breadcrumb {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 20px;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    align-items: center;
    font-size: 14px;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    color: white;
}

.breadcrumb li:not(:last-child)::after {
    content: ">";
    margin: 0 8px;
    color: rgba(255, 255, 255, 0.7);
}

.breadcrumb a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
}

.breadcrumb a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ===== レッスンコンテナ（2列レイアウト） ===== */
.lesson-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 320px; /* 左側：可変幅、右側：固定320px */
    gap: 20px;
}

/* 左列：メインコンテンツエリア */
.main-content-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* グリッドアイテムのオーバーフロー防止 */
}

/* 講座セクション */
.material-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
    font-weight: 500;
}

.material-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--main-color-ultra-light);
}

.lesson-icon {
    font-size: 2.5rem;
}

.material-title {
    color: var(--main-color);
    font-size: 1.7rem;
    font-weight: bold;
    letter-spacing: 0.3px;
}

.material-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin: 5px 0 0 0;
    font-weight: 500;
}

/* ステップナビゲーション */
.step-navigation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 25px;
}

.step-button {
    background: var(--light-color);
    color: var(--dark-color);
    border: 2px solid var(--main-color-light);
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-button.active {
    background: var(--main-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 151, 211, 0.3);
}

.step-button.completed {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.step-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ステップコンテンツ */
.step-content {
    font-size: 1.1rem;
    line-height: 1.8;
    font-weight: 500;
}

.step-content h3 {
    color: var(--main-color);
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: bold;
}

.step-content h4 {
    color: var(--main-color-dark);
    font-size: 1.3rem;
    margin: 25px 0 15px 0;
    font-weight: bold;
}

.step-content p {
    margin-bottom: 16px;
    color: #333;
    font-size: 1.1rem;
    line-height: 1.8;
    font-weight: 500;
}

.step-content ul, .step-content ol {
    margin: 16px 0;
    padding-left: 26px;
}

.step-content li {
    margin-bottom: 10px;
    font-size: 1.05rem;
    line-height: 1.7;
    font-weight: 500;
}

.step-content code {
    background: #f0f8ff;
    color: var(--main-color-dark);
    padding: 2px 6px;
    border-radius: 5px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.98rem;
    font-weight: 600;
}

.step-content strong {
    color: var(--accent-color);
    font-weight: bold;
}

.code-example-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #6c757d;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 500;
}

.step-button-next {
    margin-top: auto;
    margin-bottom: 40px;
    background: var(--success-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
    text-align: center;
}

/* PC版のみの修正 */
@media (min-width: 769px) {
    .step-button-next {
        margin-top: 30px;
        width: 50%;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
        display: block;
    }
}

.step-button-next:hover {
    background: #218838;
    transform: translateY(-1px);
}

.hint-section {
    background: var(--main-color-ultra-light);
    border-left: 4px solid var(--main-color);
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
}

.hint-title {
    font-weight: bold;
    color: var(--main-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* ===== エディタ+プレビューセクション ===== */
.editor-preview-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--main-color-ultra-light);
}

.editor-title {
    color: var(--main-color);
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-tabs {
    display: flex;
    gap: 10px;
}

.tab-button {
    background: var(--light-color);
    color: var(--dark-color);
    border: none;
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.tab-button.active {
    background: var(--main-color);
    color: white;
}

.tab-button:hover {
    background: var(--main-color-light);
    color: white;
}

/* エディタ+プレビューの横並び */
.editor-preview-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: 20px;
    min-height: 600px;
}

/* エディタエリア */
.editor-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* エディタコンテナ */
.editor-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--main-color-light);
    border-radius: 8px;
    overflow: hidden;
    background: #1e1e1e;
}

.editor-toolbar {
    background: #2d2d30;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3e3e42;
    font-size: 0.85rem;
}

.editor-info {
    color: #cccccc;
    display: flex;
    gap: 15px;
}

.editor-tools {
    display: flex;
    gap: 8px;
}

.tool-button {
    background: none;
    border: 1px solid #464647;
    color: #cccccc;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.tool-button:hover {
    background: #464647;
    border-color: #007acc;
}

.code-input {
    flex: 1;
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    white-space: pre;
    overflow: auto;
    tab-size: 2;
    min-height: 300px;
}

.code-input::placeholder {
    color: #6a6a6a;
}

/* プレビューエリア */
.preview-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.preview-header {
    background: var(--main-color);
    color: white;
    padding: 12px 15px;
    font-weight: bold;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.preview-iframe {
    flex: 1;
    border: none;
    background: white;
    border-radius: 0 0 8px 8px;
    border: 1px solid var(--main-color-light);
    border-top: none;
    min-height: 500px;
}

.fullscreen-btn, .layout-toggle-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-left: 5px;
}

.fullscreen-btn:hover, .layout-toggle-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* アクションボタン */
.action-buttons {
    grid-column: 1 / -1; /* 全幅に配置 */
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.action-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    flex: 1;
    font-size: 1rem;
    min-height: 44px;
}

.run-button {
    background: var(--success-color);
    color: white;
}

.run-button:hover {
    background: #218838;
    transform: translateY(-1px);
}

.reset-button {
    background: var(--warning-color);
    color: var(--dark-color);
}

.reset-button:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

/* オートコンプリートポップアップ */
.autocomplete-popup {
    position: absolute;
    background: #2d2d30;
    border: 1px solid #464647;
    border-radius: 4px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    color: #cccccc;
    border-bottom: 1px solid #3e3e42;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #464647;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-icon {
    margin-right: 8px;
}

.autocomplete-description {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* エラーパネル */
.error-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2d1b1b;
    border-top: 2px solid var(--danger-color);
    max-height: 150px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s ease;
    z-index: 10;
    display: none;
}

.error-panel.show {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

.error-message {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #4a2c2c;
    color: #ffffff;
    font-size: 0.9rem;
    line-height: 1.4;
}

.error-message:last-child {
    border-bottom: none;
}

.error-message span:first-child {
    margin-right: 8px;
    font-size: 1rem;
}

/* ===== サイドパネル ===== */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.panel-title {
    color: var(--main-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}

.goal-list {
    list-style: none;
}

.goal-item {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.goal-item:last-child {
    border-bottom: none;
}

.goal-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--main-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: bold;
}

.goal-checkbox.checked {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.goal-checkbox:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.points-earned {
    background: linear-gradient(135deg, var(--accent-color) 0%, #ff8a65 100%);
    color: white;
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    font-weight: bold;
}

.points-number {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 5px;
}

/* ===== 目次ページ ===== */
.index-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.index-hero {
    text-align: center;
    padding: 60px 20px;
    /*background: linear-gradient(135deg, var(--main-color-ultra-light) 0%, #ffffff 100%);*/
    background: #fff8dc;

    /*background: url('../images/hero-bg.jpg');*/
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 40px;
    flex-direction: row-reverse; /* これで左右反転 */
    border: 3px solid var(--main-color); /* 追加 */
}

.hero-content {
    flex: 1;
    text-align: left;
}

.hero-character {
    flex-shrink: 0;
}

.hero-character img {
    max-width: 250px;
    height: auto;
    animation: float 3s ease-in-out infinite;
}

/* ふわふわアニメーション */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* モバイル対応 */
@media (max-width: 768px) {
    .index-hero {
        flex-direction: column; /* モバイルは縦並び */
        text-align: center;
        /*background-image: linear-gradient(135deg, #fffef0 0%, #fef9e7 100%);*/
    }
    
    .hero-content {
        text-align: center;
    }
    
    .hero-character img {
        max-width: 200px;
    }
}

.index-hero h1 {
    font-size: 3rem;
    color: var(--main-color);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.index-hero p {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 30px;
}

.index-cta-button {
    background: linear-gradient(135deg, var(--accent-color) 0%, #ff8a65 100%);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.index-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.4);
}

.index-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.index-course-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.index-section-title {
    color: var(--main-color);
    font-size: 2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.index-course-cards {
    display: grid;
    gap: 20px;
}

.course-card {
    border: 2px solid var(--main-color-light);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 151, 211, 0.2);
}

.course-card.completed {
    background: linear-gradient(135deg, var(--success-color) 0%, #34ce57 100%);
    color: white;
}

.course-card.in-progress {
    background: linear-gradient(135deg, var(--warning-color) 0%, #ffcd39 100%);
    color: #333;
}

.course-number {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--main-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.course-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    padding-right: 40px;
}

.course-description {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

.course-progress {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    overflow: hidden;
}

.index-badge-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.index-badge-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.badge.earned {
    background: linear-gradient(135deg, var(--main-color-light) 0%, var(--main-color) 100%);
    color: white;
    transform: scale(1.05);
}

.badge.not-earned {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px dashed #dee2e6;
}

.badge:hover {
    transform: translateY(-3px) scale(1.02);
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.badge-name {
    font-weight: bold;
    text-align: center;
    font-size: 0.9rem;
}

.badge-description {
    font-size: 0.7rem;
    text-align: center;
    margin-top: 5px;
    opacity: 0.8;
}

.index-points-display {
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
}

.index-points-display .points-number {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.index-points-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* ===== 共通要素 ===== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip:hover::after {
    opacity: 1;
}

.footer {
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color-dark) 100%);
    padding: 30px;
    text-align: center;
    margin-top: 50px;
}

.footer-link {
    display: inline-block;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-link:hover {
    transform: scale(1.05);
}

.footer-logo {
    max-height: 50px;
    width: auto;
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
    .lesson-header {
        padding: 8px 0;
    }

    .lesson-header .header-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 0 15px;
    }

    header:not(.lesson-header) .header-content {
        flex-direction: column;
        gap: 8px;
        padding: 1rem 15px 0;
    }

    .index-progress-summary {
        flex-direction: column;
        gap: 10px;
    }

    .dev-reset-all {
        margin-left: 0;
        margin-top: 5px;
    }

    .index-main-grid {
        grid-template-columns: 1fr;
    }

    .index-hero h1 {
        font-size: 2rem;
    }

    .index-badge-grid {
        grid-template-columns: 1fr;
    }

    .lesson-container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
        min-height: auto;
    }

    .main-content-area {
        order: 1;
    }

    .side-panel {
        order: 2;
        gap: 15px;
    }

    .lesson-nav {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .nav-button {
        padding: 5px 10px;
        font-size: 0.8rem;
        border-radius: 15px;
    }

    .lesson-title, h1.lesson-title {
        font-size: 1.6rem;
        text-align: center;
        line-height: 1.3;
    }

    .progress-container {
        padding: 0 15px;
        margin-top: 5px;
    }

    .progress-bar-wrapper {
        height: 6px;
    }

    .progress-text {
        font-size: 0.8rem;
        margin-top: 3px;
    }

    .breadcrumb {
        padding: 8px 15px;
    }

    .step-navigation {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .step-button {
        padding: 8px 10px;
        font-size: 0.95rem;
    }

    .material-section {
        padding: 20px;
    }

    .material-title {
        font-size: 1.6rem;
    }

    .step-content {
        font-size: 1.1rem;
        line-height: 1.8;
        font-weight: 500;
    }

    .step-content h3 {
        font-size: 1.4rem;
        font-weight: 700;
        line-height: 1.3;
        margin-bottom: 18px;
    }

    .step-content h4 {
        font-size: 1.1rem;
    }

    .step-content p {
        font-size: 1.1rem;
        line-height: 1.8;
        font-weight: 500;
        margin-bottom: 16px;
    }

    .step-content code {
        font-size: 1.05rem;
        font-weight: 700;
        padding: 3px 8px;
        border-radius: 6px;
    }

    .step-content strong {
        color: #ff4500;
        font-weight: 700;
        text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    .hint-section {
        background: #f0f8ff;
        border-left: 5px solid var(--main-color);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        padding: 18px;
        margin: 18px 0;
        border-radius: 10px;
    }

    .hint-title {
        font-size: 1.1rem;
        font-weight: 700;
        margin-bottom: 10px;
        color: var(--main-color);
        text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    .code-example-box {
        font-size: 1.0rem;
        line-height: 1.8;
        font-weight: 600;
        padding: 15px;
        border-radius: 10px;
    }

    .step-button {
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.4;
        padding: 10px 12px;
        border: 3px solid var(--main-color-light);
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

    .step-button.active {
        box-shadow: 0 4px 12px rgba(0, 151, 211, 0.3);
        transform: translateY(-1px);
    }

    .step-button-next {
        font-size: 1.1rem;
        font-weight: 700;
        padding: 12px 24px;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    }

    .editor-preview-section {
        padding: 12px;
    }

    .editor-header {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 10px;
    }

    .editor-title {
        font-size: 1.1rem;
        text-align: center;
    }

    .editor-tabs {
        width: 100%;
        justify-content: center;
    }

    .tab-button {
        flex: 1;
        padding: 6px 12px;
    }

    /* モバイル版でPCと同じ縦横比を維持（縦一列表示） */
    .editor-preview-content {
        grid-template-columns: 1fr; /* 縦一列表示のまま */
        grid-template-rows: auto auto auto; /* エディタ + プレビュー + ボタン */
        min-height: auto;
        gap: 15px;
    }

    /* PCの縦横比を維持するため高さを調整 */
    .code-input {
        min-height: 400px; /* PCと同じような縦横比 */
        padding: 10px;
        font-size: 12px;
    }

    .preview-iframe {
        min-height: 400px; /* PCと同じような縦横比 */
    }

    .action-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 10px;
    }

    .action-button {
        padding: 10px 16px;
        font-size: 1rem;
        min-height: 44px;
    }

    .panel-card {
        padding: 15px;
    }

    .panel-title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .goal-item {
        padding: 6px 0;
        font-size: 0.9rem;
    }

    .goal-checkbox {
        width: 18px;
        height: 18px;
        min-width: 18px;
    }

    .points-earned {
        padding: 12px;
    }

    .points-number {
        font-size: 1.8rem;
    }

    .dev-reset-button {
        font-size: 0.6rem;
        padding: 2px 4px;
        margin-left: 8px;
        min-height: 18px;
        min-width: 18px;
    }

    /* フォント改善 */
    body {
        font-size: 17px;
        line-height: 1.7;
    }

    .material-section {
        font-weight: 500;
        line-height: 1.8;
    }

    /* タップ対応 */
    .step-button,
    .nav-button,
    .action-button,
    .goal-checkbox,
    .tool-button {
        min-height: 44px;
        min-width: 44px;
    }
}

@media (max-width: 480px) {
    .lesson-header {
        padding: 5px 0;
        position: static;
    }

    .lesson-header .header-content {
        padding: 0 10px;
    }

    .lesson-title, h1.lesson-title {
        font-size: 1.4rem;
        word-break: break-all;
        line-height: 1.3;
        text-align: center;
    }

    .lesson-nav {
        gap: 5px;
        width: 100%;
    }

    .nav-button {
        padding: 4px 8px;
        font-size: 0.7rem;
        border-radius: 12px;
        min-height: 30px;
    }

    .progress-container {
        padding: 0 10px;
        margin-top: 3px;
    }

    .progress-bar-wrapper {
        height: 4px;
    }

    .progress-text {
        font-size: 0.75rem;
        margin-top: 2px;
    }

    .material-section {
        padding: 15px;
        margin-bottom: 10px;
    }

    .material-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .lesson-icon {
        font-size: 2rem;
    }

    .material-title {
        font-size: 1.5rem;
        text-align: center;
        line-height: 1.3;
    }

    .step-navigation {
        gap: 6px;
    }

    .step-button {
        padding: 6px 8px;
        font-size: 1.0rem;
        white-space: normal;
        line-height: 1.3;
        min-height: 40px;
    }

    .step-content {
        font-size: 0.95rem;
    }

    .step-content h3 {
        font-size: 1.1rem;
    }

    .step-content p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .code-example-box {
        padding: 10px;
        font-size: 0.9rem;
        word-break: break-all;
        overflow-x: auto;
    }

    .hint-section {
        padding: 12px;
        margin: 12px 0;
    }

    .editor-preview-section {
        padding: 8px;
    }

    .editor-preview-content {
        min-height: auto;
    }

    /* より小さな画面でも縦横比を維持 */
    .code-input {
        min-height: 350px; /* 小画面でも適切な縦横比 */
        font-size: 11px;
        padding: 8px;
    }

    .preview-iframe {
        min-height: 350px; /* 小画面でも適切な縦横比 */
    }

    .action-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 10px;
    }
    
    .action-button {
        padding: 12px 20px;
        font-size: 1.1rem;
        min-height: 48px;
        border-radius: 10px;
    }

    .breadcrumb {
        padding: 8px 10px;
    }

    .breadcrumb ol {
        font-size: 12px;
    }

    .dev-reset-button {
        font-size: 0.5rem;
        padding: 1px 3px;
        margin-left: 6px;
        min-height: 16px;
        min-width: 16px;
    }

    /* スマホ専用フォント改善 */
    body {
        font-size: 18px;
        line-height: 1.8;
    }

    .step-content {
        font-size: 1.1rem;
        line-height: 1.9;
        font-weight: 500;
    }

    .step-content h3 {
        font-size: 1.4rem;
        font-weight: 700;
        line-height: 1.2;
        margin-bottom: 20px;
        text-align: center;
    }

    .step-content p {
        font-size: 1.1rem;
        line-height: 1.9;
        font-weight: 500;
        margin-bottom: 18px;
    }

    .step-content code {
        font-size: 1.05rem;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 8px;
        word-break: break-all;
    }

    .step-button-next {
        font-size: 1.1rem;
        font-weight: 700;
        padding: 15px 25px;
        margin-top: 25px;
        margin-bottom: 25px;
    }

    .hint-section {
        padding: 20px;
        margin: 20px 0;
    }

    .hint-title {
        font-size: 1.2rem;
        font-weight: 700;
        margin-bottom: 12px;
    }

    .code-example-box {
        font-size: 1.0rem;
        line-height: 1.9;
        font-weight: 600;
        padding: 18px;
        border-radius: 12px;
    }
}

/* モバイル専用「目次へ」ボタン */
.mobile-only-button {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only-button {
        display: block;
    }
}

/* フルスクリーン表示用（スクロールバー最適化版） */
.fullscreen-preview {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: white !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;  /* 外側のスクロールを防止 */
}

body:has(.fullscreen-preview) {
    overflow: hidden !important;
}


.fullscreen-preview .preview-header {
    flex-shrink: 0;
    height: 60px;
    background: var(--main-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 0;
}

.fullscreen-preview .preview-iframe {
    flex: 1 !important;
    width: 100% !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    display: block !important;
    overflow: hidden !important;  /* iframe自体にスクロールを任せる */
}

/* フルスクリーンボタン */
.fullscreen-btn::before {
    content: "⛶ 全画面";
}

.fullscreen-preview .fullscreen-btn::before {
    content: "✕ 閉じる";
}

/* ESCキーヒント */
.fullscreen-preview::after {
    content: "ESCキーで閉じる";
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 10001;
    pointer-events: none;
}

/* アニメーション */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* ===== ヘルプモーダル ===== */
.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.help-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: helpFadeIn 0.3s ease;
}

.help-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: helpSlideUp 0.3s ease;
    position: relative;
}

.help-header {
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color-dark) 100%);
    color: white;
    padding: 25px;
    border-radius: 20px 20px 0 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.help-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.help-subtitle {
    font-size: 1rem;
    margin: 8px 0 0 0;
    opacity: 0.9;
}

.help-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.help-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.help-body {
    padding: 30px;
}

.help-section {
    margin-bottom: 30px;
}

.help-section-title {
    color: var(--main-color);
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--main-color-ultra-light);
}

.help-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-step {
    background: var(--light-color);
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    transition: all 0.3s ease;
}

.help-step:hover {
    background: var(--main-color-ultra-light);
    border-color: var(--main-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 151, 211, 0.1);
}

.help-step-number {
    background: var(--main-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.help-step-content {
    flex: 1;
}

.help-step-title {
    font-weight: bold;
    color: #333;
    margin: 0 0 5px 0;
}

.help-step-description {
    color: #666;
    margin: 0;
    line-height: 1.6;
}

.help-code-examples {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.help-code-title {
    color: #569cd6;
    font-weight: bold;
    margin-bottom: 8px;
}

.help-tip {
    background: linear-gradient(135deg, #fff3cd 0%, #fef7e0 100%);
    border: 1px solid var(--warning-color);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.help-tip-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.help-tip-content {
    flex: 1;
    line-height: 1.6;
}

.help-actions {
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    background: var(--light-color);
    border-radius: 0 0 20px 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.help-action-button {
    background: var(--main-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.help-action-button:hover {
    background: var(--main-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 151, 211, 0.3);
}

.help-action-button.secondary {
    background: #6c757d;
}

.help-action-button.secondary:hover {
    background: #5a6268;
}

/* ヘルプモーダル用アニメーション */
@keyframes helpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes helpSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes celebrationPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.celebration-pulse {
    animation: celebrationPulse 2s infinite;
}

/* ヘルプモーダル モバイル対応 */
@media (max-width: 768px) {
    .help-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }

    .help-header {
        padding: 20px;
    }

    .help-title {
        font-size: 1.5rem;
    }

    .help-body {
        padding: 20px;
    }

    .help-section-title {
        font-size: 1.2rem;
    }

    .help-step {
        padding: 12px;
        gap: 12px;
    }

    .help-step-number {
        width: 25px;
        height: 25px;
        font-size: 0.9rem;
    }

    .help-actions {
        padding: 15px 20px;
        flex-direction: column;
    }

    .help-action-button {
        padding: 10px 20px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .help-content {
        width: 98%;
        margin: 10px;
    }

    .help-header {
        padding: 15px;
    }

    .help-title {
        font-size: 1.3rem;
    }

    .help-body {
        padding: 15px;
    }

    .help-step {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .help-step-number {
        align-self: center;
    }
}

/* ===== お祝いモーダル（コンパクト版） ===== */
.celebration-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1001;
    backdrop-filter: blur(5px);
}

.celebration-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: celebrationFadeIn 0.5s ease;
    padding: 10px;
}

.celebration-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    max-width: 450px;
    max-height: 85vh;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    animation: celebrationBounce 0.6s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.celebration-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--accent-color) 0%, 
        var(--success-color) 25%, 
        var(--main-color) 50%, 
        var(--warning-color) 75%, 
        var(--accent-color) 100%);
}

.celebration-header {
    background: linear-gradient(135deg, var(--success-color) 0%, #34ce57 100%);
    color: white;
    padding: 20px 20px 18px;
    position: relative;
    flex-shrink: 0;
}

.celebration-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.celebration-title {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.celebration-subtitle {
    font-size: 1rem;
    margin: 0;
    opacity: 0.95;
}

.celebration-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.celebration-lesson-title {
    color: var(--main-color);
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 15px 0;
}

.celebration-achievements {
    background: var(--main-color-ultra-light);
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
}

.celebration-achievement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0;
    font-weight: 500;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.celebration-achievement-icon {
    font-size: 1rem;
}

.celebration-points-display {
    background: linear-gradient(135deg, var(--accent-color) 0%, #ff8a65 100%);
    color: white;
    border-radius: 15px;
    padding: 15px;
    margin: 18px 0;
    font-weight: bold;
}

.celebration-points-number {
    font-size: 2rem;
    display: block;
    margin-bottom: 3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.celebration-badge {
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color-dark) 100%);
    color: white;
    border-radius: 12px;
    padding: 12px;
    margin: 15px 0;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

.celebration-badge-icon {
    font-size: 1.3rem;
}

.celebration-actions {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.celebration-action-button {
    background: var(--main-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.celebration-action-button:hover {
    background: var(--main-color-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 151, 211, 0.4);
}

.celebration-action-button.secondary {
    background: #6c757d;
    font-size: 0.9rem;
    padding: 10px 20px;
}

.celebration-action-button.secondary:hover {
    background: #5a6268;
}

.celebration-action-button.primary {
    background: linear-gradient(135deg, var(--success-color) 0%, #34ce57 100%);
    font-size: 1.1rem;
    padding: 14px 30px;
}

.celebration-action-button.primary:hover {
    background: linear-gradient(135deg, #218838 0%, #28a745 100%);
}

/* お祝い用アニメーション */
@keyframes celebrationFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes celebrationBounce {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(100px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(-20px);
    }
    70% {
        transform: scale(0.95) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* お祝いモーダル モバイル対応（コンパクト版） */
@media (max-width: 768px) {
    .celebration-modal.show {
        padding: 5px;
    }

    .celebration-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .celebration-header {
        padding: 15px;
        border-radius: 12px 12px 0 0;
    }

    .celebration-title {
        font-size: 1.4rem;
    }

    .celebration-body {
        padding: 15px;
    }

    .celebration-lesson-title {
        font-size: 1.1rem;
    }

    .celebration-achievements {
        padding: 12px;
        margin: 12px 0;
    }

    .celebration-achievement {
        font-size: 0.85rem;
        padding: 4px 0;
    }

    .celebration-points-number {
        font-size: 1.6rem;
    }

    .celebration-actions {
        padding: 12px 15px 15px;
    }

    .celebration-action-button {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .celebration-action-button.primary {
        font-size: 1rem;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .celebration-content {
        width: 98%;
        max-height: 92vh;
        border-radius: 10px;
    }

    .celebration-header {
        padding: 12px;
        border-radius: 10px 10px 0 0;
    }

    .celebration-title {
        font-size: 1.3rem;
    }

    .celebration-body {
        padding: 12px;
    }

    .celebration-achievements {
        padding: 10px;
    }

    .celebration-points-number {
        font-size: 1.4rem;
    }

    .celebration-actions {
        padding: 10px 12px 12px;
    }
}
        /* 進歩リセットボタンのスタイル */
        .dev-reset-button {
            background: none;
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: rgba(255, 255, 255, 0.8);
            padding: 2px 6px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.7rem;
            margin-left: 10px;
            transition: all 0.2s ease;
            min-height: 20px;
            min-width: 20px;
        }

        .dev-reset-button:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.5);
            color: white;
            transform: scale(1.1);
        }

        .dev-reset-button:active {
            transform: scale(0.95);
        }

        /* モバイル対応 */
        @media (max-width: 768px) {
            .dev-reset-button {
                font-size: 0.6rem;
                padding: 2px 4px;
                margin-left: 8px;
                min-height: 18px;
                min-width: 18px;
            }
        }

        @media (max-width: 480px) {
            .dev-reset-button {
                font-size: 0.5rem;
                padding: 1px 3px;
                margin-left: 6px;
                min-height: 16px;
                min-width: 16px;
            }
        }

        /* 画像ガイドセクション */
        .image-guide-section {
            background: #fff3cd;
            border: 1px solid #ffc107;
            border-radius: 10px;
            padding: 20px;
            margin: 20px 0;
        }

        .image-guide-title {
            color: #856404;
            margin-top: 0;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 1.2rem;
            font-weight: bold;
        }

        .image-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin: 15px 0;
        }

        .image-item {
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 15px;
            text-align: center;
            transition: all 0.3s ease;
        }

        .image-item:hover {
            border-color: #0097d3;
            transform: translateY(-2px);
        }

        .image-placeholder {
            width: 100%;
            height: 100px;
            background: #f0f0f0;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            margin-bottom: 10px;
        }

        .image-filename {
            font-family: 'Courier New', monospace;
            color: #0097d3;
            font-weight: bold;
            margin-bottom: 5px;
        }

        .image-description {
            font-size: 0.9rem;
            color: #666;
        }

        /* ダウンロードセクション */
        .download-section {
            background: #e8f5e8;
            border-radius: 15px;
            padding: 25px;
            margin: 20px 0;
            border-left: 4px solid #28a745;
            text-align: center;
        }

        .download-section h3 {
            color: #155724;
            margin-top: 0;
            margin-bottom: 15px;
            font-size: 1.3rem;
        }

        .download-buttons {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
            justify-content: center;
            margin-top: 20px;
        }

        .download-button {
            background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
            color: white;
            padding: 15px 25px;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 1rem;
            text-decoration: none;
            justify-content: center;
            text-align: center;
        }

        .download-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
        }

        .download-button.certificate {
            background: linear-gradient(135deg, #ff6b35 0%, #ff8a65 100%);
        }

        .download-button.certificate:hover {
            box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
        }

        @media (min-width: 769px) {
            .download-button {
                min-width: 280px;
                flex: 0 0 auto;
                text-align: center;
            }
        }

        @media (max-width: 768px) {
            .download-buttons {
                flex-direction: column;
                align-items: center;
            }

            .download-button {
                width: 100%;
                max-width: 300px;
                justify-content: center;
            }

            .image-list {
                grid-template-columns: 1fr;
            }
        }

        /* 画像プレビュー用のスタイル */
        .image-preview {
            position: relative;
            width: 100%;
            height: 120px;
            background: #f0f0f0;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 10px;
            overflow: hidden;
            border: 2px solid #e0e0e0;
        }

        .preview-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 6px;
            z-index: 2;
            position: relative;
        }

        .fallback-placeholder {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            border-radius: 6px;
            z-index: 1;
        }

        /* 画像が読み込まれた場合はフォールバックを非表示 */
        .image-preview:not(.image-error) .fallback-placeholder {
            display: none;
        }

        /* ホバー効果 */
        .image-item:hover .image-preview {
            border-color: #0097d3;
            transform: translateY(-2px);
            transition: all 0.3s ease;
        }

        .image-item:hover .preview-image {
            transform: scale(1.05);
            transition: transform 0.3s ease;
        }

        /* 事前準備セクションのスタイル */
        .preparation-section {
            background: #f0f7ff;  /* グラデーションから単色に変更 */
            border-radius: 15px;
            padding: 25px;
            margin: 20px 0;
            border-left: 5px solid #2196f3;
        }
        
        .preparation-title {
            color: #1976d2;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .preparation-section > p {
            margin-bottom: 20px;
            font-size: 1.1rem;
            color: #424242;
        }
        
        .preparation-checklist {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 15px;
        }
        
        .preparation-item {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 3px 10px rgba(0,0,0,0.1);
            transition: transform 0.2s;
        }
        
        .preparation-item:nth-child(1) {
            border: 2px solid #e3f2fd;
        }
        
        .preparation-item:nth-child(2) {
            border: 2px solid #e8f5e8;
        }
        
        .preparation-item:nth-child(3) {
            border: 2px solid #fff3e0;
        }
        
        .preparation-item:nth-child(4) {
            border: 2px solid #fce4ec;
        }
        
        .preparation-item:hover {
            transform: translateY(-2px);
        }
        
        .preparation-item > div {
            display: flex;
            align-items: flex-start;
            gap: 15px;
        }
        
        .preparation-icon {
            font-size: 2rem;
            flex-shrink: 0;
        }
        
        .preparation-text strong {
            font-size: 1.1rem;
        }
        
        .preparation-item:nth-child(1) .preparation-text strong {
            color: #1976d2;
        }
        
        .preparation-item:nth-child(2) .preparation-text strong {
            color: #388e3c;
        }
        
        .preparation-item:nth-child(3) .preparation-text strong {
            color: #f57c00;
        }
        
        .preparation-item:nth-child(4) .preparation-text strong {
            color: #c2185b;
        }
        
        .preparation-text span {
            color: #666;
            font-size: 0.95rem;
            line-height: 1.4;
        }
        
        .preparation-hint {
            margin-top: 20px;
            padding: 15px;
            background: rgba(255,255,255,0.7);
            border-radius: 8px;
            border-left: 3px solid #4caf50;
        }
        
        .preparation-hint p {
            margin: 0;
            color: #2e7d32;
            font-weight: 500;
        }