/* Charte kamkod.com : papier, encre, vert citron ; Geist (titres), Inter (texte), JetBrains Mono (repères). */
:root {
  --bg: #f7f7f4;
  --card: #ffffff;
  --text: #0e1013;
  --muted: #5e6169;
  --line: #d5d8d1;
  --soft: #eeefea;
  --accent: #cff24a;
  --accent-text: #0e1013;
  --link: #0e1013;
  --rec: #e5484d;
  --ok: #2f8f5b;
  --radius: 20px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-head: "Geist", "Inter", -apple-system, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --card: #1a1d22;
    --text: #f7f7f4;
    --muted: #a9aeb6;
    --line: #2a2e35;
    --soft: #23272d;
    --link: #cff24a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-body);
}
main { max-width: 880px; margin: 0 auto; padding: 32px 16px 64px; }
h1, h2, .title-input { font-family: var(--font-head); letter-spacing: -0.02em; }
h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grow { flex: 1 1 220px; }
label { display: flex; gap: 8px; align-items: center; }
input[type="text"], select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:disabled { opacity: .45; cursor: default; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
button.danger { background: var(--rec); color: #fff; border-color: transparent; }
.status { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.rec { background: var(--rec); animation: pulse 1.2s infinite; }
.dot.ok { background: var(--ok); }
@keyframes pulse { 50% { opacity: .3; } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.link { word-break: break-all; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
ul.list li:first-child { border-top: 0; }
a { color: var(--link); text-underline-offset: 3px; }
.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { display: block; width: 100%; max-height: 70vh; background: #000; }
.transcript { max-height: 320px; overflow: auto; }
.transcript p { margin: 0; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.transcript p:hover { background: var(--bg); }
.transcript p.active { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.transcript time { color: var(--muted); font-family: var(--font-mono); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.title-input { font-size: 26px; font-weight: 800; border: 0; background: transparent; padding: 0; width: 100%; color: inherit; }
.title-input:focus { outline: 2px solid var(--accent); border-radius: 4px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--text); width: 0; transition: width .3s; }

/* ---------- Bibliothèque « Mes vidéos » ---------- */
body.lib { display: flex; min-height: 100vh; }
.side {
  width: 232px; flex: none; border-right: 1px solid var(--line); background: var(--card);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: inline-flex; align-items: center; gap: 9px; padding: 0 8px 18px; color: var(--text); text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand .wm { font-family: var(--font-head); font-weight: 800; font-size: 20px; letter-spacing: -1px; }
.brand .wm i { font-style: normal; color: var(--muted); }
.brand .tag { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent); color: var(--accent-text); padding: 2px 7px; border-radius: 999px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin: -8px 0 22px; }
.topbar .brand { padding: 0; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
#folders { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.fitem {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; border: 1px dashed transparent;
}
.fitem svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; opacity: .75; }
.fitem:hover { background: var(--bg); }
.fitem.active { background: var(--soft); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.fitem.drop { border-color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcount { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fsep { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.newfolder { margin-top: 8px; justify-content: flex-start; border: 0; background: transparent; color: var(--muted); font-weight: 500; padding: 7px 10px; border-radius: 8px; }
.newfolder:hover { background: var(--bg); color: var(--text); }

.libmain { flex: 1; min-width: 0; padding: 28px 32px 64px; max-width: none; margin: 0; }
.libhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.libhead h1 { font-size: 30px; letter-spacing: -1px; }
.libhead p { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px 18px; }

.vcard { position: relative; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.vcard:hover { box-shadow: 0 6px 22px rgb(0 0 0 / .10); }
.vcard.dragging { opacity: .45; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #1b1b1f; overflow: hidden; }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb video { opacity: 0; transition: opacity .15s; }
.thumb.playing video { opacity: 1; }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgb(14 16 19 / .78); color: #f7f7f4; font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.thumb .state { position: absolute; inset: 0; display: grid; place-items: center; color: #d6d6dc; font-size: 13px; padding: 12px; text-align: center; }
.actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity .12s; }
.vcard:hover .actions, .vcard:focus-within .actions { opacity: 1; }
.ibtn { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 8px; background: rgb(255 255 255 / .94); color: #1d1d1b; border: 0; box-shadow: 0 1px 4px rgb(0 0 0 / .25); }
.ibtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ibtn:hover { background: var(--accent); color: #0e1013; }
.ibtn.warn:hover { color: var(--rec); }
.vmeta { padding: 10px 12px 12px; }
.vtitle { display: block; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtitle:hover { text-decoration: underline; }

.menu { position: absolute; z-index: 20; min-width: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgb(0 0 0 / .18); padding: 6px; display: flex; flex-direction: column; }
.menu .mtitle { font-size: 12px; color: var(--muted); padding: 4px 10px 6px; }
.menu button { border: 0; border-radius: 6px; background: transparent; font-weight: 500; justify-content: flex-start; padding: 7px 10px; }
.menu button:hover { background: var(--bg); }
.menu button.current { font-weight: 700; }
.menu button.current::after { content: '✓'; margin-left: auto; }
.menu button.new { color: var(--muted); border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; margin-top: 4px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #0e1013; color: #f7f7f4; box-shadow: inset 0 0 0 1px #2a2e35; padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 30; box-shadow: 0 6px 20px rgb(0 0 0 / .25); }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
dialog h2 { font-size: 17px; margin: 0 0 8px; overflow-wrap: anywhere; }
dialog p { margin: 0 0 18px; }
dialog input[type="text"] { margin: 6px 0 18px; }
.row.end { justify-content: flex-end; }
@media (max-width: 720px) {
  body.lib { flex-direction: column; }
  .side { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .libmain { padding: 20px 16px 48px; }
}
.recdot { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); display: inline-block; }
