Files
homeschool/public/handwriting.css
T
nmemmert 8d37038177 feat: Complete tablet UI overhaul with popup menu system and help bubble
Major Changes:
- 🪟 Popup Menu System: Converted slide-down navigation to draggable, minimizable popup window
- ❓ Help Bubble: Added contextual help system for admin dashboard (accessible via ? bubble)
- 🎨 Universal Theme Engine: All elements now properly match selected theme across all panels
- 📱 Enhanced Tablet Support: Comprehensive touch gestures, handwriting recognition, and Apple Pencil optimization
- 🖊️ Unified Write Mode: Combined handwriting and keyboard input with large canvas interface

Technical Implementation:
- Draggable popup with minimize/restore functionality and boundary constraints
- Dynamic theme switching using CSS variables throughout all components
- Help system with modal overlay and keyboard shortcuts (ESC to close)
- Responsive design optimizations for mobile, tablet, and desktop
- Comprehensive CSS overrides to eliminate hardcoded colors
- JavaScript fixes for canvas stroke colors and input styling

UI/UX Improvements:
- Clean admin dashboard without instruction clutter
- Professional popup interface with smooth animations
- Better contrast and readability across all themes (default, playground, chalkboard, galaxy, nature)
- Improved accessibility with proper focus management
- Enhanced mobile responsiveness with touch-optimized controls

Files Modified:
- Menu system: tablet-menu.js, tablet-menu.css
- Theme engine: styles.css, themes integration
- Admin interface: index.html, ui.js
- Input systems: game.js, unified-write.js, handwriting.js
- Authentication: auth.js with tablet menu cleanup
2025-10-02 14:26:04 -04:00

421 lines
8.1 KiB
CSS

/* Handwriting Recognition Styles */
/* Canvas container */
.handwriting-container {
background: var(--bg-primary);
border-radius: 16px;
padding: 1.5rem;
margin: 1.5rem auto;
box-shadow: var(--shadow-lg);
border: 2px solid var(--border);
max-width: 600px;
text-align: center;
}
.handwriting-container.active {
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* Canvas element */
#handwritingCanvas {
border: 2px solid var(--border);
border-radius: 12px;
background: white;
cursor: crosshair;
display: block;
margin: 1rem auto;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
touch-action: none; /* Prevent scrolling on touch devices */
}
#handwritingCanvas:focus {
outline: none;
border-color: var(--primary);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* Canvas controls */
.canvas-controls {
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
margin: 1rem 0;
flex-wrap: wrap;
}
.canvas-controls button {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
min-height: 44px;
min-width: 44px;
}
.canvas-controls .clear-btn {
background-color: var(--error);
color: white;
}
.canvas-controls .clear-btn:hover {
background-color: #dc2626;
transform: translateY(-1px);
}
.canvas-controls .recognize-btn {
background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
color: white;
}
.canvas-controls .recognize-btn:hover {
transform: translateY(-1px);
box-shadow: var(--shadow-lg);
}
.canvas-controls .recognize-btn:disabled {
background: var(--text-secondary);
cursor: not-allowed;
transform: none;
}
.canvas-controls .undo-btn {
background-color: var(--warning);
color: white;
}
.canvas-controls .undo-btn:hover {
background-color: #d97706;
transform: translateY(-1px);
}
/* Input mode toggle */
.input-mode-toggle {
display: flex;
background: var(--secondary);
border-radius: 12px;
padding: 0.25rem;
margin: 1.5rem auto;
max-width: 300px;
position: relative;
}
.input-mode-toggle button {
flex: 1;
padding: 0.75rem 1.5rem;
border: none;
background: transparent;
color: var(--text-secondary);
font-weight: 600;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
position: relative;
z-index: 2;
}
.input-mode-toggle button.active {
background: var(--bg-primary);
color: var(--primary);
box-shadow: var(--shadow);
}
.input-mode-toggle button:not(.active):hover {
color: var(--text-primary);
}
/* Recognition status */
.recognition-status {
margin: 1rem 0;
padding: 0.75rem 1rem;
border-radius: 8px;
font-weight: 600;
text-align: center;
min-height: 20px;
}
.recognition-status.processing {
background-color: #fef3c7;
color: #92400e;
border: 1px solid #fcd34d;
}
.recognition-status.success {
background-color: #f0fdf4;
color: var(--success);
border: 1px solid var(--success);
}
.recognition-status.error {
background-color: #fef2f2;
color: var(--error);
border: 1px solid var(--error);
}
.recognition-status.empty {
background: transparent;
border: none;
}
/* Recognized text display */
.recognized-text {
background: var(--secondary);
border-radius: 8px;
padding: 1rem;
margin: 1rem 0;
font-size: 1.25rem;
font-weight: 600;
min-height: 50px;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-primary);
border: 2px solid var(--border);
}
.recognized-text.has-content {
background: var(--bg-primary);
border-color: var(--primary);
color: var(--primary);
}
/* Handwriting hints */
.handwriting-hints {
background: var(--secondary);
border-radius: 8px;
padding: 1rem;
margin: 1rem 0;
font-size: 0.875rem;
color: var(--text-secondary);
text-align: left;
}
.handwriting-hints h4 {
color: var(--text-primary);
margin-bottom: 0.5rem;
font-size: 1rem;
}
.handwriting-hints ul {
margin: 0;
padding-left: 1.5rem;
}
.handwriting-hints li {
margin-bottom: 0.25rem;
}
/* Stroke width selector */
.stroke-controls {
display: flex;
align-items: center;
gap: 1rem;
margin: 0.5rem 0;
}
.stroke-controls label {
font-size: 0.875rem;
color: var(--text-secondary);
font-weight: 600;
}
.stroke-width-slider {
width: 100px;
height: 6px;
border-radius: 3px;
background: var(--border);
outline: none;
-webkit-appearance: none;
appearance: none;
}
.stroke-width-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: var(--primary);
cursor: pointer;
box-shadow: var(--shadow);
}
.stroke-width-slider::-moz-range-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background: var(--primary);
cursor: pointer;
border: none;
box-shadow: var(--shadow);
}
/* Color picker */
.color-controls {
display: flex;
align-items: center;
gap: 1rem;
margin: 0.5rem 0;
}
.color-picker {
width: 40px;
height: 40px;
border: 2px solid var(--border);
border-radius: 8px;
background: none;
cursor: pointer;
padding: 0;
}
.color-picker:hover {
border-color: var(--primary);
}
/* Tablet-specific handwriting styles */
@media screen and (min-width: 768px) and (max-width: 1024px) {
.handwriting-container {
padding: 2rem;
margin: 2rem auto;
max-width: 700px;
}
#handwritingCanvas {
width: 100%;
max-width: 600px;
height: 300px;
}
.canvas-controls {
gap: 1.5rem;
margin: 1.5rem 0;
}
.canvas-controls button {
padding: 1rem 2rem;
font-size: 1.125rem;
min-height: 50px;
min-width: 100px;
}
.input-mode-toggle {
max-width: 400px;
margin: 2rem auto;
}
.input-mode-toggle button {
padding: 1rem 2rem;
font-size: 1.125rem;
}
.recognized-text {
font-size: 1.5rem;
padding: 1.5rem;
min-height: 60px;
}
.handwriting-hints {
padding: 1.5rem;
font-size: 1rem;
}
.handwriting-hints h4 {
font-size: 1.125rem;
}
}
/* Mobile handwriting adjustments */
@media screen and (max-width: 767px) {
.handwriting-container {
margin: 1rem;
padding: 1rem;
}
#handwritingCanvas {
width: 100%;
height: 250px;
}
.canvas-controls {
flex-direction: column;
gap: 0.5rem;
}
.canvas-controls button {
width: 100%;
max-width: 200px;
}
.input-mode-toggle {
max-width: 280px;
}
.stroke-controls,
.color-controls {
justify-content: center;
flex-wrap: wrap;
}
}
/* Animation for canvas drawing */
@keyframes drawStroke {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.drawing-animation {
animation: drawStroke 0.1s ease-out;
}
/* Loading spinner for recognition */
.recognition-spinner {
width: 20px;
height: 20px;
border: 2px solid var(--border);
border-top-color: var(--primary);
border-radius: 50%;
animation: spin 1s linear infinite;
display: inline-block;
margin-right: 0.5rem;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* Accessibility improvements */
.handwriting-container:focus-within {
outline: 2px solid var(--primary);
outline-offset: 2px;
}
.canvas-controls button:focus {
outline: 2px solid var(--primary);
outline-offset: 2px;
}
/* High contrast mode support */
@media (prefers-contrast: high) {
#handwritingCanvas {
border-width: 3px;
border-color: #000;
}
.canvas-controls button {
border: 2px solid currentColor;
}
.recognition-status {
border-width: 2px;
}
}