:root {
    --primary: #1976d2;
    --primary-dark: #1565c0;
    --primary-light: #42a5f5;
    --secondary: #7c4dff;
    --success: #4caf50;
    --error: #f44336;
    --warning: #ff9800;
    --bg-main: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.header {
    background: var(--bg-header);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.demo-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 50;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-main);
}

.dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.demo-icon {
    font-size: 1.25rem;
}

.teacher-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.teacher-toggle:hover {
    background: var(--bg-main);
}

.teacher-toggle input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.teacher-toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.teacher-toggle input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

.teacher-icon {
    color: var(--text-secondary);
}

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

.main-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
}

.circuit-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

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

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

.qubit-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qubit-selector label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.qubit-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.qubit-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.qubit-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.gate-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.gate-btn {
    position: relative;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: var(--transition);
    user-select: none;
}

.gate-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.gate-btn:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.gate-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.gate-cnot {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: #81c784;
}

.gate-cnot .gate-symbol {
    color: #388e3c;
    font-size: 1.2rem;
}

.gate-toffoli {
    background: linear-gradient(135deg, #e1f5fe, #b3e5fc);
    border-color: #4fc3f7;
}

.gate-toffoli .gate-symbol {
    color: #0277bd;
    font-size: 1.2rem;
}

.gate-measure {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-color: #ffb74d;
}

.gate-measure .gate-symbol {
    font-size: 1rem;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    width: 200px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 100;
    pointer-events: none;
    margin-bottom: 0.5rem;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text-primary);
}

.tooltip strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.tooltip p {
    line-height: 1.4;
    color: #e2e8f0;
}

.gate-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.circuit-canvas {
    min-height: 200px;
    background: linear-gradient(to right, transparent 19px, #e2e8f0 19px, #e2e8f0 20px, transparent 20px),
                linear-gradient(to bottom, transparent 19px, #e2e8f0 19px, #e2e8f0 20px, transparent 20px);
    background-size: 20px 20px;
    background-color: #fafbfc;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    position: relative;
    transition: var(--transition);
}

.circuit-canvas.drag-over {
    border-color: var(--primary);
    background-color: #e3f2fd;
}

.circuit-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.qubit-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.qubit-row.hidden {
    display: none;
}

.qubit-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
    width: 30px;
    flex-shrink: 0;
}

.qubit-wire {
    flex: 1;
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.wire-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    top: 50%;
    transform: translateY(-50%);
}

.gate-slots {
    display: flex;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    padding: 0 0.5rem;
    min-height: 50px;
    align-items: center;
}

.placed-gate {
    width: 50px;
    height: 50px;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    animation: gatePlace 0.3s ease;
}

@keyframes gatePlace {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.placed-gate:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.placed-gate .gate-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary);
}

.placed-gate .delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placed-gate:hover .delete-btn {
    opacity: 1;
}

.placed-gate.gate-cnot {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: #81c784;
}

.placed-gate.gate-cnot .gate-label {
    color: #388e3c;
}

.placed-gate.gate-toffoli {
    background: linear-gradient(135deg, #e1f5fe, #b3e5fc);
    border-color: #4fc3f7;
}

.placed-gate.gate-toffoli .gate-label {
    color: #0277bd;
}

.placed-gate.gate-measure {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-color: #ffb74d;
}

.cnot-connection {
    position: absolute;
    left: 50%;
    width: 2px;
    background: #388e3c;
    transform: translateX(-50%);
    z-index: -1;
}

.circuit-drop-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    pointer-events: none;
}

.circuit-drop-hint svg {
    opacity: 0.5;
}

.circuit-drop-hint p {
    font-size: 0.9rem;
}

.circuit-drop-hint.hidden {
    display: none;
}

.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.control-left, .control-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.shots-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shots-input label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.shots-input input {
    width: 80px;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
    transition: var(--transition);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-main);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.gate-count {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.visualization-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.viz-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
}

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

.chart-container {
    height: 200px;
    position: relative;
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 180px;
    color: var(--text-muted);
}

.no-results svg {
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.no-results p {
    font-size: 0.9rem;
}

.no-results.hidden {
    display: none;
}

.state-vector-display, .multi-qubit-states {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.multi-qubit-states.hidden {
    display: none;
}

.tensor-product-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.5rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    text-align: center;
    word-break: break-word;
}

.state-bars-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
}

.state-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.state-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary);
    width: 35px;
    flex-shrink: 0;
}

.state-bar-container {
    flex: 1;
    height: 24px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.state-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
}

.state-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 40px;
    text-align: right;
}

.bloch-card {
    text-align: center;
}

.bloch-card h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.bloch-3d-badge {
    font-size: 0.65rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bloch-sphere-3d {
    width: 220px;
    height: 220px;
    margin: 0.5rem auto;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #f8fafc, #e3f2fd);
    cursor: grab;
    position: relative;
    overflow: hidden;
}

.bloch-sphere-3d:active {
    cursor: grabbing;
}

.bloch-sphere-3d canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: var(--radius-md);
}

.bloch-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

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

.bloch-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.circuit-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    background: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
}

.teacher-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.teacher-panel.show {
    transform: translateX(0);
}

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

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

.teacher-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-main);
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

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

.teacher-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.save-circuit-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-field {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

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

textarea.input-field {
    min-height: 80px;
    resize: vertical;
}

.json-export h4, .saved-circuits h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.json-textarea {
    width: 100%;
    height: 120px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    resize: vertical;
    background: var(--bg-main);
}

.json-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.saved-circuit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.saved-circuit-item:hover {
    background: var(--border);
}

.saved-circuit-item .circuit-info {
    flex: 1;
}

.saved-circuit-item .circuit-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.saved-circuit-item .circuit-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-circuit-item .circuit-actions {
    display: flex;
    gap: 0.25rem;
}

.saved-circuit-item .circuit-actions button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.saved-circuit-item .circuit-actions button:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.saved-circuit-item .circuit-actions button.delete-btn:hover {
    color: var(--error);
}

.empty-message {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 1rem;
}

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

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

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.hidden {
    transform: translateX(-50%) translateY(100px);
}

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

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

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .visualization-section {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .viz-card:last-child {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .main-container {
        padding: 1rem;
    }
    
    .gate-palette {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .gate-btn {
        width: 100%;
        height: 50px;
    }
    
    .control-panel {
        flex-direction: column;
    }
    
    .control-left, .control-right {
        width: 100%;
        justify-content: center;
    }
    
    .visualization-section {
        grid-template-columns: 1fr;
    }
    
    .viz-card:last-child {
        grid-column: span 1;
    }
    
    .teacher-panel {
        width: 100%;
    }
    
    .toggle-label {
        display: none;
    }
}

@media (max-width: 480px) {
    .gate-palette {
        grid-template-columns: repeat(4, 1fr);
        padding: 0.75rem;
    }
    
    .gate-btn {
        height: 45px;
    }
    
    .gate-symbol {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .circuit-canvas {
        min-height: 150px;
        overflow-x: auto;
    }
}

.lessons-btn {
    background: linear-gradient(135deg, var(--secondary), #651fff);
}

.lessons-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #651fff, var(--secondary));
}

.lessons-panel {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lessons-panel.show {
    opacity: 1;
    visibility: visible;
}

.lessons-panel.hidden {
    opacity: 0;
    visibility: hidden;
}

.lessons-panel-inner {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 95%;
    max-width: 1100px;
    height: 85vh;
    max-height: 750px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lessons-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #f3e5f5, #e8eaf6);
}

.lessons-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lessons-title svg {
    color: var(--secondary);
}

.lessons-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--secondary), #651fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.language-selector {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.language-selector:hover {
    border-color: var(--secondary);
}

.language-selector:focus {
    outline: none;
    border-color: var(--secondary);
}

.lessons-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.lessons-split-layout {
    display: flex;
    height: 100%;
}

.lessons-sidebar {
    width: 320px;
    min-width: 280px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    overflow-y: auto;
    background: var(--bg-main);
}

.lesson-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    overflow: hidden;
}

.lesson-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.lesson-placeholder.hidden {
    display: none;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.lesson-placeholder h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.lesson-placeholder p {
    font-size: 0.9rem;
}

.course-intro {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.course-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

.progress-container {
    background: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-md);
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), #651fff);
    border-radius: 4px;
    transition: width 0.5s ease;
}

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

.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.lesson-item:hover:not(.locked) {
    background: #e8eaf6;
    border-color: var(--secondary);
}

.lesson-item.active {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.lesson-item.completed {
    background: #e8f5e9;
}

.lesson-item.completed:not(.active) {
    border-color: var(--success);
}

.lesson-item.completed.active {
    border-color: var(--primary);
}

.lesson-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.lesson-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.lesson-item.completed .lesson-icon {
    background: var(--success);
    color: white;
    font-size: 1rem;
    font-weight: bold;
}

.lesson-info {
    flex: 1;
}

.lesson-title {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.lesson-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lesson-lock {
    font-size: 1rem;
}

.lesson-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lesson-view.hidden {
    display: none;
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.lesson-number {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.lesson-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

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

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

.lesson-content-wrapper p {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

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

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

.lesson-highlight {
    background: linear-gradient(135deg, #e8eaf6, #f3e5f5);
    border-left: 4px solid var(--secondary);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1rem 0;
}

.lesson-highlight h3 {
    margin-top: 0;
    color: var(--secondary);
}

.lesson-highlight p {
    margin-bottom: 0.5rem;
}

.lesson-highlight p:last-child {
    margin-bottom: 0;
}

.lesson-task {
    background: #fff3e0;
    border-left: 4px solid var(--warning);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1rem 0;
}

.lesson-task h4 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: #e65100;
}

.lesson-task p, .lesson-task ol, .lesson-task ul {
    margin-bottom: 0.5rem;
}

.lesson-task p:last-child, .lesson-task ol:last-child, .lesson-task ul:last-child {
    margin-bottom: 0;
}

.lesson-tip {
    background: #e3f2fd;
    border-left: 4px solid var(--primary);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.lesson-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .lessons-panel-inner {
        width: 95%;
        height: 90vh;
        max-height: none;
    }
    
    .lessons-split-layout {
        flex-direction: column;
    }
    
    .lessons-sidebar {
        width: 100%;
        min-width: auto;
        max-height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .lesson-main {
        min-height: 0;
        flex: 1;
    }
    
    .lessons-btn span {
        display: none;
    }
}

.demo-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.demo-modal.show {
    opacity: 1;
    visibility: visible;
}

.demo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.demo-modal-container {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 540px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.demo-modal.show .demo-modal-container {
    transform: scale(1) translateY(0);
}

.demo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
}

.demo-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.demo-modal-icon {
    font-size: 1.5rem;
}

.demo-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.demo-modal-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin: 1rem 0 0.5rem;
}

.demo-modal-body h3:first-child {
    margin-top: 0;
}

.demo-modal-body p {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.7;
}

.demo-modal-body ul {
    margin: 0.5rem 0 1rem 1.25rem;
}

.demo-modal-body li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.demo-modal-body strong {
    color: var(--text-primary);
}

.demo-tip {
    background: linear-gradient(135deg, #e8f5e9, #e3f2fd);
    border-left: 4px solid var(--success);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1rem 0 0;
    font-size: 0.9rem;
}

.demo-tip strong {
    color: var(--success);
}

.circuit-steps {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin: 0.75rem 0;
    border: 1px solid var(--border);
}

.circuit-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.circuit-step:not(:last-child) {
    border-bottom: 1px dashed var(--border);
}

.circuit-step:hover {
    background: rgba(99, 102, 241, 0.05);
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

.step-gate {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 70px;
    text-align: center;
    white-space: nowrap;
}

.step-desc {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.step-desc strong {
    color: var(--text-primary);
}

.demo-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    background: var(--bg-main);
}

@media (max-width: 480px) {
    .demo-modal-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .demo-modal-header {
        padding: 1rem;
    }
    
    .demo-modal-body {
        padding: 1rem;
    }
}

.gate-info-panel {
    background: linear-gradient(135deg, #f8fafc, #e3f2fd);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    min-height: 70px;
}

.gate-info-panel.active {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.15);
}

.gate-info-default {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.gate-info-default.hidden {
    display: none;
}

.gate-info-icon {
    font-size: 1.25rem;
}

.gate-info-content {
    animation: fadeIn 0.2s ease;
}

.gate-info-content.hidden {
    display: none;
}

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

.gate-info-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.gate-info-symbol {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    flex-shrink: 0;
}

.gate-info-title {
    flex: 1;
}

.gate-info-title h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.gate-info-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--primary-light);
    color: white;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gate-info-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.gate-info-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.gate-info-detail {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 50px;
}

.detail-value {
    color: var(--text-primary);
    flex: 1;
}

.gate-math {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(25, 118, 210, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .gate-info-panel {
        padding: 0.875rem 1rem;
    }
    
    .gate-info-symbol {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
    
    .gate-info-title h4 {
        font-size: 0.9rem;
    }
    
    .gate-info-details {
        flex-direction: column;
    }
}

.applications-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

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

.applications-panel-inner {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

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

.applications-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.applications-title svg {
    color: var(--primary);
}

.applications-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.applications-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.applications-intro {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-align: center;
}

.application-card {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.application-card:hover {
    border-color: var(--primary-light);
    transform: translateX(4px);
}

.application-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.application-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.application-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.application-example {
    font-size: 0.85rem;
    color: var(--primary-dark);
    background: rgba(25, 118, 210, 0.08);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.application-example strong {
    color: var(--primary);
}

.application-card-interactive {
    border: 2px solid var(--primary-light);
    background: linear-gradient(135deg, white, rgba(25, 118, 210, 0.03));
}

.application-card-interactive:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.btn-try-demo {
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-try-demo svg {
    transition: transform 0.2s ease;
}

.btn-try-demo:hover svg {
    transform: translateX(3px);
}

.applications-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    gap: 1rem;
}

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

.applications-divider span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.applications-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.future-note {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.1), rgba(124, 77, 255, 0.1));
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(25, 118, 210, 0.2);
}

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

.future-note p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.future-note strong {
    color: var(--primary);
}

.applications-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .applications-panel-inner {
        max-height: 95vh;
    }
    
    .application-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .application-example {
        border-left: none;
        border-top: 3px solid var(--primary);
    }
    
    .future-note {
        flex-direction: column;
        text-align: center;
    }
    
    .applications-btn span {
        display: none;
    }
}

.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.share-modal.hidden {
    display: none;
}

.share-modal-inner {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.05), rgba(124, 77, 255, 0.05));
}

.share-modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.share-modal-title svg {
    color: var(--primary);
}

.share-modal-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.share-modal-content {
    padding: 1.5rem;
}

.share-circuit-preview {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
}

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

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

.share-gate-count {
    font-size: 0.8rem;
    color: var(--primary);
    background: rgba(25, 118, 210, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.share-preview-gates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 2.5rem;
    align-items: center;
}

.share-preview-gate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
}

.share-preview-gate.gate-cnot {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: var(--success);
    color: var(--success);
}

.share-preview-gate.gate-toffoli {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-color: var(--warning);
    color: #e65100;
}

.share-preview-gate.gate-measure {
    background: linear-gradient(135deg, #fce4ec, #f8bbd9);
    border-color: #e91e63;
    color: #c2185b;
}

.share-name-input {
    margin-bottom: 1.25rem;
}

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

.share-name-input input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: var(--transition);
}

.share-name-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.share-link-container {
    margin-bottom: 1.25rem;
    animation: fadeIn 0.3s ease;
}

.share-link-container label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.share-link-row {
    display: flex;
    gap: 0.5rem;
}

.share-link-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-main);
    color: var(--text-primary);
}

.share-link-row .btn {
    flex-shrink: 0;
}

.share-success-msg {
    font-size: 0.85rem;
    color: var(--success);
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-success-msg::before {
    content: "✓";
    font-weight: bold;
}

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

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shared-circuit-banner {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.1), rgba(124, 77, 255, 0.1));
    border: 1px solid rgba(25, 118, 210, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: slideDown 0.3s ease;
}

.shared-circuit-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.shared-circuit-info svg {
    color: var(--primary);
    flex-shrink: 0;
}

.shared-circuit-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.shared-circuit-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shared-circuit-name {
    font-weight: 600;
    color: var(--text-primary);
}

.shared-circuit-banner .btn-close {
    font-size: 1.25rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: var(--transition);
}

.shared-circuit-banner .btn-close:hover {
    color: var(--text-primary);
}

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

@media (max-width: 480px) {
    .share-modal-inner {
        max-height: 95vh;
    }
    
    .share-actions {
        flex-direction: column;
    }
    
    .share-actions .btn {
        width: 100%;
    }
    
    .share-link-row {
        flex-direction: column;
    }
}

/* Welcome Modal */
.welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.welcome-modal.show {
    opacity: 1;
    visibility: visible;
}

.welcome-modal.hidden {
    display: none;
}

.welcome-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(8px);
}

.welcome-modal-container {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(30px);
    transition: transform 0.3s ease;
}

.welcome-modal.show .welcome-modal-container {
    transform: scale(1) translateY(0);
}

.welcome-video-wrap {
    width: 100%;
    background: #000;
    line-height: 0;
    flex-shrink: 0;
}

.welcome-intro-video {
    width: 100%;
    display: block;
    max-height: 220px;
    object-fit: cover;
}

.welcome-modal-header {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-bottom: 1px solid var(--border);
}

.welcome-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

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

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.welcome-modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.welcome-section {
    margin-bottom: 1.5rem;
}

.welcome-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.welcome-section p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.welcome-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.welcome-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

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

.step-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.welcome-tips {
    background: linear-gradient(135deg, #e8f5e9, #e3f2fd);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.welcome-tips h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 0.75rem;
}

.welcome-tips ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.welcome-tips li {
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.welcome-tips li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.welcome-tips li strong {
    color: var(--text-primary);
}

.welcome-modal-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-main);
}

.dont-show-again {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dont-show-again input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

@media (max-width: 600px) {
    .welcome-modal-header {
        padding: 1.5rem 1.25rem 1rem;
    }
    
    .welcome-modal-header h1 {
        font-size: 1.4rem;
    }
    
    .welcome-modal-body {
        padding: 1.25rem;
    }
    
    .welcome-modal-footer {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.25rem;
    }
    
    .welcome-step {
        padding: 0.75rem;
    }
}

/* Enhanced Applications Panel */
.applications-intro-section {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.applications-intro-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.applications-intro-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.learning-path {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.path-step {
    background: white;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.path-arrow {
    color: var(--primary);
    font-weight: bold;
}

.app-intro {
    margin-bottom: 1rem;
}

.app-intro p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.app-intro p:last-child {
    margin-bottom: 0;
}

.what-youll-learn {
    background: linear-gradient(135deg, #e8f5e9, #e3f2fd);
    border-left: 3px solid var(--success);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.what-youll-learn strong {
    color: var(--success);
}

.application-card .application-example {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
    border-top: 1px dashed var(--border);
    margin-top: 0.5rem;
}

.application-card .application-example strong {
    color: var(--text-secondary);
}
