1
0
Maksim Totmin d5998e81cf Multi-device support, dynamic grid adaptation, keyboard action
- Multi-device: OpenAllDecks(), GET /api/decks, per-deck PageManagers
- Dynamic grid: frontend adapts to connected device layout
- Keyboard action: new action type for sending key combos via wtype/xdotool
- Key recorder UI: click-based modifier toggles + single key capture
- Config: remove hardcoded maxKey validation
- Screensaver and auto-switch sync across all decks
2026-06-16 22:51:39 +07:00

724 lines
14 KiB
CSS

:root {
--bg: #0a0a10;
--surface: #141420;
--surface-hover: #1a1a2a;
--border: #252540;
--border-light: #333358;
--text: #e4e4f0;
--text-muted: #7a7a90;
--accent: #6366f1;
--accent-glow: rgba(99, 102, 241, 0.3);
--danger: #ef4444;
--success: #22c55e;
--radius: 12px;
--radius-sm: 8px;
--radius-xs: 6px;
--shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
--transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
background: var(--bg);
color: var(--text);
font-size: 14px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
.app {
display: flex;
flex-direction: column;
height: 100vh;
max-width: 780px;
margin: 0 auto;
padding: 0 16px;
}
/* ── Header ── */
header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 0;
gap: 12px;
flex-shrink: 0;
}
header h1 {
font-size: 16px;
font-weight: 600;
letter-spacing: -0.3px;
}
.page-nav {
display: flex;
align-items: center;
gap: 6px;
}
.page-nav .dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--border);
cursor: pointer;
transition: background var(--transition);
}
.page-nav .dot:hover { background: var(--text-muted); }
.page-nav .dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.header-actions {
display: flex;
gap: 8px;
}
.icon-btn {
background: var(--surface);
border: 1px solid var(--border);
color: var(--text-muted);
width: 32px;
height: 32px;
border-radius: var(--radius-xs);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all var(--transition);
font-size: 14px;
}
.icon-btn:hover {
background: var(--surface-hover);
border-color: var(--border-light);
color: var(--text);
}
/* ── Grid ── */
main {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.deck-grid {
display: grid;
gap: 8px;
padding: 20px;
background: var(--surface);
border-radius: var(--radius);
border: 1px solid var(--border);
}
.deck-selector {
display: flex;
gap: 4px;
margin-bottom: 8px;
align-self: stretch;
}
.deck-btn {
flex: 1;
padding: 6px 10px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius-xs);
color: var(--text-muted);
font-size: 11px;
font-weight: 600;
font-family: inherit;
cursor: pointer;
transition: all var(--transition);
text-align: center;
}
.deck-btn:hover { color: var(--text); border-color: var(--border-light); }
.deck-btn.active {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
.key-btn {
aspect-ratio: 1;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: #0d0d18;
cursor: pointer;
overflow: hidden;
position: relative;
transition: all var(--transition);
padding: 8px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.key-btn:hover {
border-color: var(--accent);
box-shadow: 0 0 12px var(--accent-glow);
transform: scale(1.03);
}
.key-btn:active { transform: scale(0.97); }
.key-btn img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: inherit;
}
.key-btn.empty {
opacity: 0.3;
}
.key-btn.empty:hover {
opacity: 0.5;
border-color: var(--border-light);
box-shadow: none;
}
.key-label {
position: absolute;
bottom: 3px;
left: 4px;
right: 4px;
font-size: 9px;
color: rgba(255, 255, 255, 0.75);
text-align: center;
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
pointer-events: none;
line-height: 1;
}
.fa-preview {
font-size: 34px;
color: #fff;
}
/* ── Modal ── */
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
animation: fadeIn 150ms ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.modal {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 24px;
width: 360px;
max-width: calc(100vw - 32px);
box-shadow: var(--shadow);
animation: slideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
max-height: 85vh;
overflow-y: auto;
}
@keyframes slideUp {
from { transform: translateY(16px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.modal h3 {
font-size: 15px;
font-weight: 600;
margin-bottom: 16px;
letter-spacing: -0.2px;
}
.preview-box {
width: 100px;
height: 100px;
margin: 0 auto 16px;
border-radius: var(--radius-xs);
overflow: hidden;
border: 1px solid var(--border);
position: relative;
background: #0d0d18;
cursor: pointer;
}
.preview-box img {
width: 100%;
height: 100%;
object-fit: cover;
}
.preview-overlay {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.5);
opacity: 0;
transition: opacity var(--transition);
border-radius: var(--radius-xs);
}
.preview-box:hover .preview-overlay { opacity: 1; }
.preview-overlay i {
font-size: 24px;
color: #fff;
}
.form-group {
margin-bottom: 12px;
}
.form-group label {
display: block;
font-size: 11px;
font-weight: 600;
color: var(--text-muted);
margin-bottom: 4px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.form-group input,
.form-group select {
width: 100%;
padding: 8px 10px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius-xs);
color: var(--text);
font-size: 13px;
font-family: inherit;
outline: none;
transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus {
border-color: var(--accent);
box-shadow: 0 0 0 2px var(--accent-glow);
}
.form-group input::placeholder {
color: var(--text-muted);
opacity: 0.5;
}
.form-group select {
cursor: pointer;
-webkit-appearance: none;
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%237a7a90' stroke-width='1.5'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 10px center;
padding-right: 28px;
}
.form-row {
display: flex;
gap: 8px;
}
.form-row .form-group { flex: 1; }
.checkbox-row {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
}
.checkbox-row input[type="checkbox"] {
width: 16px;
height: 16px;
accent-color: var(--accent);
cursor: pointer;
}
.checkbox-row label {
font-size: 13px;
color: var(--text);
cursor: pointer;
}
/* Collapsible */
.collapse-toggle {
display: flex;
align-items: center;
gap: 6px;
background: none;
border: none;
color: var(--text-muted);
cursor: pointer;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
padding: 4px 0;
margin-bottom: 8px;
font-family: inherit;
}
.collapse-toggle:hover { color: var(--accent); }
.collapse-toggle i { font-size: 10px; transition: transform var(--transition); }
.collapse-toggle.open i { transform: rotate(90deg); }
.modal-actions {
display: flex;
gap: 8px;
margin-top: 20px;
}
.btn {
padding: 8px 16px;
border-radius: var(--radius-xs);
font-size: 13px;
font-weight: 600;
cursor: pointer;
font-family: inherit;
border: 1px solid transparent;
transition: all var(--transition);
}
.btn-primary {
background: var(--accent);
color: #fff;
border-color: var(--accent);
flex: 1;
}
.btn-primary:hover {
background: #4f46e5;
box-shadow: 0 0 16px var(--accent-glow);
}
.btn-outline {
background: transparent;
border-color: var(--border);
color: var(--text);
}
.btn-outline:hover {
background: var(--surface-hover);
border-color: var(--border-light);
}
.btn-danger {
color: var(--danger);
border-color: transparent;
background: transparent;
}
.btn-danger:hover {
background: rgba(239, 68, 68, 0.12);
border-color: rgba(239, 68, 68, 0.3);
}
/* ── Settings / Backup panels ── */
.panel {
width: 100%;
padding: 20px;
background: var(--surface);
border-radius: var(--radius);
border: 1px solid var(--border);
}
.panel h3 {
font-size: 14px;
font-weight: 600;
margin-bottom: 16px;
}
.panel-section {
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 1px solid var(--border);
}
.panel-section:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.panel-section h4 {
font-size: 12px;
font-weight: 600;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 8px;
}
.backup-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 0;
border-bottom: 1px solid var(--border);
font-size: 12px;
}
.backup-item:last-child { border-bottom: none; }
.backup-item .meta {
color: var(--text-muted);
font-size: 11px;
}
.status-badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
background: var(--bg);
border-radius: 20px;
font-size: 12px;
border: 1px solid var(--border);
}
.status-badge .dot {
width: 6px;
height: 6px;
border-radius: 50%;
}
.status-badge .dot.online { background: var(--success); }
.status-badge .dot.offline { background: var(--text-muted); }
/* ── Toasts ── */
.toast {
position: fixed;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
background: var(--surface);
border: 1px solid var(--border);
padding: 12px 24px;
border-radius: var(--radius);
font-size: 13px;
z-index: 200;
box-shadow: var(--shadow);
animation: slideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.slider-group {
display: flex;
align-items: center;
gap: 10px;
}
.slider-group input[type="range"] {
flex: 1;
-webkit-appearance: none;
appearance: none;
height: 4px;
border-radius: 2px;
background: var(--border);
outline: none;
}
.slider-group input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--accent);
cursor: pointer;
border: 2px solid var(--bg);
}
.slider-group .value {
font-size: 12px;
color: var(--text-muted);
min-width: 36px;
text-align: right;
font-variant-numeric: tabular-nums;
}
/* ── Toolbar ── */
.toolbar {
display: flex;
align-items: center;
gap: 6px;
margin-top: 12px;
flex-shrink: 0;
}
.toolbar .btn {
font-size: 12px;
padding: 6px 14px;
}
/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
/* ── Auto-switch rule item ── */
.rule-item {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
background: var(--bg);
border-radius: var(--radius-xs);
margin-bottom: 6px;
font-size: 12px;
}
.rule-item code {
background: var(--surface);
padding: 2px 6px;
border-radius: 3px;
font-size: 11px;
color: var(--accent);
}
/* ── Display indicator on grid keys ── */
.display-indicator {
position: absolute;
bottom: 4px;
right: 4px;
font-size: 7px;
color: var(--accent);
opacity: 0.6;
pointer-events: none;
}
/* ── Tab buttons ── */
.tab-row {
display: flex;
gap: 0;
border: 1px solid var(--border);
border-radius: var(--radius-xs);
overflow: hidden;
}
.tab-btn {
flex: 1;
padding: 6px 8px;
background: var(--bg);
border: none;
color: var(--text-muted);
font-size: 11px;
font-weight: 600;
font-family: inherit;
cursor: pointer;
transition: all var(--transition);
border-right: 1px solid var(--border);
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
background: var(--accent);
color: #fff;
}
/* ── Modifier buttons ── */
.mod-row {
display: flex;
gap: 4px;
margin-bottom: 8px;
}
.mod-btn {
flex: 1;
padding: 6px 8px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius-xs);
color: var(--text-muted);
font-size: 11px;
font-weight: 600;
font-family: inherit;
cursor: pointer;
transition: all var(--transition);
text-align: center;
}
.mod-btn:hover { color: var(--text); border-color: var(--border-light); }
.mod-btn.active {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
/* ── Key capture ── */
.key-capture {
border: 1px dashed var(--border);
border-radius: var(--radius-xs);
padding: 8px;
min-height: 34px;
cursor: pointer;
text-align: center;
transition: all var(--transition);
outline: none;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
.key-capture:hover { border-color: var(--accent); }
.key-capture:focus-visible { border-color: var(--accent); }
.key-capture.capturing {
border-color: var(--accent);
box-shadow: 0 0 12px var(--accent-glow);
animation: recorderPulse 1s infinite;
}
.captured-key {
font-weight: 600;
font-family: 'SF Mono', 'Fira Code', monospace;
color: var(--accent);
font-size: 13px;
}
.capture-hint { color: var(--accent); font-weight: 600; }
.capture-placeholder { color: var(--text-muted); opacity: 0.6; }
@keyframes recorderPulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.6; }
}
.key-chips {
display: flex;
align-items: center;
gap: 2px;
flex-wrap: wrap;
justify-content: center;
}
.key-chip {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 4px;
padding: 2px 8px;
font-size: 12px;
font-weight: 600;
font-family: 'SF Mono', 'Fira Code', monospace;
color: var(--accent);
}
.key-plus {
color: var(--text-muted);
font-size: 11px;
margin: 0 2px;
}