:root {
  --accent: #ff3d71;
  --accent-2: #7c4dff;
  --bg: #0b0d17;
  --bg-2: #11142280;
  --panel: #151a2c;
  --panel-2: #1c2238;
  --line: #ffffff14;
  --text: #e9ecf5;
  --muted: #8b93ad;
  --danger: #ff4d4f;
  --ok: #2ecc71;
  --radius: 14px;
  --card: 180px;
  --shadow: 0 10px 30px #0008;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef0f7;
  --bg-2: #ffffffa0;
  --panel: #ffffff;
  --panel-2: #f3f4fa;
  --line: #0000001a;
  --text: #171a29;
  --muted: #5d6480;
  --shadow: 0 10px 30px #0002;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
body.app { display: grid; grid-template-columns: 250px 1fr; overflow: hidden; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(700px 500px at -10% 110%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 40px 40px;
  mask-image: linear-gradient(#000, #0008);
}

/* ---------- Barre latérale ---------- */
.sidebar {
  height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px; border-right: 1px solid var(--line);
  background: var(--bg-2); backdrop-filter: blur(14px);
  overflow-y: auto; z-index: 20;
}
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-size: 20px; font-weight: 600; letter-spacing: .3px; }
.brand b { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { margin: 16px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 10px; background: none; text-align: left;
  color: var(--muted); transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.nav-item.active .ico { color: var(--accent); }
.nav-item .ico { width: 18px; text-align: center; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--panel-2); padding: 1px 8px; border-radius: 99px; }
.nav-item.disabled-sys { opacity: .45; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.storage { padding: 6px 10px 10px; font-size: 12px; color: var(--muted); }
.storage .bar { height: 5px; border-radius: 9px; background: var(--panel-2); margin-top: 6px; overflow: hidden; }
.storage .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- Zone principale ---------- */
.main { height: 100vh; overflow-y: auto; padding: 0 28px 60px; scroll-behavior: smooth; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 16px 0; background: linear-gradient(var(--bg) 70%, transparent);
}
.search {
  flex: 1; display: flex; align-items: center; gap: 8px; min-width: 120px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.search span { color: var(--muted); font-size: 18px; }
.search input { flex: 1; border: 0; outline: 0; background: none; padding: 10px 0; min-width: 0; }
.search.wide { margin: 0 0 12px; }
.select, .input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; outline: 0;
}
.input:focus, .select:focus { border-color: var(--accent); }
input[type=range] { accent-color: var(--accent); width: 110px; }

.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 14px;
  font-weight: 600; white-space: nowrap; transition: transform .1s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.ghost { background: transparent; }
.btn.danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.big { padding: 13px 26px; font-size: 16px; border-radius: 12px; }
.icon-btn { border: 0; background: var(--panel-2); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
a.icon-btn { color: inherit; text-decoration: none; }
.icon-btn:hover { background: color-mix(in srgb, var(--accent) 25%, var(--panel-2)); }

.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  display: none; flex-direction: column;
}
.menu.open { display: flex; animation: pop .15s ease-out; }
.menu button { border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 8px; }
.menu button:hover { background: var(--panel-2); }

/* ---------- Bannière « Reprendre » ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; min-height: 230px; margin: 6px 0 26px;
  display: flex; align-items: flex-end; padding: 28px; border: 1px solid var(--line);
  background: var(--panel);
}
.hero .hero-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(26px) saturate(1.4); opacity: .55; transform: scale(1.1); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 60%, transparent) 55%, transparent); }
.hero-content { position: relative; z-index: 1; display: flex; gap: 26px; align-items: flex-end; width: 100%; }
.hero-cover { width: 130px; aspect-ratio: 3/4; border-radius: 12px; background-size: cover; background-position: center; box-shadow: var(--shadow); flex-shrink: 0; }
.hero-snap { margin-left: auto; width: 300px; aspect-ratio: 4/3; border-radius: 12px; background: #000 center/cover; box-shadow: var(--shadow); image-rendering: pixelated; border: 3px solid #0006; }
.hero .kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); font-weight: 700; }
.hero h2 { margin: 6px 0 4px; font-size: 32px; line-height: 1.1; }
.hero .meta { color: var(--muted); margin-bottom: 16px; }

.section-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 16px; }
.section-head h1 { margin: 0; font-size: 22px; }

/* ---------- Grille des jeux ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card), 1fr)); gap: 22px 18px; outline: 0; }
.card { position: relative; perspective: 800px; cursor: pointer; outline: 0; animation: rise .35s both; }
.card .cover {
  position: relative; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden;
  background: var(--panel-2); box-shadow: 0 6px 16px #0006;
  transform: rotateX(var(--rx, 0)) rotateY(var(--ry, 0)); transition: transform .2s ease-out, box-shadow .2s;
  transform-style: preserve-3d;
}
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .cover img.contain { object-fit: contain; background: #000; image-rendering: pixelated; }
.card .shine { position: absolute; inset: 0; background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%), #ffffff40, transparent 55%); opacity: 0; transition: opacity .2s; pointer-events: none; }
.card:hover .cover, .card:focus-visible .cover, .card.focused .cover { box-shadow: 0 16px 34px #000a, 0 0 0 3px var(--accent); }
.card:hover .shine, .card.focused .shine { opacity: 1; }
.card .play-fab {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-size: 22px; display: grid; place-items: center;
  opacity: 0; transform: scale(.6); transition: .2s; box-shadow: 0 6px 20px #0008;
}
.card:hover .play-fab, .card.focused .play-fab { opacity: 1; transform: scale(1); }
.card .fav {
  position: absolute; top: 8px; right: 8px; border: 0; width: 32px; height: 32px; border-radius: 50%;
  background: #0009; color: #fff; opacity: 0; transition: .2s; font-size: 15px;
}
.card .fav.on { opacity: 1; color: #ffd54f; }
.card:hover .fav { opacity: 1; }
.card .badge {
  position: absolute; left: 8px; bottom: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px;
  padding: 3px 8px; border-radius: 99px; color: #fff; background: var(--sys, #444); box-shadow: 0 2px 8px #0007;
}
.card .title { margin-top: 9px; font-weight: 600; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .sub { font-size: 12px; color: var(--muted); }

/* jaquette générée quand aucune image n'est disponible */
.placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; padding: 14px 14px 44px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--sys) 85%, #000) 0%, color-mix(in srgb, var(--sys) 35%, #000) 100%);
  color: #fff;
}
.placeholder::before {
  content: ""; position: absolute; inset: 0; opacity: .18;
  background: repeating-linear-gradient(0deg, #fff 0 1px, transparent 1px 4px);
}
.placeholder .ph-sys { position: relative; font-size: 10px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; opacity: .85; }
/* titre centré verticalement, au-dessus du badge console */
.placeholder .ph-title { position: relative; margin: auto 0; font-family: 'Press Start 2P', monospace; font-size: 11px; line-height: 1.6; text-shadow: 2px 2px 0 #0008; word-break: break-word; }

/* ---------- État vide ---------- */
.empty { display: grid; place-items: center; padding: 30px 0; }
.drop-big {
  width: min(720px, 100%); text-align: center; padding: 50px 30px; border-radius: 24px;
  border: 2px dashed color-mix(in srgb, var(--accent) 50%, var(--line)); background: var(--bg-2);
}
.pixel { font-family: 'Press Start 2P', monospace; font-size: 28px; color: var(--accent); text-shadow: 3px 3px 0 var(--accent-2); animation: blink 1.2s steps(2) infinite; margin-bottom: 18px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 18px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--panel-2); display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: #0009; backdrop-filter: blur(6px); animation: fade .15s; }
.modal-card {
  width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); animation: pop .2s ease-out;
}
.modal-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-card header h2 { margin: 0; font-size: 19px; }
.modal-card footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.game-card { width: min(940px, 100%); padding: 0; overflow: hidden; }
.gd-top { position: relative; padding: 26px; display: grid; grid-template-columns: 220px 1fr; gap: 26px; }
.gd-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(30px) saturate(1.5); opacity: .35; }
.gd-top > *:not(.gd-bg) { position: relative; }
.gd-cover { aspect-ratio: 3/4; border-radius: 14px; overflow: hidden; position: relative; box-shadow: var(--shadow); background: var(--panel-2); }
.gd-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gd-close { position: absolute !important; top: 14px; right: 14px; }
.gd-info h2 { margin: 6px 0 4px; font-size: 28px; line-height: 1.15; padding-right: 40px; }
.gd-sys { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: #fff; background: var(--sys); padding: 4px 10px; border-radius: 99px; }
.gd-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 18px 0; }
.stat { background: color-mix(in srgb, var(--panel-2) 80%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 15px; }
.stat span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gd-bottom { padding: 0 26px 26px; }
.gd-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gd-shots figure { margin: 0; }
.gd-shots img, .gd-shots .noshot { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #000; border-radius: 12px; image-rendering: pixelated; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.gd-shots figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.gd-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.gd-edit label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.gd-file { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 12px; }

.picker { width: min(900px, 100%); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.picker-item { border: 0; padding: 0; background: none; text-align: left; border-radius: 10px; }
.picker-item .pi-img { aspect-ratio: 3/4; border-radius: 10px; background: var(--panel-2) center/cover; transition: .15s; box-shadow: 0 4px 12px #0006; }
.picker-item:hover .pi-img { box-shadow: 0 0 0 3px var(--accent); transform: translateY(-2px); }
.picker-item span { display: block; font-size: 11.5px; margin-top: 6px; color: var(--muted); line-height: 1.3; }
.picker-status { margin-bottom: 10px; font-size: 13px; }

.assign-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.assign-row { display: grid; grid-template-columns: 1fr 190px; gap: 10px; align-items: center; }
.assign-row span { font-size: 13px; word-break: break-all; }

.settings { width: min(720px, 100%); }
.settings-body section { padding: 16px 0; border-top: 1px solid var(--line); }
.settings-body section:first-child { border-top: 0; padding-top: 0; }
.settings-body h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 10px 0; }
.field > span { flex: 1; }
.field small { display: block; color: var(--muted); font-size: 12px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label { display: flex; gap: 6px; align-items: center; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.bios-list { display: flex; flex-direction: column; gap: 8px; }
.bios-row { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.bios-row .grow { flex: 1; }
.ok { color: var(--ok); }

/* ---------- Lecteur ---------- */
.player { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; animation: fade .2s; }
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: #0b0d17; border-bottom: 1px solid #ffffff14; color: #e9ecf5; }
.player-title { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-actions { display: flex; align-items: center; gap: 8px; }
.player-stage { flex: 1; position: relative; }
.player-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Divers ---------- */
.dropzone { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 20%, #000c); backdrop-filter: blur(4px); pointer-events: none; }
.dropzone div { font-size: 26px; font-weight: 800; padding: 50px 70px; border: 3px dashed #fff; border-radius: 26px; color: #fff; }
.progress { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; width: min(440px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.progress-label { font-size: 13px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-track { height: 6px; background: var(--panel-2); border-radius: 9px; overflow: hidden; }
.progress-track div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.toasts { position: fixed; right: 18px; top: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
/* pendant le jeu, les notifications passent en bas pour ne pas masquer « Quitter » */
.player:not([hidden]) ~ .toasts { top: auto; bottom: 18px; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 340px; font-size: 14px; animation: slide .25s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }
.only-mobile { display: none; }

/* ---------- Compte, mode invité, sources ---------- */
.small-btn { padding: 6px 10px; font-size: 13px; }
.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.account-box { display: flex; align-items: center; gap: 10px; padding: 10px; margin: 4px 0 8px; border-radius: 12px; background: var(--panel-2); }
.avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.avatar.guest { background: var(--panel); color: var(--muted); border: 1px dashed var(--muted); }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.who span { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-status { margin: 0 10px 8px; padding: 6px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: #ffab00; background: #ffab0018; }
.guest-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 12px 16px; border-radius: 14px; font-size: 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, var(--panel)), color-mix(in srgb, var(--accent-2) 14%, var(--panel)));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.section-head .btn { margin-left: auto; }
.card .cloud { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #000a; color: #fff; font-size: 14px; }
.card .resume-tag { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; color: #fff; background: color-mix(in srgb, var(--accent) 85%, #000); box-shadow: 0 2px 8px #0007; }
.card:has(.cloud) .resume-tag { top: 42px; }
.card .cloud.cached { background: color-mix(in srgb, var(--accent) 80%, #000); }
.card .cloud.cached::after { content: '✓'; position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; font-size: 9px; font-weight: 800; display: grid; place-items: center; background: #fff; color: #111; }
/* Jeu grisé : ROM absente de cet appareil ou fichier disparu de la source. */
.card.unavailable .cover > :is(img, .placeholder, .shine) { filter: grayscale(1) brightness(.55); }
.card.unavailable .title, .card.unavailable .sub { opacity: .55; }
.card.unavailable .play-fab { display: none; }
.card .unavail-tag { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; padding: 5px 11px; border-radius: 99px; font-size: 11.5px; font-weight: 700; color: #fff; background: #000c; border: 1px solid #fff3; pointer-events: none; }
.unavail-line { margin-top: 10px; font-size: 13.5px; font-weight: 600; color: var(--warning, #f5a524); }
.modal-card footer { flex-wrap: wrap; }
.modal-card footer .dialog-extra { margin-right: auto; }
.btn.danger-text { color: var(--danger); }
.save-line { margin-top: 10px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.locked-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.locked-box { text-align: center; padding: 20px; }
select:disabled, input:disabled, button:disabled { opacity: .45; cursor: not-allowed; }
.sources { width: min(680px, 100%); }
.source-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.source-row { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 8px 12px; border-radius: 10px; }
.source-row b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-row small { font-size: 12px; }
.src-ico { font-size: 20px; }
.source-add { padding: 14px 0; border-top: 1px solid var(--line); }
.source-add h3 { margin: 0 0 8px; font-size: 15px; }
.dbx-browser { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 8px 0 12px; background: var(--panel-2); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.crumb { border: 0; background: none; padding: 4px 6px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--muted); }
.crumb:last-of-type { color: var(--text); }
.crumb:hover { background: var(--panel-2); color: var(--text); }
.crumb-sep { color: var(--muted); font-size: 13px; }
.dbx-list { max-height: 260px; overflow-y: auto; }
.dbx-folder { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 12px; text-align: left; font-size: 14px; }
.dbx-folder:last-child { border-bottom: 0; }
.dbx-folder:hover, .dbx-folder:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: 0; }
.dbx-folder .chev { color: var(--muted); }
.dbx-added { font-size: 12px; color: var(--ok); }
.dbx-empty { padding: 14px 12px; font-size: 13.5px; }
.dbx-empty.error { color: var(--danger); }
.dbx-status { padding: 8px 12px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); background: var(--panel); }
.confirm { width: min(440px, 100%); }
.confirm h2 { margin: 0 0 8px; font-size: 19px; }
.auth-card { position: relative; width: min(430px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.auth-close { position: absolute; top: 14px; right: 14px; }
.auth-head { text-align: center; }
.auth-head img { display: block; margin: 0 auto 10px; filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--accent) 45%, transparent)); }
.auth-head h2 { margin: 0; font-size: 22px; }
.auth-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border-radius: 12px; padding: 4px; }
.auth-tabs button { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.auth-tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 2px 8px #0004; }
.auth-perks { list-style: none; margin: 0; padding: 12px 14px; border-radius: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px;
  background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label { font-size: 13px; font-weight: 600; }
.auth-input { position: relative; display: block; }
.auth-input .input { width: 100%; padding: 11px 12px; font-size: 15px; }
.auth-input .input[type=password], .auth-input .input[name=password] { padding-right: 44px; }
.auth-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; opacity: .5; font-size: 16px; }
.auth-eye:hover, .auth-eye.on { opacity: 1; background: var(--panel-2); }
.auth-hint { margin-top: -8px; color: var(--muted); font-size: 12px; }
.auth-error { color: var(--danger); font-size: 13.5px; background: color-mix(in srgb, var(--danger) 12%, transparent); padding: 9px 12px; border-radius: 10px; }
.auth-submit { width: 100%; margin-top: 2px; }
.auth-submit.loading { opacity: .7; cursor: progress; }
.auth-switch { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.auth-code { width: 100%; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 12px; padding: 12px; font-variant-numeric: tabular-nums; }
.auth-code::placeholder { letter-spacing: 12px; opacity: .35; }
.auth-trust { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.auth-error.info { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.link-btn:disabled { color: var(--muted); text-decoration: none; cursor: default; opacity: 1; }
.auth-note { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.lang-select { padding: 8px; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { opacity: 0; transform: translateX(20px); } }
@keyframes blink { 50% { opacity: .35; } }

@media (max-width: 860px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .25s; background: var(--panel); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .only-mobile { display: grid; }
  .hide-mobile, #zoom { display: none; }
  .main { padding: 0 16px 60px; }
  .topbar { flex-wrap: wrap; }
  .search { order: 5; flex-basis: 100%; }
  #btn-scrape-all, body.app #lang-slot { display: none; }
  .hero-snap { display: none; }
  .hero h2 { font-size: 24px; }
  .hero-cover { width: 90px; }
  .gd-top { grid-template-columns: 1fr; }
  .gd-cover { width: 160px; }
  .gd-shots, .gd-edit { grid-template-columns: 1fr; }
  .grid { --card: 130px !important; gap: 16px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- Installation de l'application (mobile) */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 45;
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 18px;
  background: var(--panel); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow), 0 0 0 1px #0003;
  animation: install-up .35s cubic-bezier(.2, .9, .3, 1.2);
}
.install-banner .install-icon { border-radius: 11px; flex: none; }
.install-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.install-text b { font-size: 14.5px; }
.install-text span { color: var(--muted); }
.install-banner .btn { flex: none; }
.install-x { flex: none; }
@keyframes install-up { from { transform: translateY(120%); opacity: 0; } }
.install-sheet-wrap { position: fixed; inset: 0; z-index: 55; display: flex; align-items: flex-end; justify-content: center; background: #0009; backdrop-filter: blur(4px); animation: fade .15s; }
.install-sheet {
  position: relative; width: min(460px, 100%); margin: 0 10px calc(14px + env(safe-area-inset-bottom)); padding: 26px 22px 20px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; animation: install-up .3s ease-out;
}
.install-sheet .install-icon { border-radius: 14px; }
.install-sheet h2 { margin: 12px 0 14px; font-size: 19px; }
.install-sheet .install-x { position: absolute; top: 12px; right: 12px; }
.install-steps { text-align: left; margin: 0 0 18px; padding-left: 22px; display: grid; gap: 10px; font-size: 14.5px; }
.install-steps .ios-share { vertical-align: -4px; color: var(--accent); margin: 0 2px; }
.install-sheet .btn { width: 100%; justify-content: center; }
.install-arrow { position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%); font-size: 26px; color: #fff; animation: install-bounce 1.2s infinite; }
@keyframes install-bounce { 50% { transform: translate(-50%, 6px); } }
@media (min-width: 768px) { .install-arrow { display: none; } }
