/* HamsiFlix — compte, favoris, Surprise Aléatoire et accessibilité */
:root {
  --hf-bg: #080809;
  --hf-panel: #17171d;
  --hf-red: #f10d20;
  --hf-red-2: #c00025;
  --hf-text: #fff;
  --hf-muted: #a4a4ad;
  --hf-line: rgba(255, 255, 255, .09);
  --hf-ease: cubic-bezier(.22, .9, .25, 1);
}

/* ---------- Accessibilité ---------- */
.hf-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hf-skip {
  position: fixed; top: 10px; left: 10px; z-index: 100000; padding: 10px 16px; border-radius: 10px;
  background: var(--hf-red); color: #fff; font-weight: 700; text-decoration: none;
  transform: translateY(-160%); transition: transform .15s;
}
.hf-skip:focus { transform: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
[role="tab"]:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #fff !important; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(241, 13, 32, .75) !important;
}
#main-content:focus { outline: none; }

html.hf-large-text { font-size: 112.5%; }
html.hf-contrast { --hf-muted: #d6d6dc; --hf-line: rgba(255, 255, 255, .28); }
html.hf-contrast .text-white\/55, html.hf-contrast .text-white\/40, html.hf-contrast .text-white\/30 { color: rgba(255, 255, 255, .88) !important; }
html.hf-contrast a:not([class*="bg-"]):hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
html.hf-reduce-motion { scroll-behavior: auto !important; }
html.hf-reduce-motion *, html.hf-reduce-motion *::before, html.hf-reduce-motion *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
}

/* ---------- Toast ---------- */
.hf-toast-zone { position: fixed; left: 50%; bottom: 24px; z-index: 100001; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.hf-toast {
  padding: 12px 16px; border-radius: 12px; background: #1f1f27; color: #fff; font-size: 14px; font-weight: 600;
  border: 1px solid var(--hf-line); box-shadow: 0 16px 40px rgba(0, 0, 0, .55); pointer-events: auto; animation: hf-rise .25s var(--hf-ease) both;
}
.hf-toast a { color: #ff5a68; text-decoration: underline; margin-left: 6px; }
@keyframes hf-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Boutons ---------- */
.hf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px; background: var(--hf-red); color: #fff; font-size: 14px; font-weight: 700;
  text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s, transform .2s var(--hf-ease);
}
.hf-btn:hover { background: var(--hf-red-2); transform: translateY(-1px); }
.hf-btn[disabled] { opacity: .55; cursor: progress; transform: none; }
.hf-btn--ghost { background: rgba(255, 255, 255, .06); border-color: var(--hf-line); }
.hf-btn--ghost:hover { background: rgba(255, 255, 255, .13); }
.hf-btn--lg { min-height: 48px; padding: 0 24px; font-size: 15px; }
.hf-icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 9px; cursor: pointer;
  background: rgba(8, 8, 9, .78); color: #fff; border: 1px solid var(--hf-line); transition: background .2s;
}
.hf-icon-btn:hover { background: var(--hf-red); }

.hf-lib-btn[aria-pressed="true"] { background: rgba(241, 13, 32, .16) !important; border-color: rgba(241, 13, 32, .6) !important; color: #fff !important; }
.hf-lib-btn[data-hf-toggle="favorites"][aria-pressed="true"] svg { fill: var(--hf-red); stroke: var(--hf-red); }

/* Cœur superposé aux affiches */
.hf-card-fav {
  position: absolute; z-index: 12; left: 50%; top: 8px; width: 30px; height: 30px; margin-left: -15px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--hf-line); background: rgba(8, 8, 9, .72); color: #fff; cursor: pointer; opacity: 0;
  transition: opacity .2s, background .2s, transform .2s var(--hf-ease);
}
.zxm-card .hf-card-fav { left: 5px; top: 34px; width: 25px; height: 25px; margin: 0; }
.zenix-card:hover .hf-card-fav, .zxm-card:hover .hf-card-fav, .zenix-card:focus-within .hf-card-fav, .zxm-card:focus-within .hf-card-fav, .hf-card-fav[aria-pressed="true"] { opacity: 1; }
.hf-card-fav:hover { background: var(--hf-red); transform: scale(1.08); }
.hf-card-fav[aria-pressed="true"] svg { fill: var(--hf-red); stroke: var(--hf-red); }
.hf-card-fav[aria-pressed="true"]:hover svg { fill: #fff; stroke: #fff; }
@media (hover: none) { .hf-card-fav { opacity: 1; } }

/* Fenêtre de choix de collection */
.hf-dialog { width: min(92vw, 420px); padding: 22px; border: 1px solid var(--hf-line); border-radius: 18px; background: var(--hf-panel); color: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }
.hf-dialog::backdrop { background: rgba(4, 4, 6, .72); backdrop-filter: blur(4px); }
.hf-dialog h2 { margin: 0 0 14px; font-size: 18px; font-weight: 700; }
.hf-dialog label { display: flex; align-items: center; gap: 10px; padding: 9px 4px; font-size: 14px; cursor: pointer; }
.hf-dialog input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--hf-red); }
.hf-dialog__row { display: flex; gap: 8px; margin-top: 14px; }
.hf-dialog__row input { flex: 1; min-width: 0; }
.hf-dialog__end { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ---------- Page générée ---------- */
.hf-page { min-height: 100vh; padding: 96px clamp(16px, 4vw, 48px) 80px; background: linear-gradient(180deg, rgba(241, 13, 32, .07), transparent 340px); color: var(--hf-text); }
.hf-account, .hf-surprise { max-width: 1240px; margin: 0 auto; }
.hf-page input[type="text"], .hf-page input[type="email"], .hf-page select, .hf-dialog input[type="text"] {
  min-height: 44px; width: 100%; padding: 0 14px; border-radius: 11px; border: 1px solid var(--hf-line); background: #101016; color: #fff; font-size: 14px;
}
.hf-page select { cursor: pointer; }
.hf-page input:disabled { color: var(--hf-muted); cursor: not-allowed; }
.hf-h2 { margin: 30px 0 14px; font-family: inherit !important; font-size: 18px; font-weight: 700; letter-spacing: 0; }
.hf-h2 small { margin-left: 6px; color: var(--hf-muted); font-size: 13px; font-weight: 500; }
.hf-empty { padding: 34px 18px; border: 1px dashed var(--hf-line); border-radius: 14px; text-align: center; color: var(--hf-muted); font-size: 14px; }
.hf-note { margin: 18px 0 0; color: var(--hf-muted); font-size: 14px; }
.hf-note strong { color: #fff; }
.hf-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }

.hf-profile { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hf-profile__copy { flex: 1; min-width: 200px; }
.hf-profile h1 { margin: 0; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15; }
.hf-profile p { margin: 4px 0 0; color: var(--hf-muted); font-size: 14px; overflow-wrap: anywhere; }

.hf-avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: #fff; font-size: 18px; font-weight: 800; }
.hf-avatar--lg { width: 84px; height: 84px; font-size: 34px; flex: none; }
.hf-avatar--crimson { background: linear-gradient(135deg, #f10d20, #7d0014); }
.hf-avatar--ember { background: linear-gradient(135deg, #f97316, #9a3412); }
.hf-avatar--violet { background: linear-gradient(135deg, #8b5cf6, #4c1d95); }
.hf-avatar--ocean { background: linear-gradient(135deg, #0ea5e9, #0c4a6e); }
.hf-avatar--emerald { background: linear-gradient(135deg, #10b981, #065f46); }
.hf-avatar--gold { background: linear-gradient(135deg, #d4a017, #713f12); }
.hf-avatar--rose { background: linear-gradient(135deg, #ec4899, #831843); }
.hf-avatar--slate { background: linear-gradient(135deg, #64748b, #1e293b); }

.hf-tabs { display: flex; gap: 4px; margin: 26px 0 22px; overflow-x: auto; border-bottom: 1px solid var(--hf-line); scrollbar-width: none; }
.hf-tabs::-webkit-scrollbar { display: none; }
.hf-tabs [role="tab"] {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; background: none; border: 0;
  border-bottom: 2px solid transparent; color: var(--hf-muted); font-size: 14px; font-weight: 600; cursor: pointer; transition: color .2s, border-color .2s;
}
.hf-tabs [role="tab"]:hover { color: #fff; }
.hf-tabs [role="tab"][aria-selected="true"] { color: #fff; border-bottom-color: var(--hf-red); }
.hf-count { padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, .09); font-size: 12px; }
.hf-panel:focus-visible { outline-offset: 6px; box-shadow: none !important; }

.hf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.hf-stat { padding: 18px; border-radius: 14px; background: var(--hf-panel); }
.hf-stat strong { display: block; font-size: 28px; line-height: 1.1; }
.hf-stat span { color: var(--hf-muted); font-size: 13px; }

.hf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 16px 12px; }
@media (min-width: 768px) { .hf-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
.hf-tile { position: relative; min-width: 0; }
.hf-tile__link { display: block; color: #fff; text-decoration: none; }
.hf-tile img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; background: var(--hf-panel); transition: transform .25s var(--hf-ease); }
.hf-tile:hover img { transform: scale(1.03); }
.hf-tile__title { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hf-tile__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.hf-tile:hover .hf-tile__actions, .hf-tile:focus-within .hf-tile__actions { opacity: 1; }
@media (hover: none) { .hf-tile__actions { opacity: 1; } }

.hf-list { margin-top: 10px; }
.hf-list header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 14px; flex-wrap: wrap; }
.hf-list .hf-h2 { margin: 0; }
.hf-inline-form label, .hf-form > label:not(.hf-switch), .hf-filters label, .hf-avatars legend { display: block; margin: 0 0 6px; color: var(--hf-muted); font-size: 13px; font-weight: 600; }
.hf-inline-form > div { display: flex; gap: 8px; max-width: 520px; }
.hf-inline-form input { flex: 1; min-width: 0; }

.hf-form { max-width: 560px; margin-bottom: 18px; padding: 4px 20px 22px; border-radius: 16px; background: var(--hf-panel); }
.hf-form .hf-h2 { margin-top: 18px; }
.hf-form > input { margin-bottom: 14px; }
.hf-avatars { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; padding: 0; border: 0; }
.hf-avatars legend { padding: 0; }
.hf-avatar-opt { position: relative; cursor: pointer; }
.hf-avatar-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.hf-avatar-opt input:checked + .hf-avatar { box-shadow: 0 0 0 2px var(--hf-panel), 0 0 0 4px #fff; }
.hf-avatar-opt input:focus-visible + .hf-avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--hf-red); }
.hf-switch { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; position: relative; }
.hf-switch input { position: absolute; width: 44px; height: 24px; opacity: 0; cursor: pointer; }
.hf-switch__ui { flex: none; position: relative; width: 44px; height: 24px; border-radius: 99px; background: rgba(255, 255, 255, .18); transition: background .2s; }
.hf-switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--hf-ease); }
.hf-switch input:checked + .hf-switch__ui { background: var(--hf-red); }
.hf-switch input:checked + .hf-switch__ui::after { transform: translateX(20px); }
.hf-switch input:focus-visible + .hf-switch__ui { outline: 2px solid #fff; outline-offset: 2px; }
.hf-switch__text strong { display: block; font-size: 14px; font-weight: 600; }
.hf-switch__text small { color: var(--hf-muted); font-size: 12.5px; }

/* ---------- Surprise ---------- */
.hf-surprise__head h1 { margin: 0; font-size: clamp(28px, 4.4vw, 46px); line-height: 1.1; }
.hf-surprise__head p { margin: 8px 0 0; color: var(--hf-muted); }
.hf-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; align-items: end; margin: 26px 0; padding: 18px; border-radius: 16px; background: var(--hf-panel); }
.hf-reel { display: flex; justify-content: center; gap: 10px; overflow: hidden; padding: 12px 0; }
.hf-reel img { flex: none; width: 118px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; opacity: .3; transform: scale(.92); transition: opacity .1s, transform .1s; }
.hf-reel img.is-on { opacity: 1; transform: scale(1); box-shadow: 0 0 0 2px var(--hf-red); }
.hf-pick {
  position: relative; display: flex; gap: clamp(16px, 3vw, 32px); padding: clamp(16px, 3vw, 32px); border-radius: 20px; overflow: hidden; background: var(--hf-panel);
  animation: hf-rise .35s var(--hf-ease) both;
}
.hf-pick__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .22; }
.hf-pick::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8, 8, 9, .92), rgba(8, 8, 9, .55)); }
.hf-pick__poster, .hf-pick__copy { position: relative; z-index: 1; }
.hf-pick__poster { flex: none; width: clamp(120px, 20vw, 220px); align-self: flex-start; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .55); }
.hf-pick__copy { min-width: 0; }
.hf-pick h2 { margin: 0; font-size: clamp(22px, 3.2vw, 36px); line-height: 1.12; }
.hf-pick__meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.hf-pick__meta span { padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-size: 12px; font-weight: 600; }
.hf-pick p { margin: 0 0 18px; color: #d6d6dc; font-size: 14.5px; line-height: 1.6; }
.hf-pick__cta { display: flex; flex-wrap: wrap; gap: 8px; }
.hf-pick__count { margin-top: 12px; color: var(--hf-muted); font-size: 12.5px; }
@media (max-width: 560px) {
  .hf-pick { flex-direction: column; }
  .hf-reel img { width: 84px; }
}
