/* ================= BASE THEME ================= */ :root { /* Primary colors */ --primary-color: #5e4b8b; --primary-light: #8a77b5; --primary-dark: #3b2e63; /* Secondary colors */ --secondary-color: #444444; --secondary-dark: #222222; /* Text colors */ --text-color: #333333; --dark-text: #111111; --light-text: #666666; --editor-text: #d4d4d4; --white-text: #ffffff; /* Background colors */ --bg-color: #f8f7fc; --panel-bg: #ffffff; --code-bg: #f7f5fa; --editor-bg: #1e1e1e; --editor-highlight: #303030; /* Border colors */ --border-color: #e0e0e0; /* Status colors */ --info-color: #7a93fe; --success-color: #58b890; --success-color-dark: #3d8d6a; --success-color-light: #a3e6c8; --error-color: #cb6e75; --danger-color: #dc3545; /* Special colors */ --primary-bg-light: rgba(94, 75, 139, 0.05); --primary-bg-medium: rgba(94, 75, 139, 0.1); --primary-bg-instruction: rgba(125, 92, 203, 0.9); --success-bg-light: rgba(88, 184, 144, 0.15); --modal-bg: rgba(0, 0, 0, 0.5); /* Typography */ --font-main: "Inter", "Segoe UI", Roboto, sans-serif; --font-code: "JetBrains Mono", "Fira Code", monospace; /* Effects */ --shadow: 0 2px 8px rgba(0, 0, 0, 0.06); --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.15); /* Sizes */ --header-height: 50px; --sidebar-width: 280px; --border-radius-sm: 4px; --border-radius-md: 6px; --border-radius-lg: 8px; --spacing-xs: 0.5rem; --spacing-sm: 0.75rem; --spacing-md: 1rem; --spacing-lg: 1.5rem; } /* ================= RESET ================= */ * { margin: 0; padding: 0; box-sizing: border-box; } /* ================= ACCESSIBILITY ================= */ .skip-link { position: absolute; top: -100%; left: 16px; padding: 8px 16px; background: var(--primary-dark); color: var(--white-text); text-decoration: none; border-radius: var(--border-radius-sm); z-index: 10000; transition: top 0.2s ease; } .skip-link:focus { top: 8px; } /* Focus styles - let browser defaults handle most cases */ /* Only enhance for our interactive elements */ /* ================= BASE STYLES ================= */ body { font-family: var(--font-main); background-color: var(--bg-color); color: var(--text-color); line-height: 1.5; overflow: hidden; } code, kbd { font-family: var(--font-code); } /* ================= APP CONTAINER ================= */ .app-container { display: flex; flex-direction: column; height: 100vh; overflow: hidden; } /* ================= HEADER ================= */ .header { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); padding: 0 var(--spacing-md); background: var(--panel-bg); border-bottom: 1px solid var(--border-color); flex-shrink: 0; } .menu-toggle { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: none; border: none; cursor: pointer; padding: 4px; border-radius: var(--border-radius-sm); } .menu-toggle:hover { background: var(--primary-bg-light); } .hamburger-icon { position: relative; width: 18px; height: 2px; background-color: var(--text-color); border-radius: 1px; } .hamburger-icon::before, .hamburger-icon::after { content: ""; position: absolute; left: 0; width: 100%; height: 2px; background-color: var(--text-color); border-radius: 1px; } .hamburger-icon::before { top: -6px; } .hamburger-icon::after { top: 6px; } .logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; cursor: pointer; } .logo h1 { font-size: 1rem; font-weight: 800; color: var(--text-color); line-height: 1; display: flex; align-items: center; gap: 0.15rem; } .logo h1 .code-text { background: var(--primary-color); color: white; padding: 0.15rem 0.35rem; border-radius: 4px; letter-spacing: 0.05em; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); } .logo h1 span:last-child { color: var(--primary-color); } .help-toggle { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-color); background: none; font-weight: bold; cursor: pointer; color: var(--light-text); transition: all 0.2s; } .help-toggle:hover { border-color: var(--primary-color); color: var(--primary-color); } .header-actions { display: flex; align-items: center; gap: var(--spacing-sm); } /* Path Indicator Pill */ .path-indicator { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--primary-bg-medium); color: var(--primary-color); padding: 6px 12px; border-radius: 16px; border: none; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; max-width: 200px; } .path-indicator:hover { background: var(--primary-bg-light); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(94, 75, 139, 0.15); } .path-indicator-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.5px; } .path-indicator-progress { color: var(--primary-dark); font-weight: 700; opacity: 0.9; font-size: 0.75rem; } /* ================= GAME LAYOUT ================= */ .game-layout { display: flex; flex: 1; min-height: 0; overflow: hidden; transition: transform 0.3s ease; } /* ================= LEFT PANEL ================= */ .left-panel { width: 50%; display: flex; flex-direction: column; border-right: 1px solid var(--border-color); background: var(--panel-bg); min-height: 0; } .instructions { padding: var(--spacing-md); border-bottom: 1px solid var(--border-color); max-height: calc(50vh - 60px); overflow-y: auto; } /* Smooth lesson transition */ #lesson-title, .lesson-description, .task-instruction { transition: opacity 0.1s ease; } .editor-section.transitioning #lesson-title, .editor-section.transitioning .lesson-description, .editor-section.transitioning .task-instruction { opacity: 0.3; } /* Loading fallback notice */ .loading-fallback { text-align: center; padding: 3rem 1rem; color: var(--light-text); animation: fadeIn 0.5s ease; } .loading-fallback p { margin-bottom: 1rem; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .module-pill { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--primary-bg-medium); color: var(--primary-color); padding: 4px 12px; border-radius: 16px; font-size: 0.8rem; font-weight: 600; min-width: 0; flex-shrink: 1; } .module-name { text-transform: uppercase; letter-spacing: 0.5px; } .module-pill .level-indicator { color: var(--primary-dark); font-weight: 500; opacity: 0.8; } #lesson-title { font-size: 1.25rem; color: var(--primary-dark); margin-bottom: var(--spacing-sm); } .completion-badge { display: inline-block; margin-left: 0.5rem; padding: 0.15rem 0.5rem; background: var(--success-color); color: white; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; border-radius: var(--border-radius-sm); vertical-align: middle; } .lesson-description { font-size: 0.95rem; line-height: 1.6; color: var(--text-color); margin-top: var(--spacing-lg); margin-bottom: var(--spacing-md); } .lesson-description kbd, .lesson-description code { background: var(--primary-bg-medium); padding: 2px 6px; border-radius: 3px; font-size: 0.85rem; } .lesson-description pre { background: var(--code-bg); padding: var(--spacing-md); border-radius: var(--border-radius-sm); overflow-x: auto; font-size: 0.85rem; margin: var(--spacing-sm) 0; } .task-instruction { background: var(--primary-bg-instruction); color: var(--white-text); padding: var(--spacing-sm) var(--spacing-md); border-radius: var(--border-radius-sm); font-size: 0.9rem; line-height: 1.6; } .task-instruction kbd, .task-instruction code { background: rgba(255, 255, 255, 0.25); padding: 2px 8px; border-radius: 4px; font-size: 0.9em; font-weight: 500; } /* ================= CONCEPT SECTION ================= */ .concept-section { margin-top: var(--spacing-lg); padding: var(--spacing-md); background: var(--primary-bg-light); border: 1px solid var(--primary-bg-medium); border-left: 3px solid var(--primary-color); border-radius: var(--border-radius-md); transition: background 0.2s ease; } .concept-section:hover { background: var(--primary-bg-medium); } .concept-section[open] { background: var(--primary-bg-medium); } .concept-summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--primary-dark); list-style: none; user-select: none; padding: var(--spacing-xs) 0; display: flex; align-items: center; gap: var(--spacing-xs); } .concept-summary::-webkit-details-marker { display: none; } .concept-summary::before { content: "▶"; display: inline-block; font-size: 0.7rem; transition: transform 0.2s ease; color: var(--primary-color); } .concept-section[open] .concept-summary::before { transform: rotate(90deg); } .concept-summary:hover { color: var(--primary-color); } .concept-content { margin-top: var(--spacing-md); padding-top: var(--spacing-sm); border-top: 1px solid var(--border-color); animation: concept-expand 0.3s ease; } @keyframes concept-expand { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } } .concept-explanation { font-size: 0.9rem; line-height: 1.6; color: var(--text-color); margin-bottom: var(--spacing-md); } .concept-explanation:empty { display: none; margin-bottom: 0; } .concept-diagram { background: var(--panel-bg); padding: var(--spacing-md); border-radius: var(--border-radius-sm); border: 1px solid var(--border-color); font-family: var(--font-code); font-size: 0.85rem; line-height: 1.4; color: var(--text-color); overflow-x: auto; white-space: pre; margin-bottom: var(--spacing-md); } .concept-diagram:empty { display: none; margin-bottom: 0; } .concept-container-vs-item { background: var(--success-bg-light); padding: var(--spacing-sm) var(--spacing-md); border-radius: var(--border-radius-sm); border-left: 3px solid var(--success-color); font-size: 0.85rem; line-height: 1.6; color: var(--text-color); } .concept-container-vs-item:empty { display: none; } .concept-container-vs-item strong { color: var(--success-color-dark); font-weight: 600; } /* ================= EDITOR SECTION ================= */ .editor-section { flex: 1; display: flex; flex-direction: column; min-height: 50vh; position: relative; } /* Playground mode - full height editor */ .editor-section.playground-mode { flex: 1; min-height: 0; } .code-editor { flex: 1; display: flex; flex-direction: column; min-height: 0; } .editor-header { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-xs) var(--spacing-md); background: var(--code-bg); border-bottom: 1px solid var(--border-color); } .editor-label { font-size: 0.85rem; font-weight: 600; color: var(--light-text); } .editor-actions { display: flex; align-items: center; gap: var(--spacing-sm); } .editor-content { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--editor-bg); overflow: hidden; } /* CodeMirror container styles */ .editor-content .cm-editor { flex: 1; height: 100%; } .editor-content .cm-scroller { overflow: auto; } /* Legacy textarea (fallback) */ .code-input { flex: 1; width: 100%; padding: var(--spacing-md); background: var(--editor-bg); color: var(--editor-text); border: none; font-family: var(--font-code); font-size: 14px; line-height: 1.5; resize: none; outline: none; } .code-input::placeholder { color: #666; } /* ================= HINT AREA ================= */ .hint-area { position: absolute; bottom: 0; left: 0; right: 0; padding: var(--spacing-sm) var(--spacing-md); background: rgba(30, 30, 30, 0.9); backdrop-filter: blur(4px); z-index: 5; } .hint-area:empty { display: none; } .hint { display: flex; align-items: center; gap: var(--spacing-sm); padding: var(--spacing-xs) var(--spacing-sm); background: rgba(94, 75, 139, 0.3); border-left: 3px solid var(--primary-light); border-radius: var(--border-radius-sm); color: var(--editor-text); } .hint-progress { background: var(--primary-color); color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: bold; flex-shrink: 0; } .hint-message { font-size: 0.9rem; color: var(--editor-text); } .hint-message kbd, .hint-message code { background: rgba(255, 255, 255, 0.15); color: #fff; padding: 2px 6px; border-radius: 3px; font-size: 0.85rem; font-family: var(--font-code); } .hint-success { background: var(--success-bg-light); border-left-color: var(--success-color); } .hint-success .hint-progress { background: var(--success-color); } /* ================= RIGHT PANEL ================= */ .right-panel { width: 50%; display: flex; flex-direction: column; background: var(--bg-color); min-height: 0; } .preview-section { flex: 1; display: flex; flex-direction: column; min-height: 0; } .preview-header { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-xs) var(--spacing-md) var(--spacing-md); background: transparent; } .preview-label { font-size: 0.85rem; font-weight: 600; color: var(--light-text); } .preview-wrapper { flex: 1; position: relative; background: var(--panel-bg); margin: var(--spacing-md); border-radius: var(--border-radius-md); box-shadow: var(--shadow); overflow: hidden; min-height: 0; } .preview-frame { width: 100%; height: 100%; padding: var(--spacing-sm); } .preview-frame iframe { width: 100%; height: 100%; border: none; border-radius: var(--border-radius-sm); } /* Expected Overlay (toggleable) */ .expected-overlay { position: absolute; inset: 0; background: var(--panel-bg); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; display: flex; align-items: center; justify-content: center; } .expected-overlay.visible { opacity: 1; pointer-events: auto; } .expected-frame { width: 100%; height: 100%; padding: var(--spacing-sm); } .expected-frame iframe { width: 100%; height: 100%; border: none; border-radius: var(--border-radius-sm); } /* Success Match Animation */ .preview-wrapper.matched { box-shadow: 0 0 0 3px var(--success-color); } .preview-wrapper.matched::after { content: "CRISPY ٩( ◕‿◕ )۶"; position: absolute; background: var(--success-color-dark); color: white; padding: var(--spacing-sm) var(--spacing-lg); border-radius: var(--border-radius-lg); font-weight: bold; font-size: 1.3rem; animation: dvd-bounce 8s ease-in-out infinite; z-index: 10; white-space: nowrap; } @keyframes dvd-bounce { 0% { top: 15%; left: 15%; transform: translate(-50%, -50%) scale(1); } 25% { top: 75%; left: 85%; transform: translate(-50%, -50%) scale(1.1); } 50% { top: 25%; left: 75%; transform: translate(-50%, -50%) scale(0.95); } 75% { top: 70%; left: 20%; transform: translate(-50%, -50%) scale(1.05); } 100% { top: 15%; left: 15%; transform: translate(-50%, -50%) scale(1); } } /* ================= GAME CONTROLS ================= */ .game-controls { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-md); background: var(--panel-bg); border-bottom: 1px solid var(--border-color); box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.08); } /* ================= SIDEBAR ================= */ .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; z-index: 199; } .sidebar-backdrop.visible { opacity: 1; visibility: visible; } .sidebar-drawer { position: fixed; left: calc(-1 * var(--sidebar-width)); top: 0; width: var(--sidebar-width); height: 100vh; background: var(--panel-bg); box-shadow: var(--shadow-modal); transition: left 0.3s ease; z-index: 200; display: flex; flex-direction: column; overflow: hidden; } .sidebar-drawer.open { left: 0; } /* Shift main content when sidebar is open */ .app-container:has(.sidebar-drawer.open) .game-layout { transform: translateX(calc(var(--sidebar-width) * 0.8)); } .sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-md); border-bottom: 1px solid var(--border-color); flex-shrink: 0; } .sidebar-header h3 { font-size: 1.1rem; color: var(--primary-dark); } .close-btn { width: 32px; height: 32px; border: none; background: none; font-size: 1.5rem; cursor: pointer; color: var(--light-text); border-radius: var(--border-radius-sm); } .close-btn:hover { background: var(--primary-bg-light); color: var(--primary-color); } .sidebar-section { padding: var(--spacing-md); border-bottom: 1px solid var(--border-color); } .sidebar-section:last-child { border-bottom: none; } /* Make the lessons nav section fill available space */ nav.sidebar-section { flex: 1; overflow-y: auto; min-height: 0; } .sidebar-section h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--light-text); margin-bottom: var(--spacing-sm); } /* Progress Display */ .progress-display { display: flex; flex-direction: column; gap: var(--spacing-xs); } .progress-bar { height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden; } .progress-fill { height: 100%; background: var(--primary-color); transition: width 0.3s ease; } .progress-text { font-size: 0.75rem; color: var(--light-text); text-align: right; } /* Lesson list nav */ .lesson-list { display: flex; flex-direction: column; gap: var(--spacing-xs); list-style: none; } .lesson-item { padding: var(--spacing-xs) var(--spacing-sm); background: transparent; border: none; border-radius: var(--border-radius-sm); color: var(--text-color); cursor: pointer; text-align: left; font-size: 0.9rem; transition: all 0.2s; display: flex; align-items: center; gap: var(--spacing-xs); } .lesson-item:hover { background: var(--primary-bg-light); color: var(--primary-color); } .lesson-item.active { background: var(--primary-bg-medium); color: var(--primary-dark); font-weight: 600; } .lesson-item.completed::before { content: "✓"; color: var(--success-color); font-weight: bold; } /* ================= RESPONSIVE ================= */ @media (max-width: 1024px) { .left-panel { width: 40%; } .right-panel { width: 60%; } } @media (max-width: 768px) { .left-panel, .right-panel { display: none; } .game-layout { flex-direction: column; } .editor-section { width: 100%; } .preview-section { display: none; } .menu-toggle { display: flex; } } @media (max-width: 480px) { .header { padding: 0 var(--spacing-sm); } .preview-wrapper { margin: var(--spacing-sm); } .hint { font-size: 0.85rem; } .logo h1 { font-size: 0.9rem; } .instructions { max-height: calc(60vh - 60px); } } /* ================= ANIMATIONS ================= */ @keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } } @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94, 75, 139, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(94, 75, 139, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 75, 139, 0); } } /* ================= UTILITY CLASSES ================= */ .hidden { display: none !important; } .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; } .no-scroll { overflow: hidden; }