*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-deep: #070a12;
  --bg-mid: #12182a;
  --accent: #7eb8ff;
  --accent-dim: rgba(126, 184, 255, 0.35);
  --text: #e8eef8;
  --text-muted: rgba(232, 238, 248, 0.65);
  --card-bg: rgba(12, 16, 28, 0.55);
  --card-border: rgba(126, 184, 255, 0.22);
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  /* Encoches / safe areas (téléphones) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* Padding carte fluide */
  --card-pad-x: clamp(1rem, 4.2vw, 3rem);
  --card-pad-y: clamp(1.35rem, 5vw, 3.5rem);
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
.btn-discord,
.enter-btn,
.audio-toggle {
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--text);
  background: radial-gradient(120% 80% at 50% 120%, #1a1030 0%, var(--bg-deep) 45%),
    radial-gradient(ellipse 100% 60% at 20% 0%, rgba(80, 40, 120, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 80% 10%, rgba(30, 60, 120, 0.25) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

body.has-custom-cursor,
body.has-custom-cursor button,
body.has-custom-cursor a,
body.has-custom-cursor .audio-toggle {
  cursor: none;
}

.ufo-cursor {
  position: fixed;
  left: -100px;
  top: -100px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  margin-left: 0;
  margin-top: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  will-change: left, top;
  filter: drop-shadow(0 2px 6px rgba(100, 180, 255, 0.45));
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ufo-cursor.is-active {
  opacity: 1;
}

.ufo-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Logo HUMA + planète (texte dedans) qui descend du haut à côté du logo */
.huma-corner {
  position: fixed;
  top: calc(0.75rem + var(--safe-top));
  left: calc(0.75rem + var(--safe-left));
  z-index: 40;
  max-width: min(400px, calc(100vw - 2rem));
  pointer-events: auto;
  outline: none;
  overflow: visible;
}

.huma-corner__inner {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
}

.huma-corner__logo {
  display: block;
  width: min(130px, 30vw);
  height: auto;
  flex-shrink: 0;
  align-self: flex-start;
  border-radius: 0.35rem;
  transition: transform 0.22s ease, filter 0.22s ease;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5));
}

.huma-corner:hover .huma-corner__logo,
.huma-corner:focus-visible .huma-corner__logo {
  transform: scale(1.03);
  filter: drop-shadow(0 6px 20px rgba(100, 160, 255, 0.35));
}

.huma-corner__planet-track {
  position: relative;
  width: min(220px, 48vw);
  flex-shrink: 0;
  align-self: stretch;
  min-width: 0;
  pointer-events: none;
}

.huma-planet-drop {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  transform: translateY(calc(-100% - 18px));
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.33, 1.15, 0.48, 1), opacity 0.35s ease;
}

.huma-corner:hover .huma-planet-drop,
.huma-corner:focus-visible .huma-planet-drop {
  transform: translateY(0);
  opacity: 1;
}

.huma-planet-bubble {
  width: min(210px, 46vw);
  aspect-ratio: 1;
  max-height: min(72vh, 320px);
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle at 32% 28%, #fffce8 0%, #ffe566 28%, #f0b820 58%, #c49012 100%);
  box-shadow: inset 0 -12px 28px rgba(90, 50, 0, 0.2), inset 0 8px 20px rgba(255, 255, 255, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(180, 130, 30, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.75rem 2.1rem;
  position: relative;
  pointer-events: auto;
}

.huma-planet-bubble__text {
  margin: 0;
  font-size: clamp(0.58rem, 1.45vw, 0.72rem);
  line-height: 1.4;
  font-weight: 600;
  color: #152238;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  max-height: 58%;
  overflow: hidden;
  z-index: 2;
  padding: 0 0.2rem;
}

.huma-planet-bubble__pads {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  gap: 0.35rem;
  z-index: 1;
}

.huma-pad {
  width: 2.1rem;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.content {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom))
    calc(1rem + var(--safe-left));
  pointer-events: none;
}

.content > * {
  pointer-events: auto;
}

.card {
  position: relative;
  width: 100%;
  max-width: min(56rem, calc(100vw - 2rem));
  padding: var(--card-pad-y) var(--card-pad-x);
  border-radius: clamp(0.85rem, 2vw, 1.25rem);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset, 0 24px 48px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(12px);
  animation: card-in 0.9s ease 0.15s forwards;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-sizing: border-box;
}

.card.is-visible {
  animation: card-in 0.9s ease forwards;
}

@keyframes card-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-dim), transparent 40%, transparent 60%, rgba(120, 80, 200, 0.15));
  pointer-events: none;
  z-index: -1;
  opacity: 0.9;
}

.card-header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: clamp(1rem, 3.5vw, 2rem);
  margin-bottom: 0;
}

.avatar {
  width: clamp(6.5rem, 28vw, 10rem);
  height: clamp(6.5rem, 28vw, 10rem);
  flex-shrink: 0;
  align-self: flex-start;
  border-radius: 0.75rem;
  object-fit: cover;
  border: 2px solid rgba(126, 184, 255, 0.35);
  box-shadow: 0 0 20px rgba(126, 184, 255, 0.15);
  background: rgba(0, 0, 0, 0.3);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.card-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 0.15rem;
}

.name {
  margin: 0 0 0.75rem;
  font-size: clamp(1.4rem, 4.5vw + 0.4rem, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  border-right: 2px solid transparent;
  filter: drop-shadow(0 2px 10px rgba(60, 120, 200, 0.25));
}

.name__text {
  display: inline-block;
  min-width: 0;
  background: linear-gradient(
    110deg,
    #8fa8c8 0%,
    #d8e8ff 22%,
    #ffffff 38%,
    #b0cce8 48%,
    #f5f9ff 55%,
    #7eb8ff 72%,
    #a8bed8 88%,
    #e8f0f8 100%
  );
  background-size: 240% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: name-shine 4.8s ease-in-out infinite;
}

@keyframes name-shine {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.card.is-ready .name {
  opacity: 1;
  border-right: 3px solid var(--accent);
  width: 0;
  animation: typewriter-name 2.4s steps(40, end) 0.4s forwards, type-caret 0.75s step-end 3s infinite;
}

@keyframes typewriter-name {
  to {
    width: 100%;
  }
}

@keyframes type-caret {
  50% {
    border-color: transparent;
  }
}

.tagline {
  margin: 0;
  font-size: clamp(1rem, 2.8vw + 0.35rem, 1.85rem);
  font-weight: 300;
  color: var(--text-muted);
  opacity: 0;
}

.card.is-ready .tagline {
  animation: fade-up 0.6s ease 2.6s forwards;
}

/* Panneau pixel : même largeur que le reste du contenu (aligné sur la bio), centré dans le cadre */
.pixel-panel-host {
  flex: 0 0 auto;
  align-self: stretch;
  margin: 1.75rem 0 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  opacity: 0;
}

.card.is-ready .pixel-panel-host {
  animation: fade-up 0.55s ease 2.85s forwards;
}

.pixel-panel-host[hidden] {
  display: none !important;
}

.pixel-panel {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  border-radius: 0.45rem;
  padding: 1.1rem 1.25rem;
  min-height: 5.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(8, 12, 28, 0.72) 0%, rgba(4, 8, 20, 0.9) 100%);
  border: 1px solid rgba(126, 184, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.pixel-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.1) 2px,
    rgba(0, 0, 0, 0.1) 3px
  );
  opacity: 0.4;
  z-index: 1;
}

.pixel-panel__line {
  position: relative;
  z-index: 2;
  margin: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 0.55em 0.95em;
  font-family: var(--font-pixel);
  font-size: clamp(0.62rem, 1.65vw, 0.95rem);
  line-height: 1.65;
  letter-spacing: 0.04em;
  word-spacing: 0.15em;
  color: #d8f0ff;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.85), 0 0 18px rgba(126, 184, 255, 0.45),
    2px 3px 0 rgba(15, 35, 70, 0.95);
  filter: contrast(1.05);
}

.pixel-panel__word {
  display: inline-flex;
  white-space: nowrap;
}

.pixel-panel__char {
  display: inline-block;
  position: relative;
}

/* Repos : lisible, pas d’animation infinie */
.pixel-panel__char::after {
  content: attr(data-ch);
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  color: #ff7eb0;
  pointer-events: none;
  z-index: -1;
}

/* Sortie : décomposition pixel */
.pixel-panel__line.is-exiting .pixel-panel__char {
  animation: pixel-panel-char-out 0.32s steps(2, end) forwards;
  animation-delay: calc((var(--max-ci) - var(--ci)) * 18ms);
}

.pixel-panel__line.is-exiting .pixel-panel__char::after {
  opacity: 0.45;
  animation: pixel-panel-ghost-out 0.32s steps(2, end) forwards;
  animation-delay: calc((var(--max-ci) - var(--ci)) * 16ms);
}

/* Entrée : apparition glitch */
.pixel-panel__line.is-entering .pixel-panel__char {
  animation: pixel-panel-char-in 0.48s steps(4, end) forwards;
  animation-delay: calc(var(--ci) * 22ms);
}

.pixel-panel__line.is-entering .pixel-panel__char::after {
  opacity: 0.5;
  animation: pixel-panel-ghost-in 0.48s steps(3, end) forwards;
  animation-delay: calc(var(--ci) * 20ms);
}

@keyframes pixel-panel-char-in {
  0% {
    transform: translate(3px, 4px) scale(0.85);
    opacity: 0;
    filter: blur(1px);
  }
  40% {
    transform: translate(-2px, -1px);
    opacity: 0.85;
    filter: drop-shadow(3px 0 0 rgba(120, 200, 255, 0.6));
  }
  75% {
    transform: translate(1px, 1px);
    opacity: 0.95;
    filter: drop-shadow(-2px 0 0 rgba(255, 120, 180, 0.35));
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
    filter: none;
  }
}

@keyframes pixel-panel-ghost-in {
  0% {
    transform: translate(6px, 4px);
    opacity: 0.6;
  }
  100% {
    transform: translate(2px, 1px);
    opacity: 0;
  }
}

@keyframes pixel-panel-char-out {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  45% {
    transform: translate(-3px, 3px);
    opacity: 0.55;
    filter: drop-shadow(2px -2px 0 rgba(255, 100, 160, 0.5));
  }
  100% {
    transform: translate(2px, -4px);
    opacity: 0;
    filter: blur(1px);
  }
}

@keyframes pixel-panel-ghost-out {
  0% {
    opacity: 0.4;
    transform: translate(2px, 1px);
  }
  100% {
    opacity: 0;
    transform: translate(-4px, 3px);
  }
}

/* ---------- Tablette (paysage / medium) ---------- */
@media (max-width: 1024px) {
  .card-header {
    gap: 1.35rem;
  }

  .huma-corner {
    max-width: min(360px, calc(100vw - 1.5rem - var(--safe-left) - var(--safe-right)));
  }
}

/* ---------- Téléphone & petites largeurs ---------- */
@media (max-width: 640px) {
  .content {
    padding: calc(0.65rem + var(--safe-top)) calc(0.65rem + var(--safe-right)) calc(0.85rem + var(--safe-bottom))
      calc(0.65rem + var(--safe-left));
    align-items: flex-start;
    padding-top: calc(5.5rem + var(--safe-top));
  }

  .card {
    max-width: 100%;
  }

  .card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .card-titles {
    width: 100%;
    align-items: center;
  }

  .name {
    white-space: normal;
    max-width: 100%;
  }

  .card.is-ready .name {
    width: auto;
    border-right: none;
    animation: fade-up 0.6s ease 0.4s forwards;
  }

  .pixel-panel {
    padding: 0.85rem 0.75rem;
    min-height: 4rem;
  }

  .pixel-panel__line {
    font-size: clamp(0.48rem, 3.4vw, 0.72rem);
    gap: 0.45em 0.65em;
  }

  .links {
    padding: 0 0.15rem;
  }

  .btn-discord {
    width: 100%;
    max-width: 22rem;
    min-height: 48px;
    box-sizing: border-box;
  }

  .huma-corner {
    top: calc(0.5rem + var(--safe-top));
    left: calc(0.5rem + var(--safe-left));
    max-width: calc(100vw - 1rem - var(--safe-left) - var(--safe-right));
  }

  .huma-corner__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .huma-corner__logo {
    width: min(115px, 42vw);
  }

  .huma-corner__planet-track {
    width: min(240px, calc(100vw - 2rem - var(--safe-left) - var(--safe-right)));
    margin-top: 0.35rem;
    align-self: stretch;
    min-height: min(175px, 46vw);
  }

  .huma-planet-bubble {
    width: min(200px, 78vw);
  }

  .huma-planet-bubble__text {
    font-size: clamp(0.52rem, 2.8vw, 0.68rem);
  }
}

/* Écrans tactiles : zones de clic confortables */
@media (pointer: coarse) {
  .btn-discord {
    min-height: 48px;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .audio-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  .enter-btn {
    min-height: 48px;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Petit écran en paysage (téléphone) */
@media (max-height: 520px) and (orientation: landscape) {
  .content {
    padding-top: calc(3.5rem + var(--safe-top));
    align-items: center;
  }

  .card {
    --card-pad-y: clamp(0.85rem, 3vh, 1.5rem);
  }

  .avatar {
    width: clamp(4.5rem, 22vh, 7rem);
    height: clamp(4.5rem, 22vh, 7rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pixel-panel__line.is-exiting .pixel-panel__char,
  .pixel-panel__line.is-entering .pixel-panel__char,
  .pixel-panel__line.is-exiting .pixel-panel__char::after,
  .pixel-panel__line.is-entering .pixel-panel__char::after {
    animation: none !important;
  }

  .huma-planet-drop {
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
}

.bio {
  margin: 2rem 0 2.5rem;
  font-size: clamp(1rem, 2.6vw + 0.4rem, 1.85rem);
  line-height: 1.55;
  color: var(--text-muted);
  opacity: 0;
}

.card.is-ready .bio {
  animation: fade-up 0.6s ease 2.9s forwards;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  opacity: 0;
  justify-content: center;
  width: 100%;
}

.card.is-ready .links {
  animation: fade-up 0.6s ease 3.2s forwards;
}

.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.65rem, 2vw, 1.1rem);
  padding: clamp(0.95rem, 2.5vw, 1.2rem) clamp(1.5rem, 5vw, 2.75rem);
  min-height: 2.75rem;
  font-size: clamp(1.1rem, 3.5vw + 0.3rem, 1.9rem);
  max-width: 100%;
  font-weight: 600;
  font-family: var(--font-sans);
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.85rem;
  background: linear-gradient(180deg, #7289da 0%, #5865f2 55%, #4752c4 100%);
  box-shadow: 0 8px 28px rgba(88, 101, 242, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-discord:hover,
.btn-discord:focus-visible {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 36px rgba(88, 101, 242, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  filter: brightness(1.06);
}

.btn-discord__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.65s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.btn-discord:hover .btn-discord__icon,
.btn-discord:focus-visible .btn-discord__icon {
  transform: rotate(360deg);
}

.btn-discord__svg {
  display: block;
  width: clamp(1.85rem, 6vw, 2.5rem);
  height: clamp(1.85rem, 6vw, 2.5rem);
}

.btn-discord__label {
  letter-spacing: 0.03em;
}

.enter-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: radial-gradient(circle at 50% 50%, rgba(15, 20, 40, 0.92) 0%, rgba(4, 6, 12, 0.97) 100%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.enter-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.enter-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.enter-btn {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 2.8vw, 0.95rem);
  font-weight: 600;
  padding: 0.85rem 1.75rem;
  min-height: 44px;
  color: var(--bg-deep);
  background: linear-gradient(180deg, #b8d8ff 0%, var(--accent) 100%);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(126, 184, 255, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}

.enter-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 32px rgba(126, 184, 255, 0.45);
}

.audio-toggle {
  position: fixed;
  bottom: calc(1rem + var(--safe-bottom));
  right: calc(1rem + var(--safe-right));
  z-index: 5;
  width: clamp(3rem, 10vw, 3.5rem);
  height: clamp(3rem, 10vw, 3.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--accent);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: opacity 0.2s, background 0.2s;
}

.audio-toggle:hover {
  background: rgba(126, 184, 255, 0.12);
}

.audio-toggle[aria-pressed="true"] {
  opacity: 0.6;
}

.audio-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

