Add keyboard-shortcut help overlay

Press '?' to open a styled overlay showing all keyboard shortcuts,
Esc to close. Lists Space (play/pause), arrow keys (seek/volume),
F (fullscreen), M (mute), ? (help), Esc (close).

Files:
- frontend/app.js: toggleShortcutHelp(), wireShortcutHelp(), '?' and Esc handlers
- frontend/index.html: shortcut-overlay markup with .shortcut-grid
- frontend/styles.css: .shortcut-overlay, .shortcut-panel, .shortcut-row, kbd styles
This commit is contained in:
Jonathan Sykes
2026-06-14 14:19:42 +08:00
parent da2ad27244
commit c676786144
7 changed files with 108 additions and 2 deletions

View File

@@ -915,6 +915,73 @@ input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* ===================== Keyboard shortcut overlay ===================== */
.shortcut-overlay {
position: fixed; inset: 0;
z-index: 500;
background: rgba(0,0,0,0.55);
backdrop-filter: blur(4px);
display: flex; align-items: center; justify-content: center;
animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.shortcut-panel {
background: var(--bg-2);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 28px 32px;
min-width: 380px;
max-width: 480px;
box-shadow: 0 24px 64px -16px rgba(0,0,0,0.6);
animation: panelIn 0.2s var(--ease);
}
@keyframes panelIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: none; } }
.shortcut-header {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 20px;
}
.shortcut-header h2 {
margin: 0;
font-family: var(--display);
font-weight: 700;
font-size: 20px;
letter-spacing: -0.01em;
}
.shortcut-close {
background: var(--bg-3);
border: 1px solid var(--line);
color: var(--text-2);
width: 32px; height: 32px;
border-radius: 9px;
cursor: pointer;
font-size: 15px;
display: grid; place-items: center;
transition: all 0.16s;
}
.shortcut-close:hover { color: var(--text); border-color: var(--accent); background: var(--bg-3); }
.shortcut-grid {
display: flex; flex-direction: column; gap: 10px;
}
.shortcut-row {
display: flex; align-items: center; gap: 10px;
padding: 6px 0;
border-bottom: 1px solid var(--line-soft);
}
.shortcut-row:last-child { border-bottom: none; }
.shortcut-row span { color: var(--text-2); font-size: 13px; flex: 1; }
.shortcut-row kbd {
font-family: var(--mono);
font-size: 11px; font-weight: 700;
color: var(--text);
background: var(--bg-3);
border: 1px solid var(--line);
border-radius: 6px;
padding: 4px 9px;
min-width: 28px;
text-align: center;
line-height: 1;
}
.hidden { display: none !important; }
@media (max-width: 1080px) {