:root {
  --accent: #ffffff;
  --text: #ffffff;
  --bgc: #000000;
  --icon: #ffffff;
  --card-bg: transparent;
  --card-blur: 0px;
  --glow: 0 0 12px var(--accent);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bgc);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- Arrière-plan ---------- */
#bg { position: fixed; inset: 0; z-index: 0; background-size: cover; background-position: center; }
#bg video, #bg canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
#bg canvas { animation: bgIn 1.2s ease both; }
@keyframes bgIn { from { opacity: 0; } to { opacity: 1; } }
#bg.blurred { transform: scale(1.05); }
#fx { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#fxOverlay { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.ov { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ov-back { z-index: 3; }
.ov-front { z-index: 45; }
#fxOverlay.nuit { background: rgba(0, 0, 0, .45); }
#fxOverlay.tv {
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px);
  animation: flicker .15s infinite alternate;
}
#fxOverlay.tv::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65));
}
@keyframes flicker { from { opacity: .85; } to { opacity: 1; } }

/* ---------- Écran d'entrée ---------- */
.enter {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  cursor: pointer; transition: opacity .6s ease;
}
.enter.gone { opacity: 0; pointer-events: none; }
.enter-text { font-size: 18px; font-weight: 600; letter-spacing: .02em; color: #fff; text-shadow: 0 0 10px rgba(255,255,255,.5); }
.caret { animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Volume ---------- */
.vol {
  position: fixed; top: 16px; left: 16px; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  height: 58px; min-width: 58px; padding: 0 17px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 12px;
  background: rgba(70,70,70,.55); color: #fff; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .2s;
}
.vol:hover { background: rgba(90,90,90,.7); }
.vol-ico { width: 24px; height: 24px; display: grid; }
.vol-ico svg { width: 24px; height: 24px; }
.vol input { width: 0; opacity: 0; transition: width .25s, opacity .25s; accent-color: #fff; cursor: pointer; }
.vol:hover input, .vol:focus-within input { width: 110px; opacity: 1; }

/* ---------- Carte ---------- */
.wrap {
  position: relative; z-index: 10;
  min-height: 100%; display: grid; place-items: center;
  padding: 24px 16px; perspective: 1200px;
}
.card {
  position: relative;
  width: min(720px, 100%);
  padding: 40px 32px 48px;
  border-radius: 22px;
  background: var(--card-bg);
  backdrop-filter: blur(var(--card-blur)); -webkit-backdrop-filter: blur(var(--card-blur));
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: transform .15s ease-out;
  transform-style: preserve-3d;
  opacity: 0; transform: translateY(14px);
}
.card.show { opacity: 1; transform: none; transition: opacity .8s ease, transform .8s ease; }
.card.draggable { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.card.draggable a, .card.draggable button { cursor: pointer; }
.card.grabbing { cursor: grabbing; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.card img { -webkit-user-drag: none; user-select: none; }
.card.bordered { border: 1px solid rgba(255,255,255,.08); box-shadow: 0 20px 60px rgba(0,0,0,.35); }

.avatar-wrap { position: relative; width: 124px; height: 124px; margin-bottom: 14px; }
.avatar { width: 124px; height: 124px; border-radius: 50%; object-fit: cover; display: block; background: rgba(255,255,255,.06); }
.deco { position: absolute; inset: -14%; width: 128%; height: 128%; pointer-events: none; }

.name {
  position: relative;
  font-size: 40px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15;
  color: var(--text);
}
.name.glow { text-shadow: var(--glow); }
.name.rainbow {
  background: linear-gradient(90deg, #ff4d4d, #ffb84d, #fff94d, #4dff88, #4dd2ff, #9b4dff, #ff4d4d);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rainbow 4s linear infinite; text-shadow: none;
}
.name.rainbow.glow { filter: drop-shadow(0 0 8px rgba(255,255,255,.35)); }
@keyframes rainbow { to { background-position: 200% 0; } }
.name .tcaret { animation: blink 1s steps(1) infinite; font-weight: 400; }
.name.glitch::before, .name.glitch::after {
  content: attr(data-text); position: absolute; inset: 0; overflow: hidden;
}
.name.glitch::before { color: #0ff; left: 2px; animation: glitchA 2.2s infinite linear alternate-reverse; mix-blend-mode: screen; }
.name.glitch::after { color: #f0f; left: -2px; animation: glitchB 1.8s infinite linear alternate-reverse; mix-blend-mode: screen; }
@keyframes glitchA {
  0% { clip-path: inset(10% 0 80% 0); } 20% { clip-path: inset(60% 0 10% 0); } 40% { clip-path: inset(30% 0 50% 0); }
  60% { clip-path: inset(80% 0 5% 0); } 80% { clip-path: inset(5% 0 70% 0); } 100% { clip-path: inset(45% 0 35% 0); }
}
@keyframes glitchB {
  0% { clip-path: inset(70% 0 10% 0); } 25% { clip-path: inset(15% 0 60% 0); } 50% { clip-path: inset(50% 0 30% 0); }
  75% { clip-path: inset(5% 0 85% 0); } 100% { clip-path: inset(35% 0 45% 0); }
}
.sparkle {
  position: absolute; pointer-events: none; width: 12px; height: 12px; color: var(--accent);
  animation: spark 1.1s ease-out forwards;
}
.sparkle svg { width: 100%; height: 100%; fill: currentColor; stroke: none; }
@keyframes spark { 0% { transform: scale(0) rotate(0); opacity: 1; } 60% { opacity: 1; } 100% { transform: scale(1.2) rotate(90deg); opacity: 0; } }

.badges { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.badges:empty { display: none; }
.badge { position: relative; width: 24px; height: 24px; color: var(--accent); display: grid; }
.badge svg { width: 24px; height: 24px; }
.badge.glow svg { filter: drop-shadow(0 0 5px var(--accent)); }
.badge[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 7px;
  background: rgba(0,0,0,.8); color: #fff;
}

.desc { margin-top: 12px; font-size: 18px; font-weight: 600; opacity: .95; max-width: 520px; white-space: pre-line; word-break: break-word; }
.desc:empty { display: none; }
.location { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; opacity: .8; }
.location svg { width: 16px; height: 16px; }

.box { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid rgba(255,255,255,.08); }
.swap .box { background: var(--text); color: var(--bgc); border-color: transparent; }

.discord {
  margin-top: 22px; width: min(420px, 100%);
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-align: left;
}
.discord .dav { position: relative; width: 52px; height: 52px; flex: none; }
.discord .dav img { width: 52px; height: 52px; border-radius: 50%; display: block; }
.discord .dot { position: absolute; right: -1px; bottom: -1px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid #111; }
.discord .dwrap { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; color: inherit; text-decoration: none; cursor: pointer; }
.discord .dtxt { min-width: 0; }
.discord .dwrap:hover .dn { text-decoration: underline; }
.discord .dn { font-weight: 700; font-size: 15px; }
.discord .ds { font-size: 13px; opacity: .75; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }

.links { margin-top: 26px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.links:empty { display: none; }
.lnk {
  width: 36px; height: 36px; display: grid; place-items: center; color: var(--icon);
  transition: transform .2s ease; cursor: pointer; background: none; border: 0;
}
.lnk:hover { transform: translateY(-3px) scale(1.08); }
.lnk .ico { width: 30px; height: 30px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.lnk svg { width: 30px; height: 30px; }
.lnk.glow .ico, .lnk.glow svg { filter: drop-shadow(0 0 6px currentColor); }
.lnk.custom { width: auto; min-width: 36px; }
.lnk.custom img { height: 34px; max-width: 72px; object-fit: contain; display: block; }
.lnk.custom.glow img { filter: drop-shadow(0 0 6px var(--accent)); }
.card.compact .lnk.custom img { height: 28px; }

.views {
  position: absolute; left: 32px; bottom: 16px;
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600;
}
.views svg { width: 18px; height: 18px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px); z-index: 60;
  padding: 10px 16px; border-radius: 10px; background: rgba(20,20,20,.9); color: #fff; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Filtre du fond ---------- */
#bg { filter: var(--bgf, none); }

/* ---------- Blocs (Discord + lecteur) ---------- */
.boxes { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.boxes:not(:has(> :not(.hidden))) { display: none; }
.player {
  margin-top: 12px; width: min(420px, 100%);
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-align: left;
}
.pl-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--text); color: var(--bgc); display: grid; place-items: center; cursor: pointer; transition: transform .2s; }
.pl-btn:hover { transform: scale(1.08); }
.pl-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.swap .pl-btn { background: var(--bgc); color: var(--text); }
.pl-info { flex: 1; min-width: 0; }
.pl-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-artist { font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-artist:empty { display: none; }
.pl-bar { position: relative; height: 4px; border-radius: 4px; background: rgba(127,127,127,.35); margin-top: 8px; cursor: pointer; }
.pl-bar span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--accent); }
.pl-time { display: flex; justify-content: space-between; font-size: 11px; opacity: .65; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Mise en page compacte ---------- */
.card.compact {
  width: min(580px, 100%); padding: 26px 26px 42px;
  display: grid; grid-template-columns: auto 1fr; column-gap: 16px; row-gap: 3px;
  align-items: center; justify-items: start; text-align: left;
}
.card.compact .avatar-wrap { grid-row: span 3; width: 86px; height: 86px; margin: 0; }
.card.compact .avatar { width: 86px; height: 86px; }
.card.compact .name, .card.compact .badges, .card.compact .desc { grid-column: 2; }
.card.compact .name { font-size: 28px; }
.card.compact .badges { justify-content: flex-start; margin-top: 2px; }
.card.compact .badge, .card.compact .badge svg { width: 19px; height: 19px; }
.card.compact .desc { font-size: 14px; font-weight: 500; opacity: .8; margin-top: 2px; }
.card.compact .location, .card.compact .boxes, .card.compact .links { grid-column: 1 / -1; }
.card.compact .location { margin-top: 8px; }
.card.compact .boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 16px; }
.card.compact .boxes:not(:has(> :not(.hidden))) { display: none; }
.card.compact .discord, .card.compact .player { margin-top: 0; width: auto; padding: 10px 12px; }
.card.compact .discord .dav, .card.compact .discord .dav img { width: 42px; height: 42px; }
.card.compact .links { justify-self: center; margin-top: 16px; gap: 10px; }
.card.compact .lnk { width: 28px; height: 28px; }
.card.compact .lnk .ico, .card.compact .lnk svg { width: 22px; height: 22px; }
.card.compact .views { left: 26px; bottom: 13px; font-size: 12px; }
@media (max-width: 560px) {
  .card.compact { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .card.compact .avatar-wrap { grid-row: auto; }
  .card.compact .name, .card.compact .badges, .card.compact .desc { grid-column: 1; }
  .card.compact .badges { justify-content: center; }
}

/* ---------- Animations du profil ---------- */
.anim .card:not(.show) .a-in { opacity: 0; }
.anim .card.show .a-in { animation: rise .8s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 110ms + 150ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.anim .card.show .avatar-wrap { animation: rise .8s cubic-bezier(.2,.8,.2,1) both .1s, float 6s ease-in-out infinite 1s; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }

.ring {
  position: absolute; inset: -6px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, var(--accent), transparent 30%, var(--accent) 55%, transparent 80%, var(--accent));
  filter: blur(3px); animation: spin 4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.anim .card.show .name.glow:not(.rainbow) {
  animation: rise .8s cubic-bezier(.2,.8,.2,1) both calc(var(--i, 0) * 110ms + 150ms), glowPulse 3s ease-in-out infinite 1.2s;
}
@keyframes glowPulse { 0%, 100% { text-shadow: 0 0 8px var(--accent); } 50% { text-shadow: 0 0 22px var(--accent), 0 0 4px var(--accent); } }

.anim .card.show .badge { animation: pop .5s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--j, 0) * 80ms + 500ms); }
.badge:hover { animation: wiggle .5s ease !important; }
@keyframes pop { from { opacity: 0; scale: 0; rotate: -30deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes wiggle { 25% { transform: rotate(-14deg) scale(1.15); } 75% { transform: rotate(14deg) scale(1.15); } }

.anim .card.show .lnk { animation: pop .55s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--j, 0) * 70ms + 750ms); }
.anim .card.show .links.floaty .lnk { animation: pop .55s cubic-bezier(.3,1.6,.5,1) both calc(var(--j, 0) * 70ms + 750ms), bob 3.2s ease-in-out infinite calc(var(--j, 0) * 250ms + 1.6s); }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.lnk:hover { transform: translateY(-4px) scale(1.15) rotate(-6deg); }

.discord .dot.online { animation: dotPulse 2s ease-out infinite; }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 rgba(35,165,90,.7); } 100% { box-shadow: 0 0 0 10px rgba(35,165,90,0); } }
.discord .dav img { transition: transform .3s; }
.discord:hover .dav img { transform: scale(1.06) rotate(-4deg); }
.discord { transition: transform .25s, background .25s; }
.discord:hover { transform: translateY(-2px); }

/* Petit flash quand le profil est mis à jour en direct */
.flash { animation: flash .6s ease; }
@keyframes flash { 0% { filter: brightness(1.8) blur(1px); } 100% { filter: none; } }

.desc .tcaret { animation: blink 1s steps(1) infinite; font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
  .anim .a-in, .anim .card.show .a-in, .anim .card.show .avatar-wrap, .anim .card.show .lnk, .anim .card.show .badge { animation: none !important; opacity: 1; }
}

@media (max-width: 560px) {
  .card { padding: 32px 18px 50px; }
  .name { font-size: 32px; }
  .desc { font-size: 16px; }
  .views { left: 18px; }
  .vol { height: 48px; min-width: 48px; padding: 0 12px; }
}
