/* Netflix-style profile gate — LMDS+ */
html.lmds-nf-gate,
html.lmds-nf-gate body {
  overflow: hidden !important;
  background: #000 !important;
  background-color: #000 !important;
  background-image: none !important;
}

html.lmds-nf-gate #rootMountPoint,
html.lmds-nf-gate .chrome,
html.lmds-nf-gate #lmds-particles,
html.lmds-nf-gate .footer {
  visibility: hidden !important;
  pointer-events: none !important;
}

.lmds-nf {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  background: #000;
  background-color: #000;
  background-image: none;
  color: #fff;
  font-family: "Netflix Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-transform: none !important;
  letter-spacing: normal;
  animation: lmdsNfIn 0.42s ease both;
}

@keyframes lmdsNfIn {
  from {
    opacity: 0;
    transform: scale(1.03);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lmds-nf__header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 3vw;
  z-index: 2;
}

.lmds-nf__logo {
  display: block;
  height: 110px;
  width: auto;
  max-width: 480px;
  object-fit: contain;
}

.lmds-nf__logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.lmds-nf__manage-top,
.lmds-nf__manage-top:hover {
  display: none !important;
}

.lmds-nf__picker {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}

.lmds-nf__picker--dim {
  pointer-events: none;
  user-select: none;
}

.lmds-nf__create-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #000;
}

.lmds-nf__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 48px;
  text-align: center;
}

.lmds-nf__title {
  margin: 0 0 1.75rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-transform: none !important;
}

.lmds-nf__title--create {
  margin: 0;
  font-size: clamp(2.2rem, 5.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lmds-nf__create-copy {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.25rem;
}

.lmds-nf__hint {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

.lmds-nf__profiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.75rem 2rem;
  max-width: 920px;
  margin: 0 auto 2.5rem;
}

.lmds-nf__card {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 140px;
  cursor: pointer;
  color: inherit;
  text-align: center;
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
}

.lmds-nf__avatar {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 4px;
  overflow: hidden;
  border: 3px solid transparent;
  transition: border-color 0.2s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease;
  display: grid;
  place-items: center;
  background: #333;
}

.lmds-nf__card:hover .lmds-nf__avatar,
.lmds-nf__card:focus-visible .lmds-nf__avatar {
  border-color: #fff;
  transform: scale(1.03);
}

.lmds-nf.is-picking .lmds-nf__title,
.lmds-nf.is-picking .lmds-nf__manage-btn,
.lmds-nf.is-picking .lmds-nf__header {
  opacity: 0;
  transition: opacity 0.28s ease;
}

.lmds-nf.is-picking .lmds-nf__card:not(.is-picked) {
  opacity: 0.18;
  transform: scale(0.9);
  filter: blur(1px);
  pointer-events: none;
}

.lmds-nf__card.is-picked {
  transform: scale(1.08);
  z-index: 3;
  pointer-events: none;
}

.lmds-nf__card.is-picked .lmds-nf__avatar {
  border-color: #fff;
  transform: scale(1.04);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.lmds-nf__avatar-letter {
  font-size: 3.4rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
}

.lmds-nf__avatar-emoji {
  font-size: 4.2rem;
  line-height: 1;
  user-select: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.lmds-nf__avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.lmds-nf__avatar--xl {
  width: 168px !important;
  height: 168px !important;
}

.lmds-nf__avatar--xl .lmds-nf__avatar-emoji {
  font-size: 5.4rem;
}

.lmds-nf__avatar--pick {
  cursor: pointer;
  border: 3px solid transparent;
  margin: 0 auto;
}

.lmds-nf__avatar--pick:hover {
  border-color: #fff;
  transform: scale(1.03);
}

.lmds-nf__avatar-edit {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.lmds-nf__create-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.lmds-nf__change-photo {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font: 500 0.95rem/1 Helvetica, Arial, sans-serif;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lmds-nf__change-photo:hover {
  color: #fff;
}

.lmds-nf__avmodal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top, 0px)) 12px
    max(12px, env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.78);
  box-sizing: border-box;
}

.lmds-nf__avmodal-card {
  width: min(520px, 94vw);
  max-height: min(88vh, 640px);
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-sizing: border-box;
  overflow: hidden;
}

.lmds-nf__avmodal-title {
  margin: 0;
  flex: 0 0 auto;
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  text-transform: none !important;
}

.lmds-nf__avgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: auto;
  align-content: start;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}

.lmds-nf__avpick {
  appearance: none !important;
  -webkit-appearance: none !important;
  border: 3px solid transparent !important;
  border-radius: 6px;
  width: 100% !important;
  /* content-box + padding-bottom = carré stable (border-box cassait la hauteur) */
  box-sizing: content-box !important;
  height: 0 !important;
  padding: 0 0 100% 0 !important;
  margin: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  cursor: pointer;
  display: block !important;
  position: relative !important;
  overflow: hidden;
  background: #222 !important;
  transition: border-color 0.15s ease, transform 0.15s ease;
  line-height: 0 !important;
  font-size: 0 !important;
}

.lmds-nf__avpick::before,
.lmds-nf__avpick::after {
  content: none !important;
  display: none !important;
  padding: 0 !important;
}

.lmds-nf__avpick .lmds-nf__avatar-img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center top !important;
  display: block !important;
  pointer-events: none;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

.lmds-nf__avpick:hover,
.lmds-nf__avpick.is-on {
  border-color: #fff !important;
  transform: scale(1.04);
}

.lmds-nf__avmodal-card > .lmds-nf__btn {
  flex: 0 0 auto;
  width: 100%;
}

.lmds-nf__avatar--add {
  background: #000;
  border: 3px solid transparent;
  box-shadow: inset 0 0 0 2px #404040;
}

.lmds-nf__avatar--add::before {
  content: "+";
  font-size: 5rem;
  font-weight: 200;
  color: #808080;
  line-height: 1;
}

.lmds-nf__card:hover .lmds-nf__avatar--add {
  background: #e5e5e5;
  box-shadow: none;
}

.lmds-nf__card:hover .lmds-nf__avatar--add::before {
  color: #000;
}

.lmds-nf__name {
  display: block;
  margin-top: 0.7rem;
  font-size: 1.05rem;
  color: #808080;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.lmds-nf__card:hover .lmds-nf__name {
  color: #fff;
}

.lmds-nf__avatar--q {
  width: 168px;
  height: 168px;
  background: #2a2a2a;
  border-radius: 4px;
  font-size: 4.5rem;
  font-weight: 900;
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.lmds-nf__avatar--q::before {
  content: "?";
}

.lmds-nf__create {
  width: min(460px, 94vw);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.6rem;
}

.lmds-nf__input {
  width: 100%;
  height: auto;
  padding: 16px 18px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #454545;
  color: #fff;
  font: 400 1.15rem/1.2 Helvetica, Arial, sans-serif;
  outline: none;
  transition: border-color 0.15s ease;
}

.lmds-nf__input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.lmds-nf__input:focus {
  border-color: #fff;
  box-shadow: none;
}

.lmds-nf__btn {
  appearance: none;
  height: auto;
  padding: 16px 18px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.25);
  font: 700 1.15rem/1 Helvetica, Arial, sans-serif;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.lmds-nf__btn--start:disabled {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.25);
  cursor: not-allowed;
}

.lmds-nf__btn--start:not(:disabled) {
  background: #3d8bff;
  color: #fff;
}

.lmds-nf__btn--start:not(:disabled):hover {
  background: #5a9fff;
}

.lmds-nf__btn--start:not(:disabled):active {
  transform: scale(0.98);
}

.lmds-nf__btn:not(.lmds-nf__btn--start):not(.lmds-nf__btn--danger):not(.lmds-nf__btn--ghost):not(:disabled):hover {
  background: #3d8bff;
  color: #fff;
}

.lmds-nf__foot {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.28);
  line-height: 1.45;
  text-align: center;
}

.lmds-nf__back {
  appearance: none;
  margin-top: -0.35rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font: 500 0.85rem/1 Helvetica, Arial, sans-serif;
  cursor: pointer;
}

.lmds-nf__back:hover {
  color: #fff;
}

.lmds-nf__manage-btn {
  appearance: none;
  margin-top: 0.25rem;
  padding: 0.65rem 1.75rem;
  border: 1px solid #808080;
  background: transparent;
  color: #808080;
  font: 500 0.95rem/1 Helvetica, Arial, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.lmds-nf__manage-btn:hover {
  color: #fff;
  border-color: #fff;
}

.lmds-nf__edit-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.lmds-nf--manage .lmds-nf__card .lmds-nf__edit-badge {
  opacity: 1;
}

.lmds-nf__edit-badge svg {
  width: 36px;
  height: 36px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.6;
}

.lmds-nf__edit-panel {
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: stretch;
}

.lmds-nf__edit-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.lmds-nf__btn--ghost {
  background: transparent;
  border: 1px solid #808080;
  color: #ccc;
}

.lmds-nf__btn--ghost:hover {
  border-color: #fff;
  color: #fff;
  background: transparent !important;
}

.lmds-nf__btn--danger {
  background: #b20710;
  color: #fff;
}

.lmds-nf__btn--danger:hover {
  background: #e50914 !important;
  color: #fff !important;
}

.lmds-nf.is-out {
  animation: lmdsNfOut 0.48s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes lmdsNfOut {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.06);
    filter: blur(4px);
    visibility: hidden;
  }
}

@media (max-width: 640px) {
  .lmds-nf__card,
  .lmds-nf__avatar {
    width: 100px;
    height: 100px;
  }

  .lmds-nf__card {
    width: 100px;
  }

  /* Create / edit : garder le grand avatar carré */
  .lmds-nf__avatar--xl,
  .lmds-nf__avatar--pick.lmds-nf__avatar--xl,
  .lmds-nf__create-avatar .lmds-nf__avatar {
    width: min(148px, 42vw) !important;
    height: min(148px, 42vw) !important;
  }

  .lmds-nf__name {
    max-width: 100px;
    font-size: 0.9rem;
  }

  .lmds-nf__avatar-letter {
    font-size: 2.4rem;
  }

  .lmds-nf__logo {
    height: 78px;
    max-width: 320px;
  }

  .lmds-nf__profiles {
    gap: 1.25rem 1.4rem;
  }

  .lmds-nf__avmodal {
    padding: 10px;
    align-items: flex-end;
  }

  .lmds-nf__avmodal-card {
    width: 100%;
    max-width: 100%;
    max-height: min(82vh, 620px);
    border-radius: 14px 14px 8px 8px;
    padding: 18px 14px 14px;
    gap: 0.9rem;
  }

  .lmds-nf__avmodal-title {
    font-size: 1.2rem;
  }

  .lmds-nf__avgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .lmds-nf__avpick {
    transform: none;
  }

  .lmds-nf__avpick:hover,
  .lmds-nf__avpick.is-on {
    transform: none;
  }

  .lmds-nf__create {
    width: min(100%, 94vw);
    gap: 1.2rem;
  }

  .lmds-nf__create-layer {
    padding: 88px 14px 24px;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Topbar: profile chip replaces search (Moonflix style) */
html.lmds-nf-has-profile .search-btn-wrapper,
html.lmds-nf-has-profile [data-test-id="search-btn"] {
  display: none !important;
}

.lmds-nf-topprof {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: Helvetica, Arial, sans-serif;
  text-transform: none !important;
  -webkit-font-smoothing: antialiased;
}

.lmds-nf-topprof__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  background: #333;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lmds-nf-topprof__avatar .lmds-nf__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lmds-nf-topprof__avatar .lmds-nf__avatar-letter {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.lmds-nf-topprof__name {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent !important;
  color: #fff;
  font: 700 15px/1.15 Helvetica, Arial, sans-serif;
  letter-spacing: 0;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  outline: none;
  caret-color: #fff;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.lmds-nf-topprof.is-editing .lmds-nf-topprof__name {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  text-overflow: clip;
  max-width: 160px;
}

.lmds-nf-topprof__pencil {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2px;
  border: 0;
  background: transparent;
  color: #fff;
  flex: 0 0 auto;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.95;
}

.lmds-nf-topprof__pencil:hover {
  opacity: 1;
}

@media (max-width: 640px) {
  .lmds-nf-topprof {
    gap: 8px;
  }

  .lmds-nf-topprof__name {
    max-width: 96px;
    font-size: 13px;
  }

  .lmds-nf-topprof.is-editing .lmds-nf-topprof__name {
    max-width: 120px;
  }

  .lmds-nf-topprof__avatar {
    width: 32px;
    height: 32px;
  }
}
