/* ========================================
   ATLAS - Automata Theory Learning and Simulation
   Professional Dark Theme Stylesheet
   ======================================== */

/* CSS Variables */
:root {
    /* Colors */
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #242b3d;
    --bg-elevated: #2d364a;
    --bg-hover: #353f56;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --accent-primary: #58a6ff;
    --accent-secondary: #3fb950;
    --accent-warning: #d29922;
    --accent-danger: #f85149;
    --accent-purple: #a371f7;

    --border-color: #30363d;
    --border-light: #21262d;

    /* State colors */
    --state-default: #58a6ff;
    --state-accepting: #3fb950;
    --state-initial: #a371f7;
    --state-current: #f0883e;
    --transition-color: #8b949e;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Sizing */
    --header-height: 56px;
    --sidebar-width: 280px;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

/* Utilities */
.hidden { display: none !important; }

/* ========================================
   Modal Styles
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s ease;
}

.close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ========================================
   Authentication Modal
   ======================================== */

.auth-modal {
    width: 420px;
    padding: 2.5rem;
}

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

.logo-large {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
}

.logo-icon-large {
    width: 100%;
    height: 100%;
    color: var(--accent-primary);
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: var(--border-radius);
}

.auth-tab {
    flex: 1;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s ease;
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.forgot-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: var(--accent-primary);
    font-size: 0.8125rem;
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}


.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.btn-sso {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #1a3a5c, #2a5a8c);
    color: #fff;
    border: 1px solid rgba(88, 166, 255, 0.2);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-sso:hover {
    background: linear-gradient(135deg, #2a4a6c, #3a6a9c);
    border-color: rgba(88, 166, 255, 0.4);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.15);
    transform: translateY(-1px);
}

.btn-sso svg {
    flex-shrink: 0;
}

/* Auth panels (verification, password reset) */
.auth-panel {
    animation: fadeIn 0.2s ease;
}

.auth-panel.hidden {
    display: none;
}

.auth-tabs.hidden {
    display: none;
}

.verification-content {
    text-align: center;
    padding: 1rem 0;
}

.verification-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    color: var(--accent-primary);
}

.verification-icon svg {
    width: 100%;
    height: 100%;
}

.verification-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.verification-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.verification-email {
    font-weight: 600;
    color: var(--accent-primary) !important;
}

.verification-content .form-group {
    text-align: left;
}

/* Button loading state */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-secondary.loading::after {
    border-color: rgba(128, 128, 128, 0.3);
    border-top-color: var(--text-primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* Ghost button (text-only style) */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.btn-ghost:hover {
    color: var(--text-primary);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #4a9eff;
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--text-muted);
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* ========================================
   App Container & Header
   ======================================== */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.main-nav {
    display: flex;
    gap: 0.25rem;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.15s ease;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-btn.active {
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.1);
}

.nav-btn.nav-locked {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.class-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.class-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.class-code {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem;
    padding-right: 0.625rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-btn:hover {
    background: var(--bg-elevated);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
}

.user-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
}

.user-dropdown.active {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.25rem 0;
}

/* ========================================
   App Main Layout
   ======================================== */

.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    height: calc(100vh - var(--header-height));
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 1.25rem;
}

.sidebar-section + .sidebar-section {
    border-top: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

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

.topic-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.topic-item:hover {
    background: var(--bg-tertiary);
}

.topic-item.active {
    background: rgba(88, 166, 255, 0.1);
}

.topic-item.active .topic-name {
    color: var(--accent-primary);
}

.topic-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    flex-shrink: 0;
}

.topic-icon svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.topic-item.active .topic-icon {
    background: rgba(88, 166, 255, 0.15);
}

.topic-item.active .topic-icon svg {
    color: var(--accent-primary);
}

.topic-info {
    flex: 1;
    min-width: 0;
}

.topic-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.topic-desc {
    font-size: 0.6875rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-progress {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--text-muted);
}

.action-btn svg {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
}

/* ========================================
   Workspace View
   ======================================== */

.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    background: var(--bg-primary);
}

.workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.workspace-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.workspace-title h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.problem-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.625rem;
    border-radius: var(--border-radius-sm);
}

.workspace-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mode-toggle {
    display: flex;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: var(--border-radius);
}

.mode-btn {
    padding: 0.375rem 0.875rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s ease;
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Workspace Content Grid */
.workspace-content {
    flex: 1;
    display: grid;
    grid-template-columns: 300px 1fr 320px;
    grid-template-rows: 1fr;
    gap: 0;
    overflow: hidden;
}

/* Problem Panel */
.problem-panel {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.problem-description {
    padding: 1.25rem;
}

.problem-description h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.problem-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.problem-text p {
    margin-bottom: 1rem;
}

.examples {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 1rem;
}

.examples h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.examples ul {
    list-style: none;
}

.examples li {
    font-size: 0.8125rem;
    padding: 0.375rem 0;
    color: var(--text-secondary);
}

.examples code {
    font-family: var(--font-mono);
    background: var(--bg-elevated);
    padding: 0.125rem 0.375rem;
    border-radius: var(--border-radius-sm);
    color: var(--accent-primary);
}

/* Editor Panel */
.editor-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Visual Editor */
.visual-editor {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.visual-editor.active {
    display: flex;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tool-group {
    display: flex;
    gap: 0.25rem;
}

.tool-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tool-btn svg {
    width: 18px;
    height: 18px;
}

.tool-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.tool-btn.active {
    background: rgba(88, 166, 255, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.canvas-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle, var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
}

#automatonCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.canvas-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Text Editor */
.text-editor {
    flex: 1;
    display: none;
    flex-direction: column;
}

.text-editor.active {
    display: flex;
}

.text-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.text-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#automatonText {
    flex: 1;
    padding: 1rem;
    background: var(--bg-primary);
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    resize: none;
}

#automatonText:focus {
    outline: none;
}

.text-help {
    padding: 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.text-help h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.text-help pre {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Test Panel */
.test-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.test-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.test-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
}

.test-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
}

.test-input input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.test-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.test-results {
    flex: 1;
    padding: 0 1.25rem 1rem;
    overflow-y: auto;
}

.test-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.1s ease;
}

.test-item:hover {
    background: var(--bg-elevated);
}

.test-string {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.test-status {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    flex-shrink: 0;
}

.test-item.success .test-status {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

.test-item.failure .test-status {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

.test-item.mismatch {
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.test-item.mismatch .test-status {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

.test-expected {
    font-size: 0.625rem;
    color: var(--accent-warning);
    flex-shrink: 0;
}

.test-correct {
    color: var(--accent-secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Execution Panel */
.execution-panel {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.execution-panel h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.execution-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.exec-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.exec-btn svg {
    width: 14px;
    height: 14px;
}

.exec-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

#speedSlider {
    flex: 1;
    margin: 0 0.5rem;
    accent-color: var(--accent-primary);
}

.speed-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.execution-trace {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    max-height: 150px;
    overflow-y: auto;
}

.trace-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    margin: 0 -0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: background 0.1s ease;
}

.trace-step.active {
    color: var(--accent-primary);
}

.step-state {
    padding: 0.125rem 0.375rem;
    background: var(--bg-elevated);
    border-radius: var(--border-radius-sm);
}

.trace-step.active .step-state {
    background: rgba(88, 166, 255, 0.2);
}

.step-input {
    color: var(--accent-warning);
}

.step-arrow {
    color: var(--text-muted);
}

.step-next {
    padding: 0.125rem 0.375rem;
    background: var(--bg-elevated);
    border-radius: var(--border-radius-sm);
}

.step-stuck {
    color: var(--accent-danger);
    background: rgba(248, 81, 73, 0.1);
}

.trace-step.active .step-next {
    background: rgba(88, 166, 255, 0.2);
}

.trace-step:hover {
    background: var(--bg-hover);
}

/* Workspace Footer */
.workspace-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.status-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.ready::before {
    background: var(--accent-secondary);
}

.automaton-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.keyboard-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    box-shadow: 0 1px 0 var(--border-color);
}

/* ========================================
   Problems View
   ======================================== */

.problems-view {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
}

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

.problems-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.filter-controls {
    display: flex;
    gap: 0.75rem;
}

.filter-controls select {
    padding: 0.5rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.problems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.problem-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.problem-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.problem-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.problem-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.problem-card-topic {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
}

.problem-card-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.problem-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.problem-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.pending {
    background: var(--text-muted);
}

.status-dot.in-progress {
    background: var(--accent-warning);
}

.status-dot.completed {
    background: var(--accent-secondary);
}

.problem-attempts {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   Progress View
   ======================================== */

.progress-view {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
}

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

.progress-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.progress-content {
    display: grid;
    gap: 1.5rem;
}

.progress-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.stat-card.alert .stat-value {
    color: var(--accent-danger);
}

.progress-topics {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.progress-topics h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.topic-progress-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topic-progress-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topic-progress-name {
    width: 120px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.topic-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.topic-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-purple));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.topic-progress-value {
    width: 50px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: right;
}

.progress-chart {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.progress-chart h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

#activityChart {
    width: 100%;
    height: 200px;
}

/* ========================================
   Dashboard View (Instructor)
   ======================================== */

.dashboard-view {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
}

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

.dashboard-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.dashboard-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.dashboard-panel h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

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

.submission-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.submission-info {
    display: flex;
    flex-direction: column;
}

.submission-student {
    font-size: 0.875rem;
    font-weight: 500;
}

.submission-problem {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.submission-result {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
}

.submission-result.correct {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

.submission-result.incorrect {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

.class-roster {
    max-height: 300px;
    overflow-y: auto;
}

.roster-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.roster-student {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.roster-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.roster-name {
    font-size: 0.875rem;
}

.roster-progress {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   Conversion Modal
   ======================================== */

.conversion-modal {
    width: 800px;
    max-width: 90vw;
}

.conversion-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem;
}

.conversion-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.15s ease;
}

.conversion-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

.conversion-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--accent-primary);
}

.conversion-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.conversion-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.conversion-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.conversion-workspace {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
}

.conversion-workspace h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ========================================
   Shortcuts Modal
   ======================================== */

.shortcuts-modal {
    width: 700px;
    max-width: 90vw;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
}

.shortcuts-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.shortcut-item kbd {
    margin-right: 0.25rem;
}

.shortcut-item span {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ========================================
   Problem Editor Modal
   ======================================== */

.problem-editor-modal {
    width: 700px;
    max-width: 90vw;
}

.problem-editor-modal form {
    padding: 1.5rem;
}

.solution-editor {
    height: 200px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.solution-editor canvas {
    width: 100%;
    height: 100%;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   Profile Settings Modal
   ======================================== */

.profile-modal {
    width: 480px;
    max-width: 90vw;
}

.profile-modal form {
    padding: 1.5rem;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar.has-image,
.profile-avatar-large.has-image {
    background: none;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-modal h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.profile-modal hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.student-email-hint {
    color: var(--accent-warning);
    font-weight: 500;
}

.form-group select option:disabled {
    color: var(--text-muted);
}

.form-group input:disabled,
.form-group select:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ========================================
   Confirmation Modal
   ======================================== */

.confirm-modal {
    width: 400px;
    max-width: 90vw;
}

.confirm-content {
    padding: 2rem 1.5rem;
    text-align: center;
}

.confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: rgba(248, 81, 73, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-icon svg {
    width: 32px;
    height: 32px;
    color: var(--accent-danger);
}

.confirm-icon.warning {
    background: rgba(227, 160, 8, 0.1);
}

.confirm-icon.warning svg {
    color: #e3a008;
}

.confirm-content p {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.confirm-hint {
    font-size: 0.8125rem !important;
    color: var(--text-secondary) !important;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.btn-danger {
    background: var(--accent-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #e5433b;
    box-shadow: 0 2px 8px rgba(248, 81, 73, 0.3);
}

/* Transition Symbol Modal */
.transition-modal {
    width: 340px;
    max-width: 90vw;
}

.transition-modal-body {
    padding: 1.5rem;
}

.transition-modal-body label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.transition-modal-body input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1.125rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.transition-modal-body input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.symbol-quick-picks {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: center;
}

.symbol-pick-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.symbol-pick-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
}

/* ========================================
   Toast Notifications
   ======================================== */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1100;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(45, 54, 74, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 320px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastSlideIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    position: relative;
    overflow: hidden;
}

.toast.success {
    border-left-color: var(--accent-secondary);
}

.toast.error {
    border-left-color: var(--accent-danger);
}

.toast.info {
    border-left-color: var(--accent-primary);
}

.toast.warning {
    border-left-color: var(--accent-warning);
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s cubic-bezier(0.06, 0.71, 0.55, 1) forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-icon-wrapper {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon-wrapper svg {
    width: 16px;
    height: 16px;
}

.toast.success .toast-icon-wrapper {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

.toast.error .toast-icon-wrapper {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

.toast.info .toast-icon-wrapper {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.toast.warning .toast-icon-wrapper {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    text-transform: capitalize;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s ease;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 var(--border-radius);
    animation: toastProgress linear forwards;
}

.toast.success .toast-progress {
    background: var(--accent-secondary);
}

.toast.error .toast-progress {
    background: var(--accent-danger);
}

.toast.info .toast-progress {
    background: var(--accent-primary);
}

.toast.warning .toast-progress {
    background: var(--accent-warning);
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ========================================
   My Classes View
   ======================================== */

.my-classes-view {
    flex: 1;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    overflow-y: auto;
    min-height: 0;
}

.my-classes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.my-classes-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.my-classes-header .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.join-class-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.2s ease;
}

.join-class-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.join-class-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.join-class-inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.join-class-inline-form input {
    flex: 1;
    padding: 0.625rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.15s ease;
}

.join-class-inline-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.join-class-inline-form input::placeholder {
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-muted);
}

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

.class-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem 1.5rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.class-card:hover {
    border-color: var(--text-muted);
    background: var(--bg-tertiary);
}

.class-card.active-class {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 0 12px rgba(88, 166, 255, 0.08);
}

.class-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius);
    background: rgba(88, 166, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-primary);
}

.class-card-icon svg {
    width: 22px;
    height: 22px;
}

.class-card-info {
    flex: 1;
    min-width: 0;
}

.class-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.class-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.class-code-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
}

.class-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.active-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-secondary);
    background: rgba(63, 185, 80, 0.1);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-drop {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-drop:hover {
    color: var(--accent-danger);
    border-color: rgba(248, 81, 73, 0.3);
    background: rgba(248, 81, 73, 0.08);
}

.claim-class-banner {
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.25);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.claim-class-banner p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.claim-class-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.claim-class-form input {
    flex: 0 1 200px;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.btn-remove-student {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-remove-student:hover {
    color: var(--accent-danger);
    border-color: rgba(248, 81, 73, 0.3);
    background: rgba(248, 81, 73, 0.08);
}

.empty-classes-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-classes-state svg {
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-classes-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-classes-state p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 320px;
}

/* View Empty States (unenrolled students) */
.view-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 2rem;
    color: var(--text-muted);
    min-height: 300px;
}

.view-empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.view-empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.view-empty-state p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 360px;
    margin-bottom: 1.5rem;
}

.view-empty-state .btn {
    margin-top: 0.5rem;
}

.sidebar .view-empty-state {
    padding: 2rem 1rem;
    min-height: auto;
}

/* ========================================
   Regex Editor Styles
   ======================================== */

.regex-editor-container {
    padding: 1.5rem;
}

.regex-input-section {
    margin-bottom: 1.5rem;
}

.regex-input-section label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.regex-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0 0.75rem;
}

.regex-delimiter {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    color: var(--text-muted);
}

.regex-input {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1rem;
}

.regex-input:focus {
    outline: none;
}

.regex-syntax-help {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.regex-syntax-help span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.regex-syntax-help code {
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.regex-test-section {
    margin-bottom: 1.5rem;
}

.regex-test-section label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.regex-test-section input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
}

.regex-match-result {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.regex-match-result.match {
    border-left: 3px solid var(--accent-secondary);
}

.regex-match-result.no-match {
    border-left: 3px solid var(--accent-danger);
}

.regex-visualization {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
}

.regex-visualization h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

#regexNFACanvas {
    width: 100%;
    height: 300px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
}

/* ========================================
   Scrollbar Styles
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 5px;
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1200px) {
    .workspace-content {
        grid-template-columns: 1fr 320px;
    }

    .problem-panel {
        display: none;
    }

    .progress-overview,
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        width: 60px;
    }

    .topic-info,
    .topic-progress,
    .sidebar-title,
    .action-btn span {
        display: none;
    }

    .topic-item {
        justify-content: center;
    }

    .action-btn {
        justify-content: center;
        padding: 0.75rem;
    }

    .workspace-content {
        grid-template-columns: 1fr;
    }

    .test-panel {
        display: none;
    }

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

@media (max-width: 768px) {
    .header-left {
        gap: 1rem;
    }

    .main-nav {
        display: none;
    }

    .class-indicator {
        display: none;
    }

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

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

    .conversion-options {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.spinner {
    animation: spin 1s linear infinite;
}

/* State highlight animation */
@keyframes stateHighlight {
    0% {
        box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 10px rgba(88, 166, 255, 0);
    }
}

.state-highlight {
    animation: stateHighlight 0.5s ease-out;
}

/* ========================================
   Interactive Tutorial
   ======================================== */

.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
}

/* ========================================
   Atlas Character - Tutorial Guide
   ======================================== */

.atlas-character {
    position: fixed;
    z-index: 2003;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.atlas-body {
    width: 100px;
    height: 120px;
    animation: atlasFloat 3s ease-in-out infinite;
}

.atlas-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3));
}

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

.atlas-antenna-light {
    animation: antennaGlow 2s ease-in-out infinite;
}

@keyframes antennaGlow {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 4px #58a6ff);
    }
    50% {
        opacity: 0.7;
        filter: drop-shadow(0 0 10px #58a6ff);
    }
}

.atlas-eyes {
    animation: atlasBlink 4s ease-in-out infinite;
}

@keyframes atlasBlink {
    0%, 45%, 55%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(0.1);
    }
}

.atlas-pupil-left,
.atlas-pupil-right {
    transition: transform 0.2s ease;
}

.atlas-arm-left {
    transform-origin: 30px 90px;
    animation: atlasWaveLeft 2s ease-in-out infinite;
}

.atlas-arm-right {
    transform-origin: 90px 90px;
    animation: atlasWaveRight 2.5s ease-in-out infinite;
}

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

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

.atlas-character.waving .atlas-arm-right {
    animation: atlasWaveHello 0.5s ease-in-out 3;
}

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

.atlas-speech-bubble {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.25rem;
    min-width: 200px;
    max-width: 340px;
    width: max-content;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.55;
    overflow-wrap: break-word;
    word-wrap: break-word;
    animation: bubbleFadeIn 0.3s ease;
}

@keyframes bubbleFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.atlas-speech-bubble::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    transform: rotate(45deg);
}

/* Atlas positions */
.atlas-character.position-left {
    left: 20px;
}

.atlas-character.position-left .atlas-speech-bubble {
    left: 110px;
    top: 30px;
}

.atlas-character.position-left .atlas-speech-bubble::before {
    left: -7px;
    top: 20px;
    border-right: none;
    border-top: none;
}

.atlas-character.position-right {
    right: 20px;
}

.atlas-character.position-right .atlas-body {
    transform: scaleX(-1);
}

.atlas-character.position-right .atlas-speech-bubble {
    right: 110px;
    top: 30px;
}

.atlas-character.position-right .atlas-speech-bubble::before {
    right: -7px;
    top: 20px;
    border-left: none;
    border-bottom: none;
}

.atlas-character.position-bottom-left {
    left: 20px;
    bottom: 20px;
}

.atlas-character.position-bottom-left .atlas-speech-bubble {
    left: 110px;
    bottom: 30px;
    top: auto;
}

.atlas-character.position-bottom-left .atlas-speech-bubble::before {
    left: -7px;
    bottom: 20px;
    top: auto;
    border-right: none;
    border-top: none;
}

.atlas-character.position-bottom-right {
    right: 20px;
    bottom: 20px;
}

.atlas-character.position-bottom-right .atlas-body {
    transform: scaleX(-1);
}

.atlas-character.position-bottom-right .atlas-speech-bubble {
    right: 110px;
    bottom: 30px;
    top: auto;
}

.atlas-character.position-bottom-right .atlas-speech-bubble::before {
    right: -7px;
    bottom: 20px;
    top: auto;
    border-left: none;
    border-bottom: none;
}

.atlas-character.position-top-left {
    left: 20px;
    top: 80px;
}

.atlas-character.position-top-left .atlas-speech-bubble {
    left: 110px;
    top: 30px;
}

.atlas-character.position-top-left .atlas-speech-bubble::before {
    left: -7px;
    top: 20px;
    border-right: none;
    border-top: none;
}

.atlas-character.position-top-right {
    right: 20px;
    top: 80px;
}

.atlas-character.position-top-right .atlas-body {
    transform: scaleX(-1);
}

.atlas-character.position-top-right .atlas-speech-bubble {
    right: 110px;
    top: 30px;
}

.atlas-character.position-top-right .atlas-speech-bubble::before {
    right: -7px;
    top: 20px;
    border-left: none;
    border-bottom: none;
}

.atlas-character.position-center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -100%);
}

.atlas-character.position-center .atlas-speech-bubble {
    display: none;
}

.atlas-character.hidden {
    opacity: 0;
    transform: scale(0);
}

/* Atlas expressions */
.atlas-character.excited .atlas-mouth {
    d: path("M 40 85 Q 60 105 80 85");
}

.atlas-character.thinking .atlas-pupil-left,
.atlas-character.thinking .atlas-pupil-right {
    transform: translateY(-3px);
}

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

.tutorial-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.tutorial-highlight {
    position: absolute;
    border: 3px solid var(--accent-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4),
                0 0 20px var(--accent-primary),
                inset 0 0 20px rgba(88, 166, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 2001;
}

.tutorial-highlight::before {
    content: '';
    position: absolute;
    inset: -3px;
    border: 3px solid var(--accent-primary);
    border-radius: var(--border-radius-lg);
    animation: tutorialPulse 2s ease-in-out infinite;
}

@keyframes tutorialPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.02);
    }
}

.tutorial-tooltip {
    position: absolute;
    width: 400px;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    z-index: 2002;
    animation: tooltipFadeIn 0.3s ease;
}

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

.tutorial-tooltip::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-right: none;
    border-bottom: none;
    transform: rotate(45deg);
}

.tutorial-tooltip.arrow-top::before {
    top: -9px;
    left: 50%;
    margin-left: -8px;
    transform: rotate(45deg);
}

.tutorial-tooltip.arrow-bottom::before {
    bottom: -9px;
    left: 50%;
    margin-left: -8px;
    transform: rotate(-135deg);
}

.tutorial-tooltip.arrow-left::before {
    left: -9px;
    top: 50%;
    margin-top: -8px;
    transform: rotate(-45deg);
}

.tutorial-tooltip.arrow-right::before {
    right: -9px;
    top: 50%;
    margin-top: -8px;
    transform: rotate(135deg);
}

.tutorial-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 0.75rem;
}

.tutorial-step-indicator {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.tutorial-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tutorial-skip:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tutorial-content {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.tutorial-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tutorial-content p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.tutorial-content ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.125rem;
}

.tutorial-content li {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 0.25rem;
}

.tutorial-content li:last-child {
    margin-bottom: 0;
}

.tutorial-content code {
    background: var(--bg-tertiary);
    padding: 0.0625rem 0.3125rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-primary);
}

.tutorial-content .tutorial-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.625rem;
    background: rgba(88, 166, 255, 0.1);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--accent-primary);
}

.tutorial-content .tutorial-tip svg {
    width: 14px;
    height: 14px;
    color: var(--accent-primary);
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.tutorial-content .tutorial-tip span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.tutorial-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    gap: 0.75rem;
    flex-shrink: 0;
}

.tutorial-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.tutorial-footer .btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

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

.tutorial-dots {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
    min-width: 0;
    max-width: 160px;
    margin: 0 auto;
}

.tutorial-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.tutorial-dot:hover {
    background: var(--text-muted);
}

.tutorial-dot.active {
    background: var(--accent-primary);
    width: 16px;
    border-radius: 3px;
}

.tutorial-dot.completed {
    background: var(--accent-secondary);
}

/* ========================================
   Welcome Modal
   ======================================== */

.welcome-modal {
    width: 500px;
    max-width: 90vw;
    text-align: center;
    padding: 2.5rem;
}

.welcome-atlas {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.welcome-atlas-svg {
    width: 100px;
    height: 120px;
    animation: welcomeAtlasBounce 2s ease-in-out infinite;
}

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

.welcome-atlas-speech {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 0.625rem 1rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    position: relative;
}

.welcome-atlas-speech::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    margin-left: -8px;
    width: 14px;
    height: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-right: none;
    border-bottom: none;
    transform: rotate(45deg);
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--accent-primary);
}

.welcome-icon svg {
    width: 100%;
    height: 100%;
}

.welcome-modal h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.welcome-subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.welcome-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
    text-align: left;
}

.welcome-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.welcome-feature svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.welcome-feature span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.welcome-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.welcome-actions .btn {
    min-width: 140px;
}

.welcome-actions .btn svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Help & Tutorial Button in Settings
   ======================================== */

.help-actions {
    margin-bottom: 1rem;
}

.btn-tutorial {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

.btn-tutorial:hover {
    background: linear-gradient(135deg, #4a9eff, #9061e7);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

.btn-tutorial svg {
    width: 20px;
    height: 20px;
}

.help-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

/* ========================================
   Floating Tooltips Button (Lightbulb)
   ======================================== */

.tooltips-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f0883e, #d29922);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(240, 136, 62, 0.3);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tooltips-btn svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.tooltips-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(240, 136, 62, 0.45);
}

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

.tooltips-btn.active {
    background: var(--accent-primary);
    box-shadow: 0 2px 6px rgba(88, 166, 255, 0.4);
}

/* ========================================
   Tooltips Panel
   ======================================== */

.tooltips-panel {
    position: fixed;
    top: 56px;
    right: 16px;
    width: 340px;
    max-height: 70vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 899;
    display: flex;
    flex-direction: column;
    animation: tooltipsPanelSlideIn 0.3s ease;
}

.tooltips-panel.hidden {
    display: none;
}

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

.tooltips-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.tooltips-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tooltips-title svg {
    width: 20px;
    height: 20px;
    color: #f0883e;
}

.tooltips-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s ease;
}

.tooltips-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tooltips-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tip-card {
    display: flex;
    gap: 0.875rem;
    padding: 0.875rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border-left: 3px solid #f0883e;
    transition: all 0.15s ease;
}

.tip-card:hover {
    background: var(--bg-elevated);
    transform: translateX(4px);
}

.tip-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(240, 136, 62, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tip-icon svg {
    width: 18px;
    height: 18px;
    color: #f0883e;
}

.tip-text {
    flex: 1;
    min-width: 0;
}

.tip-text strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tip-text p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.tip-text kbd {
    font-size: 0.6875rem;
    padding: 0.125rem 0.25rem;
}

.tooltips-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.tooltips-footer .btn {
    width: 100%;
}

/* ========================================
   Copyright Footer
   ======================================== */

.copyright-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    z-index: 50;
}

.copyright-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.auth-copyright {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.auth-copyright p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* ========================================
   Study View Styles
   ======================================== */

.study-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding-bottom: 32px;
}

#studyContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.study-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.study-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.study-search {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 320px;
}

.study-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.study-search input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.study-search input:focus {
    outline: none;
}

.study-search input::placeholder {
    color: var(--text-muted);
}

.study-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Study Sidebar */
.study-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.study-nav-section {
    padding: 1rem 0;
}

.study-nav-section:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.study-nav-section h3 {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.study-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.study-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.study-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.study-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.study-nav-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-right: 3px solid var(--accent-primary);
}

.study-nav-item.active svg {
    color: var(--accent-primary);
}

.nav-badge {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.nav-badge.complete {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

/* Study Main Content */
.study-main {
    overflow-y: auto;
    padding: 1.5rem;
    min-height: 0;
    position: relative;
}

.study-module {
    display: none;
}

.study-module.active {
    display: block;
}

.module-header {
    margin-bottom: 1.5rem;
}

.module-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.module-header p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

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

.module-progress {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Course Overview Styles */
.course-intro {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.intro-card {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.intro-card.highlight {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(163, 113, 247, 0.1));
    border-color: var(--accent-primary);
}

.intro-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.intro-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.learning-objectives {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.learning-objectives h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.learning-objectives ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.learning-objectives li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    padding: 0.5rem 0;
}

.learning-objectives li::before {
    content: '\2713';
    color: var(--accent-secondary);
    font-weight: 700;
    flex-shrink: 0;
}

/* Course Roadmap */
.course-roadmap {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.course-roadmap h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.roadmap-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.roadmap-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    position: relative;
}

.roadmap-item::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 44px;
    bottom: -12px;
    width: 2px;
    background: var(--border-color);
}

.roadmap-item:last-child::before {
    display: none;
}

.roadmap-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.roadmap-item.completed .roadmap-marker {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: #fff;
}

.roadmap-content h5 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.roadmap-content p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.module-actions {
    margin-top: 2rem;
}

/* Lesson List */
.lesson-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lesson-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lesson-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.lesson-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.lesson-number.quiz {
    background: rgba(163, 113, 247, 0.15);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.lesson-number.practice {
    background: rgba(63, 185, 80, 0.15);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.lesson-card.completed .lesson-number {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: #fff;
}

.lesson-content {
    flex: 1;
    min-width: 0;
}

.lesson-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.lesson-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.lesson-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lesson-duration {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.lesson-duration svg {
    width: 14px;
    height: 14px;
}

.lesson-status {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

.lesson-status.pending {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.lesson-status.in-progress {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.lesson-status.completed {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

.lesson-status.locked {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Quiz Card */
.quiz-card,
.practice-card {
    background: var(--bg-tertiary);
    border-style: dashed;
}

/* Flashcard Styles */
.flashcard-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.flashcard-topic-select {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.flashcard-topic-select label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.flashcard-topic-select select {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.flashcard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    height: 300px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: var(--bg-tertiary);
}

.flashcard-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.flashcard-front p,
.flashcard-back p {
    font-size: 1.125rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.flashcard-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: auto;
}

.flashcard-navigation {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.flashcard-progress {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: center;
}

.flashcard-rating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.flashcard-rating > span {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.rating-buttons {
    display: flex;
    gap: 0.5rem;
}

.rating-btn {
    padding: 0.5rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rating-btn:hover {
    background: var(--bg-elevated);
}

.rating-btn.hard:hover {
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

.rating-btn.medium:hover {
    border-color: var(--accent-warning);
    color: var(--accent-warning);
}

.rating-btn.easy:hover {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

/* Quiz Setup & Container */
.quiz-setup {
    max-width: 600px;
    margin: 0 auto;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.quiz-option-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.quiz-option-group select {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.quiz-topic-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.btn-large {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

/* Quiz Container */
.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}

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

.quiz-progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.quiz-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.quiz-progress-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.quiz-question {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
}

.quiz-question h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
}

.quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.quiz-answer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.quiz-answer:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.quiz-answer.selected {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
}

.quiz-answer.correct {
    background: rgba(63, 185, 80, 0.1);
    border-color: var(--accent-secondary);
}

.quiz-answer.incorrect {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--accent-danger);
}

.quiz-answer.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.answer-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.quiz-answer.selected .answer-letter {
    background: var(--accent-primary);
    color: #fff;
}

.quiz-answer.correct .answer-letter {
    background: var(--accent-secondary);
    color: #fff;
}

.quiz-answer.incorrect .answer-letter {
    background: var(--accent-danger);
    color: #fff;
}

.answer-text {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.quiz-feedback {
    padding: 1.25rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
}

.quiz-feedback.correct {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--accent-secondary);
}

.quiz-feedback.incorrect {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--accent-danger);
}

.feedback-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.quiz-feedback.correct .feedback-title {
    color: var(--accent-secondary);
}

.quiz-feedback.incorrect .feedback-title {
    color: var(--accent-danger);
}

.feedback-explanation {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
}

/* Quiz Results */
.quiz-results {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.results-header {
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
}

.results-header h4 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.results-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.score-total {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.results-percentage {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-secondary);
}

.results-breakdown {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.breakdown-item {
    text-align: center;
}

.breakdown-count {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.breakdown-item.correct .breakdown-count {
    color: var(--accent-secondary);
}

.breakdown-item.incorrect .breakdown-count {
    color: var(--accent-danger);
}

.breakdown-item.skipped .breakdown-count {
    color: var(--text-muted);
}

.breakdown-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.results-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* Glossary Styles */
.glossary-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.glossary-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.glossary-search input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.glossary-search input:focus {
    outline: none;
}

.glossary-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glossary-letter-group {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.letter-header {
    padding: 0.75rem 1.25rem;
    background: var(--bg-tertiary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-primary);
    border-bottom: 1px solid var(--border-color);
}

.glossary-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

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

.glossary-item h5 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.glossary-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Lesson Viewer */
.lesson-viewer {
    max-width: 900px;
    margin: 0 auto;
}

.lesson-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.lesson-progress-indicator {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.lesson-content-area {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    min-height: 400px;
}

.lesson-content-area h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.lesson-content-area h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem;
}

.lesson-content-area p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.lesson-content-area ul,
.lesson-content-area ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.lesson-content-area li {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.lesson-content-area code {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--accent-primary);
}

.lesson-content-area pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.lesson-content-area pre code {
    background: transparent;
    padding: 0;
    font-size: 0.875rem;
}

.lesson-content-area .definition-box {
    background: var(--bg-tertiary);
    border-left: 4px solid var(--accent-primary);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.lesson-content-area .example-box {
    background: rgba(63, 185, 80, 0.1);
    border-left: 4px solid var(--accent-secondary);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.lesson-content-area .warning-box {
    background: rgba(248, 81, 73, 0.1);
    border-left: 4px solid var(--accent-danger);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.lesson-viewer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========================================
   Module Slides Section
   ======================================== */

.module-slides {
    display: flex;
    gap: 0.75rem;
    padding: 0 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.slide-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(163, 113, 247, 0.1));
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: var(--border-radius);
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.slide-btn:hover {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.2), rgba(163, 113, 247, 0.2));
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.15);
}

.slide-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ========================================
   Slide Viewer
   ======================================== */

#study-slide-viewer {
    display: none;
}

#study-slide-viewer.active {
    display: block;
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 28px;
    z-index: 10;
    background: var(--bg-primary);
}

.slide-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.slide-viewer-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.slide-viewer-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.slide-viewer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slide-mode-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.slide-mode-btn {
    padding: 0.35rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.slide-mode-btn.active {
    background: var(--accent-primary);
    color: #fff;
}

.slide-mode-btn:not(.active):hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.slide-viewer-frame {
    flex: 1;
    min-height: 0;
    background: #0f172a;
}

.slide-viewer-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #0f172a;
}

/* Slide viewer responsive */
@media (max-width: 1024px) {
    #study-slide-viewer.active {
        left: 200px; /* matches sidebar width at this breakpoint */
    }
}

@media (max-width: 768px) {
    #study-slide-viewer.active {
        left: 0; /* sidebar is hidden at this breakpoint */
    }
}

/* Study Responsive */
@media (max-width: 1024px) {
    .study-content {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 768px) {
    .study-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .study-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 200px;
    }

    .study-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .study-search {
        width: 100%;
    }

    .quiz-topic-checkboxes {
        grid-template-columns: 1fr;
    }

    .flashcard {
        height: 250px;
    }
}

/* ========================================
   Instructor Views
   ======================================== */

.inst-view {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
}

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

.inst-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.inst-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.inst-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Search Input */
.search-input {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    min-width: 200px;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Roster Table */
.roster-table-wrapper {
    overflow-x: auto;
}

.roster-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.roster-table thead {
    background: var(--bg-tertiary);
}

.roster-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.roster-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.roster-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.roster-row:hover {
    background: var(--bg-hover);
}

.roster-student-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.roster-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.roster-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.roster-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Small Progress Bar */
.progress-bar-small {
    width: 80px;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.on-track {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

.status-badge.ahead {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.status-badge.struggling {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

.status-badge.draft {
    background: rgba(139, 148, 158, 0.15);
    color: var(--text-secondary);
}

/* Topic Label */
.topic-label {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--bg-elevated);
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Action Cell */
.action-cell {
    display: flex;
    gap: 0.25rem;
}

.btn-danger-ghost:hover {
    color: var(--accent-danger) !important;
}

/* Student Detail Panel */
.student-detail-panel {
    margin-top: 1rem;
}

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

.detail-student-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.detail-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.detail-student-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.detail-student-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.detail-student-info .status-badge {
    margin-left: auto;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Module Card */
.module-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.module-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    transition: border-color 0.15s ease;
}

.module-card:hover {
    border-color: var(--accent-primary);
}

.module-order {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.module-info {
    flex: 1;
    min-width: 0;
}

.module-title {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.module-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.module-card .module-actions {
    display: flex;
    gap: 0.25rem;
}

/* Visibility Badge */
.visibility-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
}

.visibility-badge.published {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

.visibility-badge.draft {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

/* Module Modal */
.module-modal {
    width: 500px;
    max-width: 90vw;
}

.delete-confirm-modal {
    width: 420px;
    max-width: 90vw;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
}

/* Module card drag styles */
.module-card.dragging {
    opacity: 0.4;
    border-style: dashed;
}

.module-card.drag-over {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.module-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    flex-shrink: 0;
    padding: 0.25rem;
}

.module-drag-handle:active {
    cursor: grabbing;
}

.module-card .btn-danger-ghost {
    color: var(--text-muted);
}

.module-card .btn-danger-ghost:hover {
    color: var(--accent-danger);
    background: rgba(248, 81, 73, 0.1);
}

/* Completion Chart Bars */
.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
}

.chart-label {
    width: 55px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.chart-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-purple));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.chart-value {
    width: 35px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Instructor Responsive */
@media (max-width: 1200px) {
    .inst-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .inst-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .inst-header-actions {
        flex-wrap: wrap;
    }

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

@media (max-width: 768px) {
    .inst-stats {
        grid-template-columns: 1fr;
    }

    .roster-table {
        font-size: 0.8125rem;
    }
}

/* ========================================
   Animated Demo Walkthrough
   ======================================== */

.demo-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    pointer-events: none;
}

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

.demo-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Demo Cursor */
.demo-cursor {
    position: fixed;
    z-index: 2520;
    pointer-events: none;
    transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    opacity: 0;
    left: 50%;
    top: 50%;
}

.demo-cursor.visible {
    opacity: 1;
}

.demo-cursor.clicking .demo-cursor-ripple {
    animation: demoCursorClick 0.5s ease-out;
}

.demo-cursor-ripple {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(88, 166, 255, 0.35);
    transform: scale(0);
    pointer-events: none;
}

@keyframes demoCursorClick {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* Demo Narration Text Box - top of screen */
.demo-narration {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2515;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-elevated, #1e293b);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 12px;
    padding: 0.875rem 1.5rem;
    min-width: 340px;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(88, 166, 255, 0.1);
    pointer-events: none;
    animation: demoNarrationIn 0.4s ease;
}

@keyframes demoNarrationIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.demo-narration-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #58a6ff, #a371f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.demo-narration-text {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary, #e2e8f0);
    line-height: 1.45;
    transition: opacity 0.15s ease;
}

.demo-narration-step {
    flex-shrink: 0;
    font-size: 0.675rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
}

.demo-atlas {
    position: fixed !important;
    pointer-events: none;
    z-index: 2503;
    bottom: 70px !important;
    margin-bottom: 0;
}

.demo-atlas .atlas-speech-bubble {
    display: none; /* narration handled by demo-narration box instead */
}

.demo-atlas .atlas-speech-bubble span {
    transition: opacity 0.15s ease;
}

/* Demo Controls - Bottom Bar */
.demo-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2510;
    background: var(--bg-elevated, var(--bg-primary));
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
}

.demo-progress-bar {
    height: 4px;
    background: var(--bg-secondary, #1e293b);
    overflow: hidden;
}

.demo-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #58a6ff, #a371f7);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 0 2px 2px 0;
}

.demo-controls-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1.5rem;
    gap: 1rem;
}

.demo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius, 0.5rem);
    background: var(--bg-secondary, #1e293b);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.demo-btn:hover {
    background: var(--bg-tertiary, #334155);
    border-color: #58a6ff;
    color: #58a6ff;
}

.demo-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.demo-btn-skip {
    color: var(--text-secondary);
}

.demo-btn-skip:hover {
    color: #f85149;
    border-color: #f85149;
}

.demo-step-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* Watch Demo Button Style */
.btn-demo {
    background: linear-gradient(135deg, #58a6ff, #a371f7);
    color: #fff;
    border: none;
}

.btn-demo:hover {
    background: linear-gradient(135deg, #79b8ff, #b48af7);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

.btn-demo svg {
    width: 16px;
    height: 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .demo-controls-inner {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .demo-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .demo-step-label {
        font-size: 0.6875rem;
    }

    .demo-narration {
        min-width: 260px;
        max-width: 90vw;
        padding: 0.625rem 1rem;
        top: 60px;
    }

    .demo-narration-text {
        font-size: 0.8rem;
    }

    .demo-atlas .atlas-body {
        width: 70px;
        height: 84px;
    }
}

/* ========================================
   ATLAS AI — Floating Atlas Character Widget
   ======================================== */

.atlas-widget {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 950;
    cursor: pointer;
    transition: opacity 0.4s ease, filter 0.3s ease;
}

.atlas-widget.hidden {
    display: none !important;
}

/* The Atlas body/SVG container */
.atlas-widget-body {
    width: 72px;
    height: 86px;
    animation: atlasWidgetFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 6px 14px rgba(88, 166, 255, 0.3));
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}

.atlas-widget-svg {
    width: 100%;
    height: 100%;
}

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

/* Hover: excited bounce + glow */
.atlas-widget:hover .atlas-widget-body {
    transform: scale(1.12);
    filter: drop-shadow(0 8px 22px rgba(88, 166, 255, 0.5));
}

.atlas-widget:active .atlas-widget-body {
    transform: scale(0.92);
}

/* Eyes blink */
.atlas-widget-eyes {
    animation: atlasWidgetBlink 4s ease-in-out infinite;
}

@keyframes atlasWidgetBlink {
    0%, 45%, 55%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.1); }
}

/* Antenna glow */
.atlas-widget-antenna {
    animation: atlasWidgetAntennaGlow 2s ease-in-out infinite;
}

@keyframes atlasWidgetAntennaGlow {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 3px #58a6ff); }
    50% { opacity: 0.6; filter: drop-shadow(0 0 8px #58a6ff); }
}

/* Arms wave */
.atlas-widget-arm-l {
    transform-origin: 30px 90px;
    animation: atlasWidgetArmL 2.2s ease-in-out infinite;
}
.atlas-widget-arm-r {
    transform-origin: 90px 90px;
    animation: atlasWidgetArmR 2.8s ease-in-out infinite;
}

@keyframes atlasWidgetArmL {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-8deg); }
}
@keyframes atlasWidgetArmR {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(12deg); }
}

/* Speech hint bubble */
.atlas-widget-hint {
    position: absolute;
    bottom: 82px;
    right: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px 10px 2px 10px;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(6px) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    box-shadow: var(--shadow-sm);
}

.atlas-widget:hover .atlas-widget-hint {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* When widget panel is open, keep Atlas in place but dim the hint */
.atlas-widget.panel-open .atlas-widget-hint {
    opacity: 0 !important;
}

/* ----------------------------------------
   Atlas Idle → Automaton Escape Animation
   When idle, Atlas dissolves into DFA states
   that orbit and drift offscreen
   ---------------------------------------- */

.atlas-widget.idle .atlas-widget-body {
    animation: atlasDissolve 1.8s ease-in forwards;
}

@keyframes atlasDissolve {
    0% { opacity: 1; transform: scale(1); filter: drop-shadow(0 6px 14px rgba(88,166,255,0.3)); }
    40% { opacity: 0.8; transform: scale(1.05); filter: drop-shadow(0 6px 20px rgba(163,113,247,0.5)); }
    70% { opacity: 0.3; transform: scale(0.7); filter: drop-shadow(0 0 30px rgba(88,166,255,0.6)) blur(2px); }
    100% { opacity: 0; transform: scale(0.2); filter: blur(4px); }
}

/* Escape particles — automaton states flying out */
.atlas-escape-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.atlas-escape-node {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--bg-secondary);
    opacity: 0;
    pointer-events: none;
}

.atlas-escape-node.accepting {
    box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 0 5px var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.atlas-escape-edge {
    position: absolute;
    height: 2px;
    background: var(--transition-color);
    transform-origin: left center;
    opacity: 0;
    pointer-events: none;
}

.atlas-escape-edge::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -3px;
    width: 0;
    height: 0;
    border-left: 6px solid var(--transition-color);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.atlas-escape-label {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-secondary);
    opacity: 0;
    pointer-events: none;
}

/* Return from idle — Atlas re-materializes */
.atlas-widget.returning .atlas-widget-body {
    animation: atlasMaterialize 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes atlasMaterialize {
    0% { opacity: 0; transform: scale(0.2); filter: blur(4px); }
    50% { opacity: 0.7; transform: scale(1.1); filter: blur(0); }
    100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 6px 14px rgba(88,166,255,0.3)); }
}

/* When idle and escaped — shrink the click target but keep it in position */
.atlas-widget.escaped {
    pointer-events: auto;
}

.atlas-widget.escaped .atlas-widget-body {
    opacity: 0;
    pointer-events: none;
}

/* Small ghost beacon that pulses where Atlas was, so users can find it */
.atlas-widget.escaped::after {
    content: '';
    position: absolute;
    bottom: 28px;
    right: 28px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(88, 166, 255, 0.15);
    animation: atlasBeacon 3s ease-in-out infinite;
}

@keyframes atlasBeacon {
    0%, 100% { transform: scale(1); opacity: 0.2; }
    50% { transform: scale(1.8); opacity: 0.5; }
}

/* Widget Panel */
.ai-widget-panel {
    position: fixed;
    bottom: 110px;
    right: 16px;
    width: 380px;
    max-height: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 950;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: aiPanelSlideUp 0.25s ease-out;
}

.ai-widget-panel.hidden {
    display: none;
}

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

.ai-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.ai-widget-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ai-widget-title svg {
    color: var(--accent-primary);
}

.ai-widget-actions {
    display: flex;
    gap: 0.25rem;
}

.ai-widget-action {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-widget-action:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Widget Messages */
.ai-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 280px;
    max-height: 380px;
    display: flex;
    flex-direction: column;
}

/* Widget Input Row */
.ai-widget-input-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.ai-widget-text-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.ai-widget-text-input:focus {
    border-color: var(--accent-primary);
}

.ai-widget-text-input::placeholder {
    color: var(--text-muted);
}

/* ========================================
   ATLAS AI — Full View
   ======================================== */

.atlas-ai-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    min-height: 0;
    padding-bottom: 32px; /* space for copyright footer */
}

.ai-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.ai-view-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-view-title svg {
    color: var(--accent-primary);
}

.ai-view-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.ai-context-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
    font-weight: 500;
}

.ai-context-badge:empty {
    display: none;
}

/* Chat Messages Area — fills all available space between header and input */
.ai-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Input Area — pinned to bottom */
.ai-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.ai-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.65rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    resize: none;
    outline: none;
    line-height: 1.5;
    max-height: 120px;
    transition: border-color 0.15s ease;
}

.ai-input:focus {
    border-color: var(--accent-primary);
}

.ai-input::placeholder {
    color: var(--text-muted);
}

/* Send Button */
.ai-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: var(--border-radius);
    background: var(--accent-primary);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
}

.ai-send-btn:hover {
    background: #4a9eff;
}

.ai-send-btn:active {
    transform: scale(0.93);
}

.ai-send-btn svg {
    width: 18px;
    height: 18px;
}

.ai-send-btn-small {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: var(--border-radius-sm);
}

.ai-send-btn-small svg {
    width: 15px;
    height: 15px;
}

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

/* ========================================
   ATLAS AI — Chat Bubbles
   ======================================== */

.ai-message {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 1rem;
    max-width: 100%;
    animation: aiMsgFadeIn 0.25s ease-out;
}

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

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-msg-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-msg-avatar.ai {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    color: #fff;
}

.ai-msg-avatar.user {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.ai-msg-bubble {
    max-width: 80%;
    padding: 0.65rem 0.9rem;
    border-radius: var(--border-radius-lg);
    line-height: 1.55;
    font-size: 0.875rem;
}

.ai-message:not(.user) .ai-msg-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-top-left-radius: var(--border-radius-sm);
}

.ai-message.user .ai-msg-bubble {
    background: var(--accent-primary);
    color: #fff;
    border-top-right-radius: var(--border-radius-sm);
}

.ai-msg-bubble p {
    margin: 0 0 0.5rem 0;
}

.ai-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ai-msg-bubble code {
    background: rgba(0,0,0,0.25);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.ai-msg-bubble pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.65rem 0.85rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    font-size: 0.8rem;
}

.ai-msg-bubble pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.ai-msg-bubble ul, .ai-msg-bubble ol {
    padding-left: 1.25rem;
    margin: 0.35rem 0;
}

.ai-msg-bubble li {
    margin-bottom: 0.2rem;
}

.ai-msg-bubble strong {
    font-weight: 600;
}

/* Typing Indicator */
.ai-typing {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 1rem;
    animation: aiMsgFadeIn 0.25s ease-out;
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    border-top-left-radius: var(--border-radius-sm);
}

.ai-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: aiDotBounce 1.2s ease-in-out infinite;
}

.ai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes aiDotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ========================================
   ATLAS AI — Welcome State
   ======================================== */

.ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.ai-welcome-icon {
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

/* ========================================
   Atlas Character Animations (AI Page)
   ======================================== */

.atlas-character {
    position: relative;
    margin-bottom: 0.5rem;
}

.atlas-character-svg {
    filter: drop-shadow(0 8px 24px rgba(88, 166, 255, 0.2));
    overflow: visible;
}

/* --- Whole body float: organic bobbing with slight rotation --- */
.atlas-whole-body {
    animation: atlasFloat 4s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes atlasFloat {
    0%   { transform: translateY(0) rotate(0deg); }
    25%  { transform: translateY(-6px) rotate(0.8deg); }
    50%  { transform: translateY(-10px) rotate(0deg); }
    75%  { transform: translateY(-6px) rotate(-0.8deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* Shadow shrinks as body rises */
.atlas-shadow {
    animation: atlasShadow 4s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes atlasShadow {
    0%, 100% { rx: 40; opacity: 0.2; }
    50% { rx: 32; opacity: 0.12; }
}

/* --- Breathing: subtle body scale --- */
.atlas-body {
    animation: atlasBreathe 3.5s ease-in-out infinite;
    transform-origin: 100px 140px;
}

@keyframes atlasBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015, 1.025); }
}

/* --- Head: independent gentle bob + tilt via JS class --- */
.atlas-head {
    transform-origin: 100px 120px;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: atlasHeadBob 5s ease-in-out infinite;
}

@keyframes atlasHeadBob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    30% { transform: translateY(-1.5px) rotate(0.5deg); }
    70% { transform: translateY(1px) rotate(-0.3deg); }
}

/* Expression-driven head tilts */
.atlas-character.expr-thinking .atlas-head { transform: translateY(-2px) rotate(-4deg); }
.atlas-character.expr-excited .atlas-head  { transform: translateY(-4px) scale(1.03); }
.atlas-character.expr-surprised .atlas-head { transform: translateY(-5px) scale(1.05); }
.atlas-character.expr-love .atlas-head     { transform: translateY(-2px) rotate(3deg); }
.atlas-character.expr-silly .atlas-head    { transform: translateY(0) rotate(5deg); }
.atlas-character.expr-cool .atlas-head     { transform: translateY(2px) rotate(-2deg); }
.atlas-character.expr-wink .atlas-head     { transform: translateY(-1px) rotate(2deg); }

/* --- Arms: smooth wave & idle sway --- */
.atlas-right-arm {
    transform-origin: 155px 130px;
    animation: atlasWaveArm 6s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes atlasWaveArm {
    0%, 50%, 100% { transform: rotate(0deg); }
    58% { transform: rotate(-18deg); }
    64% { transform: rotate(6deg); }
    70% { transform: rotate(-12deg); }
    76% { transform: rotate(3deg); }
    82% { transform: rotate(-5deg); }
    88% { transform: rotate(0deg); }
}

.atlas-left-arm {
    transform-origin: 45px 130px;
    animation: atlasSwingArm 7s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes atlasSwingArm {
    0%, 100% { transform: rotate(0deg); }
    30% { transform: rotate(4deg); }
    60% { transform: rotate(-3deg); }
}

/* Expression-driven arm poses */
.atlas-character.expr-excited .atlas-left-arm  { animation-duration: 2s; }
.atlas-character.expr-excited .atlas-right-arm { animation-duration: 2s; }

/* --- Antenna: organic glow & wobble --- */
.atlas-antenna-orb {
    animation: atlasAntennaGlow 2.5s ease-in-out infinite;
}

@keyframes atlasAntennaGlow {
    0%, 100% { opacity: 0.9; filter: url(#acGlow); }
    50% { opacity: 0.5; filter: url(#acGlow) brightness(1.5); }
}

.atlas-antenna-stem {
    animation: atlasAntennaWobble 4s ease-in-out infinite;
    transform-origin: 100px 72px;
}

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

/* --- Eyes: smooth transitions for all properties --- */
.atlas-pupil-l, .atlas-pupil-r {
    transition: r 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                fill 0.5s ease,
                cx 0.5s ease, cy 0.5s ease,
                rx 0.4s ease, ry 0.4s ease;
}

.atlas-highlight-l, .atlas-highlight-r {
    transition: opacity 0.4s ease, cx 0.5s ease, cy 0.5s ease;
}

/* Eye look-around */
.atlas-eyes {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: atlasLookAround 8s ease-in-out infinite, atlasBlink 5s ease-in-out infinite;
}

@keyframes atlasLookAround {
    0%, 20%  { transform: translateX(0) scaleY(1); }
    25%      { transform: translateX(-3px) scaleY(1); }
    35%, 40% { transform: translateX(-2px) scaleY(1); }
    45%      { transform: translateX(4px) scaleY(1); }
    55%, 65% { transform: translateX(3px) scaleY(1); }
    70%      { transform: translateX(0) scaleY(1); }
    100%     { transform: translateX(0) scaleY(1); }
}

@keyframes atlasBlink {
    0%, 38%, 42%, 78%, 82%, 100% { transform: scaleY(1); }
    40% { transform: scaleY(0.08); }
    80% { transform: scaleY(0.08); }
}

/* --- Eyebrows: smooth attribute transitions --- */
.atlas-brow-l, .atlas-brow-r {
    transition: x1 0.6s ease, y1 0.6s ease, x2 0.6s ease, y2 0.6s ease,
                stroke 0.5s ease;
}

/* --- Mouths: crossfade system --- */
.atlas-mouth-shape {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.atlas-mouth-shape.active {
    opacity: 1;
}

/* --- Cheeks: smooth blush transitions --- */
.atlas-cheek-l, .atlas-cheek-r {
    opacity: 0.12;
    transition: opacity 0.6s ease, r 0.5s ease;
}

.atlas-character:hover .atlas-cheek-l,
.atlas-character:hover .atlas-cheek-r {
    opacity: 0.35;
}

/* Expression-driven cheek blush */
.atlas-character.expr-love .atlas-cheek-l,
.atlas-character.expr-love .atlas-cheek-r     { opacity: 0.4; }
.atlas-character.expr-excited .atlas-cheek-l,
.atlas-character.expr-excited .atlas-cheek-r  { opacity: 0.3; }
.atlas-character.expr-silly .atlas-cheek-l,
.atlas-character.expr-silly .atlas-cheek-r    { opacity: 0.35; }

/* --- Feet: gentle tap --- */
.atlas-foot-l {
    animation: atlasFootTapL 4s ease-in-out infinite;
    transform-origin: 78px 200px;
}

.atlas-foot-r {
    animation: atlasFootTapR 4s ease-in-out 0.5s infinite;
    transform-origin: 122px 200px;
}

@keyframes atlasFootTapL {
    0%, 85%, 100% { transform: scaleY(1); }
    90% { transform: scaleY(0.7) scaleX(1.1); }
}

@keyframes atlasFootTapR {
    0%, 85%, 100% { transform: scaleY(1); }
    90% { transform: scaleY(0.7) scaleX(1.1); }
}

/* --- Speech bubble: smooth slide + fade --- */
.atlas-speech-bubble {
    position: absolute;
    top: -10px;
    right: -60px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.atlas-speech-bubble.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.atlas-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transform: rotate(45deg);
}

.ai-welcome h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-welcome p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 340px;
    margin-bottom: 0.75rem;
}

.ai-welcome-compact {
    padding: 1.25rem 0.75rem;
    gap: 0.35rem;
}

.ai-welcome-compact h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-welcome-compact p {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

/* Suggestion Chips */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.ai-suggestion-chip {
    padding: 0.4rem 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-sans);
}

.ai-suggestion-chip:hover {
    background: var(--bg-elevated);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.ai-suggestions-compact {
    gap: 0.35rem;
}

.ai-suggestions-compact .ai-suggestion-chip {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
}

/* Scrollbar for chat areas */
.ai-chat-area::-webkit-scrollbar,
.ai-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-area::-webkit-scrollbar-track,
.ai-widget-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-area::-webkit-scrollbar-thumb,
.ai-widget-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.ai-chat-area::-webkit-scrollbar-thumb:hover,
.ai-widget-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   ATLAS AI — Responsive
   ======================================== */

@media (max-width: 768px) {
    .ai-widget-panel {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 100px;
        max-height: 55vh;
    }

    .atlas-widget {
        bottom: 10px;
        right: 10px;
    }

    .atlas-widget-body {
        width: 58px;
        height: 70px;
    }

    .ai-msg-bubble {
        max-width: 90%;
    }
}

/* ============================================
   Game View
   ============================================ */

.game-view {
    padding: 0;
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-view-header {
    display: none;
}

.game-view-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.game-view-header p {
    color: var(--text-secondary);
    font-size: 11px;
}

.game-iframe-container {
    flex: 1;
    width: 100%;
    overflow: hidden;
    background: #000;
    border: none;
    border-radius: 0;
}

.game-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.game-iframe-container.quiz-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    min-height: unset;
    border: none;
    border-radius: 0;
    z-index: 9999;
}

/* ============================================
   Quiz Gallery
   ============================================ */

.quiz-gallery {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.quiz-gallery-header {
    margin-bottom: 1.5rem;
}

.quiz-gallery-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.quiz-gallery-header p {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.quiz-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.quiz-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg, 0.75rem);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.quiz-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quiz-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.quiz-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.quiz-card-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.badge-graded {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
}

.badge-practice {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
}

.badge-game {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
}

.quiz-card-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quiz-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.quiz-card-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.quiz-card-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.quiz-card-status .status-dot.completed { background: #3fb950; }
.quiz-card-status .status-dot.in-progress { background: #d29922; }
.quiz-card-status .status-dot.pending { background: var(--text-muted); }
.quiz-card-status .status-dot.practice { background: #58a6ff; }

.quiz-card-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: right;
}

.quiz-card-instructor {
    background: rgba(163, 113, 247, 0.1);
    border: 1px solid rgba(163, 113, 247, 0.2);
    border-radius: 6px;
    padding: 0.375rem 0.625rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: #a371f7;
}

.quiz-back-btn {
    margin: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
}

.quiz-back-btn.hidden {
    display: none;
}

@media (max-width: 640px) {
    .quiz-gallery {
        padding: 1rem;
    }
    .quiz-gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Gradebook View
   ============================================ */

.gradebook-passkey-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.gradebook-passkey-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.passkey-active-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
}

.passkey-label {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.passkey-value {
    color: var(--accent-blue);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: 2px;
    flex: 1;
}

.passkey-set-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.passkey-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    width: 180px;
    text-transform: uppercase;
}

.passkey-input::placeholder {
    text-transform: none;
}

.passkey-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.passkey-rules {
    font-size: 11px;
    color: var(--text-tertiary);
    margin: 0;
}

.gradebook-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.answer-key-section {
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
}

.answer-key-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    transition: background 0.15s;
}

.answer-key-toggle:hover {
    background: var(--bg-tertiary);
}

.answer-key-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.answer-key-chevron.open {
    transform: rotate(180deg);
}

.answer-key-content {
    padding: 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
}

.answer-key-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.answer-key-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 14px;
}

.answer-key-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.answer-key-qnum {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}

.answer-key-type {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 4px;
}

.answer-key-type.dfa {
    background: rgba(68, 136, 255, 0.15);
    color: #4488ff;
}

.answer-key-type.nfa {
    background: rgba(204, 68, 255, 0.15);
    color: #cc44ff;
}

.answer-key-question {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.answer-key-answer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: rgba(0, 255, 136, 0.06);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 6px;
}

.answer-key-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #00cc66;
    text-transform: uppercase;
}

.answer-key-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.answer-key-explanation {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
    font-style: italic;
}

.gradebook-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.gradebook-toolbar .search-input {
    flex: 1;
    max-width: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
}

.gradebook-toolbar .search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}
