@font-face { font-family: Creepster; src: url(/fonts/creepster.woff2) format('woff2'); font-display: swap; }

:root {
  --bg: #0b0b0f; --card: #17171e; --card2: #20202a; --cream: #f3e9d2; --muted: #a79f8f;
  --orange: #ff7518; --blood: #b3001b; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--cream);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
  background-image: radial-gradient(ellipse at 50% 0%, #2a1206 0%, transparent 55%),
                    radial-gradient(ellipse at 50% 120%, #2b0007 0%, transparent 50%);
  background-attachment: fixed;
}
body::after { /* vignettage */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65) 100%);
}
.mist { position: fixed; inset: -20% -50%; pointer-events: none; z-index: 0; opacity: .5;
  background: radial-gradient(40% 20% at 30% 70%, rgba(255,255,255,.07), transparent),
              radial-gradient(35% 18% at 70% 40%, rgba(255,255,255,.06), transparent),
              radial-gradient(45% 22% at 50% 90%, rgba(255,255,255,.05), transparent);
  animation: drift 40s linear infinite alternate; }
@keyframes drift { to { transform: translateX(25%); } }

.site-top, main, footer { position: relative; z-index: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 0 14px; }
.site-top { padding-top: 18px; text-align: center; }
h1, h2, .rank, .badge { font-family: Creepster, 'Impact', system-ui, sans-serif; font-weight: 400; letter-spacing: .03em; }
h1 { margin: 0 0 6px; font-size: 2.6rem; color: var(--orange); line-height: 1; text-shadow: 0 0 14px rgba(255,117,24,.45); animation: flicker 6s infinite; }
h1 small { display: block; font-size: 1.2rem; color: var(--cream); text-shadow: none; margin-top: 4px; }
@keyframes flicker { 0%,92%,100% { opacity: 1; } 93% { opacity: .55; } 95% { opacity: 1; } 97% { opacity: .7; } }
h2 { color: var(--orange); font-size: 1.8rem; margin: 18px 0 8px; text-align: center; }
main { flex: 1; padding-bottom: 24px; }
footer { padding: 14px; color: var(--muted); font-size: .75rem; text-align: center; }
.center { text-align: center; }
.muted { color: var(--muted); }
.error { color: #ff6b6b; text-align: center; }

button, .btn { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 14px 18px; min-height: 48px;
  background: var(--card2); color: var(--cream); -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.primary { background: var(--orange); color: #1a0a00; font-weight: 700; }
.danger { background: var(--blood); color: #fff; }
.block { display: block; width: 100%; }
.ghost { background: transparent; border: 1px solid #3a3a46; }

/* choix du prénom */
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.names button { font-size: 1.1rem; }
.names button[disabled] { opacity: .4; }

/* cartes de classement */
.hint { text-align: center; color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
#list { list-style: none; margin: 0 0 90px; padding: 0; }
.film { display: grid; grid-template-columns: 78px 1fr; gap: 10px; background: var(--card); border-radius: var(--radius);
  padding: 10px; margin-bottom: 10px; position: relative; border: 1px solid #25252f; }
.film .rank { position: absolute; left: 4px; top: -2px; font-size: 2.6rem; line-height: 1; color: var(--orange);
  text-shadow: 0 2px 6px #000, 0 0 3px #000; z-index: 2; }
.poster { aspect-ratio: 2 / 3; width: 100%; border-radius: 8px; object-fit: cover; background: #111; display: block; }
.ph { aspect-ratio: 2 / 3; width: 100%; border-radius: 8px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 6px; gap: 4px; font-size: .62rem; line-height: 1.15;
  background: linear-gradient(160deg, #2b1206, #12060a 70%); color: var(--cream); }
.ph b { font-size: 1.9rem; }
.film h3 { margin: 0 0 2px; font-size: 1.05rem; padding-left: 0; }
.meta { color: var(--muted); font-size: .8rem; margin-bottom: 4px; }
.syn { font-size: .85rem; margin: 0 0 4px; }
.forwho { font-size: .82rem; color: var(--orange); margin: 0; }
.warn { background: var(--blood); color: #fff; border-radius: 8px; padding: 4px 8px; font-size: .78rem; margin: 6px 0 0; }
.ctrl { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.ctrl button { padding: 0; width: 48px; font-size: 1.1rem; }
.handle { flex: 1; text-align: center; color: var(--muted); font-size: 1.3rem; cursor: grab; touch-action: none;
  min-height: 48px; display: flex; align-items: center; justify-content: center; background: var(--card2); border-radius: 12px; user-select: none; }
.sortable-chosen { box-shadow: 0 10px 28px rgba(0,0,0,.8), 0 0 0 2px var(--orange); transform: scale(1.02); z-index: 3; }
.sortable-ghost { opacity: .35; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, #0b0b0f 40%); }
.bar button { max-width: 612px; margin: 0 auto; display: block; width: 100%; }

/* attente */
.wait { list-style: none; padding: 0; margin: 14px 0; }
.wait li { background: var(--card); border-radius: 10px; padding: 10px 14px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.progress { height: 10px; background: var(--card2); border-radius: 6px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--orange); transition: width .5s; }

/* modale */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal .box { background: var(--card); border: 1px solid var(--orange); border-radius: var(--radius); padding: 20px; max-width: 360px; width: 100%; }
.modal p { margin: 0 0 16px; }
.modal .row { display: flex; gap: 10px; }
.modal .row button { flex: 1; }

/* résultats */
.res { display: grid; grid-template-columns: 54px 1fr; gap: 10px; background: var(--card); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; align-items: center; }
.res .num { font-family: Creepster, Impact, sans-serif; font-size: 2rem; color: var(--orange); text-align: center; line-height: 1; }
.res .num small { display: block; font-family: system-ui, sans-serif; font-size: .6rem; color: var(--muted); }
.res .body { display: flex; gap: 10px; align-items: center; }
.res .body > :first-child { width: 56px; flex: none; }
.res h3 { margin: 0; font-size: 1rem; }
.res .stats { font-size: .8rem; color: var(--muted); }
.res.top { display: block; text-align: center; border: 2px solid var(--orange); padding: 14px; margin: 14px 0; position: static; max-width: none; background: var(--card); }
.res.top .num { display: none; }
.res.top .body { flex-direction: column; }
.res.top .body > :first-child { width: 62%; max-width: 260px; }
.res.top h3 { font-size: 1.3rem; }
.res.top.first { border-color: var(--blood); box-shadow: 0 0 24px rgba(179,0,27,.5); }
.badge { display: inline-block; background: var(--blood); color: #fff; padding: 2px 14px; border-radius: 8px; font-size: 1.4rem; margin-bottom: 6px; }
.hide { visibility: hidden; opacity: 0; }
.appear { animation: pop .6s ease-out both; }
.appear.top { animation: pop .6s ease-out both, shake .7s .3s; }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-8px) rotate(-1deg); } 40% { transform: translateX(8px) rotate(1deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.flash { position: fixed; inset: 0; background: var(--blood); opacity: 0; pointer-events: none; z-index: 15; animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .65; } 100% { opacity: 0; } }
details { background: var(--card); border-radius: var(--radius); padding: 10px 14px; margin: 14px 0; }
summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; margin-top: 8px; }
th, td { padding: 6px 8px; text-align: center; border-bottom: 1px solid #25252f; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }
.legend { font-size: .78rem; color: var(--muted); columns: 2; margin-top: 8px; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; }
.tools button { flex: 1; }

@media (min-width: 480px) { .film { grid-template-columns: 110px 1fr; } .film .rank { font-size: 3.2rem; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
