Files
mediadeck/mediadeck/web/static/style.css
T
Denis e823b2d470 Initial commit: MediaDeck web remote for a Linux media PC
Python bridge (aiohttp, single asyncio loop) between a tablet browser and
a Linux media PC: MPRIS players, PipeWire audio (pactl), virtual keyboard
and touchpad (uinput), power and session control (logind).

- Tablet UI with player, audio, touchpad, launchers and system tabs (fr/en)
- Launchers stored in SQLite and managed from /admin; raw commands are
  opt-in (admin.allow_custom_command)
- Optional text entry, translated to key presses from the PC's real
  keyboard layout with libxkbcommon and never through the clipboard
  (features.text_input, off by default)
- Local HTTPS with a private CA restricted by name constraints (make cert)
- Token-protected WebSocket and REST API, strict CSP, no JS dependencies

Checked: pyright 0 errors, 87 unit tests, browser tests in headless
Chromium. Not yet exercised on the real tablet, nor with real uinput key
presses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-23 23:33:10 +02:00

1085 lines
20 KiB
CSS

/* MediaDeck : thème sombre pensé pour une tablette posée près du PC */
:root {
--bg: #0e0f13;
--surface: #171920;
--surface-2: #20232c;
--surface-3: #2a2e39;
--line: #2f3340;
--text: #eef0f5;
--text-dim: #9aa0ae;
--text-faint: #636a79;
--accent: #f5a524;
--accent-ink: #1b1305;
--danger: #ef5b5b;
--ok: #3ecf8e;
--radius: 18px;
--radius-sm: 12px;
--tap: 56px;
--font: "Inter", "Noto Sans", "Cantarell", system-ui, sans-serif;
color-scheme: dark;
}
* {
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
html,
body {
margin: 0;
height: 100%;
background: var(--bg);
color: var(--text);
font-family: var(--font);
-webkit-user-select: none;
user-select: none;
overscroll-behavior: none;
}
[hidden] {
display: none !important;
}
button {
font: inherit;
color: inherit;
border: 0;
background: none;
cursor: pointer;
touch-action: manipulation;
}
button:disabled {
opacity: 0.35;
cursor: default;
}
svg {
width: 24px;
height: 24px;
flex: none;
}
.sprite {
display: none;
}
/* ------------------------------------------------------------------ */
/* Structure */
/* ------------------------------------------------------------------ */
.app {
display: grid;
grid-template-rows: auto 1fr auto;
height: 100dvh;
padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 20px;
}
.topbar-actions {
display: flex;
gap: 8px;
align-items: center;
}
.status {
display: flex;
align-items: center;
gap: 10px;
font-size: 14px;
color: var(--text-dim);
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--text-faint);
}
.status[data-state="online"] .status-dot {
background: var(--ok);
box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent);
}
.status[data-state="connecting"] .status-dot {
background: var(--accent);
animation: pulse 1.2s ease-in-out infinite;
}
.status[data-state="offline"] .status-dot,
.status[data-state="auth"] .status-dot {
background: var(--danger);
}
@keyframes pulse {
50% {
opacity: 0.3;
}
}
.panels {
position: relative;
overflow: hidden;
min-height: 0;
}
.panel {
height: 100%;
overflow-y: auto;
padding: 8px 24px 24px;
}
.tabbar {
display: grid;
grid-auto-flow: column;
grid-auto-columns: 1fr;
gap: 6px;
padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
border-top: 1px solid var(--line);
background: var(--surface);
}
.tab {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
min-width: 0;
padding: 8px 0;
border-radius: var(--radius-sm);
color: var(--text-faint);
font-size: 13px;
font-weight: 500;
}
.tab.active {
color: var(--accent);
background: var(--surface-2);
}
/* ------------------------------------------------------------------ */
/* Éléments communs */
/* ------------------------------------------------------------------ */
.icon-btn {
display: inline-grid;
place-items: center;
width: var(--tap);
height: var(--tap);
border-radius: 50%;
color: var(--text-dim);
position: relative;
transition: background 0.15s, color 0.15s;
}
.icon-btn:active:not(:disabled) {
background: var(--surface-3);
}
.icon-btn.big svg {
width: 34px;
height: 34px;
color: var(--text);
}
.icon-btn.small {
width: 44px;
height: 44px;
}
.icon-btn.on {
color: var(--accent);
}
.badge {
position: absolute;
top: 10px;
right: 8px;
font-size: 10px;
font-weight: 700;
color: var(--accent);
}
.chip {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 40px;
padding: 0 16px;
border-radius: 999px;
background: var(--surface-2);
color: var(--text-dim);
font-size: 14px;
font-weight: 600;
white-space: nowrap;
}
.chip svg {
width: 18px;
height: 18px;
}
.chip.active {
background: var(--text);
color: var(--bg);
}
.chip.live::before {
content: "";
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--accent);
}
.empty {
display: grid;
place-items: center;
align-content: center;
gap: 8px;
height: 100%;
color: var(--text-faint);
text-align: center;
}
.empty svg {
width: 64px;
height: 64px;
}
.sub {
color: var(--text-faint);
font-size: 14px;
}
.section-title {
margin: 24px 0 12px;
font-size: 13px;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--text-faint);
}
.section-title:first-child {
margin-top: 8px;
}
/* Titre de section accompagné d'une action (lien « Gérer ») */
.section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin: 8px 0 12px;
}
.section-head .section-title {
margin: 0;
}
a.chip {
text-decoration: none;
}
/* Sliders : piste remplie via --fill (mise à jour en JS) */
input[type="range"] {
--fill: 0%;
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 32px;
background: transparent;
touch-action: none;
}
input[type="range"]::-webkit-slider-runnable-track {
height: 6px;
border-radius: 3px;
background: linear-gradient(to right, var(--accent) var(--fill), var(--surface-3) var(--fill));
}
input[type="range"]::-moz-range-track {
height: 6px;
border-radius: 3px;
background: linear-gradient(to right, var(--accent) var(--fill), var(--surface-3) var(--fill));
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 22px;
height: 22px;
margin-top: -8px;
border-radius: 50%;
background: var(--text);
box-shadow: 0 2px 8px rgb(0 0 0 / 0.5);
}
input[type="range"]::-moz-range-thumb {
width: 22px;
height: 22px;
border: 0;
border-radius: 50%;
background: var(--text);
}
input[type="range"].thick {
height: 48px;
}
input[type="range"].thick::-webkit-slider-runnable-track {
height: 14px;
border-radius: 7px;
}
input[type="range"].thick::-moz-range-track {
height: 14px;
border-radius: 7px;
}
input[type="range"].thick::-webkit-slider-thumb {
width: 30px;
height: 30px;
margin-top: -8px;
}
input[type="range"].muted::-webkit-slider-runnable-track {
background: linear-gradient(to right, var(--text-faint) var(--fill), var(--surface-3) var(--fill));
}
input[type="range"].muted::-moz-range-track {
background: linear-gradient(to right, var(--text-faint) var(--fill), var(--surface-3) var(--fill));
}
input[type="range"]:disabled {
opacity: 0.4;
}
.slider-row {
display: flex;
align-items: center;
gap: 12px;
color: var(--text-dim);
}
.slider-row .value {
min-width: 52px;
text-align: right;
font-variant-numeric: tabular-nums;
font-size: 14px;
}
/* ------------------------------------------------------------------ */
/* Lecture */
/* ------------------------------------------------------------------ */
.now-playing {
display: grid;
grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
gap: 40px;
align-items: center;
height: 100%;
}
.cover {
position: relative;
display: grid;
place-items: center;
aspect-ratio: 1;
width: 100%;
max-height: calc(100dvh - 220px);
justify-self: center;
border-radius: var(--radius);
background: var(--surface-2);
overflow: hidden;
box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
}
.cover img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.cover-fallback {
width: 30%;
height: 30%;
color: var(--surface-3);
}
.track {
display: flex;
flex-direction: column;
min-width: 0;
}
.player-tabs {
display: flex;
gap: 8px;
overflow-x: auto;
margin-bottom: 24px;
scrollbar-width: none;
}
.track-title {
margin: 0;
font-size: clamp(24px, 3.6vw, 40px);
font-weight: 700;
line-height: 1.15;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.track-artist {
margin: 10px 0 0;
font-size: clamp(17px, 2vw, 22px);
color: var(--accent);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.track-album {
margin: 4px 0 0;
font-size: 15px;
color: var(--text-faint);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.progress {
margin-top: 28px;
}
.times {
display: flex;
justify-content: space-between;
font-size: 13px;
color: var(--text-faint);
font-variant-numeric: tabular-nums;
}
.transport {
display: flex;
align-items: center;
justify-content: space-between;
max-width: 440px;
margin: 16px auto 0;
width: 100%;
}
.play-btn {
display: grid;
place-items: center;
width: 84px;
height: 84px;
border-radius: 50%;
background: var(--accent);
color: var(--accent-ink);
box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
transition: transform 0.1s;
}
.play-btn:active {
transform: scale(0.94);
}
.play-btn svg {
width: 40px;
height: 40px;
}
.player-extra {
display: flex;
align-items: center;
gap: 16px;
margin-top: 24px;
}
.player-extra .slider-row {
flex: 1;
}
/* ------------------------------------------------------------------ */
/* Son */
/* ------------------------------------------------------------------ */
.audio-view {
max-width: 820px;
margin: 0 auto;
}
.master {
display: flex;
align-items: center;
gap: 20px;
padding: 24px;
border-radius: var(--radius);
background: var(--surface);
}
.mute-btn {
display: grid;
place-items: center;
width: 72px;
height: 72px;
border-radius: 50%;
background: var(--surface-2);
flex: none;
}
.mute-btn svg {
width: 32px;
height: 32px;
}
.mute-btn.on {
background: color-mix(in srgb, var(--danger) 20%, var(--surface-2));
color: var(--danger);
}
.master-body {
flex: 1;
min-width: 0;
}
.master-head {
display: flex;
justify-content: space-between;
align-items: baseline;
}
.master-head .label {
font-weight: 600;
font-size: 18px;
}
.master-head .value {
font-size: 28px;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.sink-list {
list-style: none;
margin: 0;
padding: 0;
display: grid;
gap: 10px;
}
.sink {
padding: 12px 16px;
border-radius: var(--radius-sm);
background: var(--surface);
border: 1px solid transparent;
}
.sink.default {
border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.sink-select {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
min-height: 44px;
text-align: left;
}
.radio {
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid var(--text-faint);
flex: none;
}
.sink.default .radio {
border-color: var(--accent);
background: radial-gradient(circle, var(--accent) 45%, transparent 50%);
}
.sink-name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
}
.tag {
font-size: 12px;
color: var(--accent);
font-weight: 600;
}
/* ------------------------------------------------------------------ */
/* Pavé tactile */
/* ------------------------------------------------------------------ */
.remote-view {
display: grid;
grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
gap: 24px;
height: 100%;
}
.touchpad {
position: relative;
display: grid;
place-items: end center;
padding: 16px;
border-radius: var(--radius);
background:
radial-gradient(circle at 1px 1px, var(--surface-3) 1px, transparent 0) 0 0 / 22px 22px,
var(--surface);
border: 1px solid var(--line);
touch-action: none;
transition: border-color 0.15s, background-color 0.15s;
}
.touchpad.active {
border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.touchpad.flash {
background-color: var(--surface-2);
}
.touchpad-hint {
font-size: 13px;
color: var(--text-faint);
text-align: center;
pointer-events: none;
}
.remote-side {
display: flex;
flex-direction: column;
gap: 20px;
justify-content: center;
}
.dpad {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-areas:
". up ."
"left ok right"
". down .";
gap: 6px;
width: min(100%, 280px);
aspect-ratio: 1;
margin: 0 auto;
}
.dpad-btn {
display: grid;
place-items: center;
border-radius: var(--radius-sm);
background: var(--surface-2);
}
.dpad-btn:active,
.key:active,
.launcher:active,
.power-btn:active {
background: var(--surface-3);
}
.dpad-btn svg {
width: 32px;
height: 32px;
}
.dpad-btn.up {
grid-area: up;
}
.dpad-btn.down {
grid-area: down;
}
.dpad-btn.left {
grid-area: left;
}
.dpad-btn.right {
grid-area: right;
}
.dpad-btn.ok {
grid-area: ok;
border-radius: 50%;
background: var(--accent);
color: var(--accent-ink);
font-weight: 800;
font-size: 20px;
}
.key-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.key {
display: grid;
place-items: center;
height: var(--tap);
border-radius: var(--radius-sm);
background: var(--surface-2);
font-weight: 600;
font-size: 15px;
}
/* ------------------------------------------------------------------ */
/* Système */
/* ------------------------------------------------------------------ */
.launcher-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 12px;
}
.launcher {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
aspect-ratio: 1.3;
padding: 12px;
border-radius: var(--radius);
background: var(--surface);
border: 1px solid var(--line);
font-weight: 600;
text-align: center;
}
.launcher svg {
width: 40px;
height: 40px;
color: var(--accent);
}
.power-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
}
.power-btn {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
padding: 22px 8px;
border-radius: var(--radius);
background: var(--surface);
border: 1px solid var(--line);
font-weight: 600;
overflow: hidden;
}
.power-btn svg {
width: 32px;
height: 32px;
}
/* Jauge de maintien : se remplit pendant 1 s */
.power-btn.hold::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
height: 4px;
width: 0;
background: var(--accent);
}
.power-btn.hold.holding::after {
width: 100%;
transition: width 1s linear;
}
.power-btn.danger {
color: var(--danger);
}
.power-btn.danger::after {
background: var(--danger);
}
/* ------------------------------------------------------------------ */
/* Toast et écran sans jeton */
/* ------------------------------------------------------------------ */
.toast {
position: fixed;
left: 50%;
bottom: 104px;
transform: translateX(-50%);
max-width: calc(100vw - 32px);
padding: 12px 20px;
border-radius: 999px;
background: var(--text);
color: var(--bg);
font-weight: 600;
font-size: 15px;
box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
}
.toast.error {
background: var(--danger);
color: #fff;
}
.overlay {
position: fixed;
inset: 0;
display: grid;
place-items: center;
align-content: center;
gap: 12px;
padding: 32px;
background: var(--bg);
text-align: center;
color: var(--text-dim);
}
.overlay svg {
width: 56px;
height: 56px;
color: var(--accent);
}
.overlay h1 {
margin: 0;
color: var(--text);
}
.overlay code {
padding: 8px 14px;
border-radius: var(--radius-sm);
background: var(--surface-2);
color: var(--accent);
user-select: text;
}
/* ------------------------------------------------------------------ */
/* Formulaires et dialogues (télécommande et page /admin) */
/* ------------------------------------------------------------------ */
.banner {
margin: 12px 0;
padding: 12px 16px;
border-radius: var(--radius-sm);
background: color-mix(in srgb, var(--danger) 18%, var(--surface));
border: 1px solid var(--danger);
color: var(--text);
}
.primary {
min-height: 48px;
padding: 0 24px;
border-radius: 999px;
background: var(--accent);
color: var(--accent-ink);
font-weight: 700;
}
dialog {
width: min(560px, calc(100vw - 24px));
max-height: calc(100dvh - 24px);
padding: 20px;
border: 1px solid var(--line);
border-radius: var(--radius);
background: var(--surface);
color: var(--text);
}
dialog::backdrop {
background: rgb(0 0 0 / 0.65);
}
dialog h2 {
margin: 0 0 16px;
font-size: 18px;
}
.field {
display: grid;
gap: 6px;
margin-bottom: 14px;
font-size: 14px;
color: var(--text-dim);
}
.field-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
input[type="text"],
input[type="password"],
input[type="url"],
input[type="search"],
select,
textarea {
width: 100%;
min-height: 48px;
padding: 10px 12px;
border: 1px solid var(--line);
border-radius: var(--radius-sm);
background: var(--surface-2);
color: var(--text);
font: inherit;
}
textarea {
font-family: ui-monospace, "DejaVu Sans Mono", monospace;
font-size: 14px;
resize: vertical;
}
select[size] {
padding: 4px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
textarea:disabled {
opacity: 0.55;
}
.check {
display: flex;
align-items: center;
gap: 12px;
min-height: 48px;
}
.check input {
width: 22px;
height: 22px;
accent-color: var(--accent);
}
.form-actions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 10px 12px;
margin-top: 16px;
}
.form-actions .chip,
.form-actions .primary {
white-space: nowrap;
}
/* Saisie de texte : fenêtre non modale, fixée en haut pour rester visible au-dessus du clavier tactile */
dialog.top {
position: fixed;
top: calc(12px + env(safe-area-inset-top));
bottom: auto;
left: 0;
right: 0;
margin: 0 auto;
z-index: 15;
box-shadow: 0 16px 40px rgb(0 0 0 / 0.55);
}
input[type="text"],
input[type="password"] {
-webkit-user-select: text;
user-select: text;
}
.quick-keys {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
margin: 4px 0 14px;
}
.key.wide {
grid-column: 1 / -1;
grid-auto-flow: column;
gap: 10px;
justify-content: center;
}
.key svg {
width: 22px;
height: 22px;
}
@media (max-width: 520px) {
.field-row {
grid-template-columns: 1fr;
gap: 0;
}
}
/* ------------------------------------------------------------------ */
/* Portrait / petits écrans */
/* ------------------------------------------------------------------ */
@media (orientation: portrait), (max-width: 760px) {
.panel {
padding: 8px 16px 16px;
}
.now-playing {
grid-template-columns: 1fr;
gap: 20px;
align-content: start;
height: auto;
}
.cover {
width: min(100%, 46dvh);
}
.remote-view {
grid-template-columns: 1fr;
grid-template-rows: minmax(260px, 1fr) auto;
}
.power-grid {
grid-template-columns: repeat(2, 1fr);
}
.master {
padding: 16px;
}
}