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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #4a5568;
    font-size: 1.5rem;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.current-course-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f7fafc;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.current-course-info.hidden {
    display: none;
}

.course-label {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

#current-course-title {
    font-size: 0.9rem;
    color: #2d3748;
    font-weight: 600;
}

.switch-course-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: #718096;
}

.switch-course-btn:hover {
    background: #e2e8f0;
    color: #4a5568;
    transform: rotate(90deg);
}

.score-display {
    display: flex;
    gap: 2rem;
    font-weight: 600;
    color: #2d3748;
}

.app-layout {
    display: flex;
    min-height: calc(100vh - 80px);
}

.sidebar {
    width: 300px;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1rem;
}

.btn-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-toggle:hover {
    background-color: #f7fafc;
}

.sidebar-content {
    padding: 1rem;
    height: calc(100vh - 140px);
    overflow-y: auto;
}

/* ツリー表示スキーマ情報 */
.schema-info {
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.tree-table {
    margin-bottom: 0.5rem;
    border-left: 2px solid #e2e8f0;
    padding-left: 0.5rem;
}

.tree-table-header {
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.tree-table-header:hover {
    background: #f7fafc;
}

.tree-toggle {
    font-size: 0.8rem;
    transition: transform 0.2s;
    color: #718096;
}

.tree-table.collapsed .tree-toggle {
    transform: rotate(-90deg);
}

.tree-table.collapsed .tree-columns {
    display: none;
}

.table-icon {
    font-size: 1rem;
}

.table-name {
    font-weight: 600;
    color: #2d3748;
}

.table-count {
    font-size: 0.8rem;
    color: #718096;
    margin-left: 0.25rem;
}

.tree-columns {
    margin-left: 1rem;
    border-left: 1px solid #e2e8f0;
}

.tree-column {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.tree-connector {
    color: #cbd5e0;
    font-family: monospace;
    width: 1.5rem;
    flex-shrink: 0;
}

.column-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.column-name {
    color: #4a5568;
    font-weight: 500;
    flex-grow: 1;
}

.column-type {
    font-size: 0.75rem;
    color: #718096;
    background: #f7fafc;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    flex-shrink: 0;
}

.loading-schema {
    text-align: center;
    color: #718096;
    font-style: italic;
}

.main-content {
    flex: 1;
    max-width: none;
    margin: 0;
    padding: 2rem;
    display: grid;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 80px;
        left: 0;
        height: calc(100vh - 80px);
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .slide-container {
        height: 400px;
    }
}

.challenge-info {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.challenge-info h2 {
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.difficulty-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.sql-editor-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

.editor-controls {
    display: flex;
    gap: 0.5rem;
}

#sql-editor {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
}

.results-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

.results-container {
    max-height: 300px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-warning {
    background: #ed8936;
    color: white;
}

.btn-info {
    background: #3182ce;
    color: white;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.navigation {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #48bb78;
    transition: width 0.3s ease;
}

.hint-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #4299e1;
}

.hidden {
    display: none;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ゲーム演出スタイル */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.game-overlay:not(.hidden) {
    display: flex;
}

.game-content {
    text-align: center;
    color: white;
}

.suspense-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.result-animation {
    animation: fadeInScale 0.8s ease-out;
}

.result-text {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px currentColor;
}

.result-text.correct {
    color: #48bb78;
    animation: correctGlow 2s ease-out;
}

.result-text.incorrect {
    color: #f56565;
    animation: incorrectShake 0.6s ease-out;
}

.result-icon {
    font-size: 4rem;
    margin-top: 1rem;
}

@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes correctGlow {
    0% { text-shadow: 0 0 30px #48bb78; }
    50% { text-shadow: 0 0 50px #48bb78, 0 0 80px #48bb78; }
    100% { text-shadow: 0 0 30px #48bb78; }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* クラッカーアニメーション */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(2n) { background: #4ecdc4; }
.confetti:nth-child(3n) { background: #45b7d1; }
.confetti:nth-child(4n) { background: #96ceb4; }
.confetti:nth-child(5n) { background: #feca57; }
.confetti:nth-child(6n) { background: #ff9ff3; }

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: #f7fafc;
    font-weight: 600;
}

.status-success {
    color: #38a169;
    font-weight: 600;
}

.status-error {
    color: #e53e3e;
    font-weight: 600;
}

/* サイドバー追加スタイル */
.table-count {
    font-size: 0.8rem;
    color: #718096;
    margin-left: 0.5rem;
}

/* スライドセクション */
.slide-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.slide-header {
    margin-bottom: 1rem;
}

.slide-header h3 {
    margin: 0;
    color: #2d3748;
}

.slide-container {
    height: 500px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.slide-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}
/* ===
== ゲームアニメーション ===== */

/* ゲームオーバーレイ */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ロボットアニメーション */
.robot-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.robot-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: robotFloat 2s ease-in-out infinite;
}

@keyframes robotFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.robot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.robot-head {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    border-radius: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    animation: robotThink 3s ease-in-out infinite;
}

@keyframes robotThink {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.robot-eye {
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    position: absolute;
    top: 25px;
    animation: robotBlink 2s ease-in-out infinite;
}

.left-eye {
    left: 20px;
}

.right-eye {
    right: 20px;
}

@keyframes robotBlink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.robot-mouth {
    width: 20px;
    height: 10px;
    background: #4a5568;
    border-radius: 0 0 20px 20px;
    position: absolute;
    bottom: 20px;
    animation: robotSpeak 1.5s ease-in-out infinite;
}

@keyframes robotSpeak {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.5); }
}

.robot-body {
    width: 60px;
    height: 80px;
    background: linear-gradient(145deg, #f0f0f0, #ffffff);
    border-radius: 15px;
    position: relative;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.robot-chest {
    width: 30px;
    height: 30px;
    background: #667eea;
    border-radius: 50%;
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    animation: robotHeartbeat 1s ease-in-out infinite;
}

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

.robot-arm {
    width: 15px;
    height: 50px;
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    border-radius: 10px;
    position: absolute;
    top: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.left-arm {
    left: -20px;
    animation: robotArmLeft 2s ease-in-out infinite;
}

.right-arm {
    right: -20px;
    animation: robotArmRight 2s ease-in-out infinite;
}

@keyframes robotArmLeft {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-15deg); }
}

@keyframes robotArmRight {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

.robot-legs {
    display: flex;
    gap: 10px;
}

.robot-leg {
    width: 20px;
    height: 40px;
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    animation: robotWalk 1s ease-in-out infinite alternate;
}

.left-leg {
    animation-delay: 0s;
}

.right-leg {
    animation-delay: 0.5s;
}

@keyframes robotWalk {
    0% { transform: translateY(0px); }
    100% { transform: translateY(5px); }
}

/* 思考バブル */
.thinking-bubbles {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

.bubble {
    background: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #4a5568;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: bubbleFloat 2s ease-in-out infinite;
}

.bubble-1 {
    animation-delay: 0s;
}

.bubble-2 {
    animation-delay: 0.5s;
}

.bubble-3 {
    animation-delay: 1s;
}

@keyframes bubbleFloat {
    0%, 100% { 
        transform: translateY(0px) scale(1);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-15px) scale(1.1);
        opacity: 1;
    }
}

.robot-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* 結果アニメーション */
.result-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    animation: resultAppear 0.8s ease-out;
}

@keyframes resultAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0px);
    }
}

.result-icon {
    font-size: 5rem;
    animation: iconBounce 1s ease-out;
}

@keyframes iconBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.result-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: textSlideUp 0.8s ease-out 0.3s both;
}

@keyframes textSlideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0px);
    }
}

/* 成功エフェクト */
.success-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cracker {
    position: absolute;
    bottom: 10%;
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border-radius: 50%;
    animation: crackerExplode 0.8s ease-out;
}

.left-cracker {
    left: 10%;
    animation-delay: 0.2s;
}

.right-cracker {
    right: 10%;
    animation-delay: 0.4s;
}

@keyframes crackerExplode {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.5) rotate(360deg);
        opacity: 0;
    }
}

.rocket-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 100%;
}

.rocket {
    position: absolute;
    font-size: 3rem;
    animation: rocketLaunch 2s ease-out;
}

.rocket-1 {
    left: 20%;
    animation-delay: 0.3s;
}

.rocket-2 {
    left: 50%;
    animation-delay: 0.6s;
}

.rocket-3 {
    left: 80%;
    animation-delay: 0.9s;
}

@keyframes rocketLaunch {
    0% {
        bottom: 0%;
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
    50% {
        opacity: 1;
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        bottom: 100%;
        opacity: 0;
        transform: rotate(360deg) scale(0.5);
    }
}

/* 失敗エフェクト */
.failure-effects {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.shake-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    animation: shakeEffect 0.6s ease-in-out;
}

@keyframes shakeEffect {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.error-icon {
    font-size: 5rem;
    animation: errorPulse 1s ease-in-out infinite;
}

@keyframes errorPulse {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.1);
        filter: brightness(1.2);
    }
}

.error-waves {
    position: relative;
    width: 200px;
    height: 200px;
}

.wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid #ff6b6b;
    border-radius: 50%;
    animation: waveExpand 1.5s ease-out infinite;
}

.wave-1 {
    animation-delay: 0s;
}

.wave-2 {
    animation-delay: 0.3s;
}

.wave-3 {
    animation-delay: 0.6s;
}

@keyframes waveExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* 紙吹雪エフェクト（既存の改良版） */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% {
        top: -10px;
        transform: rotateZ(0deg);
    }
    100% {
        top: 100vh;
        transform: rotateZ(720deg);
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .robot-container {
        transform: scale(0.8);
    }
    
    .result-icon {
        font-size: 3rem;
    }
    
    .result-text {
        font-size: 1.8rem;
    }
    
    .robot-text {
        font-size: 1rem;
    }
    
    .thinking-bubbles {
        transform: translateX(-50%) scale(0.8);
    }
}

/* ===== 問題タイプ選択 ===== */

.challenge-meta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.challenge-type-selector {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.selector-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: block;
}

.type-toggle {
    display: flex;
    background: #e2e8f0;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 0.75rem;
}

.type-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #718096;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.type-button:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #4a5568;
}

.type-button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.type-icon {
    font-size: 1.1rem;
}

.type-text {
    font-size: 0.85rem;
}

.type-description {
    text-align: center;
    color: #718096;
    font-size: 0.8rem;
    font-style: italic;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .challenge-meta {
        gap: 0.75rem;
    }
    
    .type-button {
        padding: 0.6rem 0.75rem;
        gap: 0.4rem;
    }
    
    .type-text {
        font-size: 0.8rem;
    }
    
    .type-icon {
        font-size: 1rem;
    }
    
    .challenge-type-selector {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .type-toggle {
        flex-direction: column;
        gap: 4px;
    }
    
    .type-button {
        justify-content: flex-start;
        padding: 0.75rem;
    }
}

/* ===== コース選択画面 ===== */

.course-selection-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.course-selection-screen.hidden {
    display: none;
}

.course-selection-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.course-selection-header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.course-selection-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.course-selection-header p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.course-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.course-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.course-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    color: white;
}

.course-title-section h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.course-difficulty {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.course-difficulty.beginner {
    background: #c6f6d5;
    color: #22543d;
}

.course-difficulty.intermediate {
    background: #fed7d7;
    color: #742a2a;
}

.course-difficulty.advanced {
    background: #bee3f8;
    color: #2a4365;
}

.course-description {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.course-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.course-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #718096;
    font-size: 0.9rem;
}

.course-meta-icon {
    font-size: 1.1rem;
}

.course-progress {
    margin-bottom: 1.5rem;
}

.course-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.course-progress-label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 600;
}

.course-progress-percentage {
    font-size: 0.8rem;
    color: #718096;
}

.course-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.course-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38a169);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.course-modules {
    margin-bottom: 1.5rem;
}

.course-modules-header {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.course-modules-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.course-module-tag {
    padding: 0.25rem 0.75rem;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.8rem;
    color: #4a5568;
}

.course-module-tag.completed {
    background: #c6f6d5;
    border-color: #9ae6b4;
    color: #22543d;
}

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

.course-select-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.course-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.course-select-btn.continue {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.course-select-btn.continue:hover {
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.course-info-btn {
    padding: 0.75rem;
    background: transparent;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
}

.course-info-btn:hover {
    border-color: #cbd5e0;
    color: #4a5568;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .course-selection-screen {
        padding: 1rem;
    }
    
    .course-selection-header h2 {
        font-size: 2rem;
    }
    
    .course-selection-header p {
        font-size: 1rem;
    }
    
    .course-list {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .course-card {
        padding: 1.5rem;
    }
    
    .course-meta {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .course-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .course-selection-header h2 {
        font-size: 1.75rem;
    }
    
    .course-card {
        padding: 1.25rem;
    }
    
    .course-header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .course-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
}

/* ===== コース情報モーダル ===== */

.course-info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
    overflow-y: auto;
}

.course-info-modal {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.course-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.course-info-header h2 {
    color: #2d3748;
    margin: 0;
}

.course-info-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.course-info-close:hover {
    background: #f7fafc;
    color: #4a5568;
}

.course-info-body {
    padding: 2rem;
}

.course-overview {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.course-overview p {
    margin: 0.5rem 0;
    color: #4a5568;
}

.course-description-full {
    margin-bottom: 2rem;
}

.course-description-full h3 {
    color: #2d3748;
    margin-bottom: 1rem;
}

.course-modules-detail h3 {
    color: #2d3748;
    margin-bottom: 1.5rem;
}

.module-detail {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.module-detail:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.module-detail.completed {
    background: #f0fff4;
    border-color: #9ae6b4;
}

.module-detail h4 {
    color: #2d3748;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-detail p {
    color: #4a5568;
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.module-progress {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 0.5rem;
}

.module-prerequisites {
    font-size: 0.8rem;
    color: #e53e3e;
    font-style: italic;
}

.course-info-actions {
    padding: 1rem 2rem 2rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.course-info-actions .course-select-btn {
    min-width: 200px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .course-info-overlay {
        padding: 1rem;
    }
    
    .course-info-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .course-info-body {
        padding: 1.5rem;
    }
    
    .course-info-actions {
        padding: 1rem 1.5rem 1.5rem;
    }
    
    .module-detail {
        padding: 1rem;
    }
}
/* ====
= 進捗表示パネル ===== */

.progress-panel {
    width: 320px;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    z-index: 90;
    order: 3;
}

.progress-panel.hidden {
    transform: translateX(100%);
}

.progress-panel-header {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.progress-panel-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1rem;
}

.progress-panel-content {
    padding: 1rem;
    height: calc(100vh - 140px);
    overflow-y: auto;
}

/* コース全体の進捗セクション */
.course-progress-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.course-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.course-progress-header h4 {
    margin: 0;
    color: #2d3748;
    font-size: 1rem;
    font-weight: 600;
}

#course-progress-percentage {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
}

.course-progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

.course-progress-stats {
    font-size: 0.9rem;
    color: #718096;
    text-align: center;
}

/* モジュール進捗セクション */
.modules-progress-section {
    margin-bottom: 1.5rem;
}

.modules-progress-section h4 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 0.95rem;
    font-weight: 600;
}

.modules-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.module-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.module-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.module-item.completed {
    background: #f0fff4;
    border-color: #9ae6b4;
}

.module-item.current {
    background: #ebf8ff;
    border-color: #90cdf4;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

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

.module-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-status {
    font-size: 1rem;
}

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

.module-progress-text {
    font-size: 0.8rem;
    color: #718096;
}

.module-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
    margin: 0 0.5rem;
}

.module-progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38a169);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.module-lessons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.lesson-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.lesson-dot.completed {
    background: #48bb78;
}

.lesson-dot.current {
    background: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.lesson-dot:hover::after {
    content: attr(data-lesson-name);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 100;
}

/* 現在のレッスン情報セクション */
.current-lesson-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #fff5f5;
    border-radius: 8px;
    border-left: 4px solid #f56565;
}

.current-lesson-section h4 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 0.95rem;
    font-weight: 600;
}

.current-lesson-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lesson-position {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #4a5568;
}

.lesson-separator {
    color: #a0aec0;
    font-weight: bold;
}

#current-module-name {
    font-weight: 600;
    color: #2d3748;
}

#current-lesson-name {
    font-weight: 600;
    color: #e53e3e;
}

.lesson-navigation {
    display: flex;
    gap: 0.5rem;
}

.lesson-nav-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #4a5568;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lesson-nav-btn:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.lesson-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 学習統計セクション */
.learning-stats-section {
    padding: 1rem;
    background: #fffaf0;
    border-radius: 8px;
    border-left: 4px solid #ed8936;
}

.learning-stats-section h4 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 0.95rem;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #fed7d7;
}

.stat-label {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 500;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2d3748;
}

/* アプリレイアウトの調整 */
.app-layout {
    display: flex;
    min-height: calc(100vh - 80px);
}

.main-content {
    flex: 1;
    max-width: none;
    margin: 0;
    padding: 2rem;
    display: grid;
    gap: 1.5rem;
    order: 2;
}

.sidebar {
    order: 1;
}

/* 進捗パネル表示時のレイアウト調整 */
.app-layout:has(.progress-panel:not(.hidden)) .main-content {
    margin-right: 0;
}

/* レスポンシブ対応 - 進捗パネル */
@media (max-width: 1200px) {
    .progress-panel {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .progress-panel {
        position: fixed;
        top: 80px;
        right: 0;
        height: calc(100vh - 80px);
        width: 300px;
        z-index: 200;
    }
    
    .progress-panel.hidden {
        transform: translateX(100%);
    }
    
    .progress-panel:not(.hidden) {
        transform: translateX(0);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .lesson-navigation {
        flex-direction: column;
    }
}/*
 進捗表示ボタン */
.show-progress-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: #4a5568;
    margin-left: 1rem;
}

.show-progress-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: scale(1.1);
}

.show-progress-btn:active {
    transform: scale(0.95);
}