/* Fondations Cineco : palette, barre du haut, chargement, transitions.
   Chargé après les styles de la page : ce fichier a le dernier mot.
   Pour changer l'ambiance de couleur, il suffit de modifier le bloc :root ci-dessous. */

/* ───── Palette « brume » : noir, blanc atténué, dégradé argent-acier ───── */
:root {
  --accent: #D9E0E7;
  --accent-ink: #0F1216;
  --grad: linear-gradient(135deg, #F1F3F6 0%, #CBD5DF 50%, #A3B3C2 100%);
  --grad-line: linear-gradient(90deg, #8795A3, #E6EBF0);
  --good: #9CCDBF;
  --good-bg: rgba(156, 205, 191, .14);
  --bad: #E5A4AE;
  --bad-bg: rgba(229, 164, 174, .13);
}
.btn.primary { background: var(--grad); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 8px 22px rgba(0, 0, 0, .28); }
.progress > div, .pbar i { background: var(--grad-line); }
.dm-send { background: var(--grad); color: var(--accent-ink); }
.dm-msg.mine .dm-bubble { background: rgba(203, 213, 223, .16); }
.prompt { color: var(--ink-2); }

/* ───── Barre du haut ───── */
#app-top { position: sticky; top: 0; z-index: 15; transition: transform .38s var(--ease), opacity .28s ease; }
#app-top::before { content: ""; position: absolute; inset: 0 0 -10px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(14, 15, 18, .88) 0%, rgba(14, 15, 18, .62) 62%, rgba(14, 15, 18, 0) 100%);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 62%, transparent); }
#app-top.away { transform: translateY(-105%); opacity: 0; pointer-events: none; }
#app-top .wrap { align-items: center; min-height: 64px; }
#app-top #count { margin-left: auto; }
body[data-bar="none"] #app-top { display: none; }
body[data-bar="back"] #brand { display: none; }
.top-btn { position: relative; flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; padding: 0; display: grid; place-items: center; color: var(--ink);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: transform .3s var(--spring), background .2s; }
.top-btn:active { transform: scale(.9); }
.top-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.top-btn .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #E5484D; box-shadow: 0 0 0 2px var(--bg); }
/* En mode « retour », la flèche de la barre remplace les anciens liens « ← … » des écrans. */
body[data-bar="back"] .view.on > a.link:first-child,
body[data-bar="back"] #c-view > section > a.link:first-child { display: none; }
body[data-bar="back"] .view.on > a.link:first-child + * { margin-top: 0; }

/* ───── Chargement : le cornet fait sauter son pop-corn ───── */
#boot.splash { transition: opacity .45s ease; }
#boot.splash.out { opacity: 0; pointer-events: none; }
#boot.splash svg { width: 96px; height: 120px; overflow: visible; animation: none; }
#boot .bucket { transform-box: fill-box; transform-origin: 50% 100%; animation: cine-shake 1.5s infinite; }
#boot .pk { transform-box: fill-box; transform-origin: center; opacity: 0; animation: cine-pop 1.5s var(--d, 0s) infinite; }
@keyframes cine-pop {
  0% { opacity: 0; transform: translate(0, 6px) scale(.5) rotate(0deg); animation-timing-function: cubic-bezier(.2, .7, .3, 1); }
  10% { opacity: 1; }
  45% { transform: translate(calc(var(--dx) * .55), var(--up, -52px)) scale(1) rotate(calc(var(--r) * .5)); animation-timing-function: cubic-bezier(.6, 0, .9, .5); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), 18px) scale(.9) rotate(var(--r)); }
}
@keyframes cine-shake {
  0%, 24%, 100% { transform: none; }
  6% { transform: scale(1.035, .965); }
  14% { transform: scale(.985, 1.02); }
}

/* ───── Transitions entre écrans ───── */
.view.enter { animation: cine-tab .3s var(--ease) backwards; }
body[data-nav="fwd"] .view.enter { animation-name: cine-fwd; }
body[data-nav="back"] .view.enter { animation-name: cine-bwd; }
@keyframes cine-tab { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cine-fwd { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes cine-bwd { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.sheet.open { animation: cine-sheet .34s var(--ease) backwards; }
@keyframes cine-sheet { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
#auth:not([hidden]) .card { animation: cine-tab .45s var(--ease) backwards; }

/* ───── Appui : léger retrait sur ce qui se touche ───── */
.set-row, .chip, .tab, .gear, .grid .cd, .ptile, .item, .chat-row, .edit-row, .fav-slot { transition: transform .3s var(--spring); }
.set-row:active, .chip:active, .grid .cd:active, .ptile:active, a.item:active, button.item:active, .chat-row:active, .fav-slot:active { transform: scale(.97); }
.tab:active, .gear:active { transform: scale(.9); }

/* ───── Connexion et création de compte ───── */
#auth { position: relative; isolation: isolate; overflow: hidden; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding-block: 24px; }
#auth .top { padding-top: 0; }
#auth .top .wrap { justify-content: center; padding-block: 0 18px; }
#auth .brand { font-size: 28px; text-shadow: 0 2px 18px rgba(0, 0, 0, .6); }
#auth main { padding-bottom: 0; }
#auth .card { max-width: 420px; margin-inline: auto; background: rgba(16, 17, 21, .62); -webkit-backdrop-filter: blur(26px) saturate(140%); backdrop-filter: blur(26px) saturate(140%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .10), inset 0 1px 0 rgba(255, 255, 255, .10); }
#auth .card > .link { justify-self: center; }
.wall { position: absolute; inset: -22% -45%; z-index: -2; display: flex; justify-content: center; align-items: flex-start; gap: 14px; transform: rotate(-16deg); opacity: 0; transition: opacity 1.4s ease; pointer-events: none; }
.wall.on { opacity: 1; }
.wall .col { flex: none; width: clamp(96px, 26vw, 150px); display: flex; flex-direction: column; gap: 14px; animation: wall-up var(--t, 70s) linear infinite; will-change: transform; }
.wall .col:nth-child(even) { margin-top: -110px; }
.wall img { display: block; flex: none; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 16px; background: #1D1E24; }
@keyframes wall-up { to { transform: translateY(calc(-50% - 7px)); } }
#auth::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 50%, rgba(14, 15, 18, .50) 0%, rgba(14, 15, 18, .74) 60%, rgba(14, 15, 18, .94) 100%); }

/* Œil pour afficher le mot de passe */
.pw { position: relative; display: block; }
.pw .field { padding-right: 52px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 50%; padding: 0; background: none; color: var(--ink-2); display: grid; place-items: center; transition: color .2s, background .2s; }
.eye:active { background: rgba(255, 255, 255, .08); }
.eye[aria-pressed="true"] { color: var(--ink); }
.eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.eye .e-off, .eye[aria-pressed="true"] .e-on { display: none; }
.eye[aria-pressed="true"] .e-off { display: block; }

/* Connexion : liens, code à 6 chiffres */
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-links .link, #auth .auth-back { font-size: 13.5px; }
#auth .card > .auth-back { justify-self: center; }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp input { width: 100%; min-width: 0; height: 58px; padding: 0; border: 0; border-radius: 16px; text-align: center; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink);
  background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); outline: none; transition: box-shadow .2s, background .2s, transform .3s var(--spring); }
.otp input:focus { background: rgba(255, 255, 255, .11); box-shadow: inset 0 0 0 2px var(--accent); transform: translateY(-2px); }
.otp.shake { animation: otp-shake .4s; }
@keyframes otp-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.dev-code { font-size: 13px; text-align: center; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); color: #D4D6DE; }
